summaryrefslogtreecommitdiffstats
path: root/audio/out
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-02-06 22:54:03 +0100
committerwm4 <wm4@nowhere>2013-02-06 23:04:18 +0100
commitae070a6f1eff9f38dcd3ec785dd1f251e3761472 (patch)
treed498b49781dcbe656b324f813ba83b9b90f2495b /audio/out
parent4628ea3c46fe64cc9989e5a3e6f9b01f72563c36 (diff)
downloadmpv-ae070a6f1eff9f38dcd3ec785dd1f251e3761472.tar.bz2
mpv-ae070a6f1eff9f38dcd3ec785dd1f251e3761472.tar.xz
audio/out, video/out: hide encoding VO/AO
mpv -ao help and mpv -vo help shouldn't show the encoding outputs (named "lavc" on both cases). Also make it impossible to select these manually when not encoding.
Diffstat (limited to 'audio/out')
-rw-r--r--audio/out/ao.c25
-rw-r--r--audio/out/ao.h1
-rw-r--r--audio/out/ao_lavc.c1
3 files changed, 19 insertions, 8 deletions
diff --git a/audio/out/ao.c b/audio/out/ao.c
index a0faafebfb..9fb201a333 100644
--- a/audio/out/ao.c
+++ b/audio/out/ao.c
@@ -91,13 +91,14 @@ static const struct ao_driver * const audio_out_drivers[] = {
void list_audio_out(void)
{
- int i=0;
mp_tmsg(MSGT_AO, MSGL_INFO, "Available audio output drivers:\n");
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "ID_AUDIO_OUTPUTS\n");
- while (audio_out_drivers[i]) {
- const ao_info_t *info = audio_out_drivers[i++]->info;
- mp_msg(MSGT_GLOBAL, MSGL_INFO, "\t%s\t%s\n", info->short_name,
- info->name);
+ for (int i = 0; audio_out_drivers[i]; i++) {
+ const ao_info_t *info = audio_out_drivers[i]->info;
+ if (!audio_out_drivers[i]->encode) {
+ mp_msg(MSGT_GLOBAL, MSGL_INFO, "\t%s\t%s\n",
+ info->short_name, info->name);
+ }
}
mp_msg(MSGT_GLOBAL, MSGL_INFO,"\n");
}
@@ -110,6 +111,13 @@ struct ao *ao_create(struct MPOpts *opts, struct input_ctx *input)
return r;
}
+static bool ao_try_init(struct ao *ao, char *params)
+{
+ if (ao->driver->encode != !!ao->encode_lavc_ctx)
+ return false;
+ return ao->driver->init(ao, params) >= 0;
+}
+
void ao_init(struct ao *ao, char **ao_list)
{
/* Caller adding child blocks is not supported as we may call
@@ -148,7 +156,7 @@ void ao_init(struct ao *ao, char **ao_list)
if (audio_out) {
// name matches, try it
ao->driver = audio_out;
- if (audio_out->init(ao, params) >= 0) {
+ if (ao_try_init(ao, params)) {
ao->driver = audio_out;
ao->initialized = true;
return;
@@ -167,13 +175,14 @@ void ao_init(struct ao *ao, char **ao_list)
try_defaults:
mp_tmsg(MSGT_AO, MSGL_V, "Trying every known audio driver...\n");
+ ao->probing = false;
+
// now try the rest...
for (int i = 0; audio_out_drivers[i]; i++) {
const struct ao_driver *audio_out = audio_out_drivers[i];
ao->driver = audio_out;
ao->probing = true;
- if (audio_out->init(ao, NULL) >= 0) {
- ao->probing = false;
+ if (ao_try_init(ao, NULL)) {
ao->initialized = true;
ao->driver = audio_out;
return;
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 2fb8d9ba2c..6b79508943 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -75,6 +75,7 @@ struct ao;
struct ao_driver {
bool is_new;
+ bool encode;
const struct ao_info *info;
const struct ao_old_functions *old_functions;
int (*control)(struct ao *ao, enum aocontrol cmd, void *arg);
diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c
index ab82ad9d6d..062d1b928b 100644
--- a/audio/out/ao_lavc.c
+++ b/audio/out/ao_lavc.c
@@ -660,6 +660,7 @@ static int play(struct ao *ao, void *data, int len, int flags)
const struct ao_driver audio_out_lavc = {
.is_new = true,
+ .encode = true,
.info = &(const struct ao_info) {
"audio encoding using libavcodec",
"lavc",