xine-lib: xine-lib-1.2.13/src/xine-engine/audio_out.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Functions | Variables
audio_out.c File Reference

xine-lib audio output implementation More...

`#include <stdio.h>`
`#include <errno.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <fcntl.h>`
`#include <math.h>`
`#include <unistd.h>`
`#include <pthread.h>`
`#include <inttypes.h>`
`#include <sys/time.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/audio_out.h>`
`#include <xine/resample.h>`
`#include <xine/metronom.h>`
`#include "xine_private.h"`

## Data Structures
struct | resample_sync_t
struct | sIIRCoefficients
struct | audio_fifo_s
struct | aos_t

## Macros
#define | XINE_ENABLE_EXPERIMENTAL_FEATURES
#define | LOG_MODULE "audio_out"
#define | LOG_VERBOSE
#define | LOG_RESAMPLE_SYNC 0
#define | NUM_AUDIO_BUFFERS 32
#define | AUDIO_BUF_SIZE 32768
#define | SYNC_TIME_INTERVAL (1 * 90000)
#define | SYNC_BUF_INTERVAL NUM_AUDIO_BUFFERS / 2
#define | RESAMPLE_SYNC_WINDOW 50
#define | RESAMPLE_MAX_GAP_DIFF 150
#define | RESAMPLE_REDUCE_GAP_THRESHOLD 200
#define | EQ_BANDS 10
#define | EQ_CHANNELS 8
#define | FP_FRBITS 28
#define | EQ_REAL(x) ((int)((x) * (1 << FP_FRBITS)))
#define | STREAMS_DEFAULT_SIZE 32
#define | _AO_FLAG_PAUSE 1
#define | _AO_FLAG_SILENT_TRICK 2
#define | EI_RING_SIZE 128 /* 2^n please */
#define | GAP_RING_LD 3
#define | GAP_RING_SIZE (1 << GAP_RING_LD)
#define | GAP_RING_MASK (GAP_RING_SIZE - 1)
#define | RESEND_BUF_SIZE (1 << 20)
#define | sat16(v) (((v + 0x8000) & ~0xffff) ? ((v) >> 31) ^ 0x7fff : (v))

## Functions
static void | ao_dbuf_reset (aos_t *this)
static void | ao_dbuf_set_min (aos_t *this, int32_t samples)
static void | ao_dbuf_set_max (aos_t *this, int32_t samples)
static void | ao_gap_ring_reset (aos_t *this)
static int | ao_gap_ring_add (aos_t *this, int gap)
static uint32_t | uint_sqrt (uint32_t v)
static void | ao_eq_update (aos_t *this)
static void | ao_resend_init (aos_t *this)
static int | ao_update_resample_factor (aos_t *this)
static void | ao_driver_lock (aos_t *this)
static void | ao_new_speed_trick (aos_t *this)
static int | ao_driver_lock_2 (aos_t *this)
static void | ao_driver_unlock (aos_t *this)
static void | ao_flush_driver (aos_t *this)
static void | ao_driver_test_intr (aos_t *this)
static int | ao_driver_test_intr_2 (aos_t *this)
static int | ao_set_property (xine_audio_port_t *this_gen, int property, int value)
static void | ao_streams_open (aos_t *this)
static void | ao_streams_close (aos_t *this)
static void | ao_streams_register (aos_t *this, xine_stream_private_t *s)
static int | ao_streams_unregister (aos_t *this, xine_stream_private_t *s)
static void | ao_unref_obsolete (aos_t *this)
static void | ao_force_unref_all (aos_t *this, int lock)
static void | ao_free_fifo_open (aos_t *this)
static void | ao_out_fifo_open (aos_t *this)
static void | ao_free_fifo_close (aos_t *this)
static void | ao_out_fifo_close (aos_t *this)
static void | ao_out_fifo_apply_vpts_step (aos_t *this, int step)
static void | ao_out_fifo_reref_append (aos_t *this, audio_buffer_t *buf, int is_first)
static void | ao_free_fifo_append (aos_t *this, audio_buffer_t *buf)
static audio_buffer_t * | ao_out_fifo_pop_int (aos_t *this)
static void | ao_out_fifo_signal (aos_t *this)
static audio_buffer_t * | ao_out_fifo_get (aos_t *this, audio_buffer_t *buf)
static void | ao_ticket_revoked (void *user_data, int flags)
static audio_buffer_t * | ao_free_fifo_get (aos_t *this)
static void | ao_out_fifo_manual_flush (aos_t *this)
static void | ao_out_fifo_loop_flush (aos_t *this)
static void | ao_resend_store (aos_t *this, audio_buffer_t *buf)
static int | ao_fill_gap (aos_t *this, int64_t pts_len)
static int | ao_resend_fill (aos_t *this, int64_t pts_len, int64_t end_time)
static void | ensure_buffer_size (audio_buffer_t *buf, int bytes_per_frame, int frames)
static audio_buffer_t * | swap_frame_buffers (aos_t *this)
int | _x_ao_mode2channels (int mode)
int | _x_ao_channels2mode (int channels)
static void | audio_filter_compress (aos_t *this, int16_t *mem, int num_frames)
static void | audio_filter_amp (aos_t *this, void *buf, int num_frames)
static void | audio_filter_equalize (aos_t *this, int16_t *data, int num_frames)
static audio_buffer_t * | prepare_samples (aos_t *this, audio_buffer_t *buf)
static int | resample_rate_adjust (aos_t *this, int64_t gap, audio_buffer_t *buf)
static int | ao_change_settings (aos_t *this, xine_stream_t *stream, uint32_t bits, uint32_t rate, int mode)
static void * | ao_loop (void *this_gen)
int | xine_get_next_audio_frame (xine_audio_port_t *this_gen, xine_audio_frame_t *frame)
void | xine_free_audio_frame (xine_audio_port_t *this_gen, xine_audio_frame_t *frame)
static int | ao_open (xine_audio_port_t *this_gen, xine_stream_t *s, uint32_t bits, uint32_t rate, int mode)
static audio_buffer_t * | ao_get_buffer (xine_audio_port_t *this_gen)
static void | ao_put_buffer (xine_audio_port_t *this_gen, audio_buffer_t *buf, xine_stream_t *stream)
static void | ao_close (xine_audio_port_t *this_gen, xine_stream_t *stream)
static void | ao_speed_change_cb (void *this_gen, int new_speed)
static void | ao_exit (xine_audio_port_t *this_gen)
static uint32_t | ao_get_capabilities (xine_audio_port_t *this_gen)
static int | ao_get_property (xine_audio_port_t *this_gen, int property)
static int | ao_control (xine_audio_port_t *this_gen, int cmd,...)
static void | ao_flush (xine_audio_port_t *this_gen)
static int | ao_status (xine_audio_port_t *this_gen, xine_stream_t *stream, uint32_t *bits, uint32_t *rate, int *mode)
static void | ao_update_av_sync_method (void *this_gen, xine_cfg_entry_t *entry)
static void | ao_update_av_fine_sync_method (void *this_gen, xine_cfg_entry_t *entry)
static void | ao_update_ptoffs (void *this_gen, xine_cfg_entry_t *entry)
static void | ao_update_slow_fast (void *this_gen, xine_cfg_entry_t *entry)
xine_audio_port_t * | _x_ao_new_port (xine_t *xine, ao_driver_t *driver, int grab_only)
| Initialise the audio_out sync routines.

## Variables
static const sIIRCoefficients | iir_cf []

## Detailed Description

xine-lib audio output implementation

Date
  2001-08-20 First implementation of Audio sync and Audio driver separation. (c) 2001 James Courtier-Dutton james.nosp@m.@sup.nosp@m.erbug.nosp@m..dem.nosp@m.on.co.nosp@m..uk
  2001-08-22 James imported some useful AC3 sections from the previous ALSA driver. (c) 2001 Andy Lo A Foe andy@.nosp@m.alsa.nosp@m.playe.nosp@m.r.or.nosp@m.g

General Programming Guidelines: - New concept of an "audio_frame". An audio_frame consists of all the samples required to fill every audio channel to a full amount of bits. So, it does not mater how many bits per sample, or how many audio channels are being used, the number of audio_frames is the same. E.g. 16 bit stereo is 4 bytes, but one frame. 16 bit 5.1 surround is 12 bytes, but one frame. The purpose of this is to make the audio_sync code a lot more readable, rather than having to multiply by the amount of channels all the time when dealing with audio_bytes instead of audio_frames.

The number of samples passed to/from the audio driver is also sent in units of audio_frames.

Currently, James has tested with OSS: Standard stereo out, SPDIF PCM, SPDIF AC3 ALSA: Standard stereo out No testing has been done of ALSA SPDIF AC3 or any 4,5,5.1 channel output. Currently, I don't think resampling functions, as I cannot test it.

equalizer based on

PCM time-domain equalizer

Copyright (C) 2002 Felipe Rivera <liebremx at users sourceforge net>

heavily modified by guenter bartsch 2003 for use in libxine

## Macro Definition Documentation

## ◆ _AO_FLAG_PAUSE

#define _AO_FLAG_PAUSE 1

Referenced by ao_loop(), and ao_new_speed_trick().

## ◆ _AO_FLAG_SILENT_TRICK

#define _AO_FLAG_SILENT_TRICK 2

Referenced by ao_loop(), and ao_new_speed_trick().

## ◆ AUDIO_BUF_SIZE

#define AUDIO_BUF_SIZE 32768

Referenced by _x_ao_new_port(), and ao_fill_gap().

## ◆ EI_RING_SIZE

#define EI_RING_SIZE 128 /* 2^n please */

Referenced by _x_ao_new_port(), and ao_loop().

## ◆ EQ_BANDS

#define EQ_BANDS 10

Referenced by ao_eq_update(), and audio_filter_equalize().

## ◆ EQ_CHANNELS

#define EQ_CHANNELS 8

## ◆ EQ_REAL

#define EQ_REAL | ( |  | x | ) | ((int)((x) * (1 << FP_FRBITS)))

Referenced by ao_eq_update().

## ◆ FP_FRBITS

#define FP_FRBITS 28

Referenced by audio_filter_equalize().

## ◆ GAP_RING_LD

#define GAP_RING_LD 3

Referenced by ao_gap_ring_add(), and ao_update_resample_factor().

## ◆ GAP_RING_MASK

#define GAP_RING_MASK (GAP_RING_SIZE - 1)

Referenced by ao_gap_ring_add().

## ◆ GAP_RING_SIZE

#define GAP_RING_SIZE (1 << GAP_RING_LD)

Referenced by ao_gap_ring_reset().

## ◆ LOG_MODULE

#define LOG_MODULE "audio_out"

Referenced by ao_dbuf_set_max().

## ◆ LOG_RESAMPLE_SYNC

#define LOG_RESAMPLE_SYNC 0

Referenced by resample_rate_adjust().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ NUM_AUDIO_BUFFERS

#define NUM_AUDIO_BUFFERS 32

Referenced by _x_ao_new_port(), ao_force_unref_all(), ao_out_fifo_close(), ao_out_fifo_open(), ao_out_fifo_reref_append(), and ao_unref_obsolete().

## ◆ RESAMPLE_MAX_GAP_DIFF

#define RESAMPLE_MAX_GAP_DIFF 150

Referenced by resample_rate_adjust().

## ◆ RESAMPLE_REDUCE_GAP_THRESHOLD

#define RESAMPLE_REDUCE_GAP_THRESHOLD 200

Referenced by resample_rate_adjust().

## ◆ RESAMPLE_SYNC_WINDOW

#define RESAMPLE_SYNC_WINDOW 50

Referenced by resample_rate_adjust().

## ◆ RESEND_BUF_SIZE

#define RESEND_BUF_SIZE (1 << 20)

Referenced by ao_resend_init().

## ◆ sat16

#define sat16 | ( |  | v | ) | (((v + 0x8000) & ~0xffff) ? ((v) >> 31) ^ 0x7fff : (v))

Referenced by audio_filter_equalize().

## ◆ STREAMS_DEFAULT_SIZE

#define STREAMS_DEFAULT_SIZE 32

Referenced by ao_streams_open().

## ◆ SYNC_BUF_INTERVAL

#define SYNC_BUF_INTERVAL NUM_AUDIO_BUFFERS / 2

Referenced by ao_loop().

## ◆ SYNC_TIME_INTERVAL

#define SYNC_TIME_INTERVAL (1 * 90000)

Referenced by ao_loop().

## ◆ XINE_ENABLE_EXPERIMENTAL_FEATURES

#define XINE_ENABLE_EXPERIMENTAL_FEATURES

## Function Documentation

## ◆ _x_ao_channels2mode()

int _x_ao_channels2mode | ( | int | channels | ) |

References AO_CAP_MODE_4CHANNEL, AO_CAP_MODE_5_1CHANNEL, AO_CAP_MODE_5CHANNEL, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, and AO_CAP_NOCAP.

Referenced by dvaudio_decode_data(), flac_decode_data(), lpcm_decode_data(), mpc_decode_data(), nsf_decode_data(), qta_init_driver(), speex_decode_data(), vorbis_decode_data(), w32a_init_audio(), and wavpack_decode_data().

## ◆ _x_ao_mode2channels()

int _x_ao_mode2channels | ( | int | mode | ) |

References AO_CAP_MODE_4_1CHANNEL, AO_CAP_MODE_4CHANNEL, AO_CAP_MODE_5_1CHANNEL, AO_CAP_MODE_5CHANNEL, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, and mode().

Referenced by ao_open(), ao_pulse_open(), ao_update_resample_factor(), fftgraph_port_open(), fftscope_port_open(), fooviz_port_open(), goom_port_open(), oscope_port_open(), stretch_port_put_buffer(), tdaan_port_open(), upmix_mono_port_open(), upmix_port_open(), and vdr_audio_port_open().

## ◆ _x_ao_new_port()

xine_audio_port_t * _x_ao_new_port | ( | xine_t * | xine,
|  | ao_driver_t * | driver,
|  | int | grab_only )

Initialise the audio_out sync routines.

References _, AO_CAP_MIXER_VOL, AO_CAP_PCM_VOL, ao_close(), ao_control(), ao_exit(), ao_flush(), ao_free_fifo_open(), ao_gap_ring_reset(), ao_get_buffer(), ao_get_capabilities(), ao_get_property(), ao_loop(), ao_open(), ao_out_fifo_open(), AO_PROP_MIXER_VOL, AO_PROP_PCM_VOL, ao_put_buffer(), ao_set_property(), ao_speed_change_cb(), ao_status(), ao_streams_open(), ao_ticket_revoked(), ao_update_av_fine_sync_method(), ao_update_av_sync_method(), ao_update_ptoffs(), ao_update_slow_fast(), AUDIO_BUF_SIZE, xine_s::clock, xine_s::config, EI_RING_SIZE, audio_buffer_s::extra_info, ao_driver_s::get_capabilities, ao_driver_s::get_gap_tolerance, audio_buffer_s::mem, audio_buffer_s::mem_size, audio_buffer_s::next, NULL, NUM_AUDIO_BUFFERS, config_values_s::register_bool, config_values_s::register_enum, config_values_s::register_num, config_values_s::register_range, metronom_clock_s::register_speed_change_callback, ao_driver_s::set_property, metronom_clock_s::speed, ao_driver_s::write, xine_free_aligned(), xine_mallocz_aligned(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, XINE_VERBOSITY_NONE, and xprintf.

Referenced by xine_new_framegrab_audio_port(), and xine_open_audio_driver().

## ◆ ao_change_settings()

static int ao_change_settings | ( | aos_t * | this,
|  | xine_stream_t * | stream,
|  | uint32_t | bits,
|  | uint32_t | rate,
|  | int | mode )
| static

References _, AO_CAP_8BITS, AO_CAP_MODE_A52, AO_CAP_MODE_AC5, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, ao_update_resample_factor(), bits, input(), xine_stream_s::metronom, mode(), metronom_s::set_audio_rate, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by ao_loop(), ao_open(), and xine_get_next_audio_frame().

## ◆ ao_close()

static void ao_close | ( | xine_audio_port_t * | this_gen,
|  | xine_stream_t * | stream )
| static

References ao_streams_unregister(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_control()

static int ao_control | ( | xine_audio_port_t * | this_gen,
|  | int | cmd,
|  |  | ... )
| static

References ao_driver_lock(), and ao_driver_unlock().

Referenced by _x_ao_new_port().

## ◆ ao_dbuf_reset()

static void ao_dbuf_reset | ( | aos_t * | this | ) |
| static

References aos_t::dbuf_max.

Referenced by ao_loop(), and ao_open().

## ◆ ao_dbuf_set_max()

static void ao_dbuf_set_max | ( | aos_t * | this,
|  | int32_t | samples )
| static

References LOG_MODULE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_loop().

## ◆ ao_dbuf_set_min()

static void ao_dbuf_set_min | ( | aos_t * | this,
|  | int32_t | samples )
| static

Referenced by ao_loop().

## ◆ ao_driver_lock()

static void ao_driver_lock | ( | aos_t * | this | ) |
| static

Referenced by ao_control(), ao_flush_driver(), ao_get_capabilities(), ao_get_property(), ao_set_property(), and ao_speed_change_cb().

## ◆ ao_driver_lock_2()

static int ao_driver_lock_2 | ( | aos_t * | this | ) |
| inlinestatic

References ao_new_speed_trick().

Referenced by ao_loop().

## ◆ ao_driver_test_intr()

static void ao_driver_test_intr | ( | aos_t * | this | ) |
| static

Referenced by ao_loop().

## ◆ ao_driver_test_intr_2()

static int ao_driver_test_intr_2 | ( | aos_t * | this | ) |
| static

Referenced by ao_fill_gap(), and ao_resend_fill().

## ◆ ao_driver_unlock()

static void ao_driver_unlock | ( | aos_t * | this | ) |
| static

Referenced by ao_control(), ao_flush_driver(), ao_get_capabilities(), ao_get_property(), ao_loop(), ao_set_property(), and ao_speed_change_cb().

## ◆ ao_eq_update()

static void ao_eq_update | ( | aos_t * | this | ) |
| static

References EQ_BANDS, EQ_REAL, and input().

Referenced by ao_set_property(), and ao_update_resample_factor().

## ◆ ao_exit()

static void ao_exit | ( | xine_audio_port_t * | this_gen | ) |
| static

References _x_free_audio_driver(), _x_freep(), AO_CAP_MIXER_VOL, AO_CAP_PCM_VOL, ao_force_unref_all(), ao_free_fifo_close(), ao_out_fifo_close(), AO_PROP_MIXER_VOL, AO_PROP_PCM_VOL, ao_speed_change_cb(), ao_streams_close(), ao_ticket_revoked(), ao_driver_s::close, ao_driver_s::get_capabilities, ao_driver_s::get_property, NULL, ao_driver_s::open, xine_freep_aligned, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_fill_gap()

static int ao_fill_gap | ( | aos_t * | this,
|  | int64_t | pts_len )
| static

References AO_CAP_MODE_A52, AO_CAP_MODE_AC5, ao_driver_test_intr_2(), AUDIO_BUF_SIZE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_loop(), and ao_resend_fill().

## ◆ ao_flush()

static void ao_flush | ( | xine_audio_port_t * | this_gen | ) |
| static

References ao_out_fifo_loop_flush(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_flush_driver()

static void ao_flush_driver | ( | aos_t * | this | ) |
| static

References AO_CTRL_FLUSH_BUFFERS, ao_driver_lock(), ao_driver_unlock(), NULL, XINE_SPEED_PAUSE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_out_fifo_loop_flush(), and ao_set_property().

## ◆ ao_force_unref_all()

static void ao_force_unref_all | ( | aos_t * | this,
|  | int | lock )
| static

References NULL, NUM_AUDIO_BUFFERS, xine_refs_sub(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_exit(), and ao_out_fifo_get().

## ◆ ao_free_fifo_append()

static void ao_free_fifo_append | ( | aos_t * | this,
|  | audio_buffer_t * | buf )
| static

References _x_assert, audio_buffer_s::next, and NULL.

Referenced by ao_loop(), ao_put_buffer(), xine_free_audio_frame(), and xine_get_next_audio_frame().

## ◆ ao_free_fifo_close()

static void ao_free_fifo_close | ( | aos_t * | this | ) |
| static

References NULL.

Referenced by ao_exit().

## ◆ ao_free_fifo_get()

static audio_buffer_t * ao_free_fifo_get | ( | aos_t * | this | ) |
| static

References ao_out_fifo_pop_int(), audio_buffer_s::next, NULL, xine_gettime(), XINE_SPEED_PAUSE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_get_buffer().

## ◆ ao_free_fifo_open()

static void ao_free_fifo_open | ( | aos_t * | this | ) |
| static

References NULL.

Referenced by _x_ao_new_port().

## ◆ ao_gap_ring_add()

static int ao_gap_ring_add | ( | aos_t * | this,
|  | int | gap )
| static

References GAP_RING_LD, and GAP_RING_MASK.

Referenced by ao_loop().

## ◆ ao_gap_ring_reset()

static void ao_gap_ring_reset | ( | aos_t * | this | ) |
| static

References GAP_RING_SIZE.

Referenced by _x_ao_new_port(), and ao_loop().

## ◆ ao_get_buffer()

static audio_buffer_t * ao_get_buffer | ( | xine_audio_port_t * | this_gen | ) |
| static

References _x_extra_info_reset(), ao_free_fifo_get(), audio_buffer_s::extra_info, NULL, and audio_buffer_s::stream.

Referenced by _x_ao_new_port().

## ◆ ao_get_capabilities()

static uint32_t ao_get_capabilities | ( | xine_audio_port_t * | this_gen | ) |
| static

References AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, ao_driver_lock(), and ao_driver_unlock().

Referenced by _x_ao_new_port().

## ◆ ao_get_property()

static int ao_get_property | ( | xine_audio_port_t * | this_gen,
|  | int | property )
| static

References ao_driver_lock(), ao_driver_unlock(), AO_PROP_AMP, AO_PROP_AMP_MUTE, AO_PROP_BUFS_FREE, AO_PROP_BUFS_IN_FIFO, AO_PROP_BUFS_TOTAL, AO_PROP_CLOCK_SPEED, AO_PROP_COMPRESSOR, AO_PROP_DISCARD_BUFFERS, AO_PROP_DRIVER_DELAY, AO_PROP_EQ_1000HZ, AO_PROP_EQ_125HZ, AO_PROP_EQ_16000HZ, AO_PROP_EQ_2000HZ, AO_PROP_EQ_250HZ, AO_PROP_EQ_30HZ, AO_PROP_EQ_4000HZ, AO_PROP_EQ_500HZ, AO_PROP_EQ_60HZ, AO_PROP_EQ_8000HZ, AO_PROP_NUM_STREAMS, AO_PROP_PTS_IN_FIFO, XINE_PARAM_VO_SINGLE_STEP, xine_rwlock_rdlock, and xine_rwlock_unlock.

Referenced by _x_ao_new_port().

## ◆ ao_loop()

static void * ao_loop | ( | void * | this_gen | ) |
| static

References _, _AO_FLAG_PAUSE, _AO_FLAG_SILENT_TRICK, _x_free_audio_driver(), _x_load_audio_output_plugin(), _x_message(), abs, AO_CAP_NO_UNPAUSE, ao_change_settings(), ao_dbuf_reset(), ao_dbuf_set_max(), ao_dbuf_set_min(), ao_driver_lock_2(), ao_driver_test_intr(), ao_driver_unlock(), ao_fill_gap(), ao_free_fifo_append(), ao_gap_ring_add(), ao_gap_ring_reset(), AO_MAX_GAP, ao_out_fifo_apply_vpts_step(), ao_out_fifo_get(), ao_resend_fill(), ao_resend_store(), ao_format_s::bits, EI_RING_SIZE, xine_stream_private_st::emergency_brake, audio_buffer_s::extra_info, xine_stream_private_st::first_frame, xine_stream_private_st::flag, audio_buffer_s::format, input(), extra_info_s::invalid, xine_stream_private_st::lock, lprintf, audio_buffer_s::mem, METRONOM_ADJ_VPTS_OFFSET, ao_format_s::mode, NULL, audio_buffer_s::num_frames, prepare_samples(), ao_format_s::rate, xine_stream_private_st::reached, resample_rate_adjust(), xine_stream_private_st::s, extra_info_s::seek_count, xine_stream_private_st::side_streams, audio_buffer_s::stream, SYNC_BUF_INTERVAL, SYNC_TIME_INTERVAL, xine_stream_private_st::video_decoder_plugin, audio_buffer_s::vpts, extra_info_s::vpts, xine_current_extra_info_set(), XINE_FINE_SPEED_NORMAL, xine_gettime(), XINE_MSG_AUDIO_OUT_UNAVAILABLE, xine_rwlock_rdlock, xine_rwlock_unlock, XINE_SPEED_PAUSE, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_new_speed_trick()

static void ao_new_speed_trick | ( | aos_t * | this | ) |
| static

References _AO_FLAG_PAUSE, _AO_FLAG_SILENT_TRICK, ao_update_resample_factor(), XINE_FINE_SPEED_NORMAL, and XINE_SPEED_PAUSE.

Referenced by ao_driver_lock_2().

## ◆ ao_open()

static int ao_open | ( | xine_audio_port_t * | this_gen,
|  | xine_stream_t * | s,
|  | uint32_t | bits,
|  | uint32_t | rate,
|  | int | mode )
| static

References _x_ao_mode2channels(), _x_message(), ao_change_settings(), ao_dbuf_reset(), ao_out_fifo_loop_flush(), ao_streams_register(), ao_unref_obsolete(), bits, xine_stream_private_st::emergency_brake, xine_stream_private_st::info_lock, mode(), NULL, xine_stream_private_st::s, xine_stream_private_st::side_streams, xine_stream_private_st::stream_info, XINE_MSG_AUDIO_OUT_UNAVAILABLE, xine_rwlock_unlock, xine_rwlock_wrlock, XINE_STREAM_INFO_AUDIO_BITS, XINE_STREAM_INFO_AUDIO_CHANNELS, XINE_STREAM_INFO_AUDIO_MODE, XINE_STREAM_INFO_AUDIO_SAMPLERATE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_out_fifo_apply_vpts_step()

static void ao_out_fifo_apply_vpts_step | ( | aos_t * | this,
|  | int | step )
| static

References audio_buffer_s::next, and audio_buffer_s::vpts.

Referenced by ao_loop().

## ◆ ao_out_fifo_close()

static void ao_out_fifo_close | ( | aos_t * | this | ) |
| static

References NULL, and NUM_AUDIO_BUFFERS.

Referenced by ao_exit().

## ◆ ao_out_fifo_get()

static audio_buffer_t * ao_out_fifo_get | ( | aos_t * | this,
|  | audio_buffer_t * | buf )
| static

References ao_force_unref_all(), xine_stream_private_st::first_frame, xine_stream_private_st::flag, audio_buffer_s::format, xine_stream_private_st::lock, audio_buffer_s::next, NULL, audio_buffer_s::num_frames, ao_format_s::rate, xine_stream_private_st::reached, xine_stream_private_st::side_streams, audio_buffer_s::stream, XINE_FINE_SPEED_NORMAL, xine_gettime(), xine_nbc_event(), XINE_NBC_EVENT_AUDIO_DRY, xine_rwlock_rdlock, xine_rwlock_unlock, xine_uint_mul_div(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_loop().

## ◆ ao_out_fifo_loop_flush()

static void ao_out_fifo_loop_flush | ( | aos_t * | this | ) |
| static

References ao_flush_driver().

Referenced by ao_flush(), and ao_open().

## ◆ ao_out_fifo_manual_flush()

static void ao_out_fifo_manual_flush | ( | aos_t * | this | ) |
| static

References NULL.

Referenced by ao_set_property().

## ◆ ao_out_fifo_open()

static void ao_out_fifo_open | ( | aos_t * | this | ) |
| static

References NULL, and NUM_AUDIO_BUFFERS.

Referenced by _x_ao_new_port().

## ◆ ao_out_fifo_pop_int()

static audio_buffer_t * ao_out_fifo_pop_int | ( | aos_t * | this | ) |
| static

References audio_buffer_s::next, and NULL.

Referenced by ao_free_fifo_get(), and xine_get_next_audio_frame().

## ◆ ao_out_fifo_reref_append()

static void ao_out_fifo_reref_append | ( | aos_t * | this,
|  | audio_buffer_t * | buf,
|  | int | is_first )
| static

References _x_assert, audio_buffer_s::extra_info, audio_buffer_s::format, audio_buffer_s::next, NULL, NUM_AUDIO_BUFFERS, audio_buffer_s::num_frames, PTR_IN_RANGE, ao_format_s::rate, xine_stream_private_st::refs, extra_info_s::seek_count, audio_buffer_s::stream, xine_refs_add(), and xine_refs_sub().

Referenced by ao_put_buffer().

## ◆ ao_out_fifo_signal()

static void ao_out_fifo_signal | ( | aos_t * | this | ) |
| static

Referenced by ao_set_property(), ao_speed_change_cb(), and ao_update_slow_fast().

## ◆ ao_put_buffer()

static void ao_put_buffer | ( | xine_audio_port_t * | this_gen,
|  | audio_buffer_t * | buf,
|  | xine_stream_t * | stream )
| static

References _x_extra_info_merge(), ao_free_fifo_append(), ao_out_fifo_reref_append(), xine_stream_private_st::audio_decoder_extra_info, ao_format_s::bits, audio_buffer_s::extra_info, xine_stream_private_st::first_frame, xine_stream_private_st::flag, audio_buffer_s::format, metronom_s::got_audio_samples, xine_stream_private_st::info_lock, extra_info_s::input_time, xine_stream_private_st::lock, lprintf, xine_stream_s::metronom, ao_format_s::mode, NULL, audio_buffer_s::num_frames, ao_format_s::rate, xine_stream_private_st::reached, xine_stream_private_st::s, extra_info_s::seek_count, xine_stream_private_st::side_streams, audio_buffer_s::stream, xine_stream_private_st::stream_info, xine_stream_private_st::video_decoder_plugin, audio_buffer_s::vpts, extra_info_s::vpts, XINE_ANON_STREAM, xine_current_extra_info_set(), xine_rwlock_rdlock, xine_rwlock_unlock, XINE_STREAM_INFO_AUDIO_BITS, XINE_STREAM_INFO_AUDIO_MODE, XINE_STREAM_INFO_AUDIO_SAMPLERATE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_resend_fill()

static int ao_resend_fill | ( | aos_t * | this,
|  | int64_t | pts_len,
|  | int64_t | end_time )
| static

References ao_driver_test_intr_2(), ao_fill_gap(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_loop().

## ◆ ao_resend_init()

static void ao_resend_init | ( | aos_t * | this | ) |
| static

References AO_CAP_MODE_A52, AO_CAP_MODE_AC5, AO_CAP_NO_UNPAUSE, RESEND_BUF_SIZE, XINE_SPEED_PAUSE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_update_resample_factor().

## ◆ ao_resend_store()

static void ao_resend_store | ( | aos_t * | this,
|  | audio_buffer_t * | buf )
| static

References audio_buffer_s::mem, audio_buffer_s::num_frames, audio_buffer_s::vpts, and xine_fast_memcpy.

Referenced by ao_loop().

## ◆ ao_set_property()

static int ao_set_property | ( | xine_audio_port_t * | this_gen,
|  | int | property,
|  | int | value )
| static

References ao_driver_lock(), ao_driver_unlock(), ao_eq_update(), ao_flush_driver(), ao_out_fifo_manual_flush(), ao_out_fifo_signal(), AO_PROP_AMP, AO_PROP_AMP_MUTE, AO_PROP_CLOCK_SPEED, AO_PROP_CLOSE_DEVICE, AO_PROP_COMPRESSOR, AO_PROP_DISCARD_BUFFERS, AO_PROP_EQ_1000HZ, AO_PROP_EQ_125HZ, AO_PROP_EQ_16000HZ, AO_PROP_EQ_2000HZ, AO_PROP_EQ_250HZ, AO_PROP_EQ_30HZ, AO_PROP_EQ_4000HZ, AO_PROP_EQ_500HZ, AO_PROP_EQ_60HZ, AO_PROP_EQ_8000HZ, AO_PROP_PTS_IN_FIFO, XINE_PARAM_VO_SINGLE_STEP, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port().

## ◆ ao_speed_change_cb()

static void ao_speed_change_cb | ( | void * | this_gen,
|  | int | new_speed )
| static

References AO_CAP_NO_UNPAUSE, AO_CTRL_FLUSH_BUFFERS, AO_CTRL_PLAY_PAUSE, AO_CTRL_PLAY_RESUME, ao_driver_lock(), ao_driver_unlock(), ao_out_fifo_signal(), ao_update_resample_factor(), NULL, XINE_FINE_SPEED_NORMAL, XINE_SPEED_PAUSE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port(), and ao_exit().

## ◆ ao_status()

static int ao_status | ( | xine_audio_port_t * | this_gen,
|  | xine_stream_t * | stream,
|  | uint32_t * | bits,
|  | uint32_t * | rate,
|  | int * | mode )
| static

References bits, input(), XINE_ANON_STREAM, xine_rwlock_rdlock, and xine_rwlock_unlock.

Referenced by _x_ao_new_port().

## ◆ ao_streams_close()

static void ao_streams_close | ( | aos_t * | this | ) |
| static

References _x_freep(), and xine_rwlock_destroy.

Referenced by ao_exit().

## ◆ ao_streams_open()

static void ao_streams_open | ( | aos_t * | this | ) |
| static

References NULL, STREAMS_DEFAULT_SIZE, and xine_rwlock_init_default.

Referenced by _x_ao_new_port().

## ◆ ao_streams_register()

static void ao_streams_register | ( | aos_t * | this,
|  | xine_stream_private_t * | s )
| static

References NULL, xine_stream_private_st::s, XINE_ANON_STREAM, xine_rwlock_unlock, and xine_rwlock_wrlock.

Referenced by ao_open().

## ◆ ao_streams_unregister()

static int ao_streams_unregister | ( | aos_t * | this,
|  | xine_stream_private_t * | s )
| static

References xine_stream_private_st::s, XINE_ANON_STREAM, xine_rwlock_unlock, and xine_rwlock_wrlock.

Referenced by ao_close().

## ◆ ao_ticket_revoked()

static void ao_ticket_revoked | ( | void * | user_data,
|  | int | flags )
| static

References user_data(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by _x_ao_new_port(), and ao_exit().

## ◆ ao_unref_obsolete()

static void ao_unref_obsolete | ( | aos_t * | this | ) |
| static

References audio_buffer_s::next, NULL, NUM_AUDIO_BUFFERS, PTR_IN_RANGE, xine_refs_sub(), xine_rwlock_rdlock, xine_rwlock_unlock, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_open().

## ◆ ao_update_av_fine_sync_method()

static void ao_update_av_fine_sync_method | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References xine_cfg_entry_s::num_value.

Referenced by _x_ao_new_port().

## ◆ ao_update_av_sync_method()

static void ao_update_av_sync_method | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References lprintf, and xine_cfg_entry_s::num_value.

Referenced by _x_ao_new_port().

## ◆ ao_update_ptoffs()

static void ao_update_ptoffs | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References AO_CAP_MODE_A52, AO_CAP_MODE_AC5, and xine_cfg_entry_s::num_value.

Referenced by _x_ao_new_port().

## ◆ ao_update_resample_factor()

static int ao_update_resample_factor | ( | aos_t * | this | ) |
| static

References _x_ao_mode2channels(), ao_eq_update(), ao_resend_init(), GAP_RING_LD, input(), lprintf, uint_sqrt(), XINE_FINE_SPEED_NORMAL, XINE_SPEED_PAUSE, xine_uint_mul_div(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ao_change_settings(), ao_new_speed_trick(), and ao_speed_change_cb().

## ◆ ao_update_slow_fast()

static void ao_update_slow_fast | ( | void * | this_gen,
|  | xine_cfg_entry_t * | entry )
| static

References ao_out_fifo_signal(), xine_cfg_entry_s::num_value, and aos_t::trick.

Referenced by _x_ao_new_port().

## ◆ audio_filter_amp()

static void audio_filter_amp | ( | aos_t * | this,
|  | void * | buf,
|  | int | num_frames )
| static

References input(), INT16_MAX, INT16_MIN, INT8_MAX, and INT8_MIN.

Referenced by prepare_samples().

## ◆ audio_filter_compress()

static void audio_filter_compress | ( | aos_t * | this,
|  | int16_t * | mem,
|  | int | num_frames )
| static

References abs, and lprintf.

Referenced by prepare_samples().

## ◆ audio_filter_equalize()

static void audio_filter_equalize | ( | aos_t * | this,
|  | int16_t * | data,
|  | int | num_frames )
| static

References sIIRCoefficients::beta, EQ_BANDS, FP_FRBITS, iir_cf, sat16, and v.

Referenced by prepare_samples().

## ◆ ensure_buffer_size()

static void ensure_buffer_size | ( | audio_buffer_t * | buf,
|  | int | bytes_per_frame,
|  | int | frames )
| static

References audio_buffer_s::mem, audio_buffer_s::mem_size, and audio_buffer_s::num_frames.

Referenced by prepare_samples().

## ◆ prepare_samples()

static audio_buffer_t * prepare_samples | ( | aos_t * | this,
|  | audio_buffer_t * | buf )
| static

References _x_audio_out_resample_16to8(), _x_audio_out_resample_4channel(), _x_audio_out_resample_6channel(), _x_audio_out_resample_8to16(), _x_audio_out_resample_mono(), _x_audio_out_resample_monotostereo(), _x_audio_out_resample_stereo(), _x_audio_out_resample_stereotomono(), 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, audio_filter_amp(), audio_filter_compress(), audio_filter_equalize(), ensure_buffer_size(), input(), lprintf, audio_buffer_s::mem, audio_buffer_s::num_frames, and swap_frame_buffers().

Referenced by ao_loop(), and xine_get_next_audio_frame().

## ◆ resample_rate_adjust()

static int resample_rate_adjust | ( | aos_t * | this,
|  | int64_t | gap,
|  | audio_buffer_t * | buf )
| static

References AO_MAX_GAP, resample_sync_t::last_avg_gap, resample_sync_t::last_factor, resample_sync_t::last_vpts, llprintf, LOG_RESAMPLE_SYNC, audio_buffer_s::num_frames, resample_sync_t::recent_gap, resample_sync_t::reduce_gap, RESAMPLE_MAX_GAP_DIFF, RESAMPLE_REDUCE_GAP_THRESHOLD, RESAMPLE_SYNC_WINDOW, resample_sync_t::valid, audio_buffer_s::vpts, resample_sync_t::window, and resample_sync_t::window_duration.

Referenced by ao_loop().

## ◆ swap_frame_buffers()

static audio_buffer_t * swap_frame_buffers | ( | aos_t * | this | ) |
| static

Referenced by prepare_samples().

## ◆ uint_sqrt()

static uint32_t uint_sqrt | ( | uint32_t | v | ) |
| static

References v.

Referenced by ao_update_resample_factor().

## ◆ xine_free_audio_frame()

void xine_free_audio_frame | ( | xine_audio_port_t * | this_gen,
|  | xine_audio_frame_t * | frame )

References ao_free_fifo_append().

## ◆ xine_get_next_audio_frame()

int xine_get_next_audio_frame | ( | xine_audio_port_t * | this_gen,
|  | xine_audio_frame_t * | frame )

References ao_change_settings(), ao_free_fifo_append(), ao_out_fifo_pop_int(), xine_stream_s::audio_fifo, ao_format_s::bits, xine_stream_private_st::demux, DEMUX_OK, xine_stream_private_st::emergency_brake, fifo_buffer_s::fifo_size, audio_buffer_s::format, demux_plugin_s::get_status, input(), lprintf, ao_format_s::mode, now(), NULL, xine_stream_private_st::plugin, prepare_samples(), ao_format_s::rate, xine_stream_private_st::s, audio_buffer_s::stream, and xine_gettime().

## Variable Documentation

## ◆ iir_cf

const sIIRCoefficients iir_cf[]
| static

Initial value:
= {
{ ((int)((9.9691562441e-01) * (1 << 28 ))), ((int)((1.5421877947e-03) * (1 << 28 ))), ((int)((1.9968961468e+00) * (1 << 28 )))},
{ ((int)((9.9384077546e-01) * (1 << 28 ))), ((int)((3.0796122698e-03) * (1 << 28 ))), ((int)((1.9937629855e+00) * (1 << 28 )))},
{ ((int)((9.8774277725e-01) * (1 << 28 ))), ((int)((6.1286113769e-03) * (1 << 28 ))), ((int)((1.9874275518e+00) * (1 << 28 )))},
{ ((int)((9.7522112569e-01) * (1 << 28 ))), ((int)((1.2389437156e-02) * (1 << 28 ))), ((int)((1.9739682661e+00) * (1 << 28 )))},
{ ((int)((9.5105628526e-01) * (1 << 28 ))), ((int)((2.4471857368e-02) * (1 << 28 ))), ((int)((1.9461077269e+00) * (1 << 28 )))},
{ ((int)((9.0450844499e-01) * (1 << 28 ))), ((int)((4.7745777504e-02) * (1 << 28 ))), ((int)((1.8852109613e+00) * (1 << 28 )))},
{ ((int)((8.1778971701e-01) * (1 << 28 ))), ((int)((9.1105141497e-02) * (1 << 28 ))), ((int)((1.7444877599e+00) * (1 << 28 )))},
{ ((int)((6.6857185264e-01) * (1 << 28 ))), ((int)((1.6571407368e-01) * (1 << 28 ))), ((int)((1.4048592171e+00) * (1 << 28 )))},
{ ((int)((4.4861333678e-01) * (1 << 28 ))), ((int)((2.7569333161e-01) * (1 << 28 ))), ((int)((6.0518718075e-01) * (1 << 28 )))},
{ ((int)((2.4201241845e-01) * (1 << 28 ))), ((int)((3.7899379077e-01) * (1 << 28 ))), ((int)((-8.0847117831e-01) * (1 << 28 )))},
}

Referenced by audio_filter_equalize().