From patchwork Sun Nov 6 20:16:43 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 1316 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.90.1 with SMTP id o1csp810655vsb; Sun, 6 Nov 2016 12:16:55 -0800 (PST) X-Received: by 10.28.19.67 with SMTP id 64mr5703474wmt.111.1478463414957; Sun, 06 Nov 2016 12:16:54 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b128si7018187wme.106.2016.11.06.12.16.54; Sun, 06 Nov 2016 12:16:54 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 88411680C83; Sun, 6 Nov 2016 22:16:48 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from vie01a-dmta-pe02-3.mx.upcmail.net (vie01a-dmta-pe02-3.mx.upcmail.net [62.179.121.159]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 8D3EC68098B for ; Sun, 6 Nov 2016 22:16:42 +0200 (EET) Received: from [172.31.216.43] (helo=vie01a-pemc-psmtp-pe01) by vie01a-dmta-pe02.mx.upcmail.net with esmtp (Exim 4.87) (envelope-from ) id 1c3Trx-0008TE-1n for ffmpeg-devel@ffmpeg.org; Sun, 06 Nov 2016 21:16:45 +0100 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id 4kGj1u0160S5wYM01kGkHQ; Sun, 06 Nov 2016 21:16:45 +0100 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Sun, 6 Nov 2016 21:16:43 +0100 Message-Id: <20161106201643.14758-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.10.2 Subject: [FFmpeg-devel] [PATCH] avformat: Allow forcing use of AVParsers X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" TODO: version bump, docs Signed-off-by: Michael Niedermayer --- 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; }