xine-lib: xine-lib-1.2.12/src/audio_dec/xine_faad_decoder.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
xine_faad_decoder.c File Reference
`#include <stdlib.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <sys/types.h>`
`#include "latm.c"`
`#include <xine/xine_internal.h>`
`#include <xine/audio_out.h>`
`#include <xine/buffer.h>`
`#include <xine/xineutils.h>`
`#include "common.h"`
`#include "structs.h"`
`#include "syntax.h"`

## Data Structures
struct | faad_class_s
struct | faad_decoder_s

## Macros
#define | LOG_MODULE "libfaad"
#define | LOG_VERBOSE
#define | FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */
#define | FAAD_PTS_LD 3
#define | FAAD_PTS_SIZE (1 << FAAD_PTS_LD)
#define | FAAD_PTS_MASK (FAAD_PTS_SIZE - 1)
#define | ADTS_FAKE_CFG
#define | sat16(v) (((v + 0x8000) & ~0xffff) ? ((v) >> 31) ^ 0x7fff : (v))
#define | GET1(i, j) v = ((int64_t)g1 * (int64_t)p[i]) >> 32; q[j] = sat16 (v)
#define | GET2(i, j) v = ((int64_t)g1 * (int64_t)(p[i] + p[i + 1])) >> 32; q[j] = sat16 (v)
#define | GET1M(i, j) v = (m + (int64_t)g1 * (int64_t)p[i]) >> 32; q[j] = sat16 (v)
#define | GET2M(i, j, l) v = ((int64_t)g1 * (int64_t)p[i] + (int64_t)g2 * (int64_t)(m + p[j])) >> 32; q[l] = sat16 (v)
#define | GET1(i, j) v = g1 * p[i]; q[j] = sat16 (v)
#define | GET2(i, j) v = g1 * (p[i] + p[i + 1]); q[j] = sat16 (v)
#define | GET1M(i, j) v = m + g1 * p[i]; q[j] = sat16 (v)
#define | GET2M(i, j, l) v = g1 * p[i] + g2 * (m + p[j]); q[l] = sat16 (v)

## Typedefs
typedef struct faad_class_s | faad_class_t
typedef struct faad_decoder_s | faad_decoder_t

## Functions
static void | faad_pts_reset (faad_decoder_t *this)
static void | faad_pts_add (faad_decoder_t *this, int64_t pts, int bytes)
static int64_t | faad_pts_get (faad_decoder_t *this, int bytes_left)
static int | faad_map_channels (faad_decoder_t *this)
static void | faad_reset (audio_decoder_t *this_gen)
static void | faad_meta_info_set (faad_decoder_t *this)
static void | faad_close_output (faad_decoder_t *this)
static int | faad_open_output (faad_decoder_t *this)
static int | faad_reopen_dec (faad_decoder_t *this)
static int | faad_apply_conf (faad_decoder_t *this, uint8_t *conf, int len)
static int | faad_apply_frame (faad_decoder_t *this, uint8_t *frame, int len)
static int | faad_open_dec (faad_decoder_t *this)
static void | faad_decode_audio (faad_decoder_t *this, int end_frame)
static void | faad_get_conf (faad_decoder_t *this, const uint8_t *d, int len)
static void | faad_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
static void | faad_discontinuity (audio_decoder_t *this_gen)
static void | faad_dispose (audio_decoder_t *this_gen)
static audio_decoder_t * | open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream)
static void | gain_update (faad_class_t *this)
static void | gain_cb (void *user_data, xine_cfg_entry_t *entry)
static void | faad_class_ref (faad_class_t *this)
static void | faad_class_unref (audio_decoder_class_t *this_gen)
static void * | faad_init_plugin (xine_t *xine, const void *data, const char *id)
static void * | latm_init_class (xine_t *xine, const void *data)
static void * | faad_init_class (xine_t *xine, const void *data)

## Variables
static const uint32_t | audio_types []
static const decoder_info_t | dec_info_audio
static const uint32_t | latm_audio_types []
static const decoder_info_t | dec_info_latm_audio
const plugin_info_t xine_plugin_info[] | EXPORTED

## Macro Definition Documentation

## ◆ ADTS_FAKE_CFG

#define ADTS_FAKE_CFG

## ◆ FAAD_MIN_STREAMSIZE

#define FAAD_MIN_STREAMSIZE 768 /* 6144 bits/channel */

## ◆ FAAD_PTS_LD

#define FAAD_PTS_LD 3

## ◆ FAAD_PTS_MASK

#define FAAD_PTS_MASK (FAAD_PTS_SIZE - 1)

## ◆ FAAD_PTS_SIZE

#define FAAD_PTS_SIZE (1 << FAAD_PTS_LD)

## ◆ GET1 [1/2]

#define GET1 | ( |  | i,
|  |  | j
| ) |  | v = ((int64_t)g1 * (int64_t)p[i]) >> 32; q[j] = sat16 (v)

## ◆ GET1 [2/2]

#define GET1 | ( |  | i,
|  |  | j
| ) |  | v = g1 * p[i]; q[j] = sat16 (v)

## ◆ GET1M [1/2]

#define GET1M | ( |  | i,
|  |  | j
| ) |  | v = (m + (int64_t)g1 * (int64_t)p[i]) >> 32; q[j] = sat16 (v)

## ◆ GET1M [2/2]

#define GET1M | ( |  | i,
|  |  | j
| ) |  | v = m + g1 * p[i]; q[j] = sat16 (v)

## ◆ GET2 [1/2]

#define GET2 | ( |  | i,
|  |  | j
| ) |  | v = ((int64_t)g1 * (int64_t)(p[i] + p[i + 1])) >> 32; q[j] = sat16 (v)

## ◆ GET2 [2/2]

#define GET2 | ( |  | i,
|  |  | j
| ) |  | v = g1 * (p[i] + p[i + 1]); q[j] = sat16 (v)

## ◆ GET2M [1/2]

#define GET2M | ( |  | i,
|  |  | j,
|  |  | l
| ) |  | v = ((int64_t)g1 * (int64_t)p[i] + (int64_t)g2 * (int64_t)(m + p[j])) >> 32; q[l] = sat16 (v)

## ◆ GET2M [2/2]

#define GET2M | ( |  | i,
|  |  | j,
|  |  | l
| ) |  | v = g1 * p[i] + g2 * (m + p[j]); q[l] = sat16 (v)

## ◆ LOG_MODULE

#define LOG_MODULE "libfaad"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ sat16

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

## Typedef Documentation

## ◆ faad_class_t

typedef struct faad_class_s faad_class_t

## ◆ faad_decoder_t

typedef struct faad_decoder_s faad_decoder_t

## Function Documentation

## ◆ faad_apply_conf()

static int faad_apply_conf | ( | faad_decoder_t * | this,
|  | uint8_t * | conf,
|  | int | len
| ) |  |
| static

References _, AOT_AAC_LC, AOT_PS, AOT_SBR, bebf_ADJ32, bits, faad_close_output(), faad_meta_info_set(), faad_open_output(), faad_reopen_dec(), XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by faad_decode_audio(), and faad_open_dec().

## ◆ faad_apply_frame()

static int faad_apply_frame | ( | faad_decoder_t * | this,
|  | uint8_t * | frame,
|  | int | len
| ) |  |
| static

References _, faad_close_output(), faad_meta_info_set(), faad_open_output(), faad_reopen_dec(), XINE_VERBOSITY_LOG, and xprintf.

Referenced by faad_decode_audio(), and faad_open_dec().

## ◆ faad_class_ref()

static void faad_class_ref | ( | faad_class_t * | this | ) |
| static

Referenced by faad_init_plugin().

## ◆ faad_class_unref()

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

References xine_s::config, and config_values_s::unregister_callback.

Referenced by faad_init_plugin().

## ◆ faad_close_output()

static void faad_close_output | ( | faad_decoder_t * | this | ) |
| static

Referenced by faad_apply_conf(), faad_apply_frame(), faad_decode_audio(), and faad_dispose().

## ◆ faad_decode_audio()

static void faad_decode_audio | ( | faad_decoder_t * | this,
|  | int | end_frame
| ) |  |
| static

References AOT_AAC_LC, AOT_SBR, bebf_ADJ32, BEBF_LATM_GOT_CONF, BEBF_LATM_GOT_FRAME, BEBF_LATM_IS_ADTS, BEBF_LATM_IS_LATM, BEBF_LATM_IS_RAW, bebf_latm_parse(), faad_apply_conf(), faad_apply_frame(), faad_close_output(), faad_meta_info_set(), faad_open_dec(), faad_open_output(), faad_pts_get(), GET1, GET1M, GET2, GET2M, lprintf, audio_buffer_s::mem, audio_buffer_s::mem_size, NULL, audio_buffer_s::num_frames, sat16, audio_buffer_s::stream, v, audio_buffer_s::vpts, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by faad_decode_data().

## ◆ faad_decode_data()

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

References BEBF_LATM_IS_ADTS, BEBF_LATM_NEED_MORE_DATA, bebf_latm_test(), BUF_AUDIO_AAC_LATM, BUF_DECODER_MASK, BUF_FLAG_FRAME_END, BUF_FLAG_PREVIEW, BUF_FLAG_SPECIAL, BUF_FLAG_STDHEADER, BUF_MAJOR_MASK, BUF_SPECIAL_DECODER_CONFIG, xine_waveformatex::cbSize, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, faad_decode_audio(), faad_get_conf(), faad_pts_add(), lprintf, buf_element_s::pts, buf_element_s::size, buf_element_s::type, xine_container_of, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ faad_discontinuity()

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

References faad_pts_reset(), and xine_container_of.

Referenced by open_plugin().

## ◆ faad_dispose()

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

References _x_freep(), bebf_latm_close(), faad_close_output(), NULL, and xine_container_of.

Referenced by open_plugin().

## ◆ faad_get_conf()

static void faad_get_conf | ( | faad_decoder_t * | this,
|  | const uint8_t * | d,
|  | int | len
| ) |  |
| static

References BEBF_LATM_IS_RAW, NULL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by faad_decode_data().

## ◆ faad_init_class()

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

References faad_init_plugin().

## ◆ faad_init_plugin()

static void * faad_init_plugin | ( | xine_t * | xine,
|  | const void * | data,
|  | const char * | id
| ) |  |
| static

References _, cfg_entry_s::callback, cfg_entry_s::callback_data, xine_s::config, faad_class_ref(), faad_class_unref(), gain_cb(), gain_update(), config_values_s::lookup_entry, N_, NULL, open_plugin(), and config_values_s::register_num.

Referenced by faad_init_class(), and latm_init_class().

## ◆ faad_map_channels()

static int faad_map_channels | ( | faad_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, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by faad_open_output().

## ◆ faad_meta_info_set()

static void faad_meta_info_set | ( | faad_decoder_t * | this | ) |
| static

References _x_meta_info_set_utf8(), and XINE_META_INFO_AUDIOCODEC.

Referenced by faad_apply_conf(), faad_apply_frame(), and faad_decode_audio().

## ◆ faad_open_dec()

static int faad_open_dec | ( | faad_decoder_t * | this | ) |
| static

References _x_stream_info_set(), faad_apply_conf(), faad_apply_frame(), lprintf, NULL, and XINE_STREAM_INFO_AUDIO_HANDLED.

Referenced by faad_decode_audio().

## ◆ faad_open_output()

static int faad_open_output | ( | faad_decoder_t * | this | ) |
| static

References AO_CAP_MODE_5_1CHANNEL, AO_CAP_MODE_MONO, AO_CAP_MODE_STEREO, faad_map_channels(), and FAAD_MIN_STREAMSIZE.

Referenced by faad_apply_conf(), faad_apply_frame(), and faad_decode_audio().

## ◆ faad_pts_add()

static void faad_pts_add | ( | faad_decoder_t * | this,
|  | int64_t | pts,
|  | int | bytes
| ) |  |
| static

References FAAD_PTS_MASK.

Referenced by faad_decode_data().

## ◆ faad_pts_get()

static int64_t faad_pts_get | ( | faad_decoder_t * | this,
|  | int | bytes_left
| ) |  |
| static

References FAAD_PTS_MASK.

Referenced by faad_decode_audio().

## ◆ faad_pts_reset()

static void faad_pts_reset | ( | faad_decoder_t * | this | ) |
| static

Referenced by faad_discontinuity(), faad_reset(), and open_plugin().

## ◆ faad_reopen_dec()

static int faad_reopen_dec | ( | faad_decoder_t * | this | ) |
| static

References _, XINE_VERBOSITY_LOG, and xprintf.

Referenced by faad_apply_conf(), and faad_apply_frame().

## ◆ faad_reset()

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

References bebf_latm_close(), BEBF_LATM_NEED_MORE_DATA, bebf_latm_open(), faad_pts_reset(), and xine_container_of.

Referenced by open_plugin().

## ◆ gain_cb()

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

References gain_update(), xine_cfg_entry_s::num_value, and user_data().

Referenced by faad_init_plugin().

## ◆ gain_update()

static void gain_update | ( | faad_class_t * | this | ) |
| static

Referenced by faad_init_plugin(), and gain_cb().

## ◆ latm_init_class()

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

References faad_init_plugin().

## ◆ open_plugin()

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

References BEBF_LATM_NEED_MORE_DATA, bebf_latm_open(), faad_decode_data(), faad_discontinuity(), faad_dispose(), faad_pts_reset(), faad_reset(), and NULL.

Referenced by faad_init_plugin().

## Variable Documentation

## ◆ audio_types

const uint32_t audio_types[]
| static

Initial value:
= {
BUF_AUDIO_AAC, 0
}
BUF_AUDIO_AAC
#define BUF_AUDIO_AAC
Definition: buffer.h:223

## ◆ dec_info_audio

const decoder_info_t dec_info_audio
| static

Initial value:
= {
.supported_types = audio_types,
.priority = 8,
}
audio_types
static const uint32_t audio_types[]
Definition: xine_faad_decoder.c:1196

## ◆ dec_info_latm_audio

const decoder_info_t dec_info_latm_audio
| static

Initial value:
= {
.supported_types = latm_audio_types,
.priority = 1,
}
latm_audio_types
static const uint32_t latm_audio_types[]
Definition: xine_faad_decoder.c:1205

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_AUDIO_DECODER, 16, "faad", XINE_VERSION_CODE, &dec_info_audio, faad_init_class },
{ PLUGIN_AUDIO_DECODER, 16, "faad-latm", XINE_VERSION_CODE, &dec_info_latm_audio, latm_init_class },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
latm_init_class
static void * latm_init_class(xine_t *xine, const void *data)
Definition: xine_faad_decoder.c:1188
faad_init_class
static void * faad_init_class(xine_t *xine, const void *data)
Definition: xine_faad_decoder.c:1192
dec_info_audio
static const decoder_info_t dec_info_audio
Definition: xine_faad_decoder.c:1200
dec_info_latm_audio
static const decoder_info_t dec_info_latm_audio
Definition: xine_faad_decoder.c:1209
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition: xine_internal.h:57
NULL
NULL
Definition: xine_plugin.c:78
PLUGIN_AUDIO_DECODER
#define PLUGIN_AUDIO_DECODER
Definition: xine_plugin.h:32
PLUGIN_NONE
#define PLUGIN_NONE
Definition: xine_plugin.h:29

## ◆ latm_audio_types

const uint32_t latm_audio_types[]
| static

Initial value:
= {
BUF_AUDIO_AAC_LATM, 0
}
BUF_AUDIO_AAC_LATM
#define BUF_AUDIO_AAC_LATM
Definition: buffer.h:276