xine-lib: xine-lib-1.2.12/src/audio_out/audio_pulse_out.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
audio_pulse_out.c File Reference
`#include <stdio.h>`
`#include <errno.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <fcntl.h>`
`#include <math.h>`
`#include <unistd.h>`
`#include <inttypes.h>`
`#include <pthread.h>`
`#include <pulse/pulseaudio.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/audio_out.h>`
`#include "bswap.h"`

## Data Structures
struct | pulse_class_t
struct | pulse_driver_s

## Macros
#define | GAP_TOLERANCE AO_MAX_GAP

## Typedefs
typedef struct pulse_driver_s | pulse_driver_t

## Functions
static void | __xine_pa_context_state_callback (pa_context *c, void *this_gen)
| Callback function called when the state of the context is changed. More...
static void | __xine_pa_stream_state_callback (pa_stream *s, void *this_gen)
| Callback function called when the state of the stream is changed. More...
static void | __xine_pa_stream_request_callback (pa_stream *s, size_t nbytes, void *this_gen)
| Callback function called when PA asks for more audio data. More...
static void | __xine_pa_stream_notify_callback (pa_stream *s, void *this_gen)
| Callback function called when PA notifies about something. More...
static void | __xine_pa_stream_success_callback (pa_stream *s, int success, void *this_gen)
| Callback function called when PA completed an operation. More...
static void | __xine_pa_context_success_callback (pa_context *c, int success, void *this_gen)
| Callback function called when PA completed an operation. More...
static void | __xine_pa_sink_info_callback (pa_context *c, const pa_sink_input_info *info, int is_last, void *userdata)
| Callback function called when the information on the context's sink is retrieved. More...
static void | __xine_pa_context_subscribe_callback (pa_context *c, pa_subscription_event_type_t t, uint32_t idx, void *this_gen)
| Callback function called when the state of the daemon changes. More...
static int | connect_context (pulse_driver_t *this)
static int | ao_pulse_open (ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode)
static int | ao_pulse_num_channels (ao_driver_t *this_gen)
static int | ao_pulse_bytes_per_frame (ao_driver_t *this_gen)
static int | ao_pulse_get_gap_tolerance (ao_driver_t *this_gen)
static int | ao_pulse_write (ao_driver_t *this_gen, int16_t *data, uint32_t num_frames)
static int | ao_pulse_delay (ao_driver_t *this_gen)
static void | ao_pulse_close (ao_driver_t *this_gen)
static uint32_t | ao_pulse_get_capabilities (ao_driver_t *this_gen)
static void | ao_pulse_exit (ao_driver_t *this_gen)
static int | wait_for_operation (pulse_driver_t *this, pa_operation *o)
static int | ao_pulse_get_property (ao_driver_t *this_gen, int property)
static int | ao_pulse_set_property (ao_driver_t *this_gen, int property, int value)
static int | ao_pulse_ctrl (ao_driver_t *this_gen, int cmd,...)
static ao_driver_t * | open_plugin (audio_driver_class_t *class_gen, const void *data)
static void | dispose_class (audio_driver_class_t *this_gen)
static void * | init_class (xine_t *xine, const void *data)

## Variables
static const ao_info_t | ao_info_pulse
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ GAP_TOLERANCE

#define GAP_TOLERANCE AO_MAX_GAP

## Typedef Documentation

## ◆ pulse_driver_t

typedef struct pulse_driver_s pulse_driver_t

## Function Documentation

## ◆ __xine_pa_context_state_callback()

static void __xine_pa_context_state_callback | ( | pa_context * | c,
|  | void * | this_gen
| ) |  |
| static

Callback function called when the state of the context is changed.

Parameters

  c | Context which changed status
  this_gen | pulse_class_t pointer for the PulseAudio output class

Referenced by connect_context().

## ◆ __xine_pa_context_subscribe_callback()

static void __xine_pa_context_subscribe_callback | ( | pa_context * | c,
|  | pa_subscription_event_type_t | t,
|  | uint32_t | idx,
|  | void * | this_gen
| ) |  |
| static

Callback function called when the state of the daemon changes.

Parameters

  c | Context in which the state of the daemon changes
  t | Subscription event type
  idx | Index of the sink
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

References __xine_pa_sink_info_callback(), NULL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by connect_context().

## ◆ __xine_pa_context_success_callback()

static void __xine_pa_context_success_callback | ( | pa_context * | c,
|  | int | success,
|  | void * | this_gen
| ) |  |
| static

Callback function called when PA completed an operation.

Parameters

  c | Context on which operation has succeeded
  nbytes | the number of bytes PA requested
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

References XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_pulse_set_property(), and connect_context().

## ◆ __xine_pa_sink_info_callback()

static void __xine_pa_sink_info_callback | ( | pa_context * | c,
|  | const pa_sink_input_info * | info,
|  | int | is_last,
|  | void * | userdata
| ) |  |
| static

Callback function called when the information on the context's sink is retrieved.

Parameters

  ctx | Context which operation has succeeded
  info | Structure containing the sink's information
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

This function saves the volume field of the passed structure to the `cvolume` variable of the output instance and send an update volume event to the frontend.

References xine_audio_level_data_t::left, xine_audio_level_data_t::mute, NULL, xine_audio_level_data_t::right, XINE_EVENT_AUDIO_LEVEL, xine_event_send(), xine_list_next_value(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by __xine_pa_context_subscribe_callback(), ao_pulse_get_property(), ao_pulse_open(), and ao_pulse_set_property().

## ◆ __xine_pa_stream_notify_callback()

static void __xine_pa_stream_notify_callback | ( | pa_stream * | s,
|  | void * | this_gen
| ) |  |
| static

Callback function called when PA notifies about something.

Parameters

  s | Stream on which the notification happened
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

Referenced by ao_pulse_open().

## ◆ __xine_pa_stream_request_callback()

static void __xine_pa_stream_request_callback | ( | pa_stream * | s,
|  | size_t | nbytes,
|  | void * | this_gen
| ) |  |
| static

Callback function called when PA asks for more audio data.

Parameters

  s | Stream on which data is requested
  nbytes | the number of bytes PA requested
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

Referenced by ao_pulse_open().

## ◆ __xine_pa_stream_state_callback()

static void __xine_pa_stream_state_callback | ( | pa_stream * | s,
|  | void * | this_gen
| ) |  |
| static

Callback function called when the state of the stream is changed.

Parameters

  s | Stream that changed status
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

Referenced by ao_pulse_open().

## ◆ __xine_pa_stream_success_callback()

static void __xine_pa_stream_success_callback | ( | pa_stream * | s,
|  | int | success,
|  | void * | this_gen
| ) |  |
| static

Callback function called when PA completed an operation.

Parameters

  ctx | Context which operation has succeeded
  nbytes | the number of bytes PA requested
  this_gen | pulse_driver_t pointer for the PulseAudio output instance.

References XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_pulse_ctrl().

## ◆ ao_pulse_bytes_per_frame()

static int ao_pulse_bytes_per_frame | ( | ao_driver_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ ao_pulse_close()

static void ao_pulse_close | ( | ao_driver_t * | this_gen | ) |
| static

References NULL.

Referenced by ao_pulse_exit(), and open_plugin().

## ◆ ao_pulse_ctrl()

static int ao_pulse_ctrl | ( | ao_driver_t * | this_gen,
|  | int | cmd,
|  |  | ...
| ) |  |
| static

References __xine_pa_stream_success_callback(), AO_CTRL_FLUSH_BUFFERS, AO_CTRL_PLAY_PAUSE, AO_CTRL_PLAY_RESUME, NULL, and wait_for_operation().

Referenced by open_plugin().

## ◆ ao_pulse_delay()

static int ao_pulse_delay | ( | ao_driver_t * | this_gen | ) |
| static

References NULL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ ao_pulse_exit()

static void ao_pulse_exit | ( | ao_driver_t * | this_gen | ) |
| static

References ao_pulse_close().

Referenced by open_plugin().

## ◆ ao_pulse_get_capabilities()

static uint32_t ao_pulse_get_capabilities | ( | ao_driver_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ ao_pulse_get_gap_tolerance()

static int ao_pulse_get_gap_tolerance | ( | ao_driver_t * | this_gen | ) |
| static

References GAP_TOLERANCE.

Referenced by open_plugin().

## ◆ ao_pulse_get_property()

static int ao_pulse_get_property | ( | ao_driver_t * | this_gen,
|  | int | property
| ) |  |
| static

References __xine_pa_sink_info_callback(), AO_PROP_MIXER_VOL, AO_PROP_MUTE_VOL, AO_PROP_PCM_VOL, NULL, and wait_for_operation().

Referenced by open_plugin().

## ◆ ao_pulse_num_channels()

static int ao_pulse_num_channels | ( | ao_driver_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ ao_pulse_open()

static int ao_pulse_open | ( | ao_driver_t * | this_gen,
|  | uint32_t | bits,
|  | uint32_t | rate,
|  | int | mode
| ) |  |
| static

References __xine_pa_sink_info_callback(), __xine_pa_stream_notify_callback(), __xine_pa_stream_request_callback(), __xine_pa_stream_state_callback(), _x_ao_mode2channels(), _x_assert, AO_CAP_MODE_4_1CHANNEL, AO_CAP_MODE_4CHANNEL, AO_CAP_MODE_5_1CHANNEL, AO_CAP_MODE_5CHANNEL, AO_CAP_MODE_A52, AO_CAP_MODE_AC5, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, AO_PROP_MIXER_VOL, bits, ao_driver_s::close, connect_context(), config_values_s::lookup_entry, mode(), NULL, cfg_entry_s::num_value, ss, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ ao_pulse_set_property()

static int ao_pulse_set_property | ( | ao_driver_t * | this_gen,
|  | int | property,
|  | int | value
| ) |  |
| static

References __xine_pa_context_success_callback(), __xine_pa_sink_info_callback(), AO_PROP_MIXER_VOL, AO_PROP_MUTE_VOL, AO_PROP_PCM_VOL, NULL, and wait_for_operation().

Referenced by open_plugin().

## ◆ ao_pulse_write()

static int ao_pulse_write | ( | ao_driver_t * | this_gen,
|  | int16_t * | data,
|  | uint32_t | num_frames
| ) |  |
| static

References NULL.

Referenced by open_plugin().

## ◆ connect_context()

static int connect_context | ( | pulse_driver_t * | this | ) |
| static

References __xine_pa_context_state_callback(), __xine_pa_context_subscribe_callback(), __xine_pa_context_success_callback(), NULL, XINE_PATH_MAX, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_pulse_open(), and open_plugin().

## ◆ dispose_class()

static void dispose_class | ( | audio_driver_class_t * | this_gen | ) |
| static

Referenced by init_class().

## ◆ init_class()

static void * init_class | ( | xine_t * | xine,
|  | const void * | data
| ) |  |
| static

References audio_driver_class_s::description, audio_driver_class_s::dispose, dispose_class(), pulse_class_t::driver_class, audio_driver_class_s::identifier, lprintf, N_, NULL, open_plugin(), audio_driver_class_s::open_plugin, and pulse_class_t::xine.

## ◆ open_plugin()

static ao_driver_t * open_plugin | ( | audio_driver_class_t * | class_gen,
|  | const void * | data
| ) |  |
| static

References _, _x_assert, AO_CAP_16BITS, AO_CAP_8BITS, AO_CAP_FLOAT32, AO_CAP_MIXER_VOL, AO_CAP_MODE_4_1CHANNEL, AO_CAP_MODE_4CHANNEL, AO_CAP_MODE_5_1CHANNEL, AO_CAP_MODE_5CHANNEL, AO_CAP_MODE_A52, AO_CAP_MODE_AC5, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, AO_CAP_MUTE_VOL, AO_CAP_PCM_VOL, ao_pulse_bytes_per_frame(), ao_pulse_close(), ao_pulse_ctrl(), ao_pulse_delay(), ao_pulse_exit(), ao_pulse_get_capabilities(), ao_pulse_get_gap_tolerance(), ao_pulse_get_property(), ao_pulse_num_channels(), ao_pulse_open(), ao_pulse_set_property(), ao_pulse_write(), connect_context(), lprintf, NULL, pulse_class_t::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by init_class().

## ◆ wait_for_operation()

static int wait_for_operation | ( | pulse_driver_t * | this,
|  | pa_operation * | o
| ) |  |
| static

Referenced by ao_pulse_ctrl(), ao_pulse_get_property(), and ao_pulse_set_property().

## Variable Documentation

## ◆ ao_info_pulse

const ao_info_t ao_info_pulse
| static

Initial value:
= {
.priority = 12,
}

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_AUDIO_OUT, 9, "pulseaudio", XINE_VERSION_CODE, &ao_info_pulse, init_class },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
init_class
static void * init_class(xine_t *xine, const void *data)
Definition: audio_pulse_out.c:1078
ao_info_pulse
static const ao_info_t ao_info_pulse
Definition: audio_pulse_out.c:1098
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition: xine_internal.h:57
NULL
NULL
Definition: xine_plugin.c:78
PLUGIN_NONE
#define PLUGIN_NONE
Definition: xine_plugin.h:29
PLUGIN_AUDIO_OUT
#define PLUGIN_AUDIO_OUT
Definition: xine_plugin.h:35