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

xine-lib 1.2.13-20230125hg15249

Data Structures | Macros | Functions
demux_real.c File Reference
`#include <stdio.h>`
`#include <fcntl.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include <stdlib.h>`
`#include <ctype.h>`
`#include "group_video.h"`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/compat.h>`
`#include <xine/demux.h>`
`#include "bswap.h"`
`#include "demux_real_common.h"`

## Data Structures
struct | mdpr_t
struct | real_index_entry_t
struct | real_stream_t
struct | demux_real_t

## Macros
#define | LOG_MODULE "demux_real"
#define | LOG_VERBOSE
#define | FOURCC_TAG BE_FOURCC
#define | PROP_TAG FOURCC_TAG('P', 'R', 'O', 'P')
#define | MDPR_TAG FOURCC_TAG('M', 'D', 'P', 'R')
#define | CONT_TAG FOURCC_TAG('C', 'O', 'N', 'T')
#define | DATA_TAG FOURCC_TAG('D', 'A', 'T', 'A')
#define | RA_TAG FOURCC_TAG('.', 'r', 'a', 0xfd)
#define | VIDO_TAG FOURCC_TAG('V', 'I', 'D', 'O')
#define | PREAMBLE_SIZE 8
#define | REAL_SIGNATURE_SIZE 8
#define | DATA_CHUNK_HEADER_SIZE 10
#define | DATA_PACKET_HEADER_SIZE 12
#define | INDEX_CHUNK_HEADER_SIZE 20
#define | INDEX_RECORD_SIZE 14
#define | PN_KEYFRAME_FLAG 0x0002
#define | MAX_VIDEO_STREAMS 10
#define | MAX_AUDIO_STREAMS 8
#define | FRAGMENT_TAB_SIZE 256
#define | ALIGN4(q) q = (uint8_t *)(((uintptr_t)q + 3) & ~(uintptr_t)3)
#define | SET_METADATA_STRING(type)
#define | abs(x) ( ((x)<0) ? -(x) : (x) )
#define | WRAP_THRESHOLD 220000
#define | PTS_AUDIO 0
#define | PTS_VIDEO 1
#define | PTS_BOTH 2
#define | NEEDBYTES(n)
#define | my_strnstr(haystack, haystacklen, needle) memmem(haystack, haystacklen, needle, sizeof(needle))

## Functions
static void | real_parse_index (demux_real_t *this)
static mdpr_t * | real_parse_mdpr (const char *data, uint32_t size)
static void | real_free_mdpr (mdpr_t *mdpr)
static int | real_parse_audio_specific_data (demux_real_t *this, real_stream_t *stream)
static void | real_parse_headers (demux_real_t *this)
static int | demux_real_parse_references (demux_real_t *this)
static void | check_newpts (demux_real_t *this, int64_t pts, int video, int preview)
static uint32_t | real_get_reordered_pts (demux_real_t *this, uint8_t *hdr, uint32_t dts)
static void | demux_real_flush (demux_real_t *this)
static int | demux_real_send_chunk (demux_plugin_t *this_gen)
static void | demux_real_send_headers (demux_plugin_t *this_gen)
static int | demux_real_find_time (real_index_entry_t *index, int n, uint32_t t)
static int | demux_real_find_offs (real_index_entry_t *index, int n, uint32_t offs)
static int | demux_real_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static void | demux_real_dispose (demux_plugin_t *this_gen)
static int | demux_real_get_status (demux_plugin_t *this_gen)
static int | demux_real_get_stream_length (demux_plugin_t *this_gen)
static uint32_t | demux_real_get_capabilities (demux_plugin_t *this_gen)
static int | demux_real_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
static int | real_check_stream_type (input_plugin_t *input)
static demux_plugin_t * | open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
void * | demux_real_init_class (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ abs

#define abs | ( |  | x | ) | ( ((x)<0) ? -(x) : (x) )

Referenced by check_newpts().

## ◆ ALIGN4

#define ALIGN4 | ( |  | q | ) | q = (uint8_t *)(((uintptr_t)q + 3) & ~(uintptr_t)3)

Referenced by real_parse_mdpr().

## ◆ CONT_TAG

#define CONT_TAG FOURCC_TAG('C', 'O', 'N', 'T')

Referenced by pnm_get_chunk(), real_parse_headers(), and rmff_new_cont().

## ◆ DATA_CHUNK_HEADER_SIZE

#define DATA_CHUNK_HEADER_SIZE 10

Referenced by demux_real_send_chunk(), and real_parse_headers().

## ◆ DATA_PACKET_HEADER_SIZE

#define DATA_PACKET_HEADER_SIZE 12

Referenced by demux_real_send_chunk().

## ◆ DATA_TAG

#define DATA_TAG FOURCC_TAG('D', 'A', 'T', 'A')

Referenced by real_parse_headers().

## ◆ FOURCC_TAG

#define FOURCC_TAG BE_FOURCC

## ◆ FRAGMENT_TAB_SIZE

#define FRAGMENT_TAB_SIZE 256

Referenced by real_parse_headers().

## ◆ INDEX_CHUNK_HEADER_SIZE

#define INDEX_CHUNK_HEADER_SIZE 20

Referenced by real_parse_index().

## ◆ INDEX_RECORD_SIZE

#define INDEX_RECORD_SIZE 14

Referenced by real_parse_index().

## ◆ LOG_MODULE

#define LOG_MODULE "demux_real"

Referenced by real_parse_headers().

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MAX_AUDIO_STREAMS

#define MAX_AUDIO_STREAMS 8

Referenced by real_parse_headers().

## ◆ MAX_VIDEO_STREAMS

#define MAX_VIDEO_STREAMS 10

Referenced by real_parse_headers().

## ◆ MDPR_TAG

#define MDPR_TAG FOURCC_TAG('M', 'D', 'P', 'R')

Referenced by pnm_get_chunk(), real_parse_headers(), and rmff_new_mdpr().

## ◆ my_strnstr

#define my_strnstr | ( |  | haystack,
|  |  | haystacklen,
|  |  | needle ) memmem(haystack, haystacklen, needle, sizeof(needle))

Referenced by real_check_stream_type().

## ◆ NEEDBYTES

#define NEEDBYTES | ( |  | n | ) |

Value:
{ \
int need = n - (q - p); \
if (need > 0) { \
if (this->input->read (this->input, q, need) != need) \
goto fail0; \
q += need; \
} \
}
input
static int input(void)
Definition goomsl_lex.c:1495

Referenced by demux_real_send_chunk().

## ◆ PN_KEYFRAME_FLAG

#define PN_KEYFRAME_FLAG 0x0002

Referenced by demux_real_send_chunk().

## ◆ PREAMBLE_SIZE

#define PREAMBLE_SIZE 8

Referenced by demux_real_send_chunk(), and real_parse_headers().

## ◆ PROP_TAG

#define PROP_TAG FOURCC_TAG('P', 'R', 'O', 'P')

Referenced by pnm_get_chunk(), pnm_get_headers(), real_parse_headers(), and rmff_new_prop().

## ◆ PTS_AUDIO

#define PTS_AUDIO 0

Referenced by demux_real_send_chunk().

## ◆ PTS_BOTH

#define PTS_BOTH 2

Referenced by demux_real_seek(), and demux_real_send_headers().

## ◆ PTS_VIDEO

#define PTS_VIDEO 1

Referenced by demux_real_send_chunk().

## ◆ RA_TAG

#define RA_TAG FOURCC_TAG('.', 'r', 'a', 0xfd)

Referenced by real_parse_headers().

## ◆ REAL_SIGNATURE_SIZE

#define REAL_SIGNATURE_SIZE 8

Referenced by real_parse_headers().

## ◆ SET_METADATA_STRING

#define SET_METADATA_STRING | ( |  | type | ) |

Value:
do { \
const uint16_t field_size = _X_BE_16(&chunk_buffer[stream_ptr]); \
stream_ptr += 2; \
_x_meta_info_n_set(this->stream, type, (char *)&chunk_buffer[stream_ptr], field_size); \
stream_ptr += field_size; \
} while(0)
_X_BE_16
#define _X_BE_16(x)
Definition bswap.h:40
type
_xine_arg_type_t type
Definition xine.c:1574

Referenced by real_parse_headers().

## ◆ VIDO_TAG

#define VIDO_TAG FOURCC_TAG('V', 'I', 'D', 'O')

Referenced by real_parse_headers().

## ◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD 220000

Referenced by check_newpts().

## Function Documentation

## ◆ check_newpts()

static void check_newpts | ( | demux_real_t * | this,
|  | int64_t | pts,
|  | int | video,
|  | int | preview )
| static

References _x_demux_control_newpts(), abs, BUF_FLAG_SEEK, and WRAP_THRESHOLD.

Referenced by demux_real_send_chunk().

## ◆ demux_real_dispose()

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

References demux_real_flush(), and real_free_mdpr().

Referenced by open_plugin().

## ◆ demux_real_find_offs()

static int demux_real_find_offs | ( | real_index_entry_t * | index,
|  | int | n,
|  | uint32_t | offs )
| static

Referenced by demux_real_seek().

## ◆ demux_real_find_time()

static int demux_real_find_time | ( | real_index_entry_t * | index,
|  | int | n,
|  | uint32_t | t )
| static

Referenced by demux_real_seek().

## ◆ demux_real_flush()

static void demux_real_flush | ( | demux_real_t * | this | ) |
| static

References NULL.

Referenced by demux_real_dispose(), and demux_real_seek().

## ◆ demux_real_get_capabilities()

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

References DEMUX_CAP_NOCAP.

Referenced by open_plugin().

## ◆ demux_real_get_optional_data()

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

References DEMUX_OPTIONAL_UNSUPPORTED.

Referenced by open_plugin().

## ◆ demux_real_get_status()

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

Referenced by open_plugin().

## ◆ demux_real_get_stream_length()

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

Referenced by open_plugin().

## ◆ demux_real_init_class()

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

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

## ◆ demux_real_parse_references()

static int demux_real_parse_references | ( | demux_real_t * | this | ) |
| static

References _x_demux_send_mrl_reference(), buf_used(), DEMUX_FINISHED, input(), lprintf, and NULL.

Referenced by demux_real_send_chunk().

## ◆ demux_real_seek()

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

References _x_demux_flush_engine(), DEMUX_OK, demux_real_find_offs(), demux_real_find_time(), demux_real_flush(), input(), INPUT_CAP_SEEKABLE, lprintf, NULL, real_index_entry_t::offset, and PTS_BOTH.

Referenced by open_plugin().

## ◆ demux_real_send_chunk()

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

References _X_BE_16, _X_BE_32, _x_demux_read_send_data(), _x_demux_send_data(), _x_is_fourcc(), BUF_AUDIO_AAC, BUF_FLAG_FRAME_END, BUF_FLAG_FRAME_START, BUF_FLAG_KEYFRAME, BUF_FLAG_SPECIAL, BUF_SPECIAL_RV_CHUNK_TABLE, BUF_VIDEO_RV30, BUF_VIDEO_RV40, check_newpts(), buf_element_s::content, DATA_CHUNK_HEADER_SIZE, DATA_PACKET_HEADER_SIZE, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, DEMUX_FINISHED, demux_real_parse_references(), demux_real_sipro_swap(), buf_element_s::extra_info, buf_element_s::free_buffer, input(), extra_info_s::input_normpos, extra_info_s::input_time, lprintf, buf_element_s::max_size, ME_FOURCC, MIN, NEEDBYTES, NULL, PN_KEYFRAME_FLAG, PREAMBLE_SIZE, buf_element_s::pts, PTS_AUDIO, PTS_VIDEO, real_get_reordered_pts(), buf_element_s::size, extra_info_s::total_time, buf_element_s::type, xine_fast_memcpy, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ demux_real_send_headers()

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

References _x_stream_info_set(), DEMUX_OK, input(), INPUT_CAP_SEEKABLE, PTS_BOTH, real_parse_headers(), demux_plugin_s::seek, XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

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_real_dispose(), demux_real_get_capabilities(), demux_real_get_optional_data(), demux_real_get_status(), demux_real_get_stream_length(), demux_real_seek(), demux_real_send_chunk(), demux_real_send_headers(), input(), lprintf, METHOD_BY_CONTENT, METHOD_BY_MRL, METHOD_EXPLICIT, NULL, and real_check_stream_type().

Referenced by demux_real_init_class().

## ◆ real_check_stream_type()

static int real_check_stream_type | ( | input_plugin_t * | input | ) |
| static

References _x_demux_read_header(), input(), MIN, and my_strnstr.

Referenced by open_plugin().

## ◆ real_free_mdpr()

static void real_free_mdpr | ( | mdpr_t * | mdpr | ) |
| static

Referenced by demux_real_dispose(), and real_parse_headers().

## ◆ real_get_reordered_pts()

static uint32_t real_get_reordered_pts | ( | demux_real_t * | this,
|  | uint8_t * | hdr,
|  | uint32_t | dts )
| static

References BUF_VIDEO_RV20, BUF_VIDEO_RV30, BUF_VIDEO_RV40, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_real_send_chunk().

## ◆ real_parse_audio_specific_data()

static int real_parse_audio_specific_data | ( | demux_real_t * | this,
|  | real_stream_t * | stream )
| static

References _X_BE_16, _X_BE_32, _X_ME_32, _x_tag32_me2str(), mdpr_t::avg_bit_rate, real_stream_t::block_align, real_stream_t::cfs, fourcc, real_stream_t::fourcc, real_stream_t::frame_buffer, real_stream_t::frame_num_bytes, real_stream_t::frame_size, real_stream_t::h, real_stream_t::intl, real_stream_t::mdpr, ME_FOURCC, NULL, real_stream_t::sps, mdpr_t::start_time, mdpr_t::stream_number, real_stream_t::sub_packet_cnt, mdpr_t::type_specific_data, mdpr_t::type_specific_len, real_stream_t::w, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by real_parse_headers().

## ◆ real_parse_headers()

static void real_parse_headers | ( | demux_real_t * | this | ) |
| static

References _X_BE_16, _X_BE_32, _x_demux_control_start(), _x_formattag_to_buf_audio(), _x_fourcc_to_buf_video(), _x_is_fourcc(), _X_ME_32, _x_report_video_fourcc(), _x_stream_info_set(), _x_tag32_me2str(), mdpr_t::avg_bit_rate, xine_bmiheader::biHeight, xine_bmiheader::biSize, xine_bmiheader::biWidth, BUF_AUDIO_AAC, BUF_AUDIO_UNKNOWN, BUF_FLAG_FRAME_END, BUF_FLAG_HEADER, BUF_FLAG_SPECIAL, BUF_FLAG_STDHEADER, BUF_SPECIAL_DECODER_CONFIG, real_stream_t::buf_type, BUF_VIDEO_UNKNOWN, CONT_TAG, buf_element_s::content, DATA_CHUNK_HEADER_SIZE, DATA_TAG, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, DEMUX_FINISHED, buf_element_s::extra_info, real_stream_t::format, fourcc, real_stream_t::fourcc, FRAGMENT_TAB_SIZE, buf_element_s::free_buffer, real_stream_t::index, input(), INPUT_CAP_CLONE, INPUT_CAP_PREVIEW, INPUT_IS_SEEKABLE, extra_info_s::input_normpos, INPUT_OPTIONAL_DATA_CLONE, INPUT_OPTIONAL_DATA_PREVIEW, INPUT_OPTIONAL_SUCCESS, extra_info_s::input_time, LOG_MODULE, lprintf, MAX_AUDIO_STREAMS, MAX_PREVIEW_SIZE, buf_element_s::max_size, MAX_VIDEO_STREAMS, real_stream_t::mdpr, MDPR_TAG, ME_FOURCC, buf_element_s::mem, mdpr_t::mime_type, NULL, PREAMBLE_SIZE, PROP_TAG, RA_TAG, real_free_mdpr(), real_parse_audio_specific_data(), real_parse_index(), real_parse_mdpr(), REAL_SIGNATURE_SIZE, input_plugin_s::seek, SET_METADATA_STRING, buf_element_s::size, mdpr_t::start_time, mdpr_t::stream_number, buf_element_s::type, mdpr_t::type_specific_data, mdpr_t::type_specific_len, VIDO_TAG, XINE_META_INFO_ARTIST, XINE_META_INFO_COMMENT, XINE_META_INFO_TITLE, XINE_META_INFO_YEAR, XINE_STREAM_INFO_AUDIO_BITRATE, XINE_STREAM_INFO_AUDIO_FOURCC, XINE_STREAM_INFO_BITRATE, XINE_STREAM_INFO_HAS_AUDIO, XINE_STREAM_INFO_HAS_VIDEO, XINE_STREAM_INFO_VIDEO_BITRATE, XINE_STREAM_INFO_VIDEO_FOURCC, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_real_send_headers().

## ◆ real_parse_index()

static void real_parse_index | ( | demux_real_t * | this | ) |
| static

References _X_BE_16, _X_BE_32, _x_is_fourcc(), INDEX_CHUNK_HEADER_SIZE, INDEX_RECORD_SIZE, input(), lprintf, NULL, real_index_entry_t::offset, real_index_entry_t::packetno, real_index_entry_t::timestamp, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by real_parse_headers().

## ◆ real_parse_mdpr()

static mdpr_t * real_parse_mdpr | ( | const char * | data,
|  | uint32_t | size )
| static

References _X_BE_16, _X_BE_32, ALIGN4, mdpr_t::avg_bit_rate, mdpr_t::avg_packet_size, mdpr_t::duration, lprintf, mdpr_t::max_bit_rate, mdpr_t::max_packet_size, mdpr_t::mime_type, mdpr_t::mime_type_size, NULL, mdpr_t::object_version, mdpr_t::preroll, mdpr_t::start_time, mdpr_t::stream_name, mdpr_t::stream_name_size, mdpr_t::stream_number, mdpr_t::type_specific_data, mdpr_t::type_specific_len, and xine_hexdump().

Referenced by real_parse_headers().