From 3b1956608dd5536b9ee226b996d2d69b35bc065b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 8 Apr 2013 01:58:33 +0200 Subject: audio: print channel map additionally to channel count on terminal --- audio/audio.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'audio/audio.c') diff --git a/audio/audio.c b/audio/audio.c index 549553184d..248f16790f 100644 --- a/audio/audio.c +++ b/audio/audio.c @@ -17,6 +17,7 @@ #include +#include "core/mp_talloc.h" #include "audio.h" void mp_audio_set_format(struct mp_audio *mpa, int format) @@ -54,3 +55,17 @@ void mp_audio_copy_config(struct mp_audio *dst, const struct mp_audio *src) mp_audio_set_channels(dst, &src->channels); dst->rate = src->rate; } + +char *mp_audio_fmt_to_str(int srate, const struct mp_chmap *chmap, int format) +{ + char *chstr = mp_chmap_to_str(chmap); + char *res = talloc_asprintf(NULL, "%dHz %s %dch %s", srate, chstr, + chmap->num, af_fmt2str_short(format)); + talloc_free(chstr); + return res; +} + +char *mp_audio_config_to_str(struct mp_audio *mpa) +{ + return mp_audio_fmt_to_str(mpa->rate, &mpa->channels, mpa->format); +} -- cgit v1.2.3