GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
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:

Data Structures

struct  ADTSHeader
 

Macros

#define DEBUG_TS_PACKET   0
 
#define ADJUST_TIMESTAMP(_TS)
 

Functions

const char * gf_m2ts_get_stream_name (u32 streamType)
 
static u32 gf_m2ts_reframe_default (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_reset (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_nalu_video (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len, Bool is_hevc)
 
static u32 gf_m2ts_reframe_avc_h264 (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_hevc (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_mpeg_video (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_aac_adts (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_aac_latm (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_reframe_mpeg_audio (GF_M2TS_Demuxer *ts, GF_M2TS_PES *pes, Bool same_pts, unsigned char *data, u32 data_len)
 
static u32 gf_m2ts_sync (GF_M2TS_Demuxer *ts, Bool simple_check)
 
Bool gf_m2ts_crc32_check (char *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)
 
void gf_m2ts_es_del (GF_M2TS_ES *es, GF_M2TS_Demuxer *ts)
 
static void gf_m2ts_reset_sdt (GF_M2TS_Demuxer *ts)
 
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 dvb_decode_mjd_date (u32 date, u16 *year, u8 *month, u8 *day)
 
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 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_flush_pes (GF_M2TS_Demuxer *ts, GF_M2TS_PES *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 void gf_m2ts_get_adaptation_field (GF_M2TS_Demuxer *ts, GF_M2TS_AdaptationField *paf, unsigned char *data, u32 size, u32 pid)
 
static void gf_m2ts_process_packet (GF_M2TS_Demuxer *ts, unsigned char *data)
 
GF_Err gf_m2ts_process_data (GF_M2TS_Demuxer *ts, char *data, u32 data_size)
 
GF_ESDgf_m2ts_get_esd (GF_M2TS_ES *es)
 
void gf_m2ts_set_segment_switch (GF_M2TS_Demuxer *ts)
 
void gf_m2ts_reset_parsers (GF_M2TS_Demuxer *ts)
 
static void gf_m2ts_process_section_discard (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)
 
GF_Err gf_m2ts_set_pes_framing (GF_M2TS_PES *pes, u32 mode)
 
GF_M2TS_Demuxer * gf_m2ts_demux_new ()
 
void gf_m2ts_demux_dmscc_init (GF_M2TS_Demuxer *ts)
 
void gf_m2ts_demux_del (GF_M2TS_Demuxer *ts)
 
void gf_m2ts_print_info (GF_M2TS_Demuxer *ts)
 
GF_Err gf_m2ts_demux_file (GF_M2TS_Demuxer *ts, const char *fileName, u64 start_byterange, u64 end_byterange, u32 refresh_type, Bool signal_end_of_stream)
 
static u32 gf_m2ts_demuxer_run (void *_p)
 
GF_Err gf_m2ts_get_socket (const char *url, const char *mcast_ifce_or_mobileip, u32 buf_size, GF_Socket **out_socket)
 
static GF_Err gf_m2ts_demuxer_setup_live (GF_M2TS_Demuxer *ts, char *url)
 
static GF_Err gf_m2ts_demuxer_setup_file (GF_M2TS_Demuxer *ts, char *url)
 
GF_Err gf_m2ts_demuxer_setup (GF_M2TS_Demuxer *ts, const char *url, Bool loop)
 
GF_Err gf_m2ts_demuxer_close (GF_M2TS_Demuxer *ts)
 
GF_Err gf_m2ts_demuxer_play (GF_M2TS_Demuxer *ts)
 
Bool gf_m2ts_probe_file (const char *fileName)
 
static void rewrite_pts_dts (unsigned char *ptr, u64 TS)
 
GF_Err gf_m2ts_restamp (char *buffer, u32 size, s64 ts_shift, u8 *is_pes)
 

Data Structure Documentation

struct ADTSHeader
+ Collaboration diagram for ADTSHeader:
Data Fields
Bool is_mp2
Bool no_crc
u32 profile
u32 sr_idx
u32 nb_ch
u32 frame_size
u32 hdr_size

Macro Definition Documentation

#define DEBUG_TS_PACKET   0
#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:245

Function Documentation

const char* gf_m2ts_get_stream_name ( u32  streamType)

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_default ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_reset ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_nalu_video ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len,
Bool  is_hevc 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_avc_h264 ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_hevc ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_mpeg_video ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_aac_adts ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_aac_latm ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_reframe_mpeg_audio ( GF_M2TS_Demuxer *  ts,
GF_M2TS_PES pes,
Bool  same_pts,
unsigned char *  data,
u32  data_len 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_sync ( GF_M2TS_Demuxer *  ts,
Bool  simple_check 
)
static

+ Here is the caller graph for this function:

Bool gf_m2ts_crc32_check ( char *  data,
u32  len 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

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:

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:

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:

void gf_m2ts_es_del ( GF_M2TS_ES *  es,
GF_M2TS_Demuxer *  ts 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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:

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:

static Bool gf_m2ts_is_long_section ( u8  table_id)
static

+ Here is the caller graph for this function:

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:

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:

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:

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:

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:

static void dvb_decode_mjd_date ( u32  date,
u16 year,
u8 month,
u8 day 
)
static

+ Here is the caller graph for this function:

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:

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:

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:

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:

u64 gf_m2ts_get_pts ( unsigned char *  data)

+ Here is the caller graph for this function:

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:

static void gf_m2ts_flush_pes ( 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:

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:

static void gf_m2ts_get_adaptation_field ( GF_M2TS_Demuxer *  ts,
GF_M2TS_AdaptationField paf,
unsigned char *  data,
u32  size,
u32  pid 
)
static

+ Here is the caller graph for this function:

static void 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_Err gf_m2ts_process_data ( GF_M2TS_Demuxer *  ts,
char *  data,
u32  data_size 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_ESD* gf_m2ts_get_esd ( GF_M2TS_ES *  es)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_m2ts_set_segment_switch ( GF_M2TS_Demuxer *  ts)
void gf_m2ts_reset_parsers ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void gf_m2ts_process_section_discard ( 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 caller graph for this function:

GF_Err gf_m2ts_set_pes_framing ( GF_M2TS_PES pes,
u32  mode 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_M2TS_Demuxer* gf_m2ts_demux_new ( )

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_m2ts_demux_dmscc_init ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_m2ts_demux_del ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void gf_m2ts_print_info ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_m2ts_demux_file ( GF_M2TS_Demuxer *  ts,
const char *  fileName,
u64  start_byterange,
u64  end_byterange,
u32  refresh_type,
Bool  signal_end_of_stream 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_m2ts_demuxer_run ( void *  _p)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_m2ts_get_socket ( const char *  url,
const char *  mcast_ifce_or_mobileip,
u32  buf_size,
GF_Socket **  out_socket 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err gf_m2ts_demuxer_setup_live ( GF_M2TS_Demuxer *  ts,
char *  url 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err gf_m2ts_demuxer_setup_file ( GF_M2TS_Demuxer *  ts,
char *  url 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_m2ts_demuxer_setup ( GF_M2TS_Demuxer *  ts,
const char *  url,
Bool  loop 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_m2ts_demuxer_close ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_m2ts_demuxer_play ( GF_M2TS_Demuxer *  ts)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Bool gf_m2ts_probe_file ( const char *  fileName)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void rewrite_pts_dts ( unsigned char *  ptr,
u64  TS 
)
static

+ Here is the caller graph for this function:

GF_Err gf_m2ts_restamp ( char *  buffer,
u32  size,
s64  ts_shift,
u8 is_pes 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: