diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/cfg-mplayer.h | 2 | ||||
-rw-r--r-- | core/command.c | 14 | ||||
-rw-r--r-- | core/defaultopts.c | 3 | ||||
-rw-r--r-- | core/m_option.h | 2 | ||||
-rw-r--r-- | core/mplayer.c | 7 | ||||
-rw-r--r-- | core/options.h | 2 |
6 files changed, 13 insertions, 17 deletions
diff --git a/core/cfg-mplayer.h b/core/cfg-mplayer.h index 6e776f6598..5994f24056 100644 --- a/core/cfg-mplayer.h +++ b/core/cfg-mplayer.h @@ -415,7 +415,7 @@ const m_option_t common_opts[] = { // force video/audio rate: OPT_DOUBLE("fps", force_fps, CONF_MIN, 0), OPT_INTRANGE("srate", force_srate, 0, 1000, 8*48000), - OPT_INTRANGE("channels", audio_output_channels, 0, 1, 8), + OPT_CHMAP("channels", audio_output_channels, CONF_MIN, .min = 1), OPT_AUDIOFORMAT("format", audio_output_format, 0), OPT_FLOATRANGE("speed", playback_speed, 0, 0.01, 100.0), diff --git a/core/command.c b/core/command.c index 641dfb80e0..115ea9236f 100644 --- a/core/command.c +++ b/core/command.c @@ -667,20 +667,10 @@ static int mp_property_channels(m_option_t *prop, int action, void *arg, return M_PROPERTY_UNAVAILABLE; switch (action) { case M_PROPERTY_PRINT: - switch (mpctx->sh_audio->channels) { - case 1: - *(char **) arg = talloc_strdup(NULL, "mono"); - break; - case 2: - *(char **) arg = talloc_strdup(NULL, "stereo"); - break; - default: - *(char **) arg = talloc_asprintf(NULL, "%d channels", - mpctx->sh_audio->channels); - } + *(char **) arg = mp_chmap_to_str(&mpctx->sh_audio->channels); return M_PROPERTY_OK; case M_PROPERTY_GET: - *(int *)arg = mpctx->sh_audio->channels; + *(int *)arg = mpctx->sh_audio->channels.num; return M_PROPERTY_OK; } return M_PROPERTY_NOT_IMPLEMENTED; diff --git a/core/defaultopts.c b/core/defaultopts.c index 75a3b8d226..f1778f2fff 100644 --- a/core/defaultopts.c +++ b/core/defaultopts.c @@ -4,6 +4,7 @@ #include "defaultopts.h" #include "core/options.h" #include "audio/mixer.h" +#include "audio/chmap.h" void set_default_mplayer_options(struct MPOpts *opts) { @@ -71,7 +72,7 @@ void set_default_mplayer_options(struct MPOpts *opts) .audio_display = 1, .sub_visibility = 1, .extension_parsing = 1, - .audio_output_channels = 2, + .audio_output_channels = MP_CHMAP_INIT_STEREO, .audio_output_format = -1, // AF_FORMAT_UNKNOWN .playback_speed = 1., .movie_aspect = -1., diff --git a/core/m_option.h b/core/m_option.h index 66e7208801..e365b3eedc 100644 --- a/core/m_option.h +++ b/core/m_option.h @@ -25,6 +25,7 @@ #include "config.h" #include "core/bstr.h" +#include "audio/chmap.h" // m_option allows to parse, print and copy data of various types. @@ -210,6 +211,7 @@ union m_option_value { struct m_color color; struct m_geometry geometry; struct m_geometry size_box; + struct mp_chmap chmap; }; //////////////////////////////////////////////////////////////////////////// diff --git a/core/mplayer.c b/core/mplayer.c index 3f7df8ef36..665216921e 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -324,7 +324,7 @@ static void print_file_properties(struct MPContext *mpctx, const char *filename) mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_RATE=%d\n", mpctx->sh_audio->samplerate); mp_msg(MSGT_IDENTIFY, MSGL_INFO, - "ID_AUDIO_NCH=%d\n", mpctx->sh_audio->channels); + "ID_AUDIO_NCH=%d\n", mpctx->sh_audio->channels.num); start_pts = ds_get_next_pts(mpctx->sh_audio->ds); } if (video_start_pts != MP_NOPTS_VALUE) { @@ -1563,8 +1563,11 @@ void reinit_audio_chain(struct MPContext *mpctx) mpctx->ao->samplerate = opts->force_srate; mpctx->ao->format = opts->audio_output_format; // Automatic downmix - if (opts->audio_output_channels == 2 && mpctx->sh_audio->channels != 2) + if (mp_chmap_is_stereo(&opts->audio_output_channels) && + !mp_chmap_is_stereo(&mpctx->sh_audio->channels)) + { mp_chmap_from_channels(&mpctx->ao->channels, 2); + } } ao = mpctx->ao; diff --git a/core/options.h b/core/options.h index e72778dbde..2af8479316 100644 --- a/core/options.h +++ b/core/options.h @@ -150,7 +150,7 @@ typedef struct MPOpts { double force_fps; - int audio_output_channels; + struct mp_chmap audio_output_channels; int audio_output_format; int force_srate; int dtshd; |