From patchwork Mon Sep 5 09:14:21 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Niedermayer X-Patchwork-Id: 422 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.134 with SMTP id o128csp6516vsd; Mon, 5 Sep 2016 02:18:07 -0700 (PDT) X-Received: by 10.28.94.18 with SMTP id s18mr15206718wmb.44.1473067087027; Mon, 05 Sep 2016 02:18:07 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id 198si16456213wmi.81.2016.09.05.02.18.02; Mon, 05 Sep 2016 02:18:07 -0700 (PDT) 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 E0E93689F65; Mon, 5 Sep 2016 12:17:51 +0300 (EEST) 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 79ADE689F3F for ; Mon, 5 Sep 2016 12:17:45 +0300 (EEST) 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 1bgq2L-0003js-Dn for ffmpeg-devel@ffmpeg.org; Mon, 05 Sep 2016 11:17:53 +0200 Received: from localhost ([213.47.41.20]) by vie01a-pemc-psmtp-pe01 with SMTP @ mailcloud.upcmail.net id flHs1t00L0S5wYM01lHthE; Mon, 05 Sep 2016 11:17:53 +0200 X-SourceIP: 213.47.41.20 From: Michael Niedermayer To: FFmpeg development discussions and patches Date: Mon, 5 Sep 2016 11:14:21 +0200 Message-Id: <20160905091421.20451-1-michael@niedermayer.cc> X-Mailer: git-send-email 2.9.3 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 | 1 + libavformat/utils.c | 3 +++ 3 files changed, 12 insertions(+) diff --git a/libavformat/avformat.h b/libavformat/avformat.h index 3ee7051..33b921a 100644 --- a/libavformat/avformat.h +++ b/libavformat/avformat.h @@ -1886,6 +1886,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 3b74d1b..359796c 100644 --- a/libavformat/options_table.h +++ b/libavformat/options_table.h @@ -103,6 +103,7 @@ 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 }, {NULL}, }; diff --git a/libavformat/utils.c b/libavformat/utils.c index 7d23c4a..a692e65 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -4197,6 +4197,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; }