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

xine-lib 1.2.12

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

## Data Structures
struct | demux_ts_media
struct | demux_ts_spu_lang
struct | demux_ts_audio_track
struct | demux_ts_pmt
struct | demux_ts_t

## Macros
#define | LOG_MODULE "demux_ts"
#define | LOG_VERBOSE
#define | LOG_DYNAMIC_PMT
#define | DUMP_VIDEO_HEADS
#define | TS_PACKET_READER 2
#define | TSP_sync_byte 0xff000000
#define | TSP_transport_error 0x00800000
#define | TSP_payload_unit_start 0x00400000
#define | TSP_transport_priority 0x00200000
#define | TSP_pid 0x001fff00
#define | TSP_scrambling_control 0x000000c0
#define | TSP_adaptation_field_1 0x00000020
#define | TSP_adaptation_field_0 0x00000010
#define | TSP_continuity_counter 0x0000000f
#define | PKT_SIZE 188
#define | BODY_SIZE (188 - 4)
#define | MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40
#define | MAX_PMTS 126
#define | PAT_BUF_SIZE (4 * MAX_PMTS + 20)
#define | MAX_PROGRAMS MAX_PMTS
#define | SYNC_BYTE 0x47
#define | BUF_SIZE (2 * 9024)
#define | SMALL_BUF_SIZE (1 * 9024)
#define | CORRUPT_PES_THRESHOLD 10
#define | NULL_PID 0x1fff
#define | INVALID_PID ((unsigned int)(-1))
#define | INVALID_PROGRAM ((unsigned int)(-1))
#define | INVALID_CC ((unsigned int)(-1))
#define | PROG_STREAM_MAP 0xBC
#define | PRIVATE_STREAM1 0xBD
#define | PADDING_STREAM 0xBE
#define | PRIVATE_STREAM2 0xBF
#define | AUDIO_STREAM_S 0xC0
#define | AUDIO_STREAM_E 0xDF
#define | VIDEO_STREAM_S 0xE0
#define | VIDEO_STREAM_E 0xEF
#define | ECM_STREAM 0xF0
#define | EMM_STREAM 0xF1
#define | DSM_CC_STREAM 0xF2
#define | ISO13522_STREAM 0xF3
#define | PROG_STREAM_DIR 0xFF
#define | DESCRIPTOR_REG_FORMAT 0x05
#define | DESCRIPTOR_LANG 0x0a
#define | DESCRIPTOR_TELETEXT 0x56
#define | DESCRIPTOR_DVBSUB 0x59
#define | DESCRIPTOR_AC3 0x6a
#define | DESCRIPTOR_EAC3 0x7a
#define | DESCRIPTOR_DTS 0x7b
#define | DESCRIPTOR_AAC 0x7c
#define | WRAP_THRESHOLD 360000
#define | PTS_AUDIO 0
#define | PTS_VIDEO 1
#define | TBRE_MIN_TIME ( 2 * 90000)
#define | TBRE_TIME (480 * 90000)
#define | TBRE_MODE_PROBE 0
#define | TBRE_MODE_AUDIO_PTS 1
#define | TBRE_MODE_AUDIO_PCR 2
#define | TBRE_MODE_PCR 3
#define | TBRE_MODE_DONE 4
#define | MIN(a, b) ((a)<(b)?(a):(b))
#define | MAX(a, b) ((a)>(b)?(a):(b))
#define | PES_FLUSHED 1
#define | PES_RESUME 2
#define | MAX_SPU_LANGS 32
#define | MAX_AUDIO_TRACKS 32
#define | ts_abs(x) (((x) < 0) ? -(x) : (x))

## Enumerations
enum | streamType { ISO_11172_VIDEO = 0x01 , ISO_13818_VIDEO = 0x02 , ISO_11172_AUDIO = 0x03 , ISO_13818_AUDIO = 0x04 , ISO_13818_PRIVATE = 0x05 , ISO_13818_PES_PRIVATE = 0x06 , ISO_13522_MHEG = 0x07 , ISO_13818_DSMCC = 0x08 , ISO_13818_TYPE_A = 0x0a , ISO_13818_TYPE_B = 0x0b , ISO_13818_TYPE_C = 0x0c , ISO_13818_TYPE_D = 0x0d , ISO_13818_AUX = 0x0e , ISO_13818_PART7_AUDIO = 0x0f , ISO_14496_PART2_VIDEO = 0x10 , ISO_14496_PART3_AUDIO = 0x11 , ISO_14496_PART10_VIDEO = 0x1b , STREAM_VIDEO_HEVC = 0x24 , STREAM_VIDEO_MPEG = 0x80 , STREAM_AUDIO_AC3 = 0x81 , STREAM_VIDEO_VC1 = 0xea , HDMV_AUDIO_80_PCM = 0x80 , HDMV_AUDIO_82_DTS = 0x82 , HDMV_AUDIO_83_TRUEHD = 0x83 , HDMV_AUDIO_84_EAC3 = 0x84 , HDMV_AUDIO_85_DTS_HRA = 0x85 , HDMV_AUDIO_86_DTS_HD_MA = 0x86 , HDMV_SPU_BITMAP = 0x90 , HDMV_SPU_INTERACTIVE = 0x91 , HDMV_SPU_TEXT = 0x92 , HDMV_AUDIO_A1_EAC3_SEC = 0xa1 , HDMV_AUDIO_A2_DTSHD_SEC = 0xa2 , STREAM_AUDIO_EAC3 = ( 0x7a << 8) , STREAM_AUDIO_DTS = ( 0x7b << 8) }
enum | frametype_t { FRAMETYPE_UNKNOWN = 0 , FRAMETYPE_I , FRAMETYPE_P , FRAMETYPE_B }

## Functions
static frametype_t | frametype_h264 (const uint8_t *f, uint32_t len)
static frametype_t | frametype_h265 (const uint8_t *f, uint32_t len)
static frametype_t | frametype_mpeg (const uint8_t *f, uint32_t len)
static frametype_t | frametype_vc1 (const uint8_t *f, uint32_t len)
static void | demux_ts_hexdump (demux_ts_t *this, const char *intro, const uint8_t *p, uint32_t len)
static void | reset_track_map (fifo_buffer_t *fifo)
static int | demux_ts_dynamic_pmt_find (demux_ts_t *this, int pid, int type, unsigned int descriptor_tag)
static void | demux_ts_dynamic_pmt_clean (demux_ts_t *this)
static void | demux_ts_dynamic_pmt_clear (demux_ts_t *this)
static void | demux_ts_tbre_reset (demux_ts_t *this)
static void | demux_ts_tbre_update (demux_ts_t *this, unsigned int mode, int64_t now)
static void | newpts_test (demux_ts_t *this, int64_t pts, int video)
static void | demux_send_special_spu_buf (demux_ts_t *this, uint32_t spu_type, int spu_channel)
static void | demux_ts_send_buffer (demux_ts_t *this, demux_ts_media *m, int flags)
static void | demux_ts_flush_media (demux_ts_t *this, demux_ts_media *m)
static void | demux_ts_update_spu_channel (demux_ts_t *this)
static void | post_sequence_end (fifo_buffer_t *fifo, uint32_t video_type)
static void | demux_ts_flush (demux_ts_t *this)
static void | demux_ts_parse_pat (demux_ts_t *this, const uint8_t *pkt, unsigned int pusi, unsigned int len)
static int | demux_ts_parse_pes_header (demux_ts_t *this, demux_ts_media *m, const uint8_t *buf, unsigned int packet_len)
static void | update_extra_info (demux_ts_t *this, demux_ts_media *m)
static void | demux_ts_buffer_pes (demux_ts_t *this, const uint8_t *ts, unsigned int mediaIndex, unsigned int tsp_head, unsigned int len)
static void | demux_ts_get_lang_desc (demux_ts_t *this, char *dest, const uint8_t *data, int length)
static uint32_t | demux_ts_get_reg_desc (demux_ts_t *this, const uint8_t *data, int length)
static void | demux_ts_parse_pmt (demux_ts_t *this, const uint8_t *pkt, unsigned int pusi, unsigned int plen, uint32_t program_count, uint32_t pid)
static int64_t | demux_ts_adaptation_field_parse (const uint8_t *data, uint32_t adaptation_field_length)
static int | sync_ts (const uint8_t *buf, int len)
static int | sync_hdmv (const uint8_t *buf, int len)
static const uint8_t * | sync_next (demux_ts_t *this)
static void | demux_ts_parse_packet (demux_ts_t *this)
static int | demux_ts_parse_pat_pmt_packet (demux_ts_t *this)
static void | demux_ts_scan_pat_pmt (demux_ts_t *this)
static void | demux_ts_event_handler (demux_ts_t *this)
static int | demux_ts_send_chunk (demux_plugin_t *this_gen)
static void | demux_ts_dispose (demux_plugin_t *this_gen)
static int | demux_ts_get_status (demux_plugin_t *this_gen)
static void | demux_ts_send_headers (demux_plugin_t *this_gen)
static int | demux_ts_seek (demux_plugin_t *this_gen, off_t start_pos, int start_time, int playing)
static int | demux_ts_get_stream_length (demux_plugin_t *this_gen)
static uint32_t | demux_ts_get_capabilities (demux_plugin_t *this_gen)
static int | demux_ts_get_optional_data (demux_plugin_t *this_gen, void *data, int data_type)
static int | detect_ts (const uint32_t *buf, size_t len)
static demux_plugin_t * | open_plugin (demux_class_t *class_gen, xine_stream_t *stream, input_plugin_t *input)
void * | demux_ts_init_class (xine_t *xine, const void *data)

## Macro Definition Documentation

## ◆ AUDIO_STREAM_E

#define AUDIO_STREAM_E 0xDF

## ◆ AUDIO_STREAM_S

#define AUDIO_STREAM_S 0xC0

## ◆ BODY_SIZE

#define BODY_SIZE (188 - 4)

## ◆ BUF_SIZE

#define BUF_SIZE (2 * 9024)

## ◆ CORRUPT_PES_THRESHOLD

#define CORRUPT_PES_THRESHOLD 10

## ◆ DESCRIPTOR_AAC

#define DESCRIPTOR_AAC 0x7c

## ◆ DESCRIPTOR_AC3

#define DESCRIPTOR_AC3 0x6a

## ◆ DESCRIPTOR_DTS

#define DESCRIPTOR_DTS 0x7b

## ◆ DESCRIPTOR_DVBSUB

#define DESCRIPTOR_DVBSUB 0x59

## ◆ DESCRIPTOR_EAC3

#define DESCRIPTOR_EAC3 0x7a

## ◆ DESCRIPTOR_LANG

#define DESCRIPTOR_LANG 0x0a

## ◆ DESCRIPTOR_REG_FORMAT

#define DESCRIPTOR_REG_FORMAT 0x05

## ◆ DESCRIPTOR_TELETEXT

#define DESCRIPTOR_TELETEXT 0x56

## ◆ DSM_CC_STREAM

#define DSM_CC_STREAM 0xF2

## ◆ DUMP_VIDEO_HEADS

#define DUMP_VIDEO_HEADS

## ◆ ECM_STREAM

#define ECM_STREAM 0xF0

## ◆ EMM_STREAM

#define EMM_STREAM 0xF1

## ◆ INVALID_CC

#define INVALID_CC ((unsigned int)(-1))

## ◆ INVALID_PID

#define INVALID_PID ((unsigned int)(-1))

## ◆ INVALID_PROGRAM

#define INVALID_PROGRAM ((unsigned int)(-1))

## ◆ ISO13522_STREAM

#define ISO13522_STREAM 0xF3

## ◆ LOG_DYNAMIC_PMT

#define LOG_DYNAMIC_PMT

## ◆ LOG_MODULE

#define LOG_MODULE "demux_ts"

HOW TO IMPLEMENT A DVBSUB DECODER.

The DVBSUB protocol is specified in ETSI EN 300 743. It can be downloaded for free (registration required, though) from www.etsi.org.

The spu_decoder should handle the packet type BUF_SPU_DVB.

BUF_SPU_DVBSUB packets without the flag BUF_FLAG_SPECIAL contain the payload of the PES packets carrying DVBSUB data. Since the payload can be broken up over several buf_element_t and the DVBSUB is PES oriented, the decoder_info[2] field (low 16 bits) is used to convey the packet boundaries to the decoder:

- For the first buffer of a packet, buf->content points to the first byte of the PES payload. decoder_info[2] is set to the length of the payload. The decoder can use this value to determine when a complete PES packet has been collected.
- For the following buffers of the PES packet, decoder_info[2] is 0.

The decoder can either use this information to reconstruct the PES payload, or ignore it and implement a parser that handles the irregularites at the start and end of PES packets.

In any case buf->pts is always set to the PTS of the PES packet.

BUF_SPU_DVB with BUF_FLAG_SPECIAL set contains no payload, and is used to pass control information to the decoder.

If decoder_info[1] == BUF_SPECIAL_SPU_DVB_DESCRIPTOR then decoder_info_ptr[2] either points to a spu_dvb_descriptor_t or is NULL.

If it is 0, the user has disabled the subtitling, or has selected a channel that is not present in the stream. The decoder should remove any visible subtitling.

If it is a pointer, the decoder should reset itself and start extracting the subtitle service identified by comp_page_id and aux_page_id in the spu_dvb_descriptor_t, (the composition and auxilliary page ids, respectively).

## ◆ LOG_VERBOSE

#define LOG_VERBOSE

## ◆ MAX

#define MAX | ( |  | a,
|  |  | b
| ) |  | ((a)>(b)?(a):(b))

## ◆ MAX_AUDIO_TRACKS

#define MAX_AUDIO_TRACKS 32

## ◆ MAX_PIDS

#define MAX_PIDS ((BODY_SIZE - 1 - 13) / 4) + 40

## ◆ MAX_PMTS

#define MAX_PMTS 126

## ◆ MAX_PROGRAMS

#define MAX_PROGRAMS MAX_PMTS

## ◆ MAX_SPU_LANGS

#define MAX_SPU_LANGS 32

## ◆ MIN

#define MIN | ( |  | a,
|  |  | b
| ) |  | ((a)<(b)?(a):(b))

## ◆ NULL_PID

#define NULL_PID 0x1fff

## ◆ PADDING_STREAM

#define PADDING_STREAM 0xBE

## ◆ PAT_BUF_SIZE

#define PAT_BUF_SIZE (4 * MAX_PMTS + 20)

## ◆ PES_FLUSHED

#define PES_FLUSHED 1

## ◆ PES_RESUME

#define PES_RESUME 2

## ◆ PKT_SIZE

#define PKT_SIZE 188

## ◆ PRIVATE_STREAM1

#define PRIVATE_STREAM1 0xBD

## ◆ PRIVATE_STREAM2

#define PRIVATE_STREAM2 0xBF

## ◆ PROG_STREAM_DIR

#define PROG_STREAM_DIR 0xFF

## ◆ PROG_STREAM_MAP

#define PROG_STREAM_MAP 0xBC

## ◆ PTS_AUDIO

#define PTS_AUDIO 0

## ◆ PTS_VIDEO

#define PTS_VIDEO 1

## ◆ SMALL_BUF_SIZE

#define SMALL_BUF_SIZE (1 * 9024)

## ◆ SYNC_BYTE

#define SYNC_BYTE 0x47

## ◆ TBRE_MIN_TIME

#define TBRE_MIN_TIME ( 2 * 90000)

## ◆ TBRE_MODE_AUDIO_PCR

#define TBRE_MODE_AUDIO_PCR 2

## ◆ TBRE_MODE_AUDIO_PTS

#define TBRE_MODE_AUDIO_PTS 1

## ◆ TBRE_MODE_DONE

#define TBRE_MODE_DONE 4

## ◆ TBRE_MODE_PCR

#define TBRE_MODE_PCR 3

## ◆ TBRE_MODE_PROBE

#define TBRE_MODE_PROBE 0

## ◆ TBRE_TIME

#define TBRE_TIME (480 * 90000)

## ◆ ts_abs

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

## ◆ TS_PACKET_READER

#define TS_PACKET_READER 2

## ◆ TSP_adaptation_field_0

#define TSP_adaptation_field_0 0x00000010

## ◆ TSP_adaptation_field_1

#define TSP_adaptation_field_1 0x00000020

## ◆ TSP_continuity_counter

#define TSP_continuity_counter 0x0000000f

## ◆ TSP_payload_unit_start

#define TSP_payload_unit_start 0x00400000

## ◆ TSP_pid

#define TSP_pid 0x001fff00

## ◆ TSP_scrambling_control

#define TSP_scrambling_control 0x000000c0

## ◆ TSP_sync_byte

#define TSP_sync_byte 0xff000000

## ◆ TSP_transport_error

#define TSP_transport_error 0x00800000

## ◆ TSP_transport_priority

#define TSP_transport_priority 0x00200000

## ◆ VIDEO_STREAM_E

#define VIDEO_STREAM_E 0xEF

## ◆ VIDEO_STREAM_S

#define VIDEO_STREAM_S 0xE0

## ◆ WRAP_THRESHOLD

#define WRAP_THRESHOLD 360000

## Enumeration Type Documentation

## ◆ frametype_t

enum frametype_t

Enumerator
FRAMETYPE_UNKNOWN |
FRAMETYPE_I |
FRAMETYPE_P |
FRAMETYPE_B |

## ◆ streamType

enum streamType

Enumerator
ISO_11172_VIDEO |
ISO_13818_VIDEO |
ISO_11172_AUDIO |
ISO_13818_AUDIO |
ISO_13818_PRIVATE |
ISO_13818_PES_PRIVATE |
ISO_13522_MHEG |
ISO_13818_DSMCC |
ISO_13818_TYPE_A |
ISO_13818_TYPE_B |
ISO_13818_TYPE_C |
ISO_13818_TYPE_D |
ISO_13818_AUX |
ISO_13818_PART7_AUDIO |
ISO_14496_PART2_VIDEO |
ISO_14496_PART3_AUDIO |
ISO_14496_PART10_VIDEO |
STREAM_VIDEO_HEVC |
STREAM_VIDEO_MPEG |
STREAM_AUDIO_AC3 |
STREAM_VIDEO_VC1 |
HDMV_AUDIO_80_PCM |
HDMV_AUDIO_82_DTS |
HDMV_AUDIO_83_TRUEHD |
HDMV_AUDIO_84_EAC3 |
HDMV_AUDIO_85_DTS_HRA |
HDMV_AUDIO_86_DTS_HD_MA |
HDMV_SPU_BITMAP |
HDMV_SPU_INTERACTIVE |
HDMV_SPU_TEXT |
HDMV_AUDIO_A1_EAC3_SEC |
HDMV_AUDIO_A2_DTSHD_SEC |
STREAM_AUDIO_EAC3 |
STREAM_AUDIO_DTS |

## Function Documentation

## ◆ demux_send_special_spu_buf()

static void demux_send_special_spu_buf | ( | demux_ts_t * | this,
|  | uint32_t | spu_type,
|  | int | spu_channel
| ) |  |
| static

References buf_element_s::type.

Referenced by demux_ts_parse_pmt().

## ◆ demux_ts_adaptation_field_parse()

static int64_t demux_ts_adaptation_field_parse | ( | const uint8_t * | data,
|  | uint32_t | adaptation_field_length
| ) |  |
| static

References _X_BE_32.

Referenced by demux_ts_parse_packet(), and demux_ts_parse_pat_pmt_packet().

## ◆ demux_ts_buffer_pes()

static void demux_ts_buffer_pes | ( | demux_ts_t * | this,
|  | const uint8_t * | ts,
|  | unsigned int | mediaIndex,
|  | unsigned int | tsp_head,
|  | unsigned int | len
| ) |  |
| static

References demux_ts_media::buf, BUF_VIDEO_H264, BUF_VIDEO_MPEG, BUF_VIDEO_VC1, fifo_buffer_s::buffer_pool_alloc, fifo_buffer_s::buffer_pool_realloc, demux_ts_media::corrupted_pes, demux_ts_media::counter, demux_ts_flush_media(), demux_ts_parse_pes_header(), demux_ts_send_buffer(), demux_ts_tbre_update(), demux_ts_media::fifo, buf_element_s::free_buffer, INVALID_CC, INVALID_PID, buf_element_s::max_size, buf_element_s::mem, NULL, demux_ts_media::pes_bytes_left, PES_RESUME, demux_ts_media::pid, demux_ts_media::pts, demux_ts_media::resume, buf_element_s::size, TBRE_MODE_AUDIO_PTS, TSP_continuity_counter, TSP_payload_unit_start, demux_ts_media::type, update_extra_info(), xine_small_memcpy, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_packet().

## ◆ demux_ts_dispose()

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

References INVALID_PROGRAM, MAX_PIDS, NULL, xine_event_dispose_queue(), XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ demux_ts_dynamic_pmt_clean()

static void demux_ts_dynamic_pmt_clean | ( | demux_ts_t * | this | ) |
| static

References _x_stream_info_set(), demux_ts_media::buf, BUF_AUDIO_BASE, BUF_MAJOR_MASK, BUF_SPU_BASE, BUF_VIDEO_BASE, buf_element_s::free_buffer, INVALID_PID, demux_ts_media::keep, name, NULL, demux_ts_media::pid, reset_track_map(), demux_ts_media::type, type, XINE_STREAM_INFO_HAS_AUDIO, XINE_STREAM_INFO_HAS_VIDEO, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_pmt().

## ◆ demux_ts_dynamic_pmt_clear()

static void demux_ts_dynamic_pmt_clear | ( | demux_ts_t * | this | ) |
| static

References INVALID_PID, INVALID_PROGRAM, NULL, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_event_handler(), and demux_ts_parse_pat().

## ◆ demux_ts_dynamic_pmt_find()

static int demux_ts_dynamic_pmt_find | ( | demux_ts_t * | this,
|  | int | pid,
|  | int | type,
|  | unsigned int | descriptor_tag
| ) |  |
| static

References demux_ts_media::audio_type, demux_ts_media::buf, BUF_AUDIO_A52, BUF_AUDIO_AAC, BUF_AUDIO_AAC_LATM, BUF_AUDIO_BASE, BUF_AUDIO_DTS, BUF_AUDIO_EAC3, BUF_AUDIO_MPEG, BUF_MAJOR_MASK, BUF_VIDEO_BASE, BUF_VIDEO_H264, BUF_VIDEO_HEVC, BUF_VIDEO_MPEG, BUF_VIDEO_MPEG4, BUF_VIDEO_VC1, demux_ts_media::corrupted_pes, demux_ts_media::counter, demux_ts_media::descriptor_tag, demux_ts_media::fifo, frametype_h264(), frametype_h265(), frametype_mpeg(), frametype_vc1(), buf_element_s::free_buffer, HDMV_AUDIO_82_DTS, HDMV_AUDIO_84_EAC3, HDMV_AUDIO_86_DTS_HD_MA, demux_ts_media::hdmv_type, INVALID_CC, ISO_13818_PART7_AUDIO, ISO_14496_PART10_VIDEO, ISO_14496_PART2_VIDEO, ISO_14496_PART3_AUDIO, demux_ts_media::keep, MAX_AUDIO_TRACKS, MAX_PIDS, NULL, demux_ts_media::pid, demux_ts_media::pts, demux_ts_media::resume, demux_ts_media::spu_type, STREAM_AUDIO_AC3, STREAM_AUDIO_DTS, STREAM_AUDIO_EAC3, STREAM_VIDEO_HEVC, STREAM_VIDEO_VC1, demux_ts_media::sure_type, demux_ts_media::type, type, demux_ts_media::video_type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_pmt().

## ◆ demux_ts_event_handler()

static void demux_ts_event_handler | ( | demux_ts_t * | this | ) |
| static

References _x_demux_control_start(), demux_ts_dynamic_pmt_clear(), demux_ts_flush(), NULL, XINE_EVENT_END_OF_CLIP, xine_event_next(), and XINE_EVENT_PIDS_CHANGE.

Referenced by demux_ts_send_chunk().

## ◆ demux_ts_flush()

static void demux_ts_flush | ( | demux_ts_t * | this | ) |
| static

References demux_ts_flush_media(), INVALID_PID, post_sequence_end(), and type.

Referenced by demux_ts_event_handler(), and sync_next().

## ◆ demux_ts_flush_media()

static void demux_ts_flush_media | ( | demux_ts_t * | this,
|  | demux_ts_media * | m
| ) |  |
| static

References BUF_FLAG_FRAME_END, demux_ts_send_buffer(), PES_FLUSHED, and demux_ts_media::resume.

Referenced by demux_ts_buffer_pes(), demux_ts_flush(), demux_ts_parse_pes_header(), and demux_ts_update_spu_channel().

## ◆ demux_ts_get_capabilities()

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

References DEMUX_CAP_AUDIOLANG, and DEMUX_CAP_SPULANG.

Referenced by open_plugin().

## ◆ demux_ts_get_lang_desc()

static void demux_ts_get_lang_desc | ( | demux_ts_t * | this,
|  | char * | dest,
|  | const uint8_t * | data,
|  | int | length
| ) |  |
| static

References DESCRIPTOR_LANG, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_pmt().

## ◆ demux_ts_get_optional_data()

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

References DEMUX_OPTIONAL_DATA_AUDIOLANG, DEMUX_OPTIONAL_DATA_SPULANG, DEMUX_OPTIONAL_SUCCESS, DEMUX_OPTIONAL_UNSUPPORTED, input(), INPUT_CAP_AUDIOLANG, INPUT_CAP_SPULANG, and NULL.

Referenced by open_plugin().

## ◆ demux_ts_get_reg_desc()

static uint32_t demux_ts_get_reg_desc | ( | demux_ts_t * | this,
|  | const uint8_t * | data,
|  | int | length
| ) |  |
| static

References _X_ME_32, _x_tag32_me2str(), DESCRIPTOR_REG_FORMAT, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_pmt().

## ◆ demux_ts_get_status()

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

Referenced by open_plugin().

## ◆ demux_ts_get_stream_length()

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

References input().

Referenced by open_plugin().

## ◆ demux_ts_hexdump()

static void demux_ts_hexdump | ( | demux_ts_t * | this,
|  | const char * | intro,
|  | const uint8_t * | p,
|  | uint32_t | len
| ) |  |
| static

References tab_hex, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_pes_header(), and demux_ts_parse_pmt().

## ◆ demux_ts_init_class()

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

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

## ◆ demux_ts_parse_packet()

static void demux_ts_parse_packet | ( | demux_ts_t * | this | ) |
| static

References _X_BE_32, BUF_AUDIO_BASE, BUF_MAJOR_MASK, demux_ts_adaptation_field_parse(), demux_ts_buffer_pes(), demux_ts_parse_pat(), demux_ts_parse_pmt(), demux_ts_tbre_update(), MAX_PIDS, NULL, NULL_PID, PKT_SIZE, SYNC_BYTE, sync_next(), TBRE_MODE_AUDIO_PCR, TBRE_MODE_PCR, TSP_adaptation_field_0, TSP_adaptation_field_1, TSP_continuity_counter, TSP_payload_unit_start, TSP_pid, TSP_scrambling_control, TSP_transport_error, TSP_transport_priority, type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_send_chunk().

## ◆ demux_ts_parse_pat()

static void demux_ts_parse_pat | ( | demux_ts_t * | this,
|  | const uint8_t * | pkt,
|  | unsigned int | pusi,
|  | unsigned int | len
| ) |  |
| static

References _X_BE_32, demux_ts_dynamic_pmt_clear(), INVALID_PROGRAM, MAX_PMTS, now(), NULL, PAT_BUF_SIZE, v, xine_crc32_ieee(), xine_small_memcpy, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_packet(), and demux_ts_parse_pat_pmt_packet().

## ◆ demux_ts_parse_pat_pmt_packet()

static int demux_ts_parse_pat_pmt_packet | ( | demux_ts_t * | this | ) |
| static

References _X_BE_32, demux_ts_adaptation_field_parse(), demux_ts_parse_pat(), demux_ts_parse_pmt(), demux_ts_tbre_update(), NULL, PKT_SIZE, SYNC_BYTE, sync_next(), TBRE_MODE_AUDIO_PCR, TBRE_MODE_PCR, TSP_adaptation_field_0, TSP_adaptation_field_1, TSP_payload_unit_start, TSP_pid, TSP_scrambling_control, and TSP_transport_error.

Referenced by demux_ts_scan_pat_pmt().

## ◆ demux_ts_parse_pes_header()

static int demux_ts_parse_pes_header | ( | demux_ts_t * | this,
|  | demux_ts_media * | m,
|  | const uint8_t * | buf,
|  | unsigned int | packet_len
| ) |  |
| static

References _X_BE_32, demux_ts_media::audio_type, demux_ts_media::buf, BUF_AUDIO_A52, BUF_AUDIO_LPCM_BE, BUF_FLAG_SPECIAL, BUF_SPECIAL_LPCM_CONFIG, BUF_SPU_DVB, BUF_SPU_DVD, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_flags, buf_element_s::decoder_info, demux_ts_flush_media(), demux_ts_hexdump(), demux_ts_media::descriptor_tag, demux_ts_media::fifo, FRAMETYPE_I, HDMV_AUDIO_80_PCM, HDMV_AUDIO_83_TRUEHD, demux_ts_media::hdmv_type, ISO_13818_PES_PRIVATE, lprintf, PADDING_STREAM, demux_ts_media::pes_bytes_left, PES_FLUSHED, PES_RESUME, demux_ts_media::pid, PRIVATE_STREAM2, demux_ts_media::pts, demux_ts_media::resume, demux_ts_media::sure_type, tab_hex, demux_ts_media::type, v, demux_ts_media::video_type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_buffer_pes().

## ◆ demux_ts_parse_pmt()

static void demux_ts_parse_pmt | ( | demux_ts_t * | this,
|  | const uint8_t * | pkt,
|  | unsigned int | pusi,
|  | unsigned int | plen,
|  | uint32_t | program_count,
|  | uint32_t | pid
| ) |  |
| static

References _X_BE_32, spu_dvb_descriptor_s::aux_page_id, demux_ts_pmt::buf, BUF_AUDIO_BASE, BUF_SPU_BASE, BUF_SPU_DVB, BUF_SPU_HDMV, BUF_SPU_HDMV_TEXT, BUF_VIDEO_BASE, spu_dvb_descriptor_s::comp_page_id, demux_ts_pmt::crc, xine_event_t::data_length, demux_send_special_spu_buf(), demux_ts_dynamic_pmt_clean(), demux_ts_dynamic_pmt_find(), demux_ts_get_lang_desc(), demux_ts_get_reg_desc(), demux_ts_hexdump(), demux_ts_tbre_reset(), demux_ts_update_spu_channel(), demux_ts_spu_lang::desc, DESCRIPTOR_AC3, DESCRIPTOR_DTS, DESCRIPTOR_DVBSUB, DESCRIPTOR_EAC3, DESCRIPTOR_TELETEXT, HDMV_AUDIO_80_PCM, HDMV_AUDIO_A1_EAC3_SEC, HDMV_AUDIO_A2_DTSHD_SEC, HDMV_SPU_BITMAP, HDMV_SPU_INTERACTIVE, HDMV_SPU_TEXT, INVALID_PID, ISO_11172_AUDIO, ISO_11172_VIDEO, ISO_13818_AUDIO, ISO_13818_PART7_AUDIO, ISO_13818_PES_PRIVATE, ISO_13818_PRIVATE, ISO_13818_TYPE_C, ISO_13818_VIDEO, ISO_14496_PART10_VIDEO, ISO_14496_PART2_VIDEO, ISO_14496_PART3_AUDIO, spu_dvb_descriptor_s::lang, demux_ts_pmt::length, MAX_AUDIO_TRACKS, MAX_SPU_LANGS, ME_FOURCC, demux_ts_spu_lang::media_index, demux_ts_spu_lang::pid, demux_ts_pmt::pid, demux_ts_pmt::program, reset_track_map(), STREAM_AUDIO_AC3, STREAM_AUDIO_DTS, STREAM_AUDIO_EAC3, STREAM_VIDEO_HEVC, STREAM_VIDEO_VC1, xine_event_t::type, type, v, demux_ts_pmt::write_pos, xine_crc32_ieee(), xine_event_send(), XINE_EVENT_UI_CHANNELS_CHANGED, xine_small_memcpy, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_parse_packet(), and demux_ts_parse_pat_pmt_packet().

## ◆ demux_ts_scan_pat_pmt()

static void demux_ts_scan_pat_pmt | ( | demux_ts_t * | this | ) |
| static

References demux_ts_parse_pat_pmt_packet(), input(), INVALID_PID, LOG_MODULE, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by demux_ts_send_headers().

## ◆ demux_ts_seek()

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

References _X_BE_32, _x_demux_flush_engine(), demux_ts_media::buf, BUF_SPU_HDMV_TEXT, demux_ts_media::corrupted_pes, demux_ts_media::counter, DEMUX_OK, demux_ts_tbre_reset(), FRAMETYPE_I, buf_element_s::free_buffer, input(), INPUT_CAP_SEEKABLE, INPUT_CAP_SLOW_SEEKABLE, INPUT_CAP_TIME_SEEKABLE, INPUT_OPTIONAL_DATA_DURATION, INPUT_OPTIONAL_SUCCESS, INVALID_CC, INVALID_PID, MAX_PIDS, NULL, post_sequence_end(), demux_ts_media::pts, demux_ts_media::resume, SYNC_BYTE, sync_next(), TSP_adaptation_field_0, TSP_adaptation_field_1, TSP_payload_unit_start, TSP_pid, TSP_scrambling_control, TSP_sync_byte, TSP_transport_error, type, XINE_VERBOSITY_DEBUG, and xprintf.

Referenced by open_plugin().

## ◆ demux_ts_send_buffer()

static void demux_ts_send_buffer | ( | demux_ts_t * | this,
|  | demux_ts_media * | m,
|  | int | flags
| ) |  |
| static

References demux_ts_media::buf, BUF_AUDIO_BASE, BUF_MAJOR_MASK, BUF_VIDEO_BASE, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::extra_info, demux_ts_media::fifo, extra_info_s::input_normpos, demux_ts_media::input_normpos, extra_info_s::input_time, demux_ts_media::input_time, buf_element_s::mem, newpts_test(), NULL, buf_element_s::pts, demux_ts_media::pts, PTS_AUDIO, PTS_VIDEO, fifo_buffer_s::put, buf_element_s::type, and demux_ts_media::type.

Referenced by demux_ts_buffer_pes(), and demux_ts_flush_media().

## ◆ demux_ts_send_chunk()

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

References demux_ts_event_handler(), demux_ts_parse_packet(), and demux_ts_update_spu_channel().

Referenced by open_plugin().

## ◆ demux_ts_send_headers()

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

References _x_demux_control_start(), _x_stream_info_set(), DEMUX_OK, demux_ts_scan_pat_pmt(), input(), INVALID_PID, XINE_STREAM_INFO_HAS_AUDIO, and XINE_STREAM_INFO_HAS_VIDEO.

Referenced by open_plugin().

## ◆ demux_ts_tbre_reset()

static void demux_ts_tbre_reset | ( | demux_ts_t * | this | ) |
| static

References INVALID_PID, TBRE_MODE_PROBE, and TBRE_TIME.

Referenced by demux_ts_parse_pmt(), and demux_ts_seek().

## ◆ demux_ts_tbre_update()

static void demux_ts_tbre_update | ( | demux_ts_t * | this,
|  | unsigned int | mode,
|  | int64_t | now
| ) |  |
| static

References mode(), now(), TBRE_MIN_TIME, TBRE_MODE_DONE, and TBRE_TIME.

Referenced by demux_ts_buffer_pes(), demux_ts_parse_packet(), and demux_ts_parse_pat_pmt_packet().

## ◆ demux_ts_update_spu_channel()

static void demux_ts_update_spu_channel | ( | demux_ts_t * | this | ) |
| static

References spu_dvb_descriptor_s::aux_page_id, BUF_DECODER_MASK, BUF_FLAG_SPECIAL, BUF_MAJOR_MASK, BUF_SPECIAL_SPU_DVB_DESCRIPTOR, BUF_SPU_DVB, spu_dvb_descriptor_s::comp_page_id, buf_element_s::content, buf_element_s::decoder_flags, buf_element_s::decoder_info, buf_element_s::decoder_info_ptr, demux_ts_flush_media(), demux_ts_spu_lang::desc, INVALID_PID, spu_dvb_descriptor_s::lang, demux_ts_spu_lang::media_index, NULL, demux_ts_spu_lang::pid, buf_element_s::type, and type.

Referenced by demux_ts_parse_pmt(), and demux_ts_send_chunk().

## ◆ detect_ts()

static int detect_ts | ( | const uint32_t * | buf,
|  | size_t | len
| ) |  |
| static

References v.

Referenced by open_plugin().

## ◆ frametype_h264()

static frametype_t frametype_h264 | ( | const uint8_t * | f,
|  | uint32_t | len
| ) |  |
| static

References _X_BE_32, FRAMETYPE_B, FRAMETYPE_I, FRAMETYPE_P, FRAMETYPE_UNKNOWN, and v.

Referenced by demux_ts_dynamic_pmt_find().

## ◆ frametype_h265()

static frametype_t frametype_h265 | ( | const uint8_t * | f,
|  | uint32_t | len
| ) |  |
| static

References _X_BE_32, FRAMETYPE_B, FRAMETYPE_I, FRAMETYPE_P, FRAMETYPE_UNKNOWN, and v.

Referenced by demux_ts_dynamic_pmt_find().

## ◆ frametype_mpeg()

static frametype_t frametype_mpeg | ( | const uint8_t * | f,
|  | uint32_t | len
| ) |  |
| static

References _X_BE_32, FRAMETYPE_B, FRAMETYPE_I, FRAMETYPE_P, FRAMETYPE_UNKNOWN, and v.

Referenced by demux_ts_dynamic_pmt_find().

## ◆ frametype_vc1()

static frametype_t frametype_vc1 | ( | const uint8_t * | f,
|  | uint32_t | len
| ) |  |
| static

References _X_BE_32, FRAMETYPE_I, FRAMETYPE_UNKNOWN, and v.

Referenced by demux_ts_dynamic_pmt_find().

## ◆ newpts_test()

static void newpts_test | ( | demux_ts_t * | this,
|  | int64_t | pts,
|  | int | video
| ) |  |
| static

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

Referenced by demux_ts_send_buffer().

## ◆ open_plugin()

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

References _x_demux_read_header(), BUF_SIZE, xine_stream_s::content_detection_method, DEMUX_FINISHED, demux_ts_dispose(), demux_ts_get_capabilities(), demux_ts_get_optional_data(), demux_ts_get_status(), demux_ts_get_stream_length(), demux_ts_seek(), demux_ts_send_chunk(), demux_ts_send_headers(), detect_ts(), input(), INPUT_CAP_SEEKABLE, INVALID_PID, INVALID_PROGRAM, MAX_PIDS, MAX_PMTS, METHOD_BY_CONTENT, METHOD_BY_MRL, METHOD_EXPLICIT, NULL, PKT_SIZE, SMALL_BUF_SIZE, XINE_EVENT_END_OF_CLIP, xine_event_new_queue(), XINE_EVENT_PIDS_CHANGE, XINE_EVENT_QUIT, and xine_event_select().

Referenced by demux_ts_init_class().

## ◆ post_sequence_end()

static void post_sequence_end | ( | fifo_buffer_t * | fifo,
|  | uint32_t | video_type
| ) |  |
| static

References BUF_FLAG_FRAME_END, BUF_VIDEO_H264, BUF_VIDEO_MPEG, BUF_VIDEO_VC1, fifo_buffer_s::buffer_pool_try_alloc, buf_element_s::content, buf_element_s::decoder_flags, fifo_buffer_s::put, buf_element_s::size, and buf_element_s::type.

Referenced by demux_ts_flush(), and demux_ts_seek().

## ◆ reset_track_map()

static void reset_track_map | ( | fifo_buffer_t * | fifo | ) |
| static

References BUF_CONTROL_RESET_TRACK_MAP, fifo_buffer_s::buffer_pool_alloc, buf_element_s::decoder_info, fifo_buffer_s::put, and buf_element_s::type.

Referenced by demux_ts_dynamic_pmt_clean(), and demux_ts_parse_pmt().

## ◆ sync_hdmv()

static int sync_hdmv | ( | const uint8_t * | buf,
|  | int | len
| ) |  |
| static

References SYNC_BYTE.

Referenced by sync_next().

## ◆ sync_next()

static const uint8_t * sync_next | ( | demux_ts_t * | this | ) |
| static

References _x_action_pending(), DEMUX_FINISHED, demux_ts_flush(), input(), NULL, SYNC_BYTE, sync_hdmv(), and sync_ts().

Referenced by demux_ts_parse_packet(), demux_ts_parse_pat_pmt_packet(), and demux_ts_seek().

## ◆ sync_ts()

static int sync_ts | ( | const uint8_t * | buf,
|  | int | len
| ) |  |
| static

References SYNC_BYTE.

Referenced by sync_next().

## ◆ update_extra_info()

static void update_extra_info | ( | demux_ts_t * | this,
|  | demux_ts_media * | m
| ) |  |
| static

References input(), demux_ts_media::input_normpos, demux_ts_media::input_time, and demux_ts_media::pts.

Referenced by demux_ts_buffer_pes().