X-Git-Url: https://git.piment-noir.org/?p=deb_ffmpeg.git;a=blobdiff_plain;f=ffmpeg%2Flibavcodec%2Foptions.c;h=7f9fb07fd60545c5727d3dc063ee66898fe8b68d;hp=ec9830faced6f0d7385168871ebfc3ec9ebce714;hb=f6fa7814ccfe3e76514b36cf04f5cd3cb657c8cf;hpb=2ba45a602cbfa7b771effba9b11bb4245c21bc00 diff --git a/ffmpeg/libavcodec/options.c b/ffmpeg/libavcodec/options.c index ec9830f..7f9fb07 100644 --- a/ffmpeg/libavcodec/options.c +++ b/ffmpeg/libavcodec/options.c @@ -27,6 +27,7 @@ #include "avcodec.h" #include "internal.h" #include "libavutil/avassert.h" +#include "libavutil/internal.h" #include "libavutil/mem.h" #include "libavutil/opt.h" #include /* FLT_MIN, FLT_MAX */ @@ -94,8 +95,10 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) s->av_class = &av_codec_context_class; s->codec_type = codec ? codec->type : AVMEDIA_TYPE_UNKNOWN; - if (codec) + if (codec) { + s->codec = codec; s->codec_id = codec->id; + } if(s->codec_type == AVMEDIA_TYPE_AUDIO) flags= AV_OPT_FLAG_AUDIO_PARAM; @@ -106,6 +109,8 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) av_opt_set_defaults2(s, flags, flags); s->time_base = (AVRational){0,1}; + s->framerate = (AVRational){ 0, 1 }; + s->pkt_timebase = (AVRational){ 0, 1 }; s->get_buffer2 = avcodec_default_get_buffer2; s->get_format = avcodec_default_get_format; s->execute = avcodec_default_execute; @@ -113,7 +118,6 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec) s->sample_aspect_ratio = (AVRational){0,1}; s->pix_fmt = AV_PIX_FMT_NONE; s->sample_fmt = AV_SAMPLE_FMT_NONE; - s->timecode_frame_start = -1; s->reordered_opaque = AV_NOPTS_VALUE; if(codec && codec->priv_data_size){ @@ -166,6 +170,9 @@ void avcodec_free_context(AVCodecContext **pavctx) av_freep(&avctx->extradata); av_freep(&avctx->subtitle_header); + av_freep(&avctx->intra_matrix); + av_freep(&avctx->inter_matrix); + av_freep(&avctx->rc_override); av_freep(pavctx); } @@ -185,6 +192,7 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) av_opt_free(dest); memcpy(dest, src, sizeof(*dest)); + av_opt_copy(dest, src); dest->priv_data = orig_priv_data; @@ -199,17 +207,11 @@ int avcodec_copy_context(AVCodecContext *dest, const AVCodecContext *src) dest->internal = NULL; /* reallocate values that should be allocated separately */ - dest->rc_eq = NULL; dest->extradata = NULL; dest->intra_matrix = NULL; dest->inter_matrix = NULL; dest->rc_override = NULL; dest->subtitle_header = NULL; - if (src->rc_eq) { - dest->rc_eq = av_strdup(src->rc_eq); - if (!dest->rc_eq) - return AVERROR(ENOMEM); - } #define alloc_and_copy_or_fail(obj, size, pad) \ if (src->obj && size > 0) { \ @@ -236,7 +238,11 @@ fail: av_freep(&dest->intra_matrix); av_freep(&dest->inter_matrix); av_freep(&dest->extradata); +#if FF_API_MPV_OPT + FF_DISABLE_DEPRECATION_WARNINGS av_freep(&dest->rc_eq); + FF_ENABLE_DEPRECATION_WARNINGS +#endif return AVERROR(ENOMEM); }