xine-lib 1.2.13-20230125hg15249
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.
 
static void __xine_pa_stream_state_callback (pa_stream *s, void *this_gen)
 Callback function called when the state of the stream is changed.
 
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.
 
static void __xine_pa_stream_notify_callback (pa_stream *s, void *this_gen)
 Callback function called when PA notifies about something.
 
static void __xine_pa_stream_success_callback (pa_stream *s, int success, void *this_gen)
 Callback function called when PA completed an operation.
 
static void __xine_pa_context_success_callback (pa_context *c, int success, void *this_gen)
 Callback function called when PA completed an operation.
 
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.
 
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.
 
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_topen_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

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
cContext which changed status
this_genpulse_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
cContext in which the state of the daemon changes
tSubscription event type
idxIndex of the sink
this_genpulse_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
cContext on which operation has succeeded
nbytesthe number of bytes PA requested
this_genpulse_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
ctxContext which operation has succeeded
infoStructure containing the sink's information
this_genpulse_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
sStream on which the notification happened
this_genpulse_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
sStream on which data is requested
nbytesthe number of bytes PA requested
this_genpulse_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
sStream that changed status
this_genpulse_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
ctxContext which operation has succeeded
nbytesthe number of bytes PA requested
this_genpulse_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

◆ 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

◆ 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

◆ ao_pulse_set_property()

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

◆ 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

◆ 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

◆ open_plugin()

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

◆ wait_for_operation()

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

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_NONE, 0, NULL, 0, NULL, NULL }
}
static void * init_class(xine_t *xine, const void *data)
Definition audio_pulse_out.c:1078
static const ao_info_t ao_info_pulse
Definition audio_pulse_out.c:1098
#define XINE_VERSION_CODE
Definition xine_internal.h:57
NULL
Definition xine_plugin.c:78
#define PLUGIN_NONE
Definition xine_plugin.h:29
#define PLUGIN_AUDIO_OUT
Definition xine_plugin.h:35