diff options
author | wm4 <wm4@nowhere> | 2013-11-23 21:25:05 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-11-23 21:25:05 +0100 |
commit | e174d31fdda78374600878699ef911fd09f55a26 (patch) | |
tree | 63cd9b7023e1a198dbbea097887a16a793f2f9b5 /audio/decode/ad_lavc.c | |
parent | 0f5ec05d8f4ae02262dc79a895bce3b465b376f2 (diff) | |
download | mpv-e174d31fdda78374600878699ef911fd09f55a26.tar.bz2 mpv-e174d31fdda78374600878699ef911fd09f55a26.tar.xz |
audio: don't write decoded audio format to sh_audio
sh_audio is supposed to contain file headers, not whatever was decoded.
Fix this, and write the decoded format to separate fields in the decoder
context, the dec_audio.decoded field. (Note that this field is really
only needed to communicate the audio format from decoder driver to the
generic code, so no other code accesses it.)
Diffstat (limited to 'audio/decode/ad_lavc.c')
-rw-r--r-- | audio/decode/ad_lavc.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/audio/decode/ad_lavc.c b/audio/decode/ad_lavc.c index 143990414b..8663d5fc32 100644 --- a/audio/decode/ad_lavc.c +++ b/audio/decode/ad_lavc.c @@ -161,9 +161,9 @@ static int setup_format(struct dec_audio *da) lavc_chmap = sh_audio->channels; } - sh_audio->channels = lavc_chmap; - sh_audio->samplerate = samplerate; - sh_audio->sample_format = sample_format; + mp_audio_set_channels(&da->decoded, &lavc_chmap); + mp_audio_set_format(&da->decoded, sample_format); + da->decoded.rate = samplerate; return 0; } @@ -366,9 +366,7 @@ static int decode_new_packet(struct dec_audio *da) return -1; priv->frame.samples = priv->avframe->nb_samples; - mp_audio_set_format(&priv->frame, da->header->audio->sample_format); - mp_audio_set_channels(&priv->frame, &da->header->audio->channels); - priv->frame.rate = da->header->audio->samplerate; + mp_audio_copy_config(&priv->frame, &da->decoded); for (int n = 0; n < priv->frame.num_planes; n++) priv->frame.planes[n] = priv->avframe->data[n]; |