xine-lib 1.2.13-20230125hg15249
Data Structures | Macros | Typedefs | Functions | Variables
audio_alsa_out.c File Reference
#include <stdio.h>
#include <stdarg.h>
#include <errno.h>
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <fcntl.h>
#include <math.h>
#include <alsa/asoundlib.h>
#include <sys/ioctl.h>
#include <inttypes.h>
#include <pthread.h>
#include <xine/xine_internal.h>
#include <xine/xineutils.h>
#include <xine/compat.h>
#include <xine/audio_out.h>
#include "speakers.h"

Data Structures

struct  alsa_class_t
 
struct  alsa_driver_s
 
struct  alsa_driver_s::_alsa_dev_info_s
 

Macros

#define ALSA_PCM_NEW_HW_PARAMS_API
 
#define ALSA_PCM_NEW_SW_PARAMS_API
 
#define AO_OUT_ALSA_IFACE_VERSION   9
 
#define BUFFER_TIME   1000*1000
 
#define GAP_TOLERANCE   5000
 
#define MIXER_MASK_LEFT   0x0001
 
#define MIXER_MASK_RIGHT   0x0002
 
#define MIXER_MASK_MUTE   0x0004
 
#define MIXER_MASK_STEREO   0x0008
 
#define MIXER_HAS_MUTE_SWITCH   0x0010
 

Typedefs

typedef struct alsa_driver_s alsa_driver_t
 

Functions

static int ao_alsa_get_percent_from_volume (long val, long min, long max)
 
static int my_snd_mixer_wait (snd_mixer_t *mixer, int timeout)
 
static void * ao_alsa_handle_event_thread (void *data)
 
static long ao_alsa_get_volume_from_percent (int val, long min, long max)
 
static void error_callback (const char *file, int line, const char *function, int err, const char *fmt,...)
 
static int ao_alsa_open (ao_driver_t *this_gen, uint32_t bits, uint32_t rate, int mode)
 
static int ao_alsa_num_channels (ao_driver_t *this_gen)
 
static int ao_alsa_bytes_per_frame (ao_driver_t *this_gen)
 
static int ao_alsa_get_gap_tolerance (ao_driver_t *this_gen)
 
static int ao_alsa_delay (ao_driver_t *this_gen)
 
static int resume (snd_pcm_t *pcm)
 
static int ao_alsa_write (ao_driver_t *this_gen, int16_t *data, uint32_t count)
 
static void ao_alsa_close (ao_driver_t *this_gen)
 
static uint32_t ao_alsa_get_capabilities (ao_driver_t *this_gen)
 
static void ao_alsa_exit (ao_driver_t *this_gen)
 
static int ao_alsa_get_property (ao_driver_t *this_gen, int property)
 
static int ao_alsa_set_property (ao_driver_t *this_gen, int property, int value)
 
static int ao_alsa_ctrl (ao_driver_t *this_gen, int cmd,...)
 
static void ao_alsa_mixer_init (ao_driver_t *this_gen)
 
static void alsa_apply_speaker_arrangement (alsa_driver_t *this, int speakers)
 
static void _alsa_mmap_cb (void *user_data, xine_cfg_entry_t *entry)
 
static void _alsa_speaker_arrangement_cb (void *user_data, xine_cfg_entry_t *entry)
 
static char * _alsa_safe_strdup (const char *s)
 
static void _alsa_dev_name_cb (void *user_data, xine_cfg_entry_t *entry)
 
static int _alsa_query_dev (alsa_driver_t *this, uint32_t index)
 
static ao_driver_topen_plugin (audio_driver_class_t *class_gen, const void *data)
 
static void * init_class (xine_t *xine, const void *data)
 

Variables

static snd_output_t * jcd_out
 
static ao_info_t ao_info_alsa
 
const plugin_info_t xine_plugin_info[] EXPORTED
 

Macro Definition Documentation

◆ ALSA_PCM_NEW_HW_PARAMS_API

#define ALSA_PCM_NEW_HW_PARAMS_API

◆ ALSA_PCM_NEW_SW_PARAMS_API

#define ALSA_PCM_NEW_SW_PARAMS_API

◆ AO_OUT_ALSA_IFACE_VERSION

#define AO_OUT_ALSA_IFACE_VERSION   9

◆ BUFFER_TIME

#define BUFFER_TIME   1000*1000

Referenced by ao_alsa_open().

◆ GAP_TOLERANCE

#define GAP_TOLERANCE   5000

◆ MIXER_HAS_MUTE_SWITCH

#define MIXER_HAS_MUTE_SWITCH   0x0010

◆ MIXER_MASK_LEFT

#define MIXER_MASK_LEFT   0x0001

◆ MIXER_MASK_MUTE

#define MIXER_MASK_MUTE   0x0004

◆ MIXER_MASK_RIGHT

#define MIXER_MASK_RIGHT   0x0002

◆ MIXER_MASK_STEREO

#define MIXER_MASK_STEREO   0x0008

Typedef Documentation

◆ alsa_driver_t

typedef struct alsa_driver_s alsa_driver_t

Function Documentation

◆ _alsa_dev_name_cb()

static void _alsa_dev_name_cb ( void * user_data,
xine_cfg_entry_t * entry )
static

◆ _alsa_mmap_cb()

static void _alsa_mmap_cb ( void * user_data,
xine_cfg_entry_t * entry )
static

References xine_cfg_entry_s::num_value, and user_data().

Referenced by open_plugin().

◆ _alsa_query_dev()

static int _alsa_query_dev ( alsa_driver_t * this,
uint32_t index )
static

◆ _alsa_safe_strdup()

static char * _alsa_safe_strdup ( const char * s)
static

References NULL.

Referenced by _alsa_dev_name_cb(), and open_plugin().

◆ _alsa_speaker_arrangement_cb()

static void _alsa_speaker_arrangement_cb ( void * user_data,
xine_cfg_entry_t * entry )
static

◆ alsa_apply_speaker_arrangement()

static void alsa_apply_speaker_arrangement ( alsa_driver_t * this,
int speakers )
static

◆ ao_alsa_bytes_per_frame()

static int ao_alsa_bytes_per_frame ( ao_driver_t * this_gen)
static

Referenced by open_plugin().

◆ ao_alsa_close()

static void ao_alsa_close ( ao_driver_t * this_gen)
static

References NULL.

Referenced by open_plugin().

◆ ao_alsa_ctrl()

static int ao_alsa_ctrl ( ao_driver_t * this_gen,
int cmd,
... )
static

◆ ao_alsa_delay()

static int ao_alsa_delay ( ao_driver_t * this_gen)
static

References now().

Referenced by open_plugin().

◆ ao_alsa_exit()

static void ao_alsa_exit ( ao_driver_t * this_gen)
static

References _x_freep(), name, NULL, and xine_config_free_string().

Referenced by open_plugin().

◆ ao_alsa_get_capabilities()

static uint32_t ao_alsa_get_capabilities ( ao_driver_t * this_gen)
static

Referenced by open_plugin().

◆ ao_alsa_get_gap_tolerance()

static int ao_alsa_get_gap_tolerance ( ao_driver_t * this_gen)
static

References GAP_TOLERANCE.

Referenced by open_plugin().

◆ ao_alsa_get_percent_from_volume()

static int ao_alsa_get_percent_from_volume ( long val,
long min,
long max )
static

◆ ao_alsa_get_property()

static int ao_alsa_get_property ( ao_driver_t * this_gen,
int property )
static

◆ ao_alsa_get_volume_from_percent()

static long ao_alsa_get_volume_from_percent ( int val,
long min,
long max )
static

Referenced by ao_alsa_set_property().

◆ ao_alsa_handle_event_thread()

static void * ao_alsa_handle_event_thread ( void * data)
static

◆ ao_alsa_mixer_init()

static void ao_alsa_mixer_init ( ao_driver_t * this_gen)
static

◆ ao_alsa_num_channels()

static int ao_alsa_num_channels ( ao_driver_t * this_gen)
static

Referenced by open_plugin().

◆ ao_alsa_open()

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

◆ ao_alsa_set_property()

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

◆ ao_alsa_write()

static int ao_alsa_write ( ao_driver_t * this_gen,
int16_t * data,
uint32_t count )
static

References jcd_out, now(), resume(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

◆ error_callback()

static void error_callback ( const char * file,
int line,
const char * function,
int err,
const char * fmt,
... )
static

References function, and NULL.

Referenced by open_plugin().

◆ init_class()

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

◆ my_snd_mixer_wait()

static int my_snd_mixer_wait ( snd_mixer_t * mixer,
int timeout )
static

References NULL.

Referenced by ao_alsa_handle_event_thread().

◆ open_plugin()

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

◆ resume()

static int resume ( snd_pcm_t * pcm)
static

Referenced by ao_alsa_write().

Variable Documentation

◆ ao_info_alsa

ao_info_t ao_info_alsa
static
Initial value:
= {
.priority = 10,
}

◆ 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_alsa_out.c:1913
static ao_info_t ao_info_alsa
Definition audio_alsa_out.c:1931
#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

◆ jcd_out

snd_output_t* jcd_out
static

Referenced by ao_alsa_open(), and ao_alsa_write().