summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-01-11 01:25:49 +0100
committerwm4 <wm4@nowhere>2014-03-11 00:07:51 +0100
commit5ab2aa84e03ca878a66cc1ce7919edc0ad9b23ed (patch)
treea3cd4045fc2cc9f46e837bf4cdeafb42107f9815 /audio
parent229d398ba941e13b755e96acc9b624bfbf48c14d (diff)
downloadmpv-5ab2aa84e03ca878a66cc1ce7919edc0ad9b23ed.tar.bz2
mpv-5ab2aa84e03ca878a66cc1ce7919edc0ad9b23ed.tar.xz
Factor out setting AVCodecContext extradata
Diffstat (limited to 'audio')
-rw-r--r--audio/decode/ad_lavc.c14
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)