mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-03-28 12:32:17 +02:00
lavf: add seek2any to allow forcing seeking to non keyframes via AVOptions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
7c00d853a6
commit
a8e748eee5
@ -1203,6 +1203,13 @@ typedef struct AVFormatContext {
|
|||||||
*/
|
*/
|
||||||
unsigned int correct_ts_overflow;
|
unsigned int correct_ts_overflow;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force seeking to any (also non key) frames.
|
||||||
|
* - encoding: unused
|
||||||
|
* - decoding: Set by user via AVOPtions (NO direct access)
|
||||||
|
*/
|
||||||
|
int seek2any;
|
||||||
|
|
||||||
/*****************************************************************
|
/*****************************************************************
|
||||||
* All fields below this line are not part of the public API. They
|
* All fields below this line are not part of the public API. They
|
||||||
* may not be used outside of libavformat and can be changed and
|
* may not be used outside of libavformat and can be changed and
|
||||||
|
@ -48,6 +48,7 @@ static const AVOption options[]={
|
|||||||
{"keepside", "dont merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
|
{"keepside", "dont merge side data", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_KEEP_SIDE_DATA }, INT_MIN, INT_MAX, D, "fflags"},
|
||||||
{"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
|
{"latm", "enable RTP MP4A-LATM payload", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_MP4A_LATM }, INT_MIN, INT_MAX, E, "fflags"},
|
||||||
{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
|
{"nobuffer", "reduce the latency introduced by optional buffering", 0, AV_OPT_TYPE_CONST, {.i64 = AVFMT_FLAG_NOBUFFER }, 0, INT_MAX, D, "fflags"},
|
||||||
|
{"seek2any", "forces seeking to enable seek to any mode", OFFSET(seek2any), AV_OPT_TYPE_INT, {.i64 = 0 }, 0, 1, D},
|
||||||
{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.i64 = 5*AV_TIME_BASE }, 0, INT_MAX, D},
|
{"analyzeduration", "specify how many microseconds are analyzed to probe the input", OFFSET(max_analyze_duration), AV_OPT_TYPE_INT, {.i64 = 5*AV_TIME_BASE }, 0, INT_MAX, D},
|
||||||
{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D},
|
{"cryptokey", "decryption key", OFFSET(key), AV_OPT_TYPE_BINARY, {.dbl = 0}, 0, 0, D},
|
||||||
{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
|
{"indexmem", "max memory used for timestamp index (per stream)", OFFSET(max_index_size), AV_OPT_TYPE_INT, {.i64 = 1<<20 }, 0, INT_MAX, D},
|
||||||
|
@ -2092,6 +2092,9 @@ int avformat_seek_file(AVFormatContext *s, int stream_index, int64_t min_ts, int
|
|||||||
if(min_ts > ts || max_ts < ts)
|
if(min_ts > ts || max_ts < ts)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
if(s->seek2any>0)
|
||||||
|
flags |= AVSEEK_FLAG_ANY;
|
||||||
|
|
||||||
if (s->iformat->read_seek2) {
|
if (s->iformat->read_seek2) {
|
||||||
int ret;
|
int ret;
|
||||||
ff_read_frame_flush(s);
|
ff_read_frame_flush(s);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user