2009-01-26 15:06:44 +00:00
|
|
|
/*
|
2015-04-13 07:36:54 +00:00
|
|
|
* This file is part of mpv.
|
2009-01-26 15:06:44 +00:00
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is free software; you can redistribute it and/or modify
|
2009-01-26 15:06:44 +00:00
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
2015-04-13 07:36:54 +00:00
|
|
|
* mpv is distributed in the hope that it will be useful,
|
2009-01-26 15:06:44 +00:00
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
2015-04-13 07:36:54 +00:00
|
|
|
* with mpv. If not, see <http://www.gnu.org/licenses/>.
|
2009-01-26 15:06:44 +00:00
|
|
|
*/
|
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#ifndef MPLAYER_AUDIO_OUT_H
|
|
|
|
#define MPLAYER_AUDIO_OUT_H
|
2002-07-25 20:28:47 +00:00
|
|
|
|
2011-04-09 00:03:22 +00:00
|
|
|
#include <stdbool.h>
|
|
|
|
|
2014-08-29 10:09:04 +00:00
|
|
|
#include "misc/bstr.h"
|
2013-12-17 01:39:45 +00:00
|
|
|
#include "common/common.h"
|
2013-04-05 21:06:22 +00:00
|
|
|
#include "audio/chmap.h"
|
2013-05-09 13:12:16 +00:00
|
|
|
#include "audio/chmap_sel.h"
|
2012-04-07 13:26:56 +00:00
|
|
|
|
|
|
|
enum aocontrol {
|
|
|
|
// _VOLUME commands take struct ao_control_vol pointer for input/output.
|
|
|
|
// If there's only one volume, SET should use average of left/right.
|
|
|
|
AOCONTROL_GET_VOLUME,
|
|
|
|
AOCONTROL_SET_VOLUME,
|
2012-04-10 01:45:53 +00:00
|
|
|
// _MUTE commands take a pointer to bool
|
|
|
|
AOCONTROL_GET_MUTE,
|
|
|
|
AOCONTROL_SET_MUTE,
|
2013-11-09 23:49:13 +00:00
|
|
|
// Has char* as argument, which contains the desired stream title.
|
|
|
|
AOCONTROL_UPDATE_STREAM_TITLE,
|
2014-09-06 00:30:57 +00:00
|
|
|
// the AO does the equivalent of af_volume (return CONTROL_TRUE if yes)
|
|
|
|
AOCONTROL_HAS_SOFT_VOLUME,
|
|
|
|
// like above, but volume persists (per app), mpv won't restore volume
|
2014-03-07 14:24:32 +00:00
|
|
|
AOCONTROL_HAS_PER_APP_VOLUME,
|
2012-04-07 13:26:56 +00:00
|
|
|
};
|
|
|
|
|
2014-02-27 23:56:10 +00:00
|
|
|
// If set, then the queued audio data is the last. Note that after a while, new
|
|
|
|
// data might be written again, instead of closing the AO.
|
2012-04-07 13:26:56 +00:00
|
|
|
#define AOPLAY_FINAL_CHUNK 1
|
|
|
|
|
2014-11-09 08:58:44 +00:00
|
|
|
enum {
|
|
|
|
AO_EVENT_RELOAD = 1,
|
2015-02-12 15:53:56 +00:00
|
|
|
AO_EVENT_HOTPLUG = 2,
|
2014-11-09 08:58:44 +00:00
|
|
|
};
|
|
|
|
|
2012-04-07 13:26:56 +00:00
|
|
|
typedef struct ao_control_vol {
|
|
|
|
float left;
|
|
|
|
float right;
|
|
|
|
} ao_control_vol_t;
|
|
|
|
|
2014-10-09 19:21:31 +00:00
|
|
|
struct ao_device_desc {
|
2014-10-10 16:27:21 +00:00
|
|
|
const char *name; // symbolic name; will be set on ao->device
|
|
|
|
const char *desc; // verbose human readable name
|
2014-10-09 19:21:31 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct ao_device_list {
|
|
|
|
struct ao_device_desc *devices;
|
|
|
|
int num_devices;
|
|
|
|
};
|
|
|
|
|
2011-05-04 11:55:15 +00:00
|
|
|
struct ao;
|
2013-08-01 15:41:32 +00:00
|
|
|
struct mpv_global;
|
2014-03-07 14:24:32 +00:00
|
|
|
struct input_ctx;
|
|
|
|
struct encode_lavc_context;
|
|
|
|
struct mp_audio;
|
|
|
|
|
2013-08-01 15:41:32 +00:00
|
|
|
struct ao *ao_init_best(struct mpv_global *global,
|
2013-07-21 19:33:17 +00:00
|
|
|
struct input_ctx *input_ctx,
|
|
|
|
struct encode_lavc_context *encode_lavc_ctx,
|
|
|
|
int samplerate, int format, struct mp_chmap channels);
|
2014-03-08 23:49:39 +00:00
|
|
|
void ao_uninit(struct ao *ao);
|
2014-03-07 14:24:32 +00:00
|
|
|
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);
|
2013-11-10 22:38:18 +00:00
|
|
|
int ao_play(struct ao *ao, void **data, int samples, int flags);
|
2012-04-07 13:26:56 +00:00
|
|
|
int ao_control(struct ao *ao, enum aocontrol cmd, void *arg);
|
2011-04-09 00:03:22 +00:00
|
|
|
double ao_get_delay(struct ao *ao);
|
|
|
|
int ao_get_space(struct ao *ao);
|
|
|
|
void ao_reset(struct ao *ao);
|
|
|
|
void ao_pause(struct ao *ao);
|
|
|
|
void ao_resume(struct ao *ao);
|
2014-03-08 23:49:39 +00:00
|
|
|
void ao_drain(struct ao *ao);
|
2014-04-17 21:48:09 +00:00
|
|
|
bool ao_eof_reached(struct ao *ao);
|
2014-11-09 08:58:44 +00:00
|
|
|
int ao_query_and_reset_events(struct ao *ao, int events);
|
|
|
|
void ao_request_reload(struct ao *ao);
|
2015-02-12 15:53:56 +00:00
|
|
|
void ao_hotplug_event(struct ao *ao);
|
|
|
|
|
|
|
|
struct ao_hotplug;
|
|
|
|
struct ao_hotplug *ao_hotplug_create(struct mpv_global *global,
|
|
|
|
struct input_ctx *input_ctx);
|
|
|
|
void ao_hotplug_destroy(struct ao_hotplug *hp);
|
|
|
|
bool ao_hotplug_check_update(struct ao_hotplug *hp);
|
2015-02-14 11:43:55 +00:00
|
|
|
const char *ao_hotplug_get_detected_device(struct ao_hotplug *hp);
|
2015-02-12 15:53:56 +00:00
|
|
|
struct ao_device_list *ao_hotplug_get_device_list(struct ao_hotplug *hp);
|
2011-04-09 00:03:22 +00:00
|
|
|
|
2014-10-10 16:27:21 +00:00
|
|
|
void ao_print_devices(struct mpv_global *global, struct mp_log *log);
|
2014-10-09 19:21:31 +00:00
|
|
|
|
2008-02-22 09:09:46 +00:00
|
|
|
#endif /* MPLAYER_AUDIO_OUT_H */
|