audio/out: remove useless info struct and redundant fields

This commit is contained in:
wm4 2013-10-23 19:07:27 +02:00
parent 6d44a4dfd1
commit d58d4ec93c
19 changed files with 47 additions and 113 deletions

View File

@ -303,7 +303,7 @@ static void restore_volume(struct mixer *mixer)
int force_mute = -1;
const char *prev_driver = mixer->driver;
mixer->driver = mixer->softvol ? "softvol" : ao->driver->info->short_name;
mixer->driver = mixer->softvol ? "softvol" : ao->driver->name;
bool restore = mixer->softvol || ao->no_persistent_volume;

View File

@ -102,8 +102,8 @@ static bool get_desc(struct m_obj_desc *dst, int index)
return false;
const struct ao_driver *ao = audio_out_drivers[index];
*dst = (struct m_obj_desc) {
.name = ao->info->short_name,
.description = ao->info->name,
.name = ao->name,
.description = ao->description,
.priv_size = ao->priv_size,
.priv_defaults = ao->priv_defaults,
.options = ao->options,
@ -189,7 +189,7 @@ autoprobe:
for (int i = 0; audio_out_drivers[i]; i++) {
struct ao *ao = ao_create(true, global, input_ctx, encode_lavc_ctx,
samplerate, format, channels,
(char *)audio_out_drivers[i]->info->short_name, NULL);
(char *)audio_out_drivers[i]->name, NULL);
if (ao)
return ao;
}

View File

@ -43,22 +43,12 @@ typedef struct ao_control_vol {
float right;
} ao_control_vol_t;
typedef struct ao_info {
/* driver name ("Matrox Millennium G200/G400" */
const char *name;
/* short name (for config strings) ("mga") */
const char *short_name;
/* author ("Aaron Holtzman <aholtzma@ess.engr.uvic.ca>") */
const char *author;
/* any additional comments */
const char *comment;
} ao_info_t;
struct ao;
struct ao_driver {
bool encode;
const struct ao_info *info;
const char *name;
const char *description;
int (*control)(struct ao *ao, enum aocontrol cmd, void *arg);
int (*init)(struct ao *ao);
void (*uninit)(struct ao *ao, bool cut_audio);

View File

@ -2,6 +2,7 @@
* ALSA 0.9.x-1.x audio output driver
*
* Copyright (C) 2004 Alex Beregszaszi
* Zsolt Barat <joy@streamminister.de>
*
* modified for real ALSA 0.9.0 support by Zsolt Barat <joy@streamminister.de>
* additional AC-3 passthrough support by Andy Lo A Foe <andy@alsaplayer.org>
@ -731,12 +732,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_alsa = {
.info = &(const struct ao_info) {
"ALSA-0.9.x-1.x audio output",
"alsa",
"Alex Beregszaszi, Zsolt Barat <joy@streamminister.de>",
"under development"
},
.description = "ALSA-0.9.x-1.x audio output",
.name = "alsa",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -4,6 +4,9 @@
* original copyright (C) Timothy J. Wood - Aug 2000
* ported to MPlayer libao2 by Dan Christiansen
*
* Chris Roccati
* Stefano Pigozzi
*
* The S/PDIF part of the code is based on the auhal audio output
* module from VideoLAN:
* Copyright (c) 2006 Derk-Jan Hartman <hartman at videolan dot org>
@ -697,12 +700,8 @@ static void audio_resume(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_coreaudio = {
.info = &(const struct ao_info) {
"CoreAudio (OS X Audio Output)",
"coreaudio",
"Timothy J. Wood, Dan Christiansen, Chris Roccati & Stefano Pigozzi",
"",
},
.description = "CoreAudio (OS X Audio Output)",
.name = "coreaudio",
.uninit = uninit,
.init = init,
.play = play,

View File

@ -634,12 +634,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_dsound = {
.info = &(const struct ao_info) {
"Windows DirectSound audio output",
"dsound",
"Gabor Szecsi <deje@miki.hu>",
""
},
.description = "Windows DirectSound audio output",
.name = "dsound",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -337,12 +337,8 @@ static int play(struct ao *ao, void *data, int len, int flags)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_jack = {
.info = &(const struct ao_info) {
"JACK audio output",
"jack",
"Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de>",
"based on ao_sdl.c"
},
.description = "JACK audio output",
.name = "jack",
.init = init,
.uninit = uninit,
.get_space = get_space,

View File

@ -633,12 +633,8 @@ static int play(struct ao *ao, void *data, int len, int flags)
const struct ao_driver audio_out_lavc = {
.encode = true,
.info = &(const struct ao_info) {
"audio encoding using libavcodec",
"lavc",
"Rudolf Polzer <divVerent@xonotic.org>",
""
},
.description = "audio encoding using libavcodec",
.name = "lavc",
.init = init,
.uninit = uninit,
.get_space = get_space,

View File

@ -117,12 +117,8 @@ static float get_delay(struct ao *ao)
}
const struct ao_driver audio_out_null = {
.info = &(const struct ao_info) {
"Null audio output",
"null",
"Tobias Diedrich <ranma+mplayer@tdiedrich.de>",
"",
},
.description = "Null audio output",
.name = "null",
.init = init,
.uninit = uninit,
.reset = reset,

View File

@ -292,12 +292,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_openal = {
.info = &(const struct ao_info) {
"OpenAL audio output",
"openal",
"Reimar Döffinger <Reimar.Doeffinger@stud.uni-karlsruhe.de>",
""
},
.description = "OpenAL audio output",
.name = "openal",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -3,6 +3,7 @@
*
* This file is part of MPlayer.
*
* Original author: A'rpi
* Support for >2 output channels added 2001-11-25
* - Steve Davies <steve@daviesfam.org>
*
@ -542,12 +543,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_oss = {
.info = &(const struct ao_info) {
"OSS/ioctl audio output",
"oss",
"A'rpi",
""
},
.description = "OSS/ioctl audio output",
.name = "oss",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -3,6 +3,8 @@
*
* This file is part of MPlayer.
*
* Original author: Atmosfear
*
* MPlayer is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@ -203,12 +205,8 @@ static int play(struct ao *ao, void *data, int len, int flags)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_pcm = {
.info = &(const struct ao_info) {
"RAW PCM/WAVE file writer audio output",
"pcm",
"Atmosfear",
"",
},
.description = "RAW PCM/WAVE file writer audio output",
.name = "pcm",
.init = init,
.uninit = uninit,
.get_space = get_space,

View File

@ -372,12 +372,8 @@ static void resume(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_portaudio = {
.info = &(const struct ao_info) {
"PortAudio",
"portaudio",
"wm4",
"",
},
.description = "PortAudio",
.name = "portaudio",
.init = init,
.uninit = uninit,
.reset = reset,

View File

@ -587,12 +587,8 @@ static int control(struct ao *ao, enum aocontrol cmd, void *arg)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_pulse = {
.info = &(const struct ao_info) {
"PulseAudio audio output",
"pulse",
"Lennart Poettering",
"",
},
.description = "PulseAudio audio output",
.name = "pulse",
.control = control,
.init = init,
.uninit = uninit,

View File

@ -179,12 +179,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_rsound = {
.info = &(const struct ao_info) {
.name = "RSound output driver",
.short_name = "rsound",
.author = "Hans-Kristian Arntzen",
.comment = "",
},
.description = "RSound output driver",
.name = "rsound",
.init = init,
.uninit = uninit,
.reset = reset,

View File

@ -347,12 +347,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_sdl = {
.info = &(const struct ao_info) {
"SDL Audio",
"sdl",
"Rudolf Polzer <divVerent@xonotic.org>",
""
},
.description = "SDL Audio",
.name = "sdl",
.init = init,
.uninit = uninit,
.get_space = get_space,

View File

@ -317,12 +317,8 @@ static void audio_resume(struct ao *ao)
#define OPT_BASE_STRUCT struct priv
const struct ao_driver audio_out_sndio = {
.info = &(const struct ao_info) {
"sndio audio output",
"sndio",
"Alexandre Ratchov <alex@caoua.org>, Christian Neukirchen <chneukirchen@gmail.com>",
"under development"
},
.description = "sndio audio output",
.name = "sndio",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -1,6 +1,8 @@
/*
* This file is part of mpv.
*
* Original author: Jonathan Yong <10walls@gmail.com>
*
* mpv is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@ -1369,12 +1371,8 @@ static float get_delay(struct ao *ao)
#define OPT_BASE_STRUCT struct wasapi_state
const struct ao_driver audio_out_wasapi = {
.info = &(const struct ao_info) {
"Windows WASAPI audio output (event mode)",
"wasapi",
"Jonathan Yong <10walls@gmail.com>",
""
},
.description = "Windows WASAPI audio output (event mode)",
.name = "wasapi",
.init = init,
.uninit = uninit,
.control = control,

View File

@ -1726,14 +1726,9 @@ void reinit_audio_chain(struct MPContext *mpctx)
}
ao->buffer.start = talloc_new(ao);
char *s = mp_audio_fmt_to_str(ao->samplerate, &ao->channels, ao->format);
MP_INFO(mpctx, "AO: [%s] %s\n",
ao->driver->info->short_name, s);
MP_INFO(mpctx, "AO: [%s] %s\n", ao->driver->name, s);
talloc_free(s);
MP_VERBOSE(mpctx, "AO: Description: %s\nAO: Author: %s\n",
ao->driver->info->name, ao->driver->info->author);
if (strlen(ao->driver->info->comment) > 0)
MP_VERBOSE(mpctx, "AO: Comment: %s\n",
ao->driver->info->comment);
MP_VERBOSE(mpctx, "AO: Description: %s\n", ao->driver->description);
}
if (recreate_audio_filters(mpctx) < 0)