2008-09-07 14:09:51 +00:00
|
|
|
/*
|
|
|
|
* JACK audio output driver for MPlayer
|
2004-06-25 18:11:15 +00:00
|
|
|
*
|
2007-07-09 19:50:36 +00:00
|
|
|
* Copyleft 2001 by Felix Bünemann (atmosfear@users.sf.net)
|
|
|
|
* and Reimar Döffinger (Reimar.Doeffinger@stud.uni-karlsruhe.de)
|
2008-09-07 14:09:51 +00:00
|
|
|
*
|
|
|
|
* This file is part of MPlayer.
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* MPlayer is distributed in the hope that it will be useful,
|
|
|
|
* 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
|
|
|
|
* along with MPlayer; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
2004-06-25 18:11:15 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdio.h>
|
2005-06-01 09:20:46 +00:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2005-06-05 08:37:48 +00:00
|
|
|
#include <unistd.h>
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2005-01-12 22:00:02 +00:00
|
|
|
#include "config.h"
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "core/mp_msg.h"
|
2005-06-01 09:20:46 +00:00
|
|
|
|
2012-11-09 00:06:43 +00:00
|
|
|
#include "ao.h"
|
|
|
|
#include "audio/format.h"
|
2005-06-01 09:20:46 +00:00
|
|
|
#include "osdep/timer.h"
|
2013-07-21 22:03:57 +00:00
|
|
|
#include "core/m_option.h"
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-06-15 21:58:26 +00:00
|
|
|
#include "core/mp_ring.h"
|
2005-06-01 09:20:46 +00:00
|
|
|
|
|
|
|
#include <jack/jack.h>
|
|
|
|
|
|
|
|
//! maximum number of channels supported, avoids lots of mallocs
|
2013-05-09 16:06:26 +00:00
|
|
|
#define MAX_CHANS MP_NUM_CHANNELS
|
2005-06-01 09:20:46 +00:00
|
|
|
|
|
|
|
//! size of one chunk, if this is too small MPlayer will start to "stutter"
|
|
|
|
//! after a short time of playback
|
2013-07-06 11:11:22 +00:00
|
|
|
#define CHUNK_SIZE (24 * 1024)
|
2005-06-01 09:20:46 +00:00
|
|
|
//! number of "virtual" chunks the buffer consists of
|
|
|
|
#define NUM_CHUNKS 8
|
|
|
|
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv {
|
|
|
|
jack_port_t * ports[MAX_CHANS];
|
|
|
|
int num_ports; // Number of used ports == number of channels
|
|
|
|
jack_client_t *client;
|
2013-06-16 17:15:32 +00:00
|
|
|
int outburst;
|
2013-06-07 14:42:29 +00:00
|
|
|
float jack_latency;
|
2013-07-21 22:03:57 +00:00
|
|
|
char *cfg_port;
|
|
|
|
char *cfg_client_name;
|
2013-06-07 14:42:29 +00:00
|
|
|
int estimate;
|
2013-07-21 22:03:57 +00:00
|
|
|
int connect;
|
|
|
|
int autostart;
|
|
|
|
int stdlayout;
|
2013-06-07 14:42:29 +00:00
|
|
|
volatile int paused;
|
|
|
|
volatile int underrun; // signals if an underrun occured
|
|
|
|
volatile float callback_interval;
|
|
|
|
volatile float callback_time;
|
2013-06-15 21:58:26 +00:00
|
|
|
struct mp_ring *ring; // buffer for audio data
|
2013-06-07 14:42:29 +00:00
|
|
|
};
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2008-01-11 20:36:33 +00:00
|
|
|
static void silence(float **bufs, int cnt, int num_bufs);
|
|
|
|
|
2009-03-09 18:21:47 +00:00
|
|
|
struct deinterleave {
|
2013-06-07 13:38:08 +00:00
|
|
|
float **bufs;
|
|
|
|
int num_bufs;
|
|
|
|
int cur_buf;
|
|
|
|
int pos;
|
2009-03-09 18:21:47 +00:00
|
|
|
};
|
|
|
|
|
2013-06-07 13:38:08 +00:00
|
|
|
static void deinterleave(void *info, void *src, int len)
|
|
|
|
{
|
|
|
|
struct deinterleave *di = info;
|
|
|
|
float *s = src;
|
|
|
|
int i;
|
|
|
|
len /= sizeof(float);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
di->bufs[di->cur_buf++][di->pos] = s[i];
|
|
|
|
if (di->cur_buf >= di->num_bufs) {
|
|
|
|
di->cur_buf = 0;
|
|
|
|
di->pos++;
|
|
|
|
}
|
2009-03-09 18:21:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief read data from buffer and splitting it into channels
|
|
|
|
* \param bufs num_bufs float buffers, each will contain the data of one channel
|
|
|
|
* \param cnt number of samples to read per channel
|
|
|
|
* \param num_bufs number of channels to split the data into
|
|
|
|
* \return number of samples read per channel, equals cnt unless there was too
|
|
|
|
* little data in the buffer
|
|
|
|
*
|
|
|
|
* Assumes the data in the buffer is of type float, the number of bytes
|
|
|
|
* read is res * num_bufs * sizeof(float), where res is the return value.
|
2006-06-25 09:02:47 +00:00
|
|
|
* If there is not enough data in the buffer remaining parts will be filled
|
|
|
|
* with silence.
|
2005-06-01 09:20:46 +00:00
|
|
|
*/
|
2013-06-15 21:58:26 +00:00
|
|
|
static int read_buffer(struct mp_ring *ring, float **bufs, int cnt, int num_bufs)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
|
|
|
struct deinterleave di = {
|
|
|
|
bufs, num_bufs, 0, 0
|
|
|
|
};
|
2013-06-15 21:58:26 +00:00
|
|
|
int buffered = mp_ring_buffered(ring);
|
2013-06-07 13:38:08 +00:00
|
|
|
if (cnt * sizeof(float) * num_bufs > buffered) {
|
|
|
|
silence(bufs, cnt, num_bufs);
|
|
|
|
cnt = buffered / sizeof(float) / num_bufs;
|
|
|
|
}
|
2013-06-15 21:58:26 +00:00
|
|
|
mp_ring_read_cb(ring, &di, cnt * num_bufs * sizeof(float), deinterleave);
|
2013-06-07 13:38:08 +00:00
|
|
|
return cnt;
|
2004-06-25 18:11:15 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
// end ring buffer stuff
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief fill the buffers with silence
|
|
|
|
* \param bufs num_bufs float buffers, each will contain the data of one channel
|
|
|
|
* \param cnt number of samples in each buffer
|
|
|
|
* \param num_bufs number of buffers
|
|
|
|
*/
|
2013-06-07 13:38:08 +00:00
|
|
|
static void silence(float **bufs, int cnt, int num_bufs)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
for (i = 0; i < num_bufs; i++)
|
|
|
|
memset(bufs[i], 0, cnt * sizeof(float));
|
2004-06-25 18:11:15 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief JACK Callback function
|
|
|
|
* \param nframes number of frames to fill into buffers
|
|
|
|
* \param arg unused
|
|
|
|
* \return currently always 0
|
|
|
|
*
|
|
|
|
* Write silence into buffers if paused or an underrun occured
|
|
|
|
*/
|
2013-06-07 13:38:08 +00:00
|
|
|
static int outputaudio(jack_nframes_t nframes, void *arg)
|
|
|
|
{
|
2013-06-07 13:44:49 +00:00
|
|
|
struct ao *ao = arg;
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-07 13:38:08 +00:00
|
|
|
float *bufs[MAX_CHANS];
|
|
|
|
int i;
|
2013-06-07 14:42:29 +00:00
|
|
|
for (i = 0; i < p->num_ports; i++)
|
|
|
|
bufs[i] = jack_port_get_buffer(p->ports[i], nframes);
|
2013-06-15 21:58:26 +00:00
|
|
|
if (p->paused || p->underrun || !p->ring)
|
2013-06-07 14:42:29 +00:00
|
|
|
silence(bufs, nframes, p->num_ports);
|
2013-06-15 21:58:26 +00:00
|
|
|
else if (read_buffer(p->ring, bufs, nframes, p->num_ports) < nframes)
|
2013-06-07 14:42:29 +00:00
|
|
|
p->underrun = 1;
|
|
|
|
if (p->estimate) {
|
2013-06-07 13:38:08 +00:00
|
|
|
float now = mp_time_us() / 1000000.0;
|
2013-06-07 14:42:29 +00:00
|
|
|
float diff = p->callback_time + p->callback_interval - now;
|
2013-06-07 13:38:08 +00:00
|
|
|
if ((diff > -0.002) && (diff < 0.002))
|
2013-06-07 14:42:29 +00:00
|
|
|
p->callback_time += p->callback_interval;
|
2013-06-07 13:38:08 +00:00
|
|
|
else
|
2013-06-07 14:42:29 +00:00
|
|
|
p->callback_time = now;
|
|
|
|
p->callback_interval = (float)nframes / (float)ao->samplerate;
|
2013-06-07 13:38:08 +00:00
|
|
|
}
|
|
|
|
return 0;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
static int init(struct ao *ao, char *params)
|
2013-04-05 21:06:22 +00:00
|
|
|
{
|
2013-07-21 22:03:57 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-07 13:38:08 +00:00
|
|
|
const char **matching_ports = NULL;
|
2013-07-21 22:03:57 +00:00
|
|
|
char *port_name = p->cfg_port && p->cfg_port[0] ? p->cfg_port : NULL;
|
2013-06-07 13:38:08 +00:00
|
|
|
jack_options_t open_options = JackUseExactName;
|
|
|
|
int port_flags = JackPortIsInput;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
struct mp_chmap_sel sel = {0};
|
2013-07-07 16:37:55 +00:00
|
|
|
|
2013-07-21 22:03:57 +00:00
|
|
|
if (p->stdlayout == 0) {
|
2013-07-07 16:37:55 +00:00
|
|
|
mp_chmap_sel_add_waveext(&sel);
|
2013-07-21 22:03:57 +00:00
|
|
|
} else if (p->stdlayout == 1) {
|
|
|
|
mp_chmap_sel_add_alsa_def(&sel);
|
|
|
|
} else {
|
|
|
|
mp_chmap_sel_add_any(&sel);
|
2013-07-07 16:37:55 +00:00
|
|
|
}
|
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
if (!ao_chmap_sel_adjust(ao, &sel, &ao->channels))
|
2013-06-07 13:38:08 +00:00
|
|
|
goto err_out;
|
|
|
|
|
2013-07-21 22:03:57 +00:00
|
|
|
if (!p->autostart)
|
2013-06-07 13:38:08 +00:00
|
|
|
open_options |= JackNoStartServer;
|
2013-07-21 22:03:57 +00:00
|
|
|
p->client = jack_client_open(p->cfg_client_name, open_options, NULL);
|
2013-06-07 14:42:29 +00:00
|
|
|
if (!p->client) {
|
2013-06-07 13:38:08 +00:00
|
|
|
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] cannot open server\n");
|
|
|
|
goto err_out;
|
2013-06-03 17:38:04 +00:00
|
|
|
}
|
2013-06-07 14:42:29 +00:00
|
|
|
jack_set_process_callback(p->client, outputaudio, ao);
|
2013-06-07 13:38:08 +00:00
|
|
|
|
|
|
|
// list matching ports if connections should be made
|
2013-07-21 22:03:57 +00:00
|
|
|
if (p->connect) {
|
2013-06-07 13:38:08 +00:00
|
|
|
if (!port_name)
|
|
|
|
port_flags |= JackPortIsPhysical;
|
2013-06-07 14:42:29 +00:00
|
|
|
matching_ports = jack_get_ports(p->client, port_name, NULL, port_flags);
|
2013-06-07 13:38:08 +00:00
|
|
|
if (!matching_ports || !matching_ports[0]) {
|
|
|
|
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");
|
|
|
|
goto err_out;
|
|
|
|
}
|
|
|
|
i = 1;
|
2013-06-07 14:42:29 +00:00
|
|
|
p->num_ports = ao->channels.num;
|
2013-06-07 13:38:08 +00:00
|
|
|
while (matching_ports[i])
|
|
|
|
i++;
|
2013-06-07 14:42:29 +00:00
|
|
|
if (p->num_ports > i)
|
|
|
|
p->num_ports = i;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2013-06-07 13:38:08 +00:00
|
|
|
|
|
|
|
// create out output ports
|
2013-06-07 14:42:29 +00:00
|
|
|
for (i = 0; i < p->num_ports; i++) {
|
2013-06-07 13:38:08 +00:00
|
|
|
char pname[30];
|
|
|
|
snprintf(pname, 30, "out_%d", i);
|
2013-06-07 14:42:29 +00:00
|
|
|
p->ports[i] =
|
|
|
|
jack_port_register(p->client, pname, JACK_DEFAULT_AUDIO_TYPE,
|
|
|
|
JackPortIsOutput, 0);
|
|
|
|
if (!p->ports[i]) {
|
2013-06-07 13:38:08 +00:00
|
|
|
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] not enough ports available\n");
|
|
|
|
goto err_out;
|
|
|
|
}
|
|
|
|
}
|
2013-06-07 14:42:29 +00:00
|
|
|
if (jack_activate(p->client)) {
|
2013-06-07 13:38:08 +00:00
|
|
|
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] activate failed\n");
|
|
|
|
goto err_out;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2013-06-07 14:42:29 +00:00
|
|
|
for (i = 0; i < p->num_ports; i++) {
|
|
|
|
if (jack_connect(p->client, jack_port_name(p->ports[i]),
|
|
|
|
matching_ports[i]))
|
|
|
|
{
|
2013-06-07 13:38:08 +00:00
|
|
|
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] connecting failed\n");
|
|
|
|
goto err_out;
|
|
|
|
}
|
|
|
|
}
|
2013-06-07 14:42:29 +00:00
|
|
|
ao->samplerate = jack_get_sample_rate(p->client);
|
2013-06-07 13:38:08 +00:00
|
|
|
jack_latency_range_t jack_latency_range;
|
2013-06-07 14:42:29 +00:00
|
|
|
jack_port_get_latency_range(p->ports[0], JackPlaybackLatency,
|
2013-06-07 13:38:08 +00:00
|
|
|
&jack_latency_range);
|
2013-06-07 14:42:29 +00:00
|
|
|
p->jack_latency = (float)(jack_latency_range.max + jack_get_buffer_size(p->client))
|
|
|
|
/ (float)ao->samplerate;
|
|
|
|
p->callback_interval = 0;
|
2013-06-07 13:38:08 +00:00
|
|
|
|
2013-06-07 14:42:29 +00:00
|
|
|
if (!ao_chmap_sel_get_def(ao, &sel, &ao->channels, p->num_ports))
|
2013-06-07 13:38:08 +00:00
|
|
|
goto err_out;
|
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
ao->format = AF_FORMAT_FLOAT_NE;
|
2013-06-07 13:58:28 +00:00
|
|
|
int unitsize = ao->channels.num * sizeof(float);
|
2013-07-06 11:11:22 +00:00
|
|
|
p->outburst = (CHUNK_SIZE + unitsize - 1) / unitsize * unitsize;
|
2013-06-16 17:15:32 +00:00
|
|
|
p->ring = mp_ring_new(p, NUM_CHUNKS * p->outburst);
|
2013-06-07 13:38:08 +00:00
|
|
|
free(matching_ports);
|
2013-06-07 13:44:49 +00:00
|
|
|
return 0;
|
2005-06-01 09:20:46 +00:00
|
|
|
|
|
|
|
err_out:
|
2013-06-07 13:38:08 +00:00
|
|
|
free(matching_ports);
|
2013-06-07 14:42:29 +00:00
|
|
|
if (p->client)
|
|
|
|
jack_client_close(p->client);
|
2013-06-07 13:44:49 +00:00
|
|
|
return -1;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
static float get_delay(struct ao *ao)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-15 21:58:26 +00:00
|
|
|
int buffered = mp_ring_buffered(p->ring); // could be less
|
2013-06-07 14:42:29 +00:00
|
|
|
float in_jack = p->jack_latency;
|
|
|
|
if (p->estimate && p->callback_interval > 0) {
|
|
|
|
float elapsed = mp_time_us() / 1000000.0 - p->callback_time;
|
|
|
|
in_jack += p->callback_interval - elapsed;
|
2013-06-07 13:44:49 +00:00
|
|
|
if (in_jack < 0)
|
|
|
|
in_jack = 0;
|
|
|
|
}
|
|
|
|
return (float)buffered / (float)ao->bps + in_jack;
|
2004-06-25 18:11:15 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief stop playing and empty buffers (for seeking/pause)
|
|
|
|
*/
|
2013-06-07 13:44:49 +00:00
|
|
|
static void reset(struct ao *ao)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
|
|
|
p->paused = 1;
|
2013-06-15 21:58:26 +00:00
|
|
|
mp_ring_reset(p->ring);
|
2013-06-07 14:42:29 +00:00
|
|
|
p->paused = 0;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
// close audio device
|
|
|
|
static void uninit(struct ao *ao, bool immed)
|
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-07 13:44:49 +00:00
|
|
|
if (!immed)
|
|
|
|
mp_sleep_us(get_delay(ao) * 1000 * 1000);
|
|
|
|
// HACK, make sure jack doesn't loop-output dirty buffers
|
|
|
|
reset(ao);
|
|
|
|
mp_sleep_us(100 * 1000);
|
2013-06-07 14:42:29 +00:00
|
|
|
jack_client_close(p->client);
|
2013-06-07 13:44:49 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief stop playing, keep buffers (for pause)
|
|
|
|
*/
|
2013-06-07 13:44:49 +00:00
|
|
|
static void audio_pause(struct ao *ao)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
|
|
|
p->paused = 1;
|
2004-06-25 18:11:15 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief resume playing, after audio_pause()
|
|
|
|
*/
|
2013-06-07 13:44:49 +00:00
|
|
|
static void audio_resume(struct ao *ao)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
|
|
|
p->paused = 0;
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
static int get_space(struct ao *ao)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-15 21:58:26 +00:00
|
|
|
return mp_ring_available(p->ring);
|
2004-06-25 18:11:15 +00:00
|
|
|
}
|
|
|
|
|
2005-06-01 09:20:46 +00:00
|
|
|
/**
|
|
|
|
* \brief write data into buffer and reset underrun flag
|
|
|
|
*/
|
2013-06-07 13:44:49 +00:00
|
|
|
static int play(struct ao *ao, void *data, int len, int flags)
|
2013-06-07 13:38:08 +00:00
|
|
|
{
|
2013-06-07 14:42:29 +00:00
|
|
|
struct priv *p = ao->priv;
|
2013-06-07 13:38:08 +00:00
|
|
|
if (!(flags & AOPLAY_FINAL_CHUNK))
|
2013-06-16 17:15:32 +00:00
|
|
|
len -= len % p->outburst;
|
2013-06-07 14:42:29 +00:00
|
|
|
p->underrun = 0;
|
2013-06-15 21:58:26 +00:00
|
|
|
return mp_ring_write(p->ring, data, len);
|
2005-06-01 09:20:46 +00:00
|
|
|
}
|
2004-06-25 18:11:15 +00:00
|
|
|
|
2013-07-21 22:03:57 +00:00
|
|
|
#define OPT_BASE_STRUCT struct priv
|
|
|
|
|
2013-06-07 13:44:49 +00:00
|
|
|
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"
|
|
|
|
},
|
|
|
|
.init = init,
|
|
|
|
.uninit = uninit,
|
|
|
|
.get_space = get_space,
|
|
|
|
.play = play,
|
|
|
|
.get_delay = get_delay,
|
|
|
|
.pause = audio_pause,
|
|
|
|
.resume = audio_resume,
|
|
|
|
.reset = reset,
|
2013-07-21 22:03:57 +00:00
|
|
|
.priv_size = sizeof(struct priv),
|
|
|
|
.priv_defaults = &(const struct priv) {
|
|
|
|
.cfg_client_name = "mpv",
|
|
|
|
.estimate = 1,
|
|
|
|
.connect = 1,
|
|
|
|
},
|
|
|
|
.options = (const struct m_option[]) {
|
|
|
|
OPT_STRING("port", cfg_port, 0),
|
|
|
|
OPT_STRING("name", cfg_client_name, 0),
|
|
|
|
OPT_FLAG("estimate", estimate, 0),
|
|
|
|
OPT_FLAG("autostart", autostart, 0),
|
|
|
|
OPT_FLAG("connect", connect, 0),
|
|
|
|
OPT_CHOICE("std-channel-layout", stdlayout, 0,
|
|
|
|
({"waveext", 0}, {"alsa", 1}, {"any", 2})),
|
|
|
|
{0}
|
|
|
|
},
|
2013-06-07 13:44:49 +00:00
|
|
|
};
|