path: root/audio/out/ao.h
diff options
authorwm4 <wm4@nowhere>2014-03-07 15:24:32 +0100
committerwm4 <wm4@nowhere>2014-03-09 00:19:31 +0100
commit41f2b26d11e81095a0d8d370480e0d2459208070 (patch)
tree1b665e392be25795b8fade6d0487609f73ac90d2 /audio/out/ao.h
parent74b7001500c0901b095986fafe7dca3e5c23c7f2 (diff)
audio/out: make ao struct opaque
We want to move the AO to its own thread. There's no technical reason for making the ao struct opaque to do this. But it helps us sleep at night, because we can control access to shared state better.
Diffstat (limited to 'audio/out/ao.h')
1 files changed, 10 insertions, 59 deletions
diff --git a/audio/out/ao.h b/audio/out/ao.h
index 73a7cdfa61..152490aacc 100644
--- a/audio/out/ao.h
+++ b/audio/out/ao.h
@@ -36,6 +36,8 @@ enum aocontrol {
// Has char* as argument, which contains the desired stream title.
// If set, then the queued audio data is the last. Note that after a while, new
@@ -48,64 +50,20 @@ typedef struct ao_control_vol {
} ao_control_vol_t;
struct ao;
-struct ao_driver {
- // If true, use with encoding only.
- bool encode;
- // Name used for --ao.
- const char *name;
- // Description shown with --ao=help.
- const char *description;
- // Init the device using ao->format/ao->channels/ao->samplerate. If the
- // device doesn't accept these parameters, you can attempt to negotiate
- // fallback parameters, and set the ao format fields accordingly.
- int (*init)(struct ao *ao);
- // See ao_control() etc. in ao.c
- int (*control)(struct ao *ao, enum aocontrol cmd, void *arg);
- void (*uninit)(struct ao *ao, bool cut_audio);
- void (*reset)(struct ao*ao);
- int (*get_space)(struct ao *ao);
- int (*play)(struct ao *ao, void **data, int samples, int flags);
- float (*get_delay)(struct ao *ao);
- void (*pause)(struct ao *ao);
- void (*resume)(struct ao *ao);
- // For option parsing (see vo.h)
- int priv_size;
- const void *priv_defaults;
- const struct m_option *options;
-/* global data used by mplayer and plugins */
-struct ao {
- int samplerate;
- struct mp_chmap channels;
- int format; // one of AF_FORMAT_...
- int bps; // bytes per second
- int sstride; // size of a sample on each plane
- // (format_size*num_channels/num_planes)
- double pts; // some mplayer.c state (why is this here?)
- struct mp_audio_buffer *buffer; // queued audio; passed to play() later
- int buffer_playable_samples;// part of the part of the buffer the AO hasn't
- // accepted yet with play()
- bool probing; // if true, don't fail loudly on init
- bool untimed; // don't assume realtime playback
- bool no_persistent_volume; // the AO does the equivalent of af_volume
- bool per_application_mixer; // like above, but volume persists (per app)
- const struct ao_driver *driver;
- void *priv;
- struct encode_lavc_context *encode_lavc_ctx;
- struct MPOpts *opts;
- struct input_ctx *input_ctx;
- struct mp_log *log; // Using e.g. "[ao/coreaudio]" as prefix
struct mpv_global;
+struct input_ctx;
+struct encode_lavc_context;
+struct mp_audio;
struct ao *ao_init_best(struct mpv_global *global,
struct input_ctx *input_ctx,
struct encode_lavc_context *encode_lavc_ctx,
int samplerate, int format, struct mp_chmap channels);
void ao_uninit(struct ao *ao, bool cut_audio);
+void ao_get_format(struct ao *ao, struct mp_audio *format);
+const char *ao_get_name(struct ao *ao);
+const char *ao_get_description(struct ao *ao);
+bool ao_untimed(struct ao *ao);
int ao_play(struct ao *ao, void **data, int samples, int flags);
int ao_control(struct ao *ao, enum aocontrol cmd, void *arg);
double ao_get_delay(struct ao *ao);
@@ -114,11 +72,4 @@ void ao_reset(struct ao *ao);
void ao_pause(struct ao *ao);
void ao_resume(struct ao *ao);
-int ao_play_silence(struct ao *ao, int samples);
-bool ao_chmap_sel_adjust(struct ao *ao, const struct mp_chmap_sel *s,
- struct mp_chmap *map);
-bool ao_chmap_sel_get_def(struct ao *ao, const struct mp_chmap_sel *s,
- struct mp_chmap *map, int num);
#endif /* MPLAYER_AUDIO_OUT_H */