[FFmpeg-devel] [PATCH 1/2] libavcodec/options: print a warning when copying open context

Lukasz Marek lukasz.m.luki2 at gmail.com
Wed Dec 3 13:41:17 CET 2014


On 2 December 2014 at 19:27, Lukasz Marek <lukasz.m.luki2 at gmail.com> wrote:

> Context copied from open context cannot be treated as opened.
> avcodec_open2 modifies context so reopening it is also questionable.
> It is worth to warn when it happens.
>
> Signed-off-by: Lukasz Marek <lukasz.m.luki2 at gmail.com>
> ---
>  libavcodec/options.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index 3dd5df3..dab5140 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -182,6 +182,9 @@ int avcodec_copy_context(AVCodecContext *dest, const
> AVCodecContext *src)
>      const AVCodec *orig_codec = dest->codec;
>      uint8_t *orig_priv_data = dest->priv_data;
>
> +    if (avcodec_is_open(src))
> +        av_log(dest, AV_LOG_WARNING, "AVCodecContext is copied from
> opened context.\n");
>

I still think copying opened codec is a bit tricky, but this would spam
this warning by ffmpeg, so dropped.


More information about the ffmpeg-devel mailing list