From e174d31fdda78374600878699ef911fd09f55a26 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 23 Nov 2013 21:25:05 +0100 Subject: 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.) --- audio/decode/ad_lavc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'audio/decode/ad_lavc.c') 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]; -- cgit v1.2.3