xine-lib: xine-lib-1.2.12/src/demuxers/demux_mpeg_block.c File Reference

xine-lib 1.2.12

Data Structures | Macros | Typedefs | Functions
demux_mpeg_block.c File Reference
`#include <stdlib.h>`
`#include <stdio.h>`
`#include <fcntl.h>`
`#include <unistd.h>`
`#include <string.h>`
`#include "group_video.h"`
`#include <xine/xine_internal.h>`
`#include <xine/xineutils.h>`
`#include <xine/demux.h>`

## Data Structures
struct | demux_mpeg_block_s

## Macros
#define | LOG_MODULE "demux_mpeg_block"
#define | LOG_VERBOSE
#define | NUM_PREVIEW_BUFFERS 250
#define | DISC_TRESHOLD 90000
#define | WRAP_THRESHOLD 120000
#define | PTS_AUDIO 0
#define | PTS_VIDEO 1
#define | abs(x) ( ((x)<0) ? -(x) : (x) )

## Typedefs
typedef struct demux_mpeg_block_s | demux_mpeg_block_t

## Functions
static int32_t | parse_video_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_audio_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_ancillary_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_program_stream_system_header (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_private_stream_1 (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_private_stream_2 (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_program_stream_map (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_padding_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_ecm_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_emm_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_dsmcc_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_iec_13522_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_h222_typeA_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_h222_typeB_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_h222_typeC_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_h222_typeD_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_h222_typeE_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_IEC14496_SL_packetized_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_IEC14496_FlexMux_stream (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_program_stream_directory (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int32_t | parse_program_stream_pack_header (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static void | check_newpts (demux_mpeg_block_t *this, int64_t pts, int video)
static void | demux_mpeg_block_parse_pack (demux_mpeg_block_t *this, int preview_mode)
static int32_t | parse_pes_for_pts (demux_mpeg_block_t *this, uint8_t *p, buf_element_t *buf)
static int | demux_mpeg_block_send_chunk (demux_plugin_t *this_gen)
static void | demux_mpeg_block_dispose (demux_plugin_t *this_gen)
static int | demux_mpeg_block_get_status (demux_plugin_t *this_gen)
static int | demux_mpeg_detect_blocksize (input_plugin_t *input)
static void | demux_mpeg_block_send_headers (demux_plugin_t *this_gen)
static int | demux_mpeg_block_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static int | demux_mpeg_block_get_stream_length (demux_plugin_t *this_gen)
static uint32_t | demux_mpeg_block_get_capabilities (demux_plugin_t *this_gen)
static int | demux_mpeg_block_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_gen)
void * | demux_mpeg_block_init_class (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ abs

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

## ◆ DISC_TRESHOLD

#define DISC_TRESHOLD 90000

## ◆ LOG_MODULE

#define LOG_MODULE "demux_mpeg_block"

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ NUM_PREVIEW_BUFFERS

#define NUM_PREVIEW_BUFFERS 250

## ◆ PTS_AUDIO

#define PTS_AUDIO 0

## ◆ PTS_VIDEO

#define PTS_VIDEO 1

## ◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD 120000

## Typedef Documentation

## ◆ demux_mpeg_block_t

typedef struct demux_mpeg_block_s demux_mpeg_block_t

## Function Documentation

## ◆ check_newpts()

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

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

Referenced by parse_audio_stream(), parse_private_stream_1(), and parse_video_stream().

## ◆ demux_mpeg_block_dispose()

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

Referenced by open_plugin().

## ◆ demux_mpeg_block_get_capabilities()

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

References DEMUX_CAP_NOCAP.

Referenced by open_plugin().

## ◆ demux_mpeg_block_get_optional_data()

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

References DEMUX_OPTIONAL_UNSUPPORTED.

Referenced by open_plugin().

## ◆ demux_mpeg_block_get_status()

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

Referenced by open_plugin().

## ◆ demux_mpeg_block_get_stream_length()

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

References input().

Referenced by open_plugin().

## ◆ demux_mpeg_block_init_class()

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

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

## ◆ demux_mpeg_block_parse_pack()

static void demux_mpeg_block_parse_pack | ( | demux_mpeg_block_t * | this,
|  | int | preview_mode
| ) |  |
| static

References _, BUF_AUDIO_BASE, BUF_CONTROL_AUDIO_CHANNEL, BUF_CONTROL_BASE, BUF_CONTROL_SPU_CHANNEL, BUF_DECODER_MASK, BUF_DEMUX_BLOCK, BUF_FLAG_PREVIEW, BUF_MAJOR_MASK, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, DEMUX_FINISHED, buf_element_s::extra_info, buf_element_s::free_buffer, input(), extra_info_s::input_normpos, lprintf, NULL, parse_ancillary_stream(), parse_audio_stream(), parse_dsmcc_stream(), parse_ecm_stream(), parse_emm_stream(), parse_h222_typeA_stream(), parse_h222_typeB_stream(), parse_h222_typeC_stream(), parse_h222_typeD_stream(), parse_h222_typeE_stream(), parse_IEC14496_FlexMux_stream(), parse_IEC14496_SL_packetized_stream(), parse_iec_13522_stream(), parse_padding_stream(), parse_private_stream_1(), parse_private_stream_2(), parse_program_stream_directory(), parse_program_stream_map(), parse_program_stream_pack_header(), parse_program_stream_system_header(), parse_video_stream(), buf_element_s::type, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_mpeg_block_send_chunk(), and demux_mpeg_block_send_headers().

## ◆ demux_mpeg_block_seek()

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

References _x_demux_flush_engine(), DEMUX_OK, input(), and INPUT_CAP_SEEKABLE.

Referenced by open_plugin().

## ◆ demux_mpeg_block_send_chunk()

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

References demux_mpeg_block_parse_pack().

Referenced by open_plugin().

## ◆ demux_mpeg_block_send_headers()

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

References _x_demux_control_start(), _x_stream_info_set(), demux_mpeg_block_parse_pack(), demux_mpeg_detect_blocksize(), DEMUX_OK, input(), INPUT_CAP_SEEKABLE, NUM_PREVIEW_BUFFERS, XINE_STREAM_INFO_BITRATE, XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

Referenced by open_plugin().

## ◆ demux_mpeg_detect_blocksize()

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

References input().

Referenced by demux_mpeg_block_send_headers(), and open_plugin().

## ◆ open_plugin()

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

References xine_stream_s::content_detection_method, DEMUX_FINISHED, demux_mpeg_block_dispose(), demux_mpeg_block_get_capabilities(), demux_mpeg_block_get_optional_data(), demux_mpeg_block_get_status(), demux_mpeg_block_get_stream_length(), demux_mpeg_block_seek(), demux_mpeg_block_send_chunk(), demux_mpeg_block_send_headers(), demux_mpeg_detect_blocksize(), input(), INPUT_CAP_BLOCK, INPUT_CAP_SEEKABLE, lprintf, METHOD_BY_CONTENT, METHOD_BY_MRL, METHOD_EXPLICIT, and NULL.

Referenced by demux_mpeg_block_init_class().

## ◆ parse_ancillary_stream()

static int32_t parse_ancillary_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_audio_stream()

static int32_t parse_audio_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References BUF_AUDIO_MPEG, check_newpts(), buf_element_s::content, buf_element_s::free_buffer, lprintf, parse_pes_for_pts(), buf_element_s::pts, PTS_AUDIO, buf_element_s::size, and buf_element_s::type.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_dsmcc_stream()

static int32_t parse_dsmcc_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_ecm_stream()

static int32_t parse_ecm_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_emm_stream()

static int32_t parse_emm_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_h222_typeA_stream()

static int32_t parse_h222_typeA_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_h222_typeB_stream()

static int32_t parse_h222_typeB_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_h222_typeC_stream()

static int32_t parse_h222_typeC_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_h222_typeD_stream()

static int32_t parse_h222_typeD_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_h222_typeE_stream()

static int32_t parse_h222_typeE_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_IEC14496_FlexMux_stream()

static int32_t parse_IEC14496_FlexMux_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_IEC14496_SL_packetized_stream()

static int32_t parse_IEC14496_SL_packetized_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_iec_13522_stream()

static int32_t parse_iec_13522_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_padding_stream()

static int32_t parse_padding_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_pes_for_pts()

static int32_t parse_pes_for_pts | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References _, _x_message(), DEMUX_FINISHED, buf_element_s::extra_info, buf_element_s::free_buffer, input(), extra_info_s::input_time, lprintf, NULL, extra_info_s::total_time, xine_log(), XINE_LOG_MSG, XINE_MSG_ENCRYPTED_SOURCE, XINE_VERBOSITY_LOG, and xprintf.

Referenced by parse_audio_stream(), parse_private_stream_1(), and parse_video_stream().

## ◆ parse_private_stream_1()

static int32_t parse_private_stream_1 | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References BUF_AUDIO_A52, BUF_AUDIO_DTS, BUF_AUDIO_LPCM_BE, BUF_FLAG_SPECIAL, BUF_SPECIAL_LPCM_CONFIG, BUF_SPECIAL_SPU_DVD_SUBTYPE, BUF_SPU_CVD, BUF_SPU_DVD, BUF_SPU_SVCD, check_newpts(), buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::free_buffer, lprintf, parse_pes_for_pts(), buf_element_s::pts, PTS_AUDIO, buf_element_s::size, SPU_DVD_SUBTYPE_PACKAGE, buf_element_s::type, XINE_VERBOSITY_DEBUG, XINE_VERBOSITY_LOG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_private_stream_2()

static int32_t parse_private_stream_2 | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References _x_demux_control_newpts(), BUF_FLAG_SEEK, BUF_FLAG_SPECIAL, BUF_SPECIAL_SPU_DVD_SUBTYPE, BUF_SPU_DVD, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::extra_info, input(), extra_info_s::input_time, lprintf, buf_element_s::pts, PTS_AUDIO, PTS_VIDEO, buf_element_s::size, SPU_DVD_SUBTYPE_NAV, and buf_element_s::type.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_program_stream_directory()

static int32_t parse_program_stream_directory | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_program_stream_map()

static int32_t parse_program_stream_map | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References buf_element_s::free_buffer, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_program_stream_pack_header()

static int32_t parse_program_stream_pack_header | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References lprintf.

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_program_stream_system_header()

static int32_t parse_program_stream_system_header | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

Referenced by demux_mpeg_block_parse_pack().

## ◆ parse_video_stream()

static int32_t parse_video_stream | ( | demux_mpeg_block_t * | this,
|  | uint8_t * | p,
|  | buf_element_t * | buf
| ) |  |
| static

References BUF_VIDEO_MPEG, check_newpts(), buf_element_s::content, buf_element_s::decoder_info, lprintf, parse_pes_for_pts(), buf_element_s::pts, PTS_VIDEO, buf_element_s::size, and buf_element_s::type.

Referenced by demux_mpeg_block_parse_pack().