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_treal_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_topen_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)

◆ CONT_TAG

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

◆ DATA_CHUNK_HEADER_SIZE

#define DATA_CHUNK_HEADER_SIZE   10

◆ 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')

◆ my_strnstr

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

◆ 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; \
} \
}
static int input(void)
Definition goomsl_lex.c:1495

◆ PN_KEYFRAME_FLAG

#define PN_KEYFRAME_FLAG   0x0002

Referenced by demux_real_send_chunk().

◆ PREAMBLE_SIZE

#define PREAMBLE_SIZE   8

◆ PROP_TAG

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

◆ PTS_AUDIO

#define PTS_AUDIO   0

Referenced by demux_real_send_chunk().

◆ PTS_BOTH

#define PTS_BOTH   2

◆ 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)
#define _X_BE_16(x)
Definition bswap.h:40
_xine_arg_type_t type
Definition xine.c:1574

◆ 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

◆ 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 )

◆ demux_real_parse_references()

static int demux_real_parse_references ( demux_real_t * this)
static

◆ demux_real_seek()

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

◆ demux_real_send_chunk()

static int demux_real_send_chunk ( demux_plugin_t * this_gen)
static

◆ demux_real_send_headers()

static void demux_real_send_headers ( demux_plugin_t * this_gen)
static

◆ open_plugin()

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

◆ 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

◆ real_get_reordered_pts()

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

◆ real_parse_audio_specific_data()

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

◆ 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

◆ real_parse_mdpr()

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