libgpac
Documentation of the core library of GPAC
mpegts.c File Reference
#include <gpac/mpegts.h>
#include <string.h>
#include <gpac/constants.h>
#include <gpac/internal/media_dev.h>
#include <gpac/download.h>
#include <gpac/internal/ietf_dev.h>
+ Include dependency graph for mpegts.c:

Macros

#define DEBUG_TS_PACKET   0
 
#define M2TS_PROBE_SIZE   188*20
 
#define ADJUST_TIMESTAMP(_TS)
 

Functions

GF_EXPORT const char * gf_m2ts_get_stream_name (GF_M2TSStreamType streamType)
 
static u32 gf_m2ts_reframe_default (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len, GF_M2TS_PESHeader *pes_hdr)
 
static u32 gf_m2ts_reframe_reset (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len, GF_M2TS_PESHeader *pes_hdr)
 
static u32 gf_m2ts_reframe_add_prop (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len, GF_M2TS_PESHeader *pes_hdr)
 
static u32 gf_m2ts_sync (GF_M2TS_Demuxer *ts, char *data, u32 size, Bool simple_check)
 
Bool gf_m2ts_crc32_check (u8 *data, u32 len)
 
static GF_M2TS_SectionFiltergf_m2ts_section_filter_new (gf_m2ts_section_callback process_section_callback, Bool process_individual)
 
static void gf_m2ts_reset_sections (GF_List *sections)
 
static void gf_m2ts_section_filter_reset (GF_M2TS_SectionFilter *sf)
 
static void gf_m2ts_section_filter_del (GF_M2TS_SectionFilter *sf)
 
static void gf_m2ts_metadata_descriptor_del (GF_M2TS_MetadataDescriptor *metad)
 
static void gf_m2ts_es_del (GF_M2TS_ES *es, GF_M2TS_Demuxer *ts)
 
static void gf_m2ts_reset_sdt (GF_M2TS_Demuxer *ts)
 
GF_EXPORT GF_M2TS_SDT * gf_m2ts_get_sdt_info (GF_M2TS_Demuxer *ts, u32 program_id)
 
static void gf_m2ts_section_complete (GF_M2TS_Demuxer *ts, GF_M2TS_SectionFilter *sec, GF_M2TS_SECTION_ES *ses)
 
static Bool gf_m2ts_is_long_section (u8 table_id)
 
static u32 gf_m2ts_get_section_length (char byte0, char byte1, char byte2)
 
static void gf_m2ts_gather_section (GF_M2TS_Demuxer *ts, GF_M2TS_SectionFilter *sec, GF_M2TS_SECTION_ES *ses, GF_M2TS_Header *hdr, unsigned char *data, u32 data_size)
 
static void gf_m2ts_process_sdt (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static void gf_m2ts_process_mpeg4section (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static void gf_m2ts_process_nit (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *nit_es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static void gf_m2ts_process_tdt_tot (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *tdt_tot_es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static GF_M2TS_MetadataPointerDescriptorgf_m2ts_read_metadata_pointer_descriptor (GF_BitStream *bs, u32 length)
 
static void gf_m2ts_metadata_pointer_descriptor_del (GF_M2TS_MetadataPointerDescriptor *metapd)
 
static GF_M2TS_MetadataDescriptorgf_m2ts_read_metadata_descriptor (GF_BitStream *bs, u32 length)
 
static void gf_m2ts_process_pmt (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *pmt, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static void gf_m2ts_process_pat (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
static void gf_m2ts_process_cat (GF_M2TS_Demuxer *ts, GF_M2TS_SECTION_ES *ses, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 
u64 gf_m2ts_get_pts (unsigned char *data)
 
void gf_m2ts_pes_header (GF_M2TS_PES *pes, unsigned char *data, u32 data_size, GF_M2TS_PESHeader *pesh)
 
static void gf_m2ts_store_temi (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes)
 
void gf_m2ts_flush_pes (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, u32 force_flush_type)
 
static void gf_m2ts_process_pes (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, GF_M2TS_Header *hdr, unsigned char *data, u32 data_size, GF_M2TS_AdaptationField *paf)
 
void gf_m2ts_flush_all (GF_M2TS_Demuxer *ts, Bool no_force_flush)
 
static void gf_m2ts_get_adaptation_field (GF_M2TS_Demuxer *ts, GF_M2TS_AdaptationField *paf, u8 *data, u32 size, u32 pid)
 
static GF_Err gf_m2ts_process_packet (GF_M2TS_Demuxer *ts, unsigned char *data)
 
GF_EXPORT GF_Err gf_m2ts_process_data (GF_M2TS_Demuxer *ts, u8 *data, u32 data_size)
 
GF_EXPORT void gf_m2ts_reset_parsers_for_program (GF_M2TS_Demuxer *ts, GF_M2TS_Program *prog)
 
GF_EXPORT void gf_m2ts_reset_parsers (GF_M2TS_Demuxer *ts)
 
void gf_m2ts_mark_seg_start (GF_M2TS_Demuxer *ts)
 
GF_EXPORT GF_Err gf_m2ts_set_pes_framing (GF_M2TS_PES *pes, GF_M2TSPesFraming mode)
 
GF_EXPORT GF_M2TS_Demuxergf_m2ts_demux_new ()
 
GF_EXPORT void gf_m2ts_demux_dmscc_init (GF_M2TS_Demuxer *ts)
 
GF_EXPORT void gf_m2ts_demux_del (GF_M2TS_Demuxer *ts)
 
static Bool gf_m2ts_probe_buffer (char *buf, u32 size)
 
GF_EXPORT Bool gf_m2ts_probe_file (const char *fileName)
 
GF_EXPORT Bool gf_m2ts_probe_data (const u8 *data, u32 size)
 
static void rewrite_pts_dts (unsigned char *ptr, u64 TS)
 
GF_EXPORT GF_Err gf_m2ts_restamp (u8 *buffer, u32 size, s64 ts_shift, u8 is_pes[GF_M2TS_MAX_STREAMS])
 

Macro Definition Documentation

◆ DEBUG_TS_PACKET

#define DEBUG_TS_PACKET   0

◆ M2TS_PROBE_SIZE

#define M2TS_PROBE_SIZE   188*20

◆ ADJUST_TIMESTAMP

#define ADJUST_TIMESTAMP (   _TS)
Value:
if (_TS < (u64) -ts_shift) _TS = pcr_mod + _TS + ts_shift; \
else _TS = _TS + ts_shift; \
while (_TS > pcr_mod) _TS -= pcr_mod; \
uint64_t u64
Definition: setup.h:322

Function Documentation

◆ gf_m2ts_reframe_default()

static u32 gf_m2ts_reframe_default ( GF_M2TS_Demuxer ts,
GF_M2TS_PES *  pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len,
GF_M2TS_PESHeader pes_hdr 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_reframe_reset()

static u32 gf_m2ts_reframe_reset ( GF_M2TS_Demuxer ts,
GF_M2TS_PES *  pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len,
GF_M2TS_PESHeader pes_hdr 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_reframe_add_prop()

static u32 gf_m2ts_reframe_add_prop ( GF_M2TS_Demuxer ts,
GF_M2TS_PES *  pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len,
GF_M2TS_PESHeader pes_hdr 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_sync()

static u32 gf_m2ts_sync ( GF_M2TS_Demuxer ts,
char *  data,
u32  size,
Bool  simple_check 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_crc32_check()

Bool gf_m2ts_crc32_check ( u8 data,
u32  len 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_section_filter_new()

static GF_M2TS_SectionFilter* gf_m2ts_section_filter_new ( gf_m2ts_section_callback  process_section_callback,
Bool  process_individual 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_reset_sections()

static void gf_m2ts_reset_sections ( GF_List *  sections)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_section_filter_reset()

static void gf_m2ts_section_filter_reset ( GF_M2TS_SectionFilter sf)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_section_filter_del()

static void gf_m2ts_section_filter_del ( GF_M2TS_SectionFilter sf)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_metadata_descriptor_del()

static void gf_m2ts_metadata_descriptor_del ( GF_M2TS_MetadataDescriptor metad)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_es_del()

static void gf_m2ts_es_del ( GF_M2TS_ES *  es,
GF_M2TS_Demuxer ts 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_reset_sdt()

static void gf_m2ts_reset_sdt ( GF_M2TS_Demuxer ts)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_section_complete()

static void gf_m2ts_section_complete ( GF_M2TS_Demuxer ts,
GF_M2TS_SectionFilter sec,
GF_M2TS_SECTION_ES *  ses 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_is_long_section()

static Bool gf_m2ts_is_long_section ( u8  table_id)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_get_section_length()

static u32 gf_m2ts_get_section_length ( char  byte0,
char  byte1,
char  byte2 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_gather_section()

static void gf_m2ts_gather_section ( GF_M2TS_Demuxer ts,
GF_M2TS_SectionFilter sec,
GF_M2TS_SECTION_ES *  ses,
GF_M2TS_Header hdr,
unsigned char *  data,
u32  data_size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_sdt()

static void gf_m2ts_process_sdt ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  ses,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_mpeg4section()

static void gf_m2ts_process_mpeg4section ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  es,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_nit()

static void gf_m2ts_process_nit ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  nit_es,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_process_tdt_tot()

static void gf_m2ts_process_tdt_tot ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  tdt_tot_es,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_read_metadata_pointer_descriptor()

static GF_M2TS_MetadataPointerDescriptor* gf_m2ts_read_metadata_pointer_descriptor ( GF_BitStream *  bs,
u32  length 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_metadata_pointer_descriptor_del()

static void gf_m2ts_metadata_pointer_descriptor_del ( GF_M2TS_MetadataPointerDescriptor metapd)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_read_metadata_descriptor()

static GF_M2TS_MetadataDescriptor* gf_m2ts_read_metadata_descriptor ( GF_BitStream *  bs,
u32  length 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_pmt()

static void gf_m2ts_process_pmt ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  pmt,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_pat()

static void gf_m2ts_process_pat ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  ses,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_cat()

static void gf_m2ts_process_cat ( GF_M2TS_Demuxer ts,
GF_M2TS_SECTION_ES *  ses,
GF_List *  sections,
u8  table_id,
u16  ex_table_id,
u8  version_number,
u8  last_section_number,
u32  status 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_get_pts()

u64 gf_m2ts_get_pts ( unsigned char *  data)
+ Here is the caller graph for this function:

◆ gf_m2ts_pes_header()

void gf_m2ts_pes_header ( GF_M2TS_PES *  pes,
unsigned char *  data,
u32  data_size,
GF_M2TS_PESHeader pesh 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_store_temi()

static void gf_m2ts_store_temi ( GF_M2TS_Demuxer ts,
GF_M2TS_PES *  pes 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_pes()

static void gf_m2ts_process_pes ( GF_M2TS_Demuxer ts,
GF_M2TS_PES *  pes,
GF_M2TS_Header hdr,
unsigned char *  data,
u32  data_size,
GF_M2TS_AdaptationField paf 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_adaptation_field()

static void gf_m2ts_get_adaptation_field ( GF_M2TS_Demuxer ts,
GF_M2TS_AdaptationField paf,
u8 data,
u32  size,
u32  pid 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_packet()

static GF_Err gf_m2ts_process_packet ( GF_M2TS_Demuxer ts,
unsigned char *  data 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_probe_buffer()

static Bool gf_m2ts_probe_buffer ( char *  buf,
u32  size 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ rewrite_pts_dts()

static void rewrite_pts_dts ( unsigned char *  ptr,
u64  TS 
)
static
+ Here is the caller graph for this function: