summaryrefslogtreecommitdiffstats
path: root/audio/audio.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-05 20:39:52 +0200
committerwm4 <wm4@nowhere>2013-05-12 21:24:54 +0200
commit7971bb87cb46f90152913de6ac673ae3bd1637a3 (patch)
tree7929e829c5960425270f4f0c017d84c37872ac5b /audio/audio.c
parentf7a427676c0fe3c12509e3d9a243301f93626b0a (diff)
downloadmpv-7971bb87cb46f90152913de6ac673ae3bd1637a3.tar.bz2
mpv-7971bb87cb46f90152913de6ac673ae3bd1637a3.tar.xz
af: use mp_chmap for mp_audio, include channel map in format negotiation
Now af_lavrresample pretends to reorder the channels, although it doesn't yet, and nothing sets non-standard layouts either.
Diffstat (limited to 'audio/audio.c')
-rw-r--r--audio/audio.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/audio/audio.c b/audio/audio.c
index 04ebe390b8..549553184d 100644
--- a/audio/audio.c
+++ b/audio/audio.c
@@ -27,12 +27,30 @@ void mp_audio_set_format(struct mp_audio *mpa, int format)
void mp_audio_set_num_channels(struct mp_audio *mpa, int num_channels)
{
- mpa->nch = num_channels;
+ struct mp_chmap map;
+ mp_chmap_from_channels(&map, num_channels);
+ mp_audio_set_channels(mpa, &map);
+}
+
+// Use old MPlayer/ALSA channel layout.
+void mp_audio_set_channels_old(struct mp_audio *mpa, int num_channels)
+{
+ struct mp_chmap map;
+ mp_chmap_from_channels(&map, num_channels);
+ mp_chmap_reorder_to_alsa(&map);
+ mp_audio_set_channels(mpa, &map);
+}
+
+void mp_audio_set_channels(struct mp_audio *mpa, const struct mp_chmap *chmap)
+{
+ assert(mp_chmap_is_empty(chmap) || mp_chmap_is_valid(chmap));
+ mpa->channels = *chmap;
+ mpa->nch = mpa->channels.num;
}
void mp_audio_copy_config(struct mp_audio *dst, const struct mp_audio *src)
{
mp_audio_set_format(dst, src->format);
- mp_audio_set_num_channels(dst, src->nch);
+ mp_audio_set_channels(dst, &src->channels);
dst->rate = src->rate;
}