[FFmpeg-cvslog] r21606 - trunk/ffplay.c

michael subversion
Tue Feb 2 19:02:16 CET 2010


Author: michael
Date: Tue Feb  2 19:02:16 2010
New Revision: 21606

Log:
Autodetect when byte based seeking is better (that is for all formats that allow
discontinuities)
Fixes issue1090

Modified:
   trunk/ffplay.c

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	Tue Feb  2 17:51:02 2010	(r21605)
+++ trunk/ffplay.c	Tue Feb  2 19:02:16 2010	(r21606)
@@ -207,7 +207,7 @@ static int video_disable;
 static int wanted_audio_stream= 0;
 static int wanted_video_stream= 0;
 static int wanted_subtitle_stream= -1;
-static int seek_by_bytes;
+static int seek_by_bytes=-1;
 static int display_disable;
 static int show_status = 1;
 static int av_sync_type = AV_SYNC_AUDIO_MASTER;
@@ -1971,6 +1971,9 @@ static int decode_thread(void *arg)
     if(ic->pb)
         ic->pb->eof_reached= 0; //FIXME hack, ffplay maybe should not use url_feof() to test for the end
 
+    if(seek_by_bytes<0)
+        seek_by_bytes= !!(ic->iformat->flags & AVFMT_TS_DISCONT);
+
     /* if seeking requested, we execute it */
     if (start_time != AV_NOPTS_VALUE) {
         int64_t timestamp;
@@ -2529,7 +2532,7 @@ static const OptionDef options[] = {
     { "vst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_video_stream}, "select desired video stream", "stream_number" },
     { "sst", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&wanted_subtitle_stream}, "select desired subtitle stream", "stream_number" },
     { "ss", HAS_ARG | OPT_FUNC2, {(void*)&opt_seek}, "seek to a given position in seconds", "pos" },
-    { "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
+    { "bytes", OPT_INT | HAS_ARG, {(void*)&seek_by_bytes}, "seek by bytes 0=off 1=on -1=auto" },
     { "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
     { "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
     { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },



More information about the ffmpeg-cvslog mailing list