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

Wolfram Gloger wmglo
Tue Jan 30 11:03:17 CET 2007


Hi,

> when someone submits a clean well split patch which passes review

Ahem.  It is hardly obvious how this could be split further.
But I'll try anyway.

The "first" part (which I will append below) was already ok'ed
by you before, just not committed.

For the other part, there has been _zero_ review or comments so far,
in particular there was no reasoning why it wasn't clean..

Regards,
Wolfram.

diff -Naur trunk/libavformat/utils.c ffmpeg-wg/libavformat/utils.c
--- trunk/libavformat/utils.c	Mon Jan  8 16:01:14 2007
+++ ffmpeg-wg/libavformat/utils.c	Tue Jan 16 10:24:13 2007
@@ -1561,6 +1622,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)
@@ -1580,7 +1642,8 @@
 
     /* we read the first packets to get the first PTS (not fully
        accurate, but it is enough now) */
-    url_fseek(&ic->pb, 0, SEEK_SET);
+    old_offset = url_ftell(&ic->pb);
+    url_fseek(&ic->pb, 0, SEEK_CUR);
     read_size = 0;
     for(;;) {
         if (read_size >= DURATION_MAX_READ_SIZE)
@@ -1646,7 +1709,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