summaryrefslogtreecommitdiffstats
path: root/options/m_option.h
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-08-04 20:49:20 +0200
committerwm4 <wm4@nowhere>2016-08-04 20:49:20 +0200
commit0b144eac39bbae51c3f2b7683f6982eb91b66393 (patch)
tree63f0585f4dece4195da5745a4969159d9b5d8122 /options/m_option.h
parentc30aa2340132e50994cdf168aaba011ecb4f6b0c (diff)
downloadmpv-0b144eac39bbae51c3f2b7683f6982eb91b66393.tar.bz2
mpv-0b144eac39bbae51c3f2b7683f6982eb91b66393.tar.xz
audio: use --audio-channels=auto behavior, except on ALSA
This commit adds an --audio-channel=auto-safe mode, and makes it the default. This mode behaves like "auto" with most AOs, except with ao_alsa. The intention is to allow multichannel output by default on sane APIs. ALSA is not sane as in it's so low level that it will e.g. configure any layout over HDMI, even if the connected A/V receiver does not support it. The HDMI fuckup is of course not ALSA's fault, but other audio APIs normally isolate applications from dealing with this and require the user to globally configure the correct output layout. This will help with other AOs too. ao_lavc (encoding) is changed to the new semantics as well, because it used to force stereo (perhaps because encoding mode is supposed to produce safe files for crap devices?). Exclusive mode output on Windows might need to be adjusted accordingly, as it grants the same kind of low level access as ALSA (requires more research). In addition to the things mentioned above, the --audio-channels option is extended to accept a set of channel layouts. This is supposed to be the correct way to configure mpv ALSA multichannel output. You need to put a list of channel layouts that your A/V receiver supports.
Diffstat (limited to 'options/m_option.h')
-rw-r--r--options/m_option.h18
1 files changed, 13 insertions, 5 deletions
diff --git a/options/m_option.h b/options/m_option.h
index e77452af69..80be447c42 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -61,7 +61,7 @@ extern const m_option_type_t m_option_type_afmt;
extern const m_option_type_t m_option_type_color;
extern const m_option_type_t m_option_type_geometry;
extern const m_option_type_t m_option_type_size_box;
-extern const m_option_type_t m_option_type_chmap;
+extern const m_option_type_t m_option_type_channels;
extern const m_option_type_t m_option_type_node;
// Used internally by m_config.c
@@ -98,6 +98,13 @@ struct m_geometry {
void m_geometry_apply(int *xpos, int *ypos, int *widw, int *widh,
int scrw, int scrh, struct m_geometry *gm);
+struct m_channels {
+ bool set : 1;
+ bool auto_safe : 1;
+ struct mp_chmap *chmaps;
+ int num_chmaps;
+};
+
struct m_obj_desc {
// Name which will be used in the option string
const char *name;
@@ -218,7 +225,7 @@ union m_option_value {
struct m_color color;
struct m_geometry geometry;
struct m_geometry size_box;
- struct mp_chmap chmap;
+ struct m_channels channels;
};
////////////////////////////////////////////////////////////////////////////
@@ -626,9 +633,10 @@ extern const char m_option_path_separator;
#define OPT_AUDIOFORMAT(...) \
OPT_GENERAL(int, __VA_ARGS__, .type = &m_option_type_afmt)
-#define OPT_CHMAP(...) \
- OPT_GENERAL(struct mp_chmap, __VA_ARGS__, .type = &m_option_type_chmap)
-
+// If .min==1, then passing auto is disallowed, but "" is still accepted, and
+// limit channel list to 1 item.
+#define OPT_CHANNELS(...) \
+ OPT_GENERAL(struct m_channels, __VA_ARGS__, .type = &m_option_type_channels)
#define M_CHOICES(choices) \
.priv = (void *)&(const struct m_opt_choice_alternatives[]){ \