xine-lib: xine-lib-1.2.12/src/combined/ffmpeg/ff_audio_decoder.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions
ff_audio_decoder.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <inttypes.h>`
`#include <string.h>`
`#include <pthread.h>`
`#include <math.h>`
`#include <libavcodec/avcodec.h>`
`#include <libavutil/mem.h>`
`#include <xine/xine_internal.h>`
`#include <xine/buffer.h>`
`#include <xine/xineutils.h>`
`#include "bswap.h"`
`#include "ffmpeg_decoder.h"`
`#include "ffmpeg_compat.h"`

## Data Structures
struct | ff_audio_class_t
struct | ff_audio_decoder_s

## Macros
#define | LOG_MODULE "ffmpeg_audio_dec"
#define | LOG_VERBOSE
#define | AUDIOBUFSIZE (64 * 1024)
#define | MAX_CHANNELS 6
#define | AAC_MODE_PROBE -8
#define | AAC_MODE_OFF 0
#define | AAC_MODE_RAW 1
#define | AAC_MODE_ADTS 2
#define | CLIP_16(v) ((v + 0x8000) & ~0xffff ? (v >> 31) ^ 0x7fff : v)

## Typedefs
typedef struct ff_audio_decoder_s | ff_audio_decoder_t

## Functions
static void | ff_aac_mode_set (ff_audio_decoder_t *this, int reset)
static int | ff_audio_open_codec (ff_audio_decoder_t *this, unsigned int codec_type)
static int | ff_aac_mode_parse (ff_audio_decoder_t *this, uint8_t *buf, int size, int *offs)
static void | ff_audio_ensure_buffer_size (ff_audio_decoder_t *this, int size)
static void | ff_audio_handle_special_buffer (ff_audio_decoder_t *this, buf_element_t *buf)
static void | ff_audio_init_codec (ff_audio_decoder_t *this, unsigned int codec_type)
static void | ff_handle_header_buffer (ff_audio_decoder_t *this, buf_element_t *buf)
static void | ff_audio_reset_parser (ff_audio_decoder_t *this)
static void | ff_audio_output_close (ff_audio_decoder_t *this)
static void | ff_map_channels (ff_audio_decoder_t *this)
static int | ff_audio_decode (ff_audio_decoder_t *this, int16_t *decode_buffer, int *decode_buffer_size, uint8_t *buf, int size)
static void | ff_audio_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
static void | ff_audio_reset (audio_decoder_t *this_gen)
static void | ff_audio_discontinuity (audio_decoder_t *this_gen)
static void | ff_audio_dispose (audio_decoder_t *this_gen)
static audio_decoder_t * | ff_audio_open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream)
static void | ff_gain_cb (void *user_data, xine_cfg_entry_t *entry)
static void | dispose_audio_class (audio_decoder_class_t *this_gen)
void * | init_audio_plugin (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ AAC_MODE_ADTS

#define AAC_MODE_ADTS 2

## ◆ AAC_MODE_OFF

#define AAC_MODE_OFF 0

## ◆ AAC_MODE_PROBE

#define AAC_MODE_PROBE -8

## ◆ AAC_MODE_RAW

#define AAC_MODE_RAW 1

## ◆ AUDIOBUFSIZE

#define AUDIOBUFSIZE (64 * 1024)

## ◆ CLIP_16

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

## ◆ LOG_MODULE

#define LOG_MODULE "ffmpeg_audio_dec"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MAX_CHANNELS

#define MAX_CHANNELS 6

## Typedef Documentation

## ◆ ff_audio_decoder_t

typedef struct ff_audio_decoder_s ff_audio_decoder_t

## Function Documentation

## ◆ dispose_audio_class()

static void dispose_audio_class | ( | audio_decoder_class_t * | this_gen | ) |
| static

References xine_s::config, NULL, config_values_s::unregister_callbacks, and ff_audio_class_t::xine.

Referenced by init_audio_plugin().

## ◆ ff_aac_mode_parse()

static int ff_aac_mode_parse | ( | ff_audio_decoder_t * | this,
|  | uint8_t * | buf,
|  | int | size,
|  | int * | offs
| ) |  |
| static

References _X_BE_32, AAC_MODE_ADTS, AAC_MODE_OFF, BUF_AUDIO_AAC, BUF_AUDIO_AAC_LATM, ff_audio_open_codec(), ffmpeg_lock, NULL, v, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ff_audio_decode().

## ◆ ff_aac_mode_set()

static void ff_aac_mode_set | ( | ff_audio_decoder_t * | this,
|  | int | reset
| ) |  |
| static

References AAC_MODE_ADTS, AAC_MODE_OFF, AAC_MODE_PROBE, AAC_MODE_RAW, BUF_AUDIO_AAC, BUF_AUDIO_AAC_LATM, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ff_audio_discontinuity(), ff_audio_handle_special_buffer(), ff_audio_init_codec(), and ff_audio_reset().

## ◆ ff_audio_decode()

static int ff_audio_decode | ( | ff_audio_decoder_t * | this,
|  | int16_t * | decode_buffer,
|  | int * | decode_buffer_size,
|  | uint8_t * | buf,
|  | int | size
| ) |  |
| static

References ff_aac_mode_parse(), ff_map_channels(), v, XFF_ALLOC_FRAME, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ff_audio_decode_data().

## ◆ ff_audio_decode_data()

static void ff_audio_decode_data | ( | audio_decoder_t * | this_gen,
|  | buf_element_t * | buf
| ) |  |
| static

References _, AV_INPUT_BUFFER_PADDING_SIZE, AVCODEC_MAX_AUDIO_FRAME_SIZE, BUF_AUDIO_WMAPRO, BUF_DECODER_MASK, BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_PREVIEW, BUF_FLAG_SPECIAL, BUF_MAJOR_MASK, CLIP_16, buf_element_s::content, buf_element_s::decoder_flags, ff_audio_decode(), ff_audio_ensure_buffer_size(), ff_audio_handle_special_buffer(), ff_audio_open_codec(), ff_audio_output_close(), ff_handle_header_buffer(), audio_buffer_s::mem, audio_buffer_s::mem_size, audio_buffer_s::num_frames, buf_element_s::pts, buf_element_s::size, audio_buffer_s::stream, buf_element_s::type, v, audio_buffer_s::vpts, xine_container_of, xine_fast_memcpy, xine_get_status(), XINE_STATUS_QUIT, XINE_STATUS_STOP, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by ff_audio_open_plugin().

## ◆ ff_audio_discontinuity()

static void ff_audio_discontinuity | ( | audio_decoder_t * | this_gen | ) |
| static

References ff_aac_mode_set(), ff_audio_reset_parser(), and xine_container_of.

Referenced by ff_audio_open_plugin().

## ◆ ff_audio_dispose()

static void ff_audio_dispose | ( | audio_decoder_t * | this_gen | ) |
| static

References _x_freep(), ff_audio_output_close(), ffmpeg_lock, NULL, XFF_FREE_CONTEXT, XFF_FREE_FRAME, XFF_PACKET_UNREF, xine_container_of, and xine_free_aligned().

Referenced by ff_audio_open_plugin().

## ◆ ff_audio_ensure_buffer_size()

static void ff_audio_ensure_buffer_size | ( | ff_audio_decoder_t * | this,
|  | int | size
| ) |  |
| static

References _, AV_INPUT_BUFFER_PADDING_SIZE, xine_realloc_aligned(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by ff_audio_decode_data(), and ff_handle_header_buffer().

## ◆ ff_audio_handle_special_buffer()

static void ff_audio_handle_special_buffer | ( | ff_audio_decoder_t * | this,
|  | buf_element_t * | buf
| ) |  |
| static

References AV_INPUT_BUFFER_PADDING_SIZE, BUF_SPECIAL_DECODER_CONFIG, BUF_SPECIAL_STSD_ATOM, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, and ff_aac_mode_set().

Referenced by ff_audio_decode_data().

## ◆ ff_audio_init_codec()

static void ff_audio_init_codec | ( | ff_audio_decoder_t * | this,
|  | unsigned int | codec_type
| ) |  |
| static

References _, _x_meta_info_set(), _x_stream_info_get(), _x_stream_info_set(), BUF_AUDIO_A52, BUF_AUDIO_AAC_LATM, BUF_AUDIO_EAC3, BUF_AUDIO_MPEG, ff_aac_mode_set(), ff_audio_lookup, ff_audio_lookup_entries, ffmpeg_lock, name, NULL, type, XINE_META_INFO_AUDIOCODEC, XINE_STREAM_INFO_AUDIO_FOURCC, XINE_STREAM_INFO_AUDIO_HANDLED, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by ff_audio_open_codec(), and ff_handle_header_buffer().

## ◆ ff_audio_open_codec()

static int ff_audio_open_codec | ( | ff_audio_decoder_t * | this,
|  | unsigned int | codec_type
| ) |  |
| static

References _, _x_stream_info_set(), ff_audio_init_codec(), ffmpeg_lock, XFF_AVCODEC_OPEN, XINE_STREAM_INFO_AUDIO_HANDLED, XINE_VERBOSITY_LOG, and xprintf.

Referenced by ff_aac_mode_parse(), and ff_audio_decode_data().

## ◆ ff_audio_open_plugin()

static audio_decoder_t * ff_audio_open_plugin | ( | audio_decoder_class_t * | class_gen,
|  | xine_stream_t * | stream
| ) |  |
| static

References AUDIOBUFSIZE, AV_INPUT_BUFFER_PADDING_SIZE, AVCODEC_MAX_AUDIO_FRAME_SIZE, ff_audio_decode_data(), ff_audio_discontinuity(), ff_audio_dispose(), ff_audio_reset(), init_once_routine(), NULL, XFF_ALLOC_CONTEXT, XFF_FREE_CONTEXT, XFF_PACKET_NEW, xine_free_aligned(), and xine_malloc_aligned().

Referenced by init_audio_plugin().

## ◆ ff_audio_output_close()

static void ff_audio_output_close | ( | ff_audio_decoder_t * | this | ) |
| static

Referenced by ff_audio_decode_data(), and ff_audio_dispose().

## ◆ ff_audio_reset()

static void ff_audio_reset | ( | audio_decoder_t * | this_gen | ) |
| static

References ff_aac_mode_set(), ff_audio_reset_parser(), ffmpeg_lock, XFF_AVCODEC_OPEN, XFF_FREE_FRAME, and xine_container_of.

Referenced by ff_audio_open_plugin().

## ◆ ff_audio_reset_parser()

static void ff_audio_reset_parser | ( | ff_audio_decoder_t * | this | ) |
| static

References ffmpeg_lock, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by ff_audio_discontinuity(), and ff_audio_reset().

## ◆ ff_gain_cb()

static void ff_gain_cb | ( | void * | user_data,
|  | xine_cfg_entry_t * | entry
| ) |  |
| static

References xine_cfg_entry_s::num_value, and user_data().

Referenced by init_audio_plugin().

## ◆ ff_handle_header_buffer()

static void ff_handle_header_buffer | ( | ff_audio_decoder_t * | this,
|  | buf_element_t * | buf
| ) |  |
| static

References _X_BE_16, _X_BE_32, AV_INPUT_BUFFER_PADDING_SIZE, BUF_AUDIO_14_4, BUF_AUDIO_28_8, BUF_AUDIO_ATRK, BUF_AUDIO_COOK, BUF_AUDIO_EAC3, BUF_DECODER_MASK, BUF_FLAG_FRAME_END, BUF_FLAG_STDHEADER, BUF_MAJOR_MASK, xine_waveformatex::cbSize, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, ff_audio_ensure_buffer_size(), ff_audio_init_codec(), xine_waveformatex::nAvgBytesPerSec, xine_waveformatex::nBlockAlign, buf_element_s::size, buf_element_s::type, xine_fast_memcpy, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by ff_audio_decode_data().

## ◆ ff_map_channels()

static void ff_map_channels | ( | ff_audio_decoder_t * | this | ) |
| static

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, MAX_CHANNELS, and XINE_VERBOSITY_LOG.

Referenced by ff_audio_decode().

## ◆ init_audio_plugin()

void * init_audio_plugin | ( | xine_t * | xine,
|  | const void * | data
| ) |  |

References _, xine_s::config, ff_audio_class_t::decoder_class, audio_decoder_class_s::description, audio_decoder_class_s::dispose, dispose_audio_class(), ff_audio_open_plugin(), ff_gain_cb(), ff_audio_class_t::gain, audio_decoder_class_s::identifier, N_, NULL, audio_decoder_class_s::open_plugin, config_values_s::register_num, and ff_audio_class_t::xine.