diff options
author | wm4 <wm4@nowhere> | 2014-09-25 01:56:51 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-09-25 01:56:51 +0200 |
commit | 9c3c199558eff0413636cdc877c13b89007d85a9 (patch) | |
tree | cf9d6c3eae2d9214776c1269a69e73ba65a938be /audio | |
parent | fd7dde404d95f9c7f703917578111317d4ab85cd (diff) | |
download | mpv-9c3c199558eff0413636cdc877c13b89007d85a9.tar.bz2 mpv-9c3c199558eff0413636cdc877c13b89007d85a9.tar.xz |
audio: remove WAVEFORMATEX from internal demuxer API
Same as with the previous commit. A bit more involved due to how the
code is written.
Diffstat (limited to 'audio')
-rw-r--r-- | audio/decode/ad_lavc.c | 24 |
1 files changed, 5 insertions, 19 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index a590de92fd..cb65cda184 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -102,18 +102,6 @@ static void set_data_from_avframe(struct dec_audio *da) da->decoded.planes[n] = priv->avframe->data[n]; } -static void set_from_wf(AVCodecContext *avctx, MP_WAVEFORMATEX *wf) -{ - avctx->channels = wf->nChannels; - avctx->sample_rate = wf->nSamplesPerSec; - avctx->bit_rate = wf->nAvgBytesPerSec * 8; - avctx->block_align = wf->nBlockAlign; - avctx->bits_per_coded_sample = wf->wBitsPerSample; - - if (wf->cbSize > 0) - mp_lavc_set_extradata(avctx, wf + 1, wf->cbSize); -} - static int init(struct dec_audio *da, const char *decoder) { struct MPOpts *mpopts = da->opts; @@ -156,13 +144,13 @@ static int init(struct dec_audio *da, const char *decoder) lavc_context->codec_tag = sh->format; lavc_context->sample_rate = sh_audio->samplerate; lavc_context->bit_rate = sh_audio->bitrate; + lavc_context->block_align = sh_audio->block_align; + lavc_context->bits_per_coded_sample = sh_audio->bits_per_coded_sample; lavc_context->channels = sh_audio->channels.num; - lavc_context->channel_layout = mp_chmap_to_lavc(&sh_audio->channels); - - if (sh_audio->wf) - set_from_wf(lavc_context, sh_audio->wf); + if (!mp_chmap_is_unknown(&sh_audio->channels)) + lavc_context->channel_layout = mp_chmap_to_lavc(&sh_audio->channels); - // demux_mkv, demux_mpg + // demux_mkv if (sh_audio->codecdata_len && sh_audio->codecdata && !lavc_context->extradata) { mp_lavc_set_extradata(lavc_context, sh_audio->codecdata, @@ -183,8 +171,6 @@ static int init(struct dec_audio *da, const char *decoder) if (lavc_context->bit_rate != 0) da->bitrate = lavc_context->bit_rate; - else if (sh_audio->wf && sh_audio->wf->nAvgBytesPerSec) - da->bitrate = sh_audio->wf->nAvgBytesPerSec * 8; return 1; } |