diff options
author | wm4 <wm4@nowhere> | 2017-01-25 08:24:19 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-25 08:24:19 +0100 |
commit | 801fa486b0b43badd05cbab64d796b3eb5a2d129 (patch) | |
tree | 15c9b086a51d50fadb7d03e52e81632907848b42 /audio | |
parent | ce803da90d432cef7befa3eee3b359e14cdacccb (diff) | |
download | mpv-801fa486b0b43badd05cbab64d796b3eb5a2d129.tar.bz2 mpv-801fa486b0b43badd05cbab64d796b3eb5a2d129.tar.xz |
ad_lavc, vd_lavc: move mpv->lavc decoder parameter setup to common code
This can be useful in other contexts.
Note that we end up setting AVCodecContext.width/height instead of
coded_width/coded_height now. AVCodecParameters can't set coded_width,
but this is probably more correct anyway.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/decode/ad_lavc.c | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 820559a06b..7f3abfd612 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -122,19 +122,11 @@ static int init(struct dec_audio *da, const char *decoder) mp_set_avopts(da->log, lavc_context, opts->avopts); - lavc_context->codec_tag = c->codec_tag; - lavc_context->sample_rate = c->samplerate; - lavc_context->bit_rate = c->bitrate; - lavc_context->block_align = c->block_align; - lavc_context->bits_per_coded_sample = c->bits_per_coded_sample; - lavc_context->channels = c->channels.num; - if (!mp_chmap_is_unknown(&c->channels)) - lavc_context->channel_layout = mp_chmap_to_lavc(&c->channels); - - // demux_mkv - mp_lavc_set_extradata(lavc_context, c->extradata, c->extradata_size); - - mp_set_lav_codec_headers(lavc_context, c); + if (mp_set_avctx_codec_headers(lavc_context, c) < 0) { + MP_ERR(da, "Could not set decoder parameters.\n"); + uninit(da); + return 0; + } mp_set_avcodec_threads(da->log, lavc_context, opts->threads); |