[Ffmpeg-devel] corrupt audio when cut [SOLVED]

Wolfram Gloger wmglo
Tue Jan 30 15:25:10 CET 2007


Hi,

> i complained about a url_ftell/url_fseek suboptimality and the one below
> is wrong it mixes CUR and SET

Argh!  My final attempt for these few lines below.

> also please attach patches so they wont get mangled (if they arent mangled
> iam fine with inline too of course ...)

Except for my SEEK_CUR vs. _SET goofs AFAICS my patches are/were
never mangled.

> could you give me some hint on which mail contained that second part?
> subject/date?

Sure, that was

Date: 17 Jan 2007 10:54:57 -0000
Message-Id: <20070117105457.21160.qmail at md.dent.med.uni-muenchen.de>
Subject: Re: [Ffmpeg-devel] corrupt audio when cut

Regards,
Wolfram

--- trunk/libavformat/utils.c	Wed Jan 24 11:35:52 2007
+++ ffmpeg-wg/libavformat/utils.c	Tue Jan 30 15:21:57 2007
@@ -1565,6 +1565,7 @@
     int read_size, i, ret;
     int64_t end_time;
     int64_t filesize, offset, duration;
+    offset_t old_offset;
 
     /* free previous packet */
     if (ic->cur_st && ic->cur_st->parser)
@@ -1584,6 +1585,7 @@
 
     /* we read the first packets to get the first PTS (not fully
        accurate, but it is enough now) */
+    old_offset = url_ftell(&ic->pb);
     url_fseek(&ic->pb, 0, SEEK_SET);
     read_size = 0;
     for(;;) {
@@ -1650,7 +1652,7 @@
 
     fill_all_stream_timings(ic);
 
-    url_fseek(&ic->pb, 0, SEEK_SET);
+    url_fseek(&ic->pb, old_offset, SEEK_SET);
 }
 
 static void av_estimate_timings(AVFormatContext *ic)




More information about the ffmpeg-devel mailing list