[FFmpeg-devel] [PATCH] avformat: Allow forcing use of AVParsers
wm4
nfxjfg at googlemail.com
Thu Nov 10 13:43:46 EET 2016
On Sun, 6 Nov 2016 21:16:43 +0100
Michael Niedermayer <michael at niedermayer.cc> wrote:
> TODO: version bump, docs
>
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
> libavformat/avformat.h | 8 ++++++++
> libavformat/options_table.h | 7 +++++++
> libavformat/utils.c | 3 +++
> 3 files changed, 18 insertions(+)
>
> diff --git a/libavformat/avformat.h b/libavformat/avformat.h
> index f9f4d72..96e6b94 100644
> --- a/libavformat/avformat.h
> +++ b/libavformat/avformat.h
> @@ -1899,6 +1899,14 @@ typedef struct AVFormatContext {
> * - decoding: set by user through AVOptions (NO direct access)
> */
> char *protocol_blacklist;
> +
> + /**
> + * Force parsing.
> + * - encoding: unused
> + * - decoding: set by user through AVOptions (NO direct access)
> + */
> + int force_parsing;
> +
> } AVFormatContext;
>
> int av_format_get_probe_score(const AVFormatContext *s);
> diff --git a/libavformat/options_table.h b/libavformat/options_table.h
> index 9d61d5a..50ea3c1 100644
> --- a/libavformat/options_table.h
> +++ b/libavformat/options_table.h
> @@ -105,6 +105,13 @@ static const AVOption avformat_options[] = {
> {"format_whitelist", "List of demuxers that are allowed to be used", OFFSET(format_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D },
> {"protocol_whitelist", "List of protocols that are allowed to be used", OFFSET(protocol_whitelist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D },
> {"protocol_blacklist", "List of protocols that are not allowed to be used", OFFSET(protocol_blacklist), AV_OPT_TYPE_STRING, { .str = NULL }, CHAR_MIN, CHAR_MAX, D },
> +{"forceparsing", "force use of AVParsers", OFFSET(force_parsing), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, AVSTREAM_PARSE_FULL_ONCE, D, "forceparsing"},
> +{"none", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_NONE }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"full", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"headers", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_HEADERS }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"timestamps", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_TIMESTAMPS }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"once", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL_ONCE }, INT_MIN, INT_MAX, D, "forceparsing" },
> +{"raw", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = AVSTREAM_PARSE_FULL_RAW }, INT_MIN, INT_MAX, D, "forceparsing" },
> {NULL},
> };
>
> diff --git a/libavformat/utils.c b/libavformat/utils.c
> index 5664646..23e063f 100644
> --- a/libavformat/utils.c
> +++ b/libavformat/utils.c
> @@ -4264,6 +4264,9 @@ FF_ENABLE_DEPRECATION_WARNINGS
> * timestamps have their first few packets buffered and the
> * timestamps corrected before they are returned to the user */
> st->cur_dts = RELATIVE_TS_BASE;
> +
> + if (s->force_parsing >= 0)
> + st->need_parsing = s->force_parsing;
> } else {
> st->cur_dts = AV_NOPTS_VALUE;
> }
Use case?
More information about the ffmpeg-devel
mailing list