summaryrefslogtreecommitdiffstats
path: root/contrib
diff options
context:
space:
mode:
authorjstebbins <[email protected]>2010-05-16 23:12:12 +0000
committerjstebbins <[email protected]>2010-05-16 23:12:12 +0000
commitfc7d1bd049ed2c0c1191c7a39f105d6658f85b03 (patch)
tree890303a95da827c49721dfb6892995ccebe98e55 /contrib
parented1c1b3fb49e1970427dd076739dfed79f15e183 (diff)
patch ffmpeg avi seek problem
when seeking to a timestamp, ffmpeg seeks to the position in the primary stream where that timestamp starts. Then seeks to the next interleaved packet for all other streams. When seeking back to the beginning of the file, this means the first packet of some streams are missed if those streams start before the video stream in the file. git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@3296 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'contrib')
-rw-r--r--contrib/ffmpeg/A05-avi-seek.patch45
1 files changed, 45 insertions, 0 deletions
diff --git a/contrib/ffmpeg/A05-avi-seek.patch b/contrib/ffmpeg/A05-avi-seek.patch
new file mode 100644
index 000000000..a1dec93ca
--- /dev/null
+++ b/contrib/ffmpeg/A05-avi-seek.patch
@@ -0,0 +1,45 @@
+Index: libavformat/avidec.c
+===================================================================
+--- ffmpeg.orig/libavformat/avidec.c (revision 22950)
++++ ffmpeg/libavformat/avidec.c (working copy)
+@@ -1072,7 +1072,7 @@
+ AVIContext *avi = s->priv_data;
+ AVStream *st;
+ int i, index;
+- int64_t pos;
++ int64_t pos, min_pos;
+ AVIStream *ast;
+
+ if (!avi->index_loaded) {
+@@ -1109,6 +1109,7 @@
+ return 0;
+ }
+
++ min_pos = pos;
+ for(i = 0; i < s->nb_streams; i++) {
+ AVStream *st2 = s->streams[i];
+ AVIStream *ast2 = st2->priv_data;
+@@ -1129,10 +1130,12 @@
+ index=0;
+
+ if(!avi->non_interleaved){
++ while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
++ index++;
+ while(index>0 && st2->index_entries[index].pos > pos)
+ index--;
+- while(index+1 < st2->nb_index_entries && st2->index_entries[index].pos < pos)
+- index++;
++ if (st2->index_entries[index].pos < min_pos)
++ min_pos = st2->index_entries[index].pos;
+ }
+
+ // av_log(s, AV_LOG_DEBUG, "%"PRId64" %d %"PRId64"\n", timestamp, index, st2->index_entries[index].timestamp);
+@@ -1141,7 +1144,7 @@
+ }
+
+ /* do the seek */
+- url_fseek(s->pb, pos, SEEK_SET);
++ url_fseek(s->pb, min_pos, SEEK_SET);
+ avi->stream_index= -1;
+ return 0;
+ }