diff options
author | wm4 <wm4@nowhere> | 2014-01-11 01:25:49 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-01-11 01:25:49 +0100 |
commit | 4b4926bbb3102836fc0c2edafe791cca6209f45e (patch) | |
tree | 3ed7d5f45e2e61ab956e18db96106cf27d99323a /audio | |
parent | 27e4360b0bc521ec6bb6ecd7c374a51c8114d090 (diff) | |
download | mpv-4b4926bbb3102836fc0c2edafe791cca6209f45e.tar.bz2 mpv-4b4926bbb3102836fc0c2edafe791cca6209f45e.tar.xz |
Factor out setting AVCodecContext extradata
Diffstat (limited to 'audio')
-rw-r--r-- | audio/decode/ad_lavc.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index b2f29505c2..0484fb9521 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -172,11 +172,8 @@ static void set_from_wf(AVCodecContext *avctx, MP_WAVEFORMATEX *wf) avctx->block_align = wf->nBlockAlign; avctx->bits_per_coded_sample = wf->wBitsPerSample; - if (wf->cbSize > 0) { - avctx->extradata = av_mallocz(wf->cbSize + FF_INPUT_BUFFER_PADDING_SIZE); - avctx->extradata_size = wf->cbSize; - memcpy(avctx->extradata, wf + 1, avctx->extradata_size); - } + if (wf->cbSize > 0) + mp_lavc_set_extradata(avctx, wf + 1, wf->cbSize); } static int init(struct dec_audio *da, const char *decoder) @@ -244,11 +241,8 @@ static int init(struct dec_audio *da, const char *decoder) // demux_mkv, demux_mpg if (sh_audio->codecdata_len && sh_audio->codecdata && !lavc_context->extradata) { - lavc_context->extradata = av_malloc(sh_audio->codecdata_len + - FF_INPUT_BUFFER_PADDING_SIZE); - lavc_context->extradata_size = sh_audio->codecdata_len; - memcpy(lavc_context->extradata, (char *)sh_audio->codecdata, - lavc_context->extradata_size); + mp_lavc_set_extradata(lavc_context, sh_audio->codecdata, + sh_audio->codecdata_len); } if (sh->lav_headers) |