Re: [FFmpeg-devel] [PATCH 2/3] avformat/utils: avoid using marked decoders for probing

2016-09-22 Thread Michael Niedermayer
On Thu, Sep 22, 2016 at 02:00:04PM +0200, Timo Rothenpieler wrote:
> ---
>  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);

this should be using a loop with av_codec_next() to preferaly
select a codec without AV_CODEC_CAP_AVOID_PROBING or
AV_CODEC_CAP_EXPERIMENTAL

or such function could be added to libavcodec if usefull elsewhere

Theres no gurantee that avcodec_find_decoder() would not pick a
AV_CODEC_CAP_AVOID_PROBING codec unless iam missing something

[...]
-- 
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire


signature.asc
Description: Digital signature
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel


[FFmpeg-devel] [PATCH 2/3] avformat/utils: avoid using marked decoders for probing

2016-09-22 Thread Timo Rothenpieler
---
 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)
-- 
2.10.0

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-devel