xine-lib: xine-lib-1.2.13/src/demuxers/demux_flac.c File Reference

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Functions | Variables
demux_flac.c File Reference
`#include <stdio.h>`
`#include <fcntl.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/compat.h>`
`#include <xine/demux.h>`
`#include "bswap.h"`
`#include "group_audio.h"`
`#include "id3.h"`
`#include "flacutils.h"`

## Data Structures
struct | demux_flac_t

## Macros
#define | LOG_MODULE "demux_flac"
#define | LOG_VERBOSE
#define | USE_FRAME_BUF

## Functions
static void | flac_init_frame_head (demux_flac_t *flac)
static void | flac_reset_head (demux_flac_t *flac)
static uint32_t | flac_test_frame_head (demux_flac_t *flac, uint32_t len)
static int | flac_parse_frame_head (demux_flac_t *flac)
static int | flac_get_frame (demux_flac_t *flac)
static int | open_flac_file (demux_flac_t *flac)
static int | demux_flac_send_chunk (demux_plugin_t *this_gen)
static void | demux_flac_send_headers (demux_plugin_t *this_gen)
static int | demux_flac_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static void | demux_flac_dispose (demux_plugin_t *this_gen)
static int | demux_flac_get_status (demux_plugin_t *this_gen)
static int | demux_flac_get_stream_length (demux_plugin_t *this_gen)
static uint32_t | demux_flac_get_capabilities (demux_plugin_t *this_gen)
static int | demux_flac_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
static demux_plugin_t * | open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
void * | demux_flac_init_plugin (xine_t *xine, const void *data)

## Variables
static const uint32_t | flac_sample_rates [16]
static const uint32_t | flac_blocksizes [16]
static const uint8_t | flac_sample_sizes [8]
static const uint8_t | flac_channels [16]

## Macro Definition Documentation

## ◆ LOG_MODULE

#define LOG_MODULE "demux_flac"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ USE_FRAME_BUF

#define USE_FRAME_BUF

## Function Documentation

## ◆ demux_flac_dispose()

static void demux_flac_dispose | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ demux_flac_get_capabilities()

static uint32_t demux_flac_get_capabilities | ( | demux_plugin_t * | this_gen | ) |
| static

References DEMUX_CAP_NOCAP.

Referenced by open_plugin().

## ◆ demux_flac_get_optional_data()

static int demux_flac_get_optional_data | ( | demux_plugin_t * | this_gen,
|  | void * | data,
|  | int | data_type )
| static

References DEMUX_OPTIONAL_UNSUPPORTED.

Referenced by open_plugin().

## ◆ demux_flac_get_status()

static int demux_flac_get_status | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ demux_flac_get_stream_length()

static int demux_flac_get_stream_length | ( | demux_plugin_t * | this_gen | ) |
| static

Referenced by open_plugin().

## ◆ demux_flac_init_plugin()

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

References demux_plugin_s::dispose, N_, NULL, demux_class_s::open_plugin, and open_plugin().

## ◆ demux_flac_seek()

static int demux_flac_seek | ( | demux_plugin_t * | this_gen,
|  | off_t | start_pos,
|  | int | start_time,
|  | int | playing )
| static

References _x_demux_control_newpts(), _x_demux_flush_engine(), BUF_FLAG_SEEK, DEMUX_FINISHED, DEMUX_OK, flac_reset_head(), input(), and NULL.

Referenced by open_plugin().

## ◆ demux_flac_send_chunk()

static int demux_flac_send_chunk | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_demux_control_newpts(), BUF_AUDIO_FLAC, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, BUF_FLAG_SEEK, buf_element_s::content, buf_element_s::decoder_flags, DEMUX_FINISHED, buf_element_s::extra_info, flac_get_frame(), buf_element_s::free_buffer, input(), extra_info_s::input_normpos, extra_info_s::input_time, buf_element_s::max_size, NULL, buf_element_s::pts, buf_element_s::size, and buf_element_s::type.

Referenced by open_plugin().

## ◆ demux_flac_send_headers()

static void demux_flac_send_headers | ( | demux_plugin_t * | this_gen | ) |
| static

References _x_demux_control_start(), _x_stream_info_set(), bits, BUF_AUDIO_FLAC, BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_STDHEADER, xine_waveformatex::cbSize, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, DEMUX_FINISHED, DEMUX_OK, FLAC_STREAMINFO_SIZE, buf_element_s::size, buf_element_s::type, XINE_STREAM_INFO_AUDIO_BITS, XINE_STREAM_INFO_AUDIO_CHANNELS, XINE_STREAM_INFO_AUDIO_SAMPLERATE, XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

Referenced by open_plugin().

## ◆ flac_get_frame()

static int flac_get_frame | ( | demux_flac_t * | flac | ) |
| static

References _X_BE_32, demux_flac_t::bits, demux_flac_t::buf_pos, demux_flac_t::filepos, flac_parse_frame_head(), demux_flac_t::frame1, demux_flac_t::frame2, demux_flac_t::frame_buf, demux_flac_t::frame_buf_filepos, demux_flac_t::frame_buf_size, demux_flac_t::frame_buf_used, demux_flac_t::frame_head, input_plugin_s::get_current_pos, demux_flac_t::hsize, demux_flac_t::input, demux_flac_t::max_size, input_plugin_s::read, demux_flac_t::stream, v, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_flac_send_chunk().

## ◆ flac_init_frame_head()

static void flac_init_frame_head | ( | demux_flac_t * | flac | ) |
| static

References demux_flac_t::frame_head_crc_tab, and v.

Referenced by open_plugin().

## ◆ flac_parse_frame_head()

static int flac_parse_frame_head | ( | demux_flac_t * | flac | ) |
| static

References _X_BE_16, _X_BE_32, demux_flac_t::bits, demux_flac_t::bsize, demux_flac_t::channels, flac_blocksizes, flac_channels, flac_sample_rates, flac_sample_sizes, flac_test_frame_head(), demux_flac_t::frame2, demux_flac_t::frame_head, demux_flac_t::hsize, demux_flac_t::max_size, demux_flac_t::num, demux_flac_t::rate, v, and demux_flac_t::vbs.

Referenced by flac_get_frame().

## ◆ flac_reset_head()

static void flac_reset_head | ( | demux_flac_t * | flac | ) |
| static

References demux_flac_t::buf_pos, demux_flac_t::frame1, demux_flac_t::frame2, demux_flac_t::frame_buf_used, and demux_flac_t::hsize.

Referenced by demux_flac_seek().

## ◆ flac_test_frame_head()

static uint32_t flac_test_frame_head | ( | demux_flac_t * | flac,
|  | uint32_t | len )
| static

References demux_flac_t::frame_head, demux_flac_t::frame_head_crc_tab, and v.

Referenced by flac_parse_frame_head().

## ◆ open_flac_file()

static int open_flac_file | ( | demux_flac_t * | flac | ) |
| static

References _X_BE_16, _X_BE_32, _X_BE_64, _x_demux_read_stream_header(), _X_LE_32, _x_meta_info_set(), _x_meta_info_set_utf8(), demux_flac_t::bits_per_sample, demux_flac_t::channels, demux_flac_t::data_size, demux_flac_t::data_start, FLAC_SEEKPOINT_SIZE, FLAC_SIGNATURE_SIZE, FLAC_STREAMINFO_SIZE, input_plugin_s::get_current_pos, input_plugin_s::get_length, demux_flac_t::input, lprintf, ME_FOURCC, flac_seekpoint_t::offset, flac_seekpoint_t::pts, input_plugin_s::read, flac_seekpoint_t::sample_number, demux_flac_t::sample_rate, input_plugin_s::seek, demux_flac_t::seekpoint_count, demux_flac_t::seekpoints, flac_seekpoint_t::size, demux_flac_t::stream, demux_flac_t::streaminfo, demux_flac_t::total_samples, XINE_META_INFO_ALBUM, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_COMPOSER, XINE_META_INFO_GENRE, XINE_META_INFO_TITLE, XINE_META_INFO_TRACK_NUMBER, XINE_META_INFO_YEAR, and xine_parse_id3v2_tag().

Referenced by open_plugin().

## ◆ open_plugin()

static demux_plugin_t * open_plugin | ( | demux_class_t * | class_gen,
|  | xine_stream_t * | stream,
|  | input_plugin_t * | input )
| static

References xine_stream_s::content_detection_method, DEMUX_FINISHED, demux_flac_dispose(), demux_flac_get_capabilities(), demux_flac_get_optional_data(), demux_flac_get_status(), demux_flac_get_stream_length(), demux_flac_seek(), demux_flac_send_chunk(), demux_flac_send_headers(), flac_init_frame_head(), input(), INPUT_IS_SEEKABLE, METHOD_BY_CONTENT, METHOD_BY_MRL, METHOD_EXPLICIT, NULL, open_flac_file(), input_plugin_s::seek, xine_stream_s::xine, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_flac_init_plugin().

## Variable Documentation

## ◆ flac_blocksizes

const uint32_t flac_blocksizes[16]
| static

Initial value:
= {
0, 192, 576, 2 * 576,
4 * 576, 8 * 576, 1, 2,
256, 2 * 256, 4 * 256, 8 * 256,
16 * 256, 32 * 256, 64 * 256, 128 * 256
}

Referenced by flac_parse_frame_head().

## ◆ flac_channels

const uint8_t flac_channels[16]
| static

Initial value:
= {
1,
2,
3,
4,
5,
6,
7,
8,
2,
2,
2,
0,
0,
0,
0,
0
}

Referenced by flac_parse_frame_head().

## ◆ flac_sample_rates

const uint32_t flac_sample_rates[16]
| static

Initial value:
= {
0, 88200, 176400, 192000,
8000, 16000, 22050, 24000,
32000, 44100, 48000, 96000,
1, 2, 3, 0
}

Referenced by flac_parse_frame_head().

## ◆ flac_sample_sizes

const uint8_t flac_sample_sizes[8]
| static

Initial value:
= {
0, 8, 12, 0,
16, 20, 24, 0
}

Referenced by flac_parse_frame_head().