summaryrefslogtreecommitdiff
path: root/ffplay.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2010-02-02 18:02:16 +0000
committerMichael Niedermayer <michaelni@gmx.at>2010-02-02 18:02:16 +0000
commit70a4764d0e0085523d46d0b3c361baa94388789c (patch)
tree6b443f11a4045b42c74023c72250e192133de2ed /ffplay.c
parent1a620dd79e8c338be593598fe33eea051fe0c9d2 (diff)
Autodetect when byte based seeking is better (that is for all formats that allow
discontinuities) Fixes issue1090 Originally committed as revision 21606 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffplay.c')
-rw-r--r--ffplay.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/ffplay.c b/ffplay.c
index 744b4d48c1..460bfeff53 100644
--- a/ffplay.c
+++ b/ffplay.c
@@ -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" },