diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2011-07-11 04:23:25 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2011-07-11 04:23:25 +0200 |
commit | 3602ad7ee6fe5caa402e61aa04ac695e1c46fe5e (patch) | |
tree | 5d89faee8784c9f755974a0822a3e9e90673494e /libavcodec/utils.c | |
parent | 3b2d285afbd6304505a96b71877cdfda13f4565c (diff) | |
parent | 142e76f1055de5dde44696e71a5f63f2cb11dedf (diff) | |
download | ffmpeg-3602ad7ee6fe5caa402e61aa04ac695e1c46fe5e.tar.gz |
Merge commit '142e76f1055de5dde44696e71a5f63f2cb11dedf'
* commit '142e76f1055de5dde44696e71a5f63f2cb11dedf':
swscale: fix crash with dithering due incorrect offset calculation.
matroskadec: fix stupid typo (!= -> ==)
build: remove duplicates from order-only directory prerequisite list
build: rework rules for things in the tools dir
configure: fix --cpu=host with gcc 4.6
ARM: use const macro to define constant data in asm
bitdepth: simplify FUNC/FUNCC macros
dsputil: remove ff_emulated_edge_mc macro used in one place
9/10-bit: simplify clipping macros
matroskadec: reindent
matroskadec: defer parsing of cues element until we seek.
lavc: add support for codec-specific defaults.
lavc: make avcodec_alloc_context3 officially public.
lavc: remove a half-working attempt at different defaults for audio/video codecs.
ac3dec: add a drc_scale private option
lavf: add avformat_find_stream_info()
lavc: introduce avcodec_open2() as a replacement for avcodec_open().
Conflicts:
Makefile
libavcodec/utils.c
libavformat/avformat.h
libswscale/swscale_internal.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/utils.c')
-rw-r--r-- | libavcodec/utils.c | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 0c84965883..356e21f541 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -32,6 +32,7 @@ #include "libavutil/audioconvert.h" #include "libavutil/imgutils.h" #include "libavutil/samplefmt.h" +#include "libavutil/dict.h" #include "avcodec.h" #include "dsputil.h" #include "libavutil/opt.h" @@ -485,9 +486,20 @@ static void avcodec_get_subtitle_defaults(AVSubtitle *sub) sub->pts = AV_NOPTS_VALUE; } +#if FF_API_AVCODEC_OPEN int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) { + return avcodec_open2(avctx, codec, NULL); +} +#endif + +int attribute_align_arg avcodec_open2(AVCodecContext *avctx, AVCodec *codec, AVDictionary **options) +{ int ret = 0; + AVDictionary *tmp = NULL; + + if (options) + av_dict_copy(&tmp, *options, 0); /* If there is a user-supplied mutex locking routine, call it. */ if (ff_lockmgr_cb) { @@ -514,14 +526,18 @@ int attribute_align_arg avcodec_open(AVCodecContext *avctx, AVCodec *codec) ret = AVERROR(ENOMEM); goto end; } - if(codec->priv_class){ //this can be droped once all user apps use avcodec_get_context_defaults3() + if (codec->priv_class) { *(AVClass**)avctx->priv_data= codec->priv_class; av_opt_set_defaults(avctx->priv_data); } } + if (codec->priv_class && (ret = av_opt_set_dict(avctx->priv_data, &tmp) < 0)) + goto free_and_end; } else { avctx->priv_data = NULL; } + if ((ret = av_opt_set_dict(avctx, &tmp)) < 0) + goto free_and_end; if(avctx->coded_width && avctx->coded_height) avcodec_set_dimensions(avctx, avctx->coded_width, avctx->coded_height); @@ -640,8 +656,14 @@ end: if (ff_lockmgr_cb) { (*ff_lockmgr_cb)(&codec_mutex, AV_LOCK_RELEASE); } + if (options) { + av_dict_free(options); + *options = tmp; + } + return ret; free_and_end: + av_dict_free(&tmp); av_freep(&avctx->priv_data); avctx->codec= NULL; goto end; |