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

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions | Variables
xine_musepack_decoder.c File Reference

xine interface to libmusepack/libmpcdec More...

`#include <stdio.h>`
`#include <stdlib.h>`
`#include <string.h>`
`#include <sys/types.h>`
`#include <unistd.h>`
`#include <xine/xine_internal.h>`
`#include <xine/audio_out.h>`
`#include <xine/buffer.h>`
`#include <xine/xineutils.h>`
`#include "mpcdec/mpcdec.h"`

## Data Structures
struct | mpc_decoder_s

## Macros
#define | LOG_MODULE "mpc_decoder"
#define | LOG_VERBOSE
#define | MPC_DECODER_MEMSIZE 65536
#define | MPC_DECODER_MEMSIZE2 (MPC_DECODER_MEMSIZE/2)
#define | INIT_BUFSIZE (MPC_DECODER_MEMSIZE*2)
#define | MPC_THIS mpc_decoder_t * const this = (mpc_decoder_t *)data

## Typedefs
typedef struct mpc_decoder_s | mpc_decoder_t

## Functions
static int32_t | mpc_reader_read (void *const data, void *const ptr, int size)
static mpc_bool_t | mpc_reader_seek (void *const data, const int32_t offset)
static int32_t | mpc_reader_tell (void *const data)
static int32_t | mpc_reader_get_size (void *const data)
static mpc_bool_t | mpc_reader_canseek (void *data)
static void | float_to_int (const float *const _f, int16_t *const s16, const int samples)
| Convert a array of floating point samples into 16-bit signed integer samples. More...
static int | mpc_decode_frame (mpc_decoder_t *this)
static void | mpc_decode_data (audio_decoder_t *this_gen, buf_element_t *buf)
static void | mpc_reset (audio_decoder_t *this_gen)
static void | mpc_discontinuity (audio_decoder_t *this_gen)
static void | mpc_dispose (audio_decoder_t *this_gen)
static audio_decoder_t * | open_plugin (audio_decoder_class_t *class_gen, xine_stream_t *stream)
static void * | init_plugin (xine_t *xine, const void *data)

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

## Detailed Description

xine interface to libmusepack/libmpcdec

Author
  James Stembridge jstem.nosp@m.brid.nosp@m.ge@gm.nosp@m.ail..nosp@m.com

Todo:

  Add support for 32-bit float samples.

  Add support for seeking.

## Macro Definition Documentation

## ◆ INIT_BUFSIZE

#define INIT_BUFSIZE (MPC_DECODER_MEMSIZE*2)

## ◆ LOG_MODULE

#define LOG_MODULE "mpc_decoder"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MPC_DECODER_MEMSIZE

#define MPC_DECODER_MEMSIZE 65536

## ◆ MPC_DECODER_MEMSIZE2

#define MPC_DECODER_MEMSIZE2 (MPC_DECODER_MEMSIZE/2)

## ◆ MPC_THIS

#define MPC_THIS mpc_decoder_t * const this = (mpc_decoder_t *)data

## Typedef Documentation

## ◆ mpc_decoder_t

typedef struct mpc_decoder_s mpc_decoder_t

## Function Documentation

## ◆ float_to_int()

static void float_to_int | ( | const float *const | _f,
|  | int16_t *const | s16,
|  | const int | samples
| ) |  |
| inlinestatic

Convert a array of floating point samples into 16-bit signed integer samples.

Parameters

  f | Floating point samples array (origin)
  s16 | 16-bit signed integer samples array (destination)
  samples | Number of samples to convert

Todo:
  This same work is being done in many decoders to adapt the output of the decoder to what the audio output can actually use, this should be done by the audio_output loop, not by the decoders.

References INT16_MAX, and INT16_MIN.

Referenced by mpc_decode_frame().

## ◆ init_plugin()

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

References N_, NULL, open_plugin(), and audio_decoder_class_s::open_plugin.

## ◆ mpc_decode_data()

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

References _, _x_ao_channels2mode(), _x_meta_info_set_utf8(), _x_stream_info_get(), _x_stream_info_set(), BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_SPECIAL, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, INIT_BUFSIZE, lprintf, mpc_decode_frame(), MPC_DECODER_MEMSIZE, MPC_DECODER_MEMSIZE2, mpc_reader_canseek(), mpc_reader_get_size(), mpc_reader_read(), mpc_reader_seek(), mpc_reader_tell(), buf_element_s::size, xine_container_of, xine_fast_memcpy, XINE_META_INFO_AUDIOCODEC, XINE_STREAM_INFO_AUDIO_BITRATE, XINE_STREAM_INFO_AUDIO_HANDLED, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by open_plugin().

## ◆ mpc_decode_frame()

static int mpc_decode_frame | ( | mpc_decoder_t * | this | ) |
| static

References float_to_int(), lprintf, audio_buffer_s::mem, audio_buffer_s::num_frames, audio_buffer_s::stream, and audio_buffer_s::vpts.

Referenced by mpc_decode_data().

## ◆ mpc_discontinuity()

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

Referenced by open_plugin().

## ◆ mpc_dispose()

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

References _x_freep(), and xine_container_of.

Referenced by open_plugin().

## ◆ mpc_reader_canseek()

static mpc_bool_t mpc_reader_canseek | ( | void * | data | ) |
| static

References lprintf.

Referenced by mpc_decode_data().

## ◆ mpc_reader_get_size()

static int32_t mpc_reader_get_size | ( | void *const | data | ) |
| static

References lprintf, and MPC_THIS.

Referenced by mpc_decode_data().

## ◆ mpc_reader_read()

static int32_t mpc_reader_read | ( | void *const | data,
|  | void *const | ptr,
|  | int | size
| ) |  |
| static

References lprintf, MPC_THIS, and xine_fast_memcpy.

Referenced by mpc_decode_data().

## ◆ mpc_reader_seek()

static mpc_bool_t mpc_reader_seek | ( | void *const | data,
|  | const int32_t | offset
| ) |  |
| static

References lprintf, and MPC_THIS.

Referenced by mpc_decode_data().

## ◆ mpc_reader_tell()

static int32_t mpc_reader_tell | ( | void *const | data | ) |
| static

References lprintf.

Referenced by mpc_decode_data().

## ◆ mpc_reset()

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

References xine_container_of.

Referenced by open_plugin().

## ◆ open_plugin()

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

References mpc_decode_data(), mpc_discontinuity(), mpc_dispose(), mpc_reset(), and NULL.

Referenced by init_plugin().

## Variable Documentation

## ◆ audio_types

const uint32_t audio_types[]
| static

Initial value:
= {
BUF_AUDIO_MPC,
0
}
BUF_AUDIO_MPC
#define BUF_AUDIO_MPC
Definition: buffer.h:263

## ◆ dec_info_audio

const decoder_info_t dec_info_audio
| static

Initial value:
= {
.supported_types = audio_types,
.priority = 5,
}
audio_types
static const uint32_t audio_types[]
Definition: xine_musepack_decoder.c:538

## ◆ EXPORTED

const plugin_info_t xine_plugin_info [] EXPORTED

Initial value:
= {
{ PLUGIN_AUDIO_DECODER, 16, "mpc", XINE_VERSION_CODE, &dec_info_audio, &init_plugin },
{ PLUGIN_NONE, 0, NULL, 0, NULL, NULL }
}
XINE_VERSION_CODE
#define XINE_VERSION_CODE
Definition: xine_internal.h:57
init_plugin
static void * init_plugin(xine_t *xine, const void *data)
Definition: xine_musepack_decoder.c:525
dec_info_audio
static const decoder_info_t dec_info_audio
Definition: xine_musepack_decoder.c:543
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