From patchwork Thu Sep 22 12:00:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Timo Rothenpieler X-Patchwork-Id: 677 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.140.66 with SMTP id o63csp1380078vsd; Thu, 22 Sep 2016 05:00:28 -0700 (PDT) X-Received: by 10.194.9.228 with SMTP id d4mr1835803wjb.135.1474545628861; Thu, 22 Sep 2016 05:00:28 -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 a73si26022371wme.1.2016.09.22.05.00.28; Thu, 22 Sep 2016 05:00:28 -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; dkim=neutral (body hash did not verify) header.i=@rothenpieler.org; 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 75834689CEC; Thu, 22 Sep 2016 15:00:03 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from btbn.de (btbn.de [5.9.118.179]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 3FD0A689CC4 for ; Thu, 22 Sep 2016 14:59:57 +0300 (EEST) Received: from localhost.localdomain (ip4d1666ad.dynamic.kabel-deutschland.de [77.22.102.173]) by btbn.de (Postfix) with ESMTPSA id 1A4A6327675; Thu, 22 Sep 2016 14:00:13 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=rothenpieler.org; s=mail; t=1474545613; bh=UL6lwJAj7tplVuEePeIqMLXLMZVmKtobc+aG7A3FZEM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=KTBoVSTD3sk9LDYQ1DXoJozTd+qj/Wj73SnNQHlT52ElUYb0uEracKEPqiPvAxcCp qYTneL5m+TTo3VJkUTHzdbshGnh39S6eubly+CkDm7KaL8G1WmGj6wWf9l86MXSOMK 4biYqsPLbyLfCwDCPF5MqrG+NyhoA+fVpZG/ffOA= From: Timo Rothenpieler To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Sep 2016 14:00:04 +0200 Message-Id: <20160922120005.1083-2-timo@rothenpieler.org> X-Mailer: git-send-email 2.10.0 In-Reply-To: <20160922120005.1083-1-timo@rothenpieler.org> References: <20160922120005.1083-1-timo@rothenpieler.org> Subject: [FFmpeg-devel] [PATCH 2/3] avformat/utils: avoid using marked decoders for probing 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 Cc: Timo Rothenpieler MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" --- libavformat/utils.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libavformat/utils.c b/libavformat/utils.c index 05d2315..87a6dd7 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -188,6 +188,8 @@ FF_ENABLE_DEPRECATION_WARNINGS static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st, enum AVCodecID codec_id) { + const AVCodec *codec; + #if CONFIG_H264_DECODER /* Other parts of the code assume this decoder to be used for h264, * so force it if possible. */ @@ -195,7 +197,14 @@ static const AVCodec *find_probe_decoder(AVFormatContext *s, const AVStream *st, return avcodec_find_decoder_by_name("h264"); #endif - return find_decoder(s, st, codec_id); + codec = find_decoder(s, st, codec_id); + if (!codec) + return NULL; + + if (codec->capabilities & AV_CODEC_CAP_AVOID_PROBING) + return avcodec_find_decoder(codec_id); + + return codec; } int av_format_get_probe_score(const AVFormatContext *s)