summaryrefslogtreecommitdiffstats
path: root/audio/decode/ad_mpg123.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-11-23 21:25:05 +0100
committerwm4 <wm4@nowhere>2013-11-23 21:25:05 +0100
commite174d31fdda78374600878699ef911fd09f55a26 (patch)
tree63cd9b7023e1a198dbbea097887a16a793f2f9b5 /audio/decode/ad_mpg123.c
parent0f5ec05d8f4ae02262dc79a895bce3b465b376f2 (diff)
downloadmpv-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_mpg123.c')
-rw-r--r--audio/decode/ad_mpg123.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/audio/decode/ad_mpg123.c b/audio/decode/ad_mpg123.c
index 1abda4e084..8f168ebb95 100644
--- a/audio/decode/ad_mpg123.c
+++ b/audio/decode/ad_mpg123.c
@@ -151,8 +151,8 @@ static int set_format(struct dec_audio *da)
int encoding;
ret = mpg123_getformat(con->handle, &rate, &channels, &encoding);
if (ret == MPG123_OK) {
- mp_chmap_from_channels(&da->header->audio->channels, channels);
- da->header->audio->samplerate = rate;
+ mp_audio_set_num_channels(&da->decoded, channels);
+ da->decoded.rate = rate;
int af = mpg123_format_to_af(encoding);
if (!af) {
/* This means we got a funny custom build of libmpg123 that only supports an unknown format. */
@@ -160,7 +160,7 @@ static int set_format(struct dec_audio *da)
"Bad encoding from mpg123: %i.\n", encoding);
return MPG123_ERR;
}
- da->header->audio->sample_format = af;
+ mp_audio_set_format(&da->decoded, af);
con->sample_size = channels * (af_fmt2bits(af) / 8);
con->new_format = 0;
}
@@ -308,9 +308,7 @@ static int decode_audio(struct dec_audio *da, struct mp_audio *buffer, int maxle
return -1;
}
- if (da->header->audio->samplerate != buffer->rate ||
- !mp_chmap_equals(&da->header->audio->channels, &buffer->channels) ||
- da->header->audio->sample_format != buffer->format)
+ if (!mp_audio_config_equals(&da->decoded, buffer))
return 0;
size_t got_now = 0;