libgpac
Documentation of the core library of GPAC
MPEG-2 TS

MPEG-TS demultiplexer and multiplexer APIs. More...

+ Collaboration diagram for MPEG-2 TS:

Modules

 ES Interface
 Basic stream interface API used by MPEG-2 TS muxer.
 

Data Structures

struct  GF_M2TS_Section
 
struct  GF_M2TS_Table
 
struct  GF_M2TS_SectionFilter
 
struct  GF_M2TS_TemiLocationDescriptor
 
struct  GF_M2TS_TemiTimecodeDescriptor
 
struct  GF_M2TS_Program
 
struct  GF_M2TS_ES
 
struct  GF_M2TS_PESHeader
 
struct  GF_M2TS_SECTION_ES
 
struct  GF_M2TS_DVB_Subtitling_Descriptor
 
struct  GF_M2TS_DVB_Teletext_Descriptor
 
struct  GF_M2TS_Header
 
struct  GF_M2TS_AdaptationField
 
struct  GF_M2TS_Mux_Section
 
struct  GF_M2TS_Mux_Table
 
struct  GF_M2TS_Time
 
struct  GF_M2TS_Packet
 
struct  GF_M2TS_Mux_Stream
 
struct  GF_M2TSDescriptor
 
struct  GF_M2TS_Mux_Program
 
struct  GF_M2TS_Mux
 

Macros

#define SECTION_HEADER_LENGTH   3
 
#define SECTION_ADDITIONAL_HEADER_LENGTH   5
 
#define CRC_LENGTH   4
 
#define GF_M2TS_MAX_STREAMS   8192
 
#define GF_M2TS_MAX_SERVICES   65535
 
#define GF_M2TS_UDP_BUFFER_SIZE   0x40000
 
#define GF_M2TS_MAX_PCR   2576980377811ULL
 
#define ABSTRACT_ES
 
#define GF_M2TS_PSI_DEFAULT_REFRESH_RATE   200
 

Typedefs

typedef struct tag_m2ts_demux GF_M2TS_Demuxer
 
typedef void(* gf_m2ts_section_callback) (GF_M2TS_Demuxer *demux, GF_M2TS_SECTION_ES *es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)
 

Enumerations

enum  { GF_M2TS_META_ID3 = GF_4CC('I','D','3',' ') , GF_M2TS_META_KLVA = GF_4CC('K','L','V','A') }
 
enum  {
  GF_M2TS_VIDEO_STREAM_DESCRIPTOR = 0x02 , GF_M2TS_AUDIO_STREAM_DESCRIPTOR = 0x03 , GF_M2TS_HIERARCHY_DESCRIPTOR = 0x04 , GF_M2TS_REGISTRATION_DESCRIPTOR = 0x05 ,
  GF_M2TS_DATA_STREAM_ALIGNEMENT_DESCRIPTOR = 0x06 , GF_M2TS_TARGET_BACKGROUND_GRID_DESCRIPTOR = 0x07 , GF_M2TS_VIEW_WINDOW_DESCRIPTOR = 0x08 , GF_M2TS_CA_DESCRIPTOR = 0x09 ,
  GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR = 0x0A , GF_M2TS_DVB_IP_MAC_PLATFORM_NAME_DESCRIPTOR = 0x0C , GF_M2TS_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR = 0x0D , GF_M2TS_PRIVATE_DATA_INDICATOR_DESCRIPTOR = 0x0F ,
  GF_M2TS_DVB_STREAM_LOCATION_DESCRIPTOR =0x13 , GF_M2TS_STD_DESCRIPTOR = 0x17 , GF_M2TS_MPEG4_VIDEO_DESCRIPTOR = 0x1B , GF_M2TS_MPEG4_AUDIO_DESCRIPTOR = 0x1C ,
  GF_M2TS_MPEG4_IOD_DESCRIPTOR = 0x1D , GF_M2TS_MPEG4_SL_DESCRIPTOR = 0x1E , GF_M2TS_MPEG4_FMC_DESCRIPTOR = 0x1F , GF_M2TS_METADATA_POINTER_DESCRIPTOR = 0x25 ,
  GF_M2TS_METADATA_DESCRIPTOR = 0x26 , GF_M2TS_AVC_VIDEO_DESCRIPTOR = 0x28 , GF_M2TS_AVC_TIMING_HRD_DESCRIPTOR = 0x2A , GF_M2TS_SVC_EXTENSION_DESCRIPTOR = 0x30 ,
  GF_M2TS_MPEG4_ODUPDATE_DESCRIPTOR = 0x35 , GF_M2TS_HEVC_VIDEO_DESCRIPTOR = 0x38 , GF_M2TS_DVB_NETWORK_NAME_DESCRIPTOR = 0x40 , GF_M2TS_DVB_SERVICE_LIST_DESCRIPTOR = 0x41 ,
  GF_M2TS_DVB_STUFFING_DESCRIPTOR = 0x42 , GF_M2TS_DVB_SAT_DELIVERY_SYSTEM_DESCRIPTOR = 0x43 , GF_M2TS_DVB_CABLE_DELIVERY_SYSTEM_DESCRIPTOR = 0x44 , GF_M2TS_DVB_VBI_DATA_DESCRIPTOR = 0x45 ,
  GF_M2TS_DVB_VBI_TELETEXT_DESCRIPTOR = 0x46 , GF_M2TS_DVB_BOUQUET_NAME_DESCRIPTOR = 0x47 , GF_M2TS_DVB_SERVICE_DESCRIPTOR = 0x48 , GF_M2TS_DVB_COUNTRY_AVAILABILITY_DESCRIPTOR = 0x49 ,
  GF_M2TS_DVB_LINKAGE_DESCRIPTOR = 0x4A , GF_M2TS_DVB_NVOD_REFERENCE_DESCRIPTOR = 0x4B , GF_M2TS_DVB_TIME_SHIFTED_SERVICE_DESCRIPTOR = 0x4C , GF_M2TS_DVB_SHORT_EVENT_DESCRIPTOR = 0x4D ,
  GF_M2TS_DVB_EXTENDED_EVENT_DESCRIPTOR = 0x4E , GF_M2TS_DVB_TIME_SHIFTED_EVENT_DESCRIPTOR = 0x4F , GF_M2TS_DVB_COMPONENT_DESCRIPTOR = 0x50 , GF_M2TS_DVB_MOSAIC_DESCRIPTOR = 0x51 ,
  GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR = 0x52 , GF_M2TS_DVB_CA_IDENTIFIER_DESCRIPTOR = 0x53 , GF_M2TS_DVB_CONTENT_DESCRIPTOR = 0x54 , GF_M2TS_DVB_PARENTAL_RATING_DESCRIPTOR = 0x55 ,
  GF_M2TS_DVB_TELETEXT_DESCRIPTOR = 0x56 , GF_M2TS_DVB_LOCAL_TIME_OFFSET_DESCRIPTOR = 0x58 , GF_M2TS_DVB_SUBTITLING_DESCRIPTOR = 0x59 , GF_M2TS_DVB_PRIVATE_DATA_SPECIFIER_DESCRIPTOR = 0x5F ,
  GF_M2TS_DVB_DATA_BROADCAST_DESCRIPTOR = 0x64 , GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR = 0x66 , GF_M2TS_DVB_AC3_DESCRIPTOR = 0x6A , GF_M2TS_DVB_TIME_SLICE_FEC_DESCRIPTOR = 0x77 ,
  GF_M2TS_DVB_EAC3_DESCRIPTOR = 0x7A , GF_M2TS_DVB_LOGICAL_CHANNEL_DESCRIPTOR = 0x83 , GF_M2TS_DOLBY_VISION_DESCRIPTOR = 0xB0
}
 
enum  {
  GF_M2TS_PID_PAT = 0x0000 , GF_M2TS_PID_CAT = 0x0001 , GF_M2TS_PID_TSDT = 0x0002 , GF_M2TS_PID_NIT_ST = 0x0010 ,
  GF_M2TS_PID_SDT_BAT_ST = 0x0011 , GF_M2TS_PID_EIT_ST_CIT = 0x0012 , GF_M2TS_PID_RST_ST = 0x0013 , GF_M2TS_PID_TDT_TOT_ST = 0x0014 ,
  GF_M2TS_PID_NET_SYNC = 0x0015 , GF_M2TS_PID_RNT = 0x0016 , GF_M2TS_PID_IN_SIG = 0x001C , GF_M2TS_PID_MEAS = 0x001D ,
  GF_M2TS_PID_DIT = 0x001E , GF_M2TS_PID_SIT = 0x001F
}
 
enum  {
  GF_M2TS_TABLE_ID_PAT = 0x00 , GF_M2TS_TABLE_ID_CAT = 0x01 , GF_M2TS_TABLE_ID_PMT = 0x02 , GF_M2TS_TABLE_ID_TSDT = 0x03 ,
  GF_M2TS_TABLE_ID_MPEG4_BIFS = 0x04 , GF_M2TS_TABLE_ID_MPEG4_OD = 0x05 , GF_M2TS_TABLE_ID_METADATA = 0x06 , GF_M2TS_TABLE_ID_IPMP_CONTROL = 0x07 ,
  GF_M2TS_TABLE_ID_DSM_CC_ENCAPSULATED_DATA = 0x3A , GF_M2TS_TABLE_ID_DSM_CC_UN_MESSAGE = 0x3B , GF_M2TS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGE = 0x3C , GF_M2TS_TABLE_ID_DSM_CC_STREAM_DESCRIPTION = 0x3D ,
  GF_M2TS_TABLE_ID_DSM_CC_PRIVATE = 0x3E , GF_M2TS_TABLE_ID_NIT_ACTUAL = 0x40 , GF_M2TS_TABLE_ID_NIT_OTHER = 0x41 , GF_M2TS_TABLE_ID_SDT_ACTUAL = 0x42 ,
  GF_M2TS_TABLE_ID_SDT_OTHER = 0x46 , GF_M2TS_TABLE_ID_BAT = 0x4a , GF_M2TS_TABLE_ID_INT = 0x4c , GF_M2TS_TABLE_ID_EIT_ACTUAL_PF = 0x4E ,
  GF_M2TS_TABLE_ID_EIT_OTHER_PF = 0x4F , GF_M2TS_TABLE_ID_EIT_SCHEDULE_MIN = 0x50 , GF_M2TS_TABLE_ID_EIT_SCHEDULE_ACTUAL_MAX = 0x5F , GF_M2TS_TABLE_ID_EIT_SCHEDULE_MAX = 0x6F ,
  GF_M2TS_TABLE_ID_TDT = 0x70 , GF_M2TS_TABLE_ID_RST = 0x71 , GF_M2TS_TABLE_ID_ST = 0x72 , GF_M2TS_TABLE_ID_TOT = 0x73 ,
  GF_M2TS_TABLE_ID_AIT = 0x74 , GF_M2TS_TABLE_ID_CONT = 0x75 , GF_M2TS_TABLE_ID_RC = 0x76 , GF_M2TS_TABLE_ID_CID = 0x77 ,
  GF_M2TS_TABLE_ID_MPE_FEC = 0x78 , GF_M2TS_TABLE_ID_RES_NOT = 0x79 , GF_M2TS_TABLE_ID_DIT = 0x7E , GF_M2TS_TABLE_ID_SIT = 0x7F ,
  GF_M2TS_TABLE_ID_SCTE35_SPLICE_INFO = 0xFC
}
 
enum  GF_M2TSStreamType {
  GF_M2TS_VIDEO_MPEG1 = 0x01 , GF_M2TS_VIDEO_MPEG2 = 0x02 , GF_M2TS_AUDIO_MPEG1 = 0x03 , GF_M2TS_AUDIO_MPEG2 = 0x04 ,
  GF_M2TS_PRIVATE_SECTION = 0x05 , GF_M2TS_PRIVATE_DATA = 0x06 , GF_M2TS_MHEG = 0x07 , GF_M2TS_13818_1_DSMCC = 0x08 ,
  GF_M2TS_H222_1 = 0x09 , GF_M2TS_13818_6_ANNEX_A = 0x0A , GF_M2TS_13818_6_ANNEX_B = 0x0B , GF_M2TS_13818_6_ANNEX_C = 0x0C ,
  GF_M2TS_13818_6_ANNEX_D = 0x0D , GF_M2TS_13818_1_AUXILIARY = 0x0E , GF_M2TS_AUDIO_AAC = 0x0F , GF_M2TS_VIDEO_MPEG4 = 0x10 ,
  GF_M2TS_AUDIO_LATM_AAC = 0x11 , GF_M2TS_SYSTEMS_MPEG4_PES = 0x12 , GF_M2TS_SYSTEMS_MPEG4_SECTIONS = 0x13 , GF_M2TS_SYNC_DOWNLOAD_PROTOCOL = 0x14 ,
  GF_M2TS_METADATA_PES = 0x15 , GF_M2TS_METADATA_SECTION = 0x16 , GF_M2TS_METADATA_DATA_CAROUSEL = 0x17 , GF_M2TS_METADATA_OBJECT_CAROUSEL = 0x18 ,
  GF_M2TS_METADATA_SYNC_DOWNLOAD_PROTOCOL = 0x19 , GF_M2TS_IPMP = 0x1A , GF_M2TS_VIDEO_H264 = 0x1B , GF_M2TS_MPEG4_AUDIO_NO_SYNTAX = 0x1C ,
  GF_M2TS_MPEG4_TEXT = 0x1D , GF_M2TS_AUX_VIDEO_23002_2 = 0x1E , GF_M2TS_VIDEO_SVC = 0x1F , GF_M2TS_VIDEO_MVC = 0x20 ,
  GF_M2TS_VIDEO_15444_1 = 0x21 , GF_M2TS_VIDEO_MPEG2_ADD_STEREO = 0x22 , GF_M2TS_VIDEO_H264_ADD_STEREO = 0x23 , GF_M2TS_VIDEO_HEVC = 0x24 ,
  GF_M2TS_VIDEO_HEVC_TEMPORAL = 0x25 , GF_M2TS_VIDEO_MVCD = 0x26 , GF_M2TS_TEMI = 0x27 , GF_M2TS_VIDEO_SHVC = 0x28 ,
  GF_M2TS_VIDEO_SHVC_TEMPORAL = 0x29 , GF_M2TS_VIDEO_MHVC = 0x2A , GF_M2TS_VIDEO_MHVC_TEMPORAL = 0x2B , GF_M2TS_GREEN = 0x2C ,
  GF_M2TS_MHAS_MAIN = 0x2D , GF_M2TS_MHAS_AUX = 0x2E , GF_M2TS_QUALITY_SEC = 0x2F , GF_M2TS_MORE_SEC = 0x30 ,
  GF_M2TS_VIDEO_HEVC_MCTS = 0x31 , GF_M2TS_JPEG_XS = 0x32 , GF_M2TS_VIDEO_VVC = 0x33 , GF_M2TS_VIDEO_VVC_TEMPORAL = 0x34 ,
  GF_M2TS_HLS_AC3_CRYPT = 0xc1 , GF_M2TS_HLS_EC3_CRYPT = 0xc2 , GF_M2TS_HLS_AAC_CRYPT = 0xcf , GF_M2TS_HLS_AVC_CRYPT = 0xdb ,
  GF_M2TS_VIDEO_VC1 = 0xEA , GF_M2TS_VIDEO_DCII = 0x80 , GF_M2TS_AUDIO_AC3 = 0x81 , GF_M2TS_AUDIO_DTS = 0x82 ,
  GF_M2TS_AUDIO_TRUEHD = 0x83 , GF_M2TS_AUDIO_EC3 = 0x84 , GF_M2TS_SCTE35_SPLICE_INFO_SECTIONS = 0x86 , GF_M2TS_MPE_SECTIONS = 0x90 ,
  GF_M2TS_SUBTITLE_DVB = 0x100 , GF_M2TS_AUDIO_OPUS = 0x101 , GF_M2TS_VIDEO_AV1 = 0x102 , GF_M2TS_DVB_TELETEXT = 0x152 ,
  GF_M2TS_DVB_VBI = 0x153 , GF_M2TS_DVB_SUBTITLE = 0x154 , GF_M2TS_METADATA_ID3_HLS = 0x155 , GF_M2TS_METADATA_ID3_KLVA = 0x156
}
 
enum  {
  GF_M2TS_RA_STREAM_AC3 = GF_4CC('A','C','-','3') , GF_M2TS_RA_STREAM_EAC3 = GF_4CC('E','A','C','3') , GF_M2TS_RA_STREAM_VC1 = GF_4CC('V','C','-','1') , GF_M2TS_RA_STREAM_HEVC = GF_4CC('H','E','V','C') ,
  GF_M2TS_RA_STREAM_DTS1 = GF_4CC('D','T','S','1') , GF_M2TS_RA_STREAM_DTS2 = GF_4CC('D','T','S','2') , GF_M2TS_RA_STREAM_DTS3 = GF_4CC('D','T','S','3') , GF_M2TS_RA_STREAM_OPUS = GF_4CC('O','p','u','s') ,
  GF_M2TS_RA_STREAM_DOVI = GF_4CC('D','O','V','I') , GF_M2TS_RA_STREAM_AV1 = GF_4CC('A','V','0','1') , GF_M2TS_RA_STREAM_SCTE35 = GF_4CC('C','U','E','I') , GF_M2TS_RA_STREAM_GPAC = GF_4CC('G','P','A','C')
}
 
enum  { GF_M2TS_AFDESC_TIMELINE_DESCRIPTOR = 0x04 , GF_M2TS_AFDESC_LOCATION_DESCRIPTOR = 0x05 , GF_M2TS_AFDESC_BASEURL_DESCRIPTOR = 0x06 }
 
enum  GF_M2TSPesFraming { GF_M2TS_PES_FRAMING_SKIP , GF_M2TS_PES_FRAMING_SKIP_NO_RESET , GF_M2TS_PES_FRAMING_RAW , GF_M2TS_PES_FRAMING_DEFAULT }
 
enum  {
  GF_M2TS_PES_PCK_RAP = 1 , GF_M2TS_PES_PCK_AU_START = 1<<1 , GF_M2TS_PES_PCK_I_FRAME = 1<<2 , GF_M2TS_PES_PCK_P_FRAME = 1<<3 ,
  GF_M2TS_PES_PCK_B_FRAME = 1<<4 , GF_M2TS_PES_PCK_DISCONTINUITY = 1<<5
}
 
enum  {
  GF_M2TS_EVT_PAT_FOUND = 0 , GF_M2TS_EVT_PAT_UPDATE , GF_M2TS_EVT_PAT_REPEAT , GF_M2TS_EVT_PMT_FOUND ,
  GF_M2TS_EVT_PMT_REPEAT , GF_M2TS_EVT_PMT_UPDATE , GF_M2TS_EVT_SDT_FOUND , GF_M2TS_EVT_SDT_REPEAT ,
  GF_M2TS_EVT_SDT_UPDATE , GF_M2TS_EVT_INT_FOUND , GF_M2TS_EVT_INT_REPEAT , GF_M2TS_EVT_INT_UPDATE ,
  GF_M2TS_EVT_PES_PCK , GF_M2TS_EVT_PES_PCR , GF_M2TS_EVT_PES_TIMING , GF_M2TS_EVT_SL_PCK ,
  GF_M2TS_EVT_IP_DATAGRAM , GF_M2TS_EVT_DURATION_ESTIMATED , GF_M2TS_EVT_PCK , GF_M2TS_EVT_AAC_CFG ,
  GF_M2TS_EVT_TDT , GF_M2TS_EVT_TOT , GF_M2TS_EVT_DVB_GENERAL , GF_M2TS_EVT_DVB_MPE ,
  GF_M2TS_EVT_CAT_FOUND , GF_M2TS_EVT_CAT_REPEAT , GF_M2TS_EVT_CAT_UPDATE , GF_M2TS_EVT_AIT_FOUND ,
  GF_M2TS_EVT_DSMCC_FOUND , GF_M2TS_EVT_TEMI_LOCATION , GF_M2TS_EVT_TEMI_TIMECODE , GF_M2TS_EVT_SCTE35_SPLICE_INFO ,
  GF_M2TS_EVT_ID3 , GF_M2TS_EVT_STREAM_REMOVED
}
 
enum  {
  GF_M2TS_TABLE_START = 1 , GF_M2TS_TABLE_END = 1<<1 , GF_M2TS_TABLE_FOUND = 1<<2 , GF_M2TS_TABLE_UPDATE = 1<<3 ,
  GF_M2TS_TABLE_REPEAT = 1<<4
}
 
enum  metadata_carriage { METADATA_CARRIAGE_SAME_TS = 0 , METADATA_CARRIAGE_DIFFERENT_TS = 1 , METADATA_CARRIAGE_PS = 2 , METADATA_CARRIAGE_OTHER = 3 }
 
enum  {
  GF_M2TS_ES_IS_PES = 1 , GF_M2TS_ES_IS_SECTION = 1<<1 , GF_M2TS_ES_IS_FMC = 1<<2 , GF_M2TS_ES_IS_SL = 1<<3 ,
  GF_M2TS_ES_IS_MPEG4_OD = 1<<4 , GF_M2TS_ES_IS_MPE = 1<<5 , GF_M2TS_INHERIT_PCR = 1<<6 , GF_M2TS_FAKE_PCR = 1<<7 ,
  GF_M2TS_GPAC_CODEC_ID = 1<<8 , GF_M2TS_ES_IS_PMT = 1<<9 , GF_M2TS_ES_IS_PCR_REUSE = 1<<10 , GF_M2TS_ES_STATIC_FLAGS_MASK = 0x0000FFFF ,
  GF_M2TS_ES_SEND_REPEATED_SECTIONS = 1<<16 , GF_M2TS_ES_IGNORE_NEXT_DISCONTINUITY = 1<<17 , GF_M2TS_ES_ALREADY_DECLARED = 1<<18 , GF_M2TS_ES_TEMI_INFO = 1<<19 ,
  GF_M2TS_ES_FULL_AU = 1<<20 , GF_M2TS_CHECK_DISC = 1<<21 , GF_M2TS_CHECK_VC1 = 1<<22
}
 
enum  { GF_M2TS_ADAPTATION_RESERVED = 0 , GF_M2TS_ADAPTATION_NONE = 1 , GF_M2TS_ADAPTATION_ONLY = 2 , GF_M2TS_ADAPTATION_AND_PAYLOAD = 3 }
 
enum  { GF_M2TS_MPEG4_SIGNALING_NONE = 0 , GF_M2TS_MPEG4_SIGNALING_FULL , GF_M2TS_MPEG4_SIGNALING_SCENE }
 
enum  GF_M2TS_PackMode { GF_M2TS_PACK_AUDIO_ONLY =0 , GF_M2TS_PACK_NONE , GF_M2TS_PACK_ALL }
 
enum  GF_M2TSMuxState { GF_M2TS_STATE_IDLE , GF_M2TS_STATE_DATA , GF_M2TS_STATE_PADDING , GF_M2TS_STATE_EOS }
 

Functions

const char * gf_m2ts_get_stream_name (GF_M2TSStreamType streamType)
 
Bool gf_m2ts_probe_file (const char *fileName)
 
Bool gf_m2ts_probe_data (const u8 *data, u32 size)
 
GF_Err gf_m2ts_restamp (u8 *buffer, u32 size, s64 ts_shift, u8 is_pes[GF_M2TS_MAX_STREAMS])
 
GF_M2TS_Demuxergf_m2ts_demux_new ()
 
void gf_m2ts_demux_del (GF_M2TS_Demuxer *demux)
 
void gf_m2ts_reset_parsers (GF_M2TS_Demuxer *demux)
 
void gf_m2ts_mark_seg_start (GF_M2TS_Demuxer *demux)
 
void gf_m2ts_reset_parsers_for_program (GF_M2TS_Demuxer *demux, GF_M2TS_Program *program)
 
GF_Err gf_m2ts_set_pes_framing (GF_M2TS_PES *pes, GF_M2TSPesFraming mode)
 
GF_Err gf_m2ts_process_data (GF_M2TS_Demuxer *demux, u8 *data, u32 data_size)
 
void gf_m2ts_demux_dmscc_init (GF_M2TS_Demuxer *demux)
 
GF_M2TS_SDT * gf_m2ts_get_sdt_info (GF_M2TS_Demuxer *demux, u32 program_id)
 
void gf_m2ts_flush_pes (GF_M2TS_Demuxer *demux, GF_M2TS_PES *pes, u32 force_flush)
 
void gf_m2ts_flush_all (GF_M2TS_Demuxer *demux, Bool no_force_flush)
 
GF_M2TS_Mux * gf_m2ts_mux_new (u32 mux_rate, u32 pat_refresh_rate, Bool real_time)
 
void gf_m2ts_mux_del (GF_M2TS_Mux *muxer)
 
void gf_m2ts_mux_set_pcr_max_interval (GF_M2TS_Mux *muxer, u32 pcr_update_ms)
 
GF_M2TS_Mux_Program * gf_m2ts_mux_program_add (GF_M2TS_Mux *muxer, u32 program_number, u32 pmt_pid, u32 pmt_refresh_rate, u64 pcr_offset, u32 mpeg4_signaling, u32 pmt_version, Bool initial_disc, u64 force_first_pts)
 
GF_M2TS_Mux_Streamgf_m2ts_program_stream_add (GF_M2TS_Mux_Program *program, GF_ESInterface *ifce, u32 pid, Bool is_pcr, Bool force_pes_mode, Bool needs_mutex)
 
void gf_m2ts_mux_update_config (GF_M2TS_Mux *muxer, Bool reset_time)
 
void gf_m2ts_program_stream_remove (GF_M2TS_Mux_Stream *stream)
 
GF_M2TS_Mux_Program * gf_m2ts_mux_program_find (GF_M2TS_Mux *muxer, u32 program_number)
 
u32 gf_m2ts_mux_program_count (GF_M2TS_Mux *muxer)
 
u32 gf_m2ts_mux_program_get_stream_count (GF_M2TS_Mux_Program *program)
 
u32 gf_m2ts_mux_program_get_pmt_pid (GF_M2TS_Mux_Program *program)
 
u32 gf_m2ts_mux_program_get_pcr_pid (GF_M2TS_Mux_Program *program)
 
const u8gf_m2ts_mux_process (GF_M2TS_Mux *muxer, GF_M2TSMuxState *status, u32 *usec_till_next)
 
u32 gf_m2ts_get_sys_clock (GF_M2TS_Mux *muxer)
 
u32 gf_m2ts_get_ts_clock (GF_M2TS_Mux *muxer)
 
u64 gf_m2ts_get_ts_clock_90k (GF_M2TS_Mux *muxer)
 
GF_Err gf_m2ts_mux_use_single_au_pes_mode (GF_M2TS_Mux *muxer, GF_M2TS_PackMode au_pes_mode)
 
GF_Err gf_m2ts_mux_set_initial_pcr (GF_M2TS_Mux *muxer, u64 init_pcr_value)
 
GF_Err gf_m2ts_mux_enable_pcr_only_packets (GF_M2TS_Mux *muxer, Bool enable_forced_pcr)
 
void gf_m2ts_mux_program_set_name (GF_M2TS_Mux_Program *program, const char *program_name, const char *mux_provider_name)
 
void gf_m2ts_mux_program_force_keep_ts (GF_M2TS_Mux_Program *program)
 
void gf_m2ts_mux_enable_sdt (GF_M2TS_Mux *muxer, u32 refresh_rate_ms)
 
void gf_m2ts_mux_table_update (GF_M2TS_Mux_Stream *stream, u8 table_id, u16 table_id_extension, u8 *table_payload, u32 table_payload_length, Bool use_syntax_indicator, Bool private_indicator)
 

Detailed Description

This section documents the MPEG-TS demultiplexer and multiplexer APIs.


Data Structure Documentation

◆ GF_M2TS_Section

struct GF_M2TS_Section

MPEG-2 TS demuxer section

Data Fields
u8 * data

section data

u32 data_size

section data size in bytes

◆ GF_M2TS_Table

struct GF_M2TS_Table

MPEG-2 TS demuxer table

Data Fields
struct __m2ts_demux_table * next

pointer to next table/section

u8 is_init

set when first table completely received

u8 is_repeat

set when repeated section

u8 table_id

table id

u16 ex_table_id

extended table id

u8 version_number

current section version number

u8 last_version_number

last received version number

u8 current_next_indicator

current/next indicator (cf MPEG-2 TS spec)

u8 section_number

current section number

u8 last_section_number

last section number to get the complete table

GF_List * sections

list of sections for this table

u32 table_size

total table size

◆ GF_M2TS_SectionFilter

struct GF_M2TS_SectionFilter

MPEG-2 TS demuxer section filter

+ Collaboration diagram for GF_M2TS_SectionFilter:
Data Fields
s16 cc

section reassembler

u8 * section

section buffer (max 4096)

u16 length

current section length as indicated in section header

u16 received

number of bytes received from current section

GF_M2TS_Table * table

section->table aggregator

Bool process_individual

indicates that the section and last_section_number do not need to be checked

Bool direct_dispatch

indicates that the section header with table id and extended table id ... is not parsed by the TS demuxer and left for the application

u32 service_id

this field is used for AIT sections, to link the AIT with the program

gf_m2ts_section_callback process_section

section callback

Bool demux_restarted

flag indicatin the demultiplexer has been restarted

◆ GF_M2TS_MetadataPointerDescriptor

struct GF_M2TS_MetadataPointerDescriptor

MPEG-2 TS demuxer metadata pointer

Data Fields
u16 application_format
u32 application_format_identifier
u8 format
u32 format_identifier
u8 service_id
Bool locator_record_flag
u32 locator_length
char * locator_data
enum metadata_carriage carriage_flag
u16 program_number
u16 ts_location
u16 ts_id
u8 * data
u32 data_size

◆ GF_M2TS_TemiLocationDescriptor

struct GF_M2TS_TemiLocationDescriptor

MPEG-2 TS demuxer TEMI location

+ Collaboration diagram for GF_M2TS_TemiLocationDescriptor:
Data Fields
u32 pid
u32 timeline_id
const char * external_URL
Bool is_announce
Bool is_splicing
Bool reload_external
GF_Fraction activation_countdown

◆ GF_M2TS_TemiTimecodeDescriptor

struct GF_M2TS_TemiTimecodeDescriptor

MPEG-2 TS demuxer TEMI timecode

Data Fields
u32 pid
u32 timeline_id
u32 media_timescale
u64 media_timestamp
u64 pes_pts
Bool force_reload
Bool is_paused
Bool is_discontinuity
u64 ntp

◆ GF_M2TS_Program

struct GF_M2TS_Program

MPEG-2 TS program object

+ Collaboration diagram for GF_M2TS_Program:
Data Fields
GF_M2TS_Demuxer * ts

parent demuxer

GF_List * streams

list of streams (PES and sections)

u32 pmt_pid

PID of PMT

u32 pcr_pid

PID of PCR

u32 number

program number

GF_InitialObjectDescriptor * pmt_iod

MPEG-4 IOD if any

GF_List * additional_ods

list of additional ODs found per program this list is only created when MPEG-4 over MPEG-2 is detected the list AND the ODs contained in it are destroyed when destroying the program/demuxer

u64 first_dts

first dts found on this program - this is used by parsers, but not setup by the lib

u64 last_pcr_value

Last PCR value received for this program and associated packet number

u32 last_pcr_value_pck_number

packet number of last PCR value received

u64 before_last_pcr_value

PCR value before the last received one for this program and associated packet number used to compute PCR interpolation value

u32 before_last_pcr_value_pck_number

packet number of before last PCR value received

Bool tdt_found

for hybrid use-cases we need to know if TDT has already been processed

u32 pid_playing

indicates if PID is playing. Used in scalable streams only to toggle quality switch

Bool is_scalable
GF_M2TS_MetadataPointerDescriptor * metadata_pointer_descriptor

metadata descriptor pointer

s16 pcr_cc

continuity counter check for pure PCR PIDs

void * user

◆ tag_m2ts_es

struct tag_m2ts_es

abstract Section/PES stream object

MPEG-2 TS demuxer elementary stream

◆ GF_M2TS_PESHeader

struct GF_M2TS_PESHeader

MPEG-2 TS muxer PES header

Data Fields
u8 id

stream ID

u16 pck_len

packet len, 0 if unknown

u8 data_alignment

data alignment flag

u64 PTS

packet PTS in 90khz

u64 DTS

packet DTS in 90khz

u8 hdr_data_len

size of PES header

◆ tag_m2ts_section_es

struct tag_m2ts_section_es

Section elementary stream

MPEG-2 TS demuxer elementary stream section

+ Collaboration diagram for GF_M2TS_SECTION_ES:
Data Fields
ABSTRACT_ES GF_M2TS_SectionFilter * sec

derive from base M2TS stream

section reassembler

◆ GF_M2TS_DVB_Subtitling_Descriptor

struct GF_M2TS_DVB_Subtitling_Descriptor

MPEG-2 TS muxer DVB subtitling descriptor

Data Fields
char language[3]
u8 type
u16 composition_page_id
u16 ancillary_page_id

◆ GF_M2TS_DVB_Teletext_Descriptor

struct GF_M2TS_DVB_Teletext_Descriptor

MPEG-2 TS muxer DVB teletext descriptor

Data Fields
char language[3]
u8 type
u8 magazine_number
u8 page_number

◆ GF_M2TS_MetadataDescriptor

struct GF_M2TS_MetadataDescriptor

MPEG-2 TS muxer metadata descriptor

Data Fields
u16 application_format
u32 application_format_identifier
u8 format
u32 format_identifier
u8 service_id
u8 decoder_config_flags
Bool dsmcc_flag
u8 service_id_record_length
char * service_id_record
u8 decoder_config_length
u8 * decoder_config
u8 decoder_config_id_length
u8 * decoder_config_id
u8 decoder_config_service_id

◆ GF_M2TS_Header

struct GF_M2TS_Header

MPEG-2 TS packet header

Data Fields
u8 sync

sync byte 0x47

u8 error

error indicator

u8 payload_start

payload start flag (start of PES or section)

u8 priority

priority flag

u16 pid

PID of packet

u8 scrambling_ctrl

scrambling flag ( 0 not scrambled, 1/2 scrambled, 3 reserved)

u8 adaptation_field

adaptation field type

u8 continuity_counter

continuity counter

◆ GF_M2TS_AdaptationField

struct GF_M2TS_AdaptationField

MPEG-2 TS packet adaptation field

Data Fields
u32 discontinuity_indicator

discontunity indicator (for timeline splicing)

u32 random_access_indicator

random access indicator

u32 priority_indicator

priority indicator

u32 PCR_flag

PCR present flag

u64 PCR_base

PCR base value

u64 PCR_ext

PCR extended value

u32 OPCR_flag

original PCR flag

u64 OPCR_base

OPCR base value

u64 OPCR_ext

OPCR extended value

u32 splicing_point_flag

splicing point flag

u32 transport_private_data_flag

transport private data flag

u32 adaptation_field_extension_flag

AF extension flag

◆ GF_M2TS_Mux_Section

struct GF_M2TS_Mux_Section

MPEG-2 TS muxer section

Data Fields
struct __m2ts_section * next

pointer to next section

u8 * data

section data

u32 length

section size

◆ GF_M2TS_Mux_Table

struct GF_M2TS_Mux_Table

MPEG-2 TS muxer table

Data Fields
struct __m2ts_table * next

pointer to next table

u8 table_id

table ID (we don't handle extended table ID as part of the section muxer

u8 version_number

version number of the table

struct __m2ts_section * section

list of sections for the table (one or more)

◆ GF_M2TS_Time

struct GF_M2TS_Time

MPEG-2 TS muxer time information

Data Fields
u32 sec

seconds

u32 nanosec

nanoseconds

◆ GF_M2TS_Packet

struct GF_M2TS_Packet

MPEG-2 TS muxer packet

Data Fields
struct __m2ts_mux_pck * next

pointer to next packet (we queue packets if needed)

u8 * data

payload

u32 data_len

payload size in bytes

u16 flags

flags

u8 sap_type

sap type

u64 cts

CTS in 90 khz

u64 dts

DTS in 90 khz

u32 duration

duration in 90 khz

u8 * mpeg2_af_descriptors

serialized list of adaptation field descriptors if any

u32 mpeg2_af_descriptors_size

size of serialized list of adaptation field descriptors

◆ GF_M2TSDescriptor

struct GF_M2TSDescriptor

MPEG-2 TS base descriptor

Data Fields
u8 tag

descriptor tag

u8 data_len

descriptor size

u8 * data

descriptor payload

◆ __m2ts_mux_program

struct __m2ts_mux_program

MPEG-2 TS muxer program info

MPEG-2 TS muxer program

+ Collaboration diagram for GF_M2TS_Mux_Program:
Data Fields
struct __m2ts_mux_program * next

next program

struct __m2ts_mux * mux

parent muxer

u16 number

program number

GF_M2TS_Mux_Stream * streams

all streams but PMT

GF_M2TS_Mux_Stream * pmt

PMT stream

GF_M2TS_Mux_Stream * pcr

pointer to PCR stream

GF_M2TS_Time ts_time_at_pcr_init

TS time at pcr init

u64 pcr_init_time

pcr init time (rand or fixed by user)

u64 num_pck_at_pcr_init

number of TS packet at PCR init

u64 last_pcr

last PCR value in 27 mhz

u64 last_dts

last DTS value in 90 khz

u64 sys_clock_at_last_pcr

system clock in microseconds at last PCR

u64 nb_pck_last_pcr

number of packets at last PCR

u64 initial_ts

min initial DTS of all streams

u32 initial_ts_set

indicates that min initial DTS of all streams is set

Bool pcr_init_time_set

if set, injects a PCR offset

u64 pcr_offset

PCR offset to inject

u64 force_first_pts

Forced value of first packet CTS

Bool initial_disc_set

indicates the initial discontinuity flag should be set on first packet of all streams

GF_Descriptor * iod

MPEG-4 IOD for 4on2

GF_List * loop_descriptors

list of GF_M2TSDescriptor to add to the program descriptor loop. By default set to NULL, if non null will be reset and destroyed upon cleanup

u32 mpeg4_signaling

MPEG-4 signaling type

Bool mpeg4_signaling_for_scene_only

if set, use MPEG-4 signaling only for BIFS and OD streams

char * name

program name (for SDT)

char * provider

program provider (for SDT)

u32 cts_offset

CTS offset in 90khz

◆ __m2ts_mux

struct __m2ts_mux

MPEG-2 TS muxer

+ Collaboration diagram for GF_M2TS_Mux:
Data Fields
GF_M2TS_Mux_Program * programs

list of programs

GF_M2TS_Mux_Stream * pat

PAT stream

GF_M2TS_Mux_Stream * sdt

SDT stream

u16 ts_id

TS ID

Bool needs_reconfig

signals reconfigure is needed (PAT)

Bool real_time

used to indicate that the input data is pushed to the muxer (i.e. not read from a file) or that the output data is sent on sockets (not written to a file)

Bool fixed_rate

indicates if the multiplexer shall target a fix bit rate (monitoring timing and produce padding packets) or if the output stream will contain only input data

u32 bit_rate

output bit-rate in bit/sec

u64 init_pcr_value

init value for PCRs on all streams if 0, random value is used

u32 pcr_update_ms

PCR update rate in milliseconds

char dst_pck[188]

destination TS packet

char null_pck[188]

destination NULL TS packet

GF_M2TS_Time time

multiplexer time, incremented each time a packet is sent used to monitor the sending of muxer related data (PAT, ...)

GF_M2TS_Time init_ts_time

Time of the muxer when the first call to process is made (first packet sent?)

u64 init_sys_time

System time in microsenconds when the muxer is started

Bool force_pat

forces PAT injection at next packet

GF_M2TS_PackMode au_pes_mode

AU per PES packing mode

Bool enable_forced_pcr

enable forced PCR (PCR only packets)

u64 last_br_time_us

last rate estimation time in microseconds

u32 pck_sent_over_br_window

number of TS packets over the bitrate estimation period

u64 tot_pck_sent

number of TS packets sent

u64 tot_pad_sent

number of TS NULL packets sent

u64 tot_pes_pad_bytes

number of PES bytes sent

u32 average_birate_kbps

average rate in kbps

Bool flush_pes_at_rap

if set, flushes all streams in a program when a PES RAP is found (eg sent remaining audios and co)

u32 force_pat_pmt_state

state for forced injection of PAT/PMT/PCR

GF_BitStream * pck_bs

static write bitstream object for formatting packets

u32 ref_pid

PID to watch for SAP insertions

Bool sap_inserted
u64 sap_time

SAP time (used when dashing)

u32 sap_type

SAP type (used when dashing)

u64 last_pts

last PTS in 90khz (used when dashing to build sidx)

u32 last_pid

last PID (used when dashing to build sidx)

Macro Definition Documentation

◆ SECTION_HEADER_LENGTH

#define SECTION_HEADER_LENGTH   3

header till the last bit of the section_length field

◆ SECTION_ADDITIONAL_HEADER_LENGTH

#define SECTION_ADDITIONAL_HEADER_LENGTH   5

header from the last bit of the section_length field to the payload

◆ CRC_LENGTH

#define CRC_LENGTH   4

CRC32 length

◆ GF_M2TS_MAX_STREAMS

#define GF_M2TS_MAX_STREAMS   8192

Maximum number of streams in a TS

◆ GF_M2TS_MAX_SERVICES

#define GF_M2TS_MAX_SERVICES   65535

Maximum number of service in a TS

◆ GF_M2TS_UDP_BUFFER_SIZE

#define GF_M2TS_UDP_BUFFER_SIZE   0x40000

Maximum size of the buffer in UDP

◆ GF_M2TS_MAX_PCR

#define GF_M2TS_MAX_PCR   2576980377811ULL

Maximum PCR value

◆ ABSTRACT_ES

#define ABSTRACT_ES
Value:
GF_M2TS_Program *program; \
u32 flags; \
u32 pid; \
u32 stream_type; \
u32 mpeg4_es_id; \
GF_SLConfig *slcfg; \
s16 component_tag; \
void *user; \
GF_List *props; \
u64 first_dts; \
Bool is_seg_start; \
u32 service_id;
Definition: mpegts.h:661

macro for abstract Section/PES stream object, only used for type casting

◆ GF_M2TS_PSI_DEFAULT_REFRESH_RATE

#define GF_M2TS_PSI_DEFAULT_REFRESH_RATE   200

default refresh rate for PSI data

Typedef Documentation

◆ GF_M2TS_Demuxer

typedef struct tag_m2ts_demux GF_M2TS_Demuxer

MPEG-2 TS demuxer

◆ gf_m2ts_section_callback

typedef void(* gf_m2ts_section_callback) (GF_M2TS_Demuxer *demux, GF_M2TS_SECTION_ES *es, GF_List *sections, u8 table_id, u16 ex_table_id, u8 version_number, u8 last_section_number, u32 status)

section callback function

Parameters
demuxthe target MPEG-2 TS demultiplexer
esthe target section stream
sectionsthe list of gathered sections
table_idthe ID of the table
ex_table_idthe extended ID of the table
version_numberthe version number of the table
last_section_numberthe last section number of the table for fragmented cases
statusthe parsing status flags

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

metadata types for GF_M2TS_METADATA_POINTER_DESCRIPTOR

Enumerator
GF_M2TS_META_ID3 
GF_M2TS_META_KLVA 

◆ anonymous enum

anonymous enum

MPEG-2 Descriptor tags

Enumerator
GF_M2TS_VIDEO_STREAM_DESCRIPTOR 
GF_M2TS_AUDIO_STREAM_DESCRIPTOR 
GF_M2TS_HIERARCHY_DESCRIPTOR 
GF_M2TS_REGISTRATION_DESCRIPTOR 
GF_M2TS_DATA_STREAM_ALIGNEMENT_DESCRIPTOR 
GF_M2TS_TARGET_BACKGROUND_GRID_DESCRIPTOR 
GF_M2TS_VIEW_WINDOW_DESCRIPTOR 
GF_M2TS_CA_DESCRIPTOR 
GF_M2TS_ISO_639_LANGUAGE_DESCRIPTOR 
GF_M2TS_DVB_IP_MAC_PLATFORM_NAME_DESCRIPTOR 
GF_M2TS_DVB_IP_MAC_PLATFORM_PROVIDER_NAME_DESCRIPTOR 
GF_M2TS_PRIVATE_DATA_INDICATOR_DESCRIPTOR 
GF_M2TS_DVB_STREAM_LOCATION_DESCRIPTOR 
GF_M2TS_STD_DESCRIPTOR 
GF_M2TS_MPEG4_VIDEO_DESCRIPTOR 
GF_M2TS_MPEG4_AUDIO_DESCRIPTOR 
GF_M2TS_MPEG4_IOD_DESCRIPTOR 
GF_M2TS_MPEG4_SL_DESCRIPTOR 
GF_M2TS_MPEG4_FMC_DESCRIPTOR 
GF_M2TS_METADATA_POINTER_DESCRIPTOR 
GF_M2TS_METADATA_DESCRIPTOR 
GF_M2TS_AVC_VIDEO_DESCRIPTOR 
GF_M2TS_AVC_TIMING_HRD_DESCRIPTOR 
GF_M2TS_SVC_EXTENSION_DESCRIPTOR 
GF_M2TS_MPEG4_ODUPDATE_DESCRIPTOR 
GF_M2TS_HEVC_VIDEO_DESCRIPTOR 
GF_M2TS_DVB_NETWORK_NAME_DESCRIPTOR 
GF_M2TS_DVB_SERVICE_LIST_DESCRIPTOR 
GF_M2TS_DVB_STUFFING_DESCRIPTOR 
GF_M2TS_DVB_SAT_DELIVERY_SYSTEM_DESCRIPTOR 
GF_M2TS_DVB_CABLE_DELIVERY_SYSTEM_DESCRIPTOR 
GF_M2TS_DVB_VBI_DATA_DESCRIPTOR 
GF_M2TS_DVB_VBI_TELETEXT_DESCRIPTOR 
GF_M2TS_DVB_BOUQUET_NAME_DESCRIPTOR 
GF_M2TS_DVB_SERVICE_DESCRIPTOR 
GF_M2TS_DVB_COUNTRY_AVAILABILITY_DESCRIPTOR 
GF_M2TS_DVB_LINKAGE_DESCRIPTOR 
GF_M2TS_DVB_NVOD_REFERENCE_DESCRIPTOR 
GF_M2TS_DVB_TIME_SHIFTED_SERVICE_DESCRIPTOR 
GF_M2TS_DVB_SHORT_EVENT_DESCRIPTOR 
GF_M2TS_DVB_EXTENDED_EVENT_DESCRIPTOR 
GF_M2TS_DVB_TIME_SHIFTED_EVENT_DESCRIPTOR 
GF_M2TS_DVB_COMPONENT_DESCRIPTOR 
GF_M2TS_DVB_MOSAIC_DESCRIPTOR 
GF_M2TS_DVB_STREAM_IDENTIFIER_DESCRIPTOR 
GF_M2TS_DVB_CA_IDENTIFIER_DESCRIPTOR 
GF_M2TS_DVB_CONTENT_DESCRIPTOR 
GF_M2TS_DVB_PARENTAL_RATING_DESCRIPTOR 
GF_M2TS_DVB_TELETEXT_DESCRIPTOR 
GF_M2TS_DVB_LOCAL_TIME_OFFSET_DESCRIPTOR 
GF_M2TS_DVB_SUBTITLING_DESCRIPTOR 
GF_M2TS_DVB_PRIVATE_DATA_SPECIFIER_DESCRIPTOR 
GF_M2TS_DVB_DATA_BROADCAST_DESCRIPTOR 
GF_M2TS_DVB_DATA_BROADCAST_ID_DESCRIPTOR 
GF_M2TS_DVB_AC3_DESCRIPTOR 
GF_M2TS_DVB_TIME_SLICE_FEC_DESCRIPTOR 
GF_M2TS_DVB_EAC3_DESCRIPTOR 
GF_M2TS_DVB_LOGICAL_CHANNEL_DESCRIPTOR 
GF_M2TS_DOLBY_VISION_DESCRIPTOR 

◆ anonymous enum

anonymous enum

Reserved PID values

Enumerator
GF_M2TS_PID_PAT 
GF_M2TS_PID_CAT 
GF_M2TS_PID_TSDT 
GF_M2TS_PID_NIT_ST 
GF_M2TS_PID_SDT_BAT_ST 
GF_M2TS_PID_EIT_ST_CIT 
GF_M2TS_PID_RST_ST 
GF_M2TS_PID_TDT_TOT_ST 
GF_M2TS_PID_NET_SYNC 
GF_M2TS_PID_RNT 
GF_M2TS_PID_IN_SIG 
GF_M2TS_PID_MEAS 
GF_M2TS_PID_DIT 
GF_M2TS_PID_SIT 

◆ anonymous enum

anonymous enum

max size includes first header, second header, payload and CRC

Enumerator
GF_M2TS_TABLE_ID_PAT 
GF_M2TS_TABLE_ID_CAT 
GF_M2TS_TABLE_ID_PMT 
GF_M2TS_TABLE_ID_TSDT 
GF_M2TS_TABLE_ID_MPEG4_BIFS 
GF_M2TS_TABLE_ID_MPEG4_OD 
GF_M2TS_TABLE_ID_METADATA 
GF_M2TS_TABLE_ID_IPMP_CONTROL 
GF_M2TS_TABLE_ID_DSM_CC_ENCAPSULATED_DATA 
GF_M2TS_TABLE_ID_DSM_CC_UN_MESSAGE 
GF_M2TS_TABLE_ID_DSM_CC_DOWNLOAD_DATA_MESSAGE 
GF_M2TS_TABLE_ID_DSM_CC_STREAM_DESCRIPTION 
GF_M2TS_TABLE_ID_DSM_CC_PRIVATE 
GF_M2TS_TABLE_ID_NIT_ACTUAL 
GF_M2TS_TABLE_ID_NIT_OTHER 
GF_M2TS_TABLE_ID_SDT_ACTUAL 
GF_M2TS_TABLE_ID_SDT_OTHER 
GF_M2TS_TABLE_ID_BAT 
GF_M2TS_TABLE_ID_INT 
GF_M2TS_TABLE_ID_EIT_ACTUAL_PF 
GF_M2TS_TABLE_ID_EIT_OTHER_PF 
GF_M2TS_TABLE_ID_EIT_SCHEDULE_MIN 
GF_M2TS_TABLE_ID_EIT_SCHEDULE_ACTUAL_MAX 
GF_M2TS_TABLE_ID_EIT_SCHEDULE_MAX 
GF_M2TS_TABLE_ID_TDT 
GF_M2TS_TABLE_ID_RST 
GF_M2TS_TABLE_ID_ST 
GF_M2TS_TABLE_ID_TOT 
GF_M2TS_TABLE_ID_AIT 
GF_M2TS_TABLE_ID_CONT 
GF_M2TS_TABLE_ID_RC 
GF_M2TS_TABLE_ID_CID 
GF_M2TS_TABLE_ID_MPE_FEC 
GF_M2TS_TABLE_ID_RES_NOT 
GF_M2TS_TABLE_ID_DIT 
GF_M2TS_TABLE_ID_SIT 
GF_M2TS_TABLE_ID_SCTE35_SPLICE_INFO 

◆ GF_M2TSStreamType

MPEG-2 TS Media types

Enumerator
GF_M2TS_VIDEO_MPEG1 
GF_M2TS_VIDEO_MPEG2 
GF_M2TS_AUDIO_MPEG1 
GF_M2TS_AUDIO_MPEG2 
GF_M2TS_PRIVATE_SECTION 
GF_M2TS_PRIVATE_DATA 
GF_M2TS_MHEG 
GF_M2TS_13818_1_DSMCC 
GF_M2TS_H222_1 
GF_M2TS_13818_6_ANNEX_A 
GF_M2TS_13818_6_ANNEX_B 
GF_M2TS_13818_6_ANNEX_C 
GF_M2TS_13818_6_ANNEX_D 
GF_M2TS_13818_1_AUXILIARY 
GF_M2TS_AUDIO_AAC 
GF_M2TS_VIDEO_MPEG4 
GF_M2TS_AUDIO_LATM_AAC 
GF_M2TS_SYSTEMS_MPEG4_PES 
GF_M2TS_SYSTEMS_MPEG4_SECTIONS 
GF_M2TS_SYNC_DOWNLOAD_PROTOCOL 
GF_M2TS_METADATA_PES 
GF_M2TS_METADATA_SECTION 
GF_M2TS_METADATA_DATA_CAROUSEL 
GF_M2TS_METADATA_OBJECT_CAROUSEL 
GF_M2TS_METADATA_SYNC_DOWNLOAD_PROTOCOL 
GF_M2TS_IPMP 
GF_M2TS_VIDEO_H264 
GF_M2TS_MPEG4_AUDIO_NO_SYNTAX 
GF_M2TS_MPEG4_TEXT 
GF_M2TS_AUX_VIDEO_23002_2 
GF_M2TS_VIDEO_SVC 
GF_M2TS_VIDEO_MVC 
GF_M2TS_VIDEO_15444_1 
GF_M2TS_VIDEO_MPEG2_ADD_STEREO 
GF_M2TS_VIDEO_H264_ADD_STEREO 
GF_M2TS_VIDEO_HEVC 
GF_M2TS_VIDEO_HEVC_TEMPORAL 
GF_M2TS_VIDEO_MVCD 
GF_M2TS_TEMI 
GF_M2TS_VIDEO_SHVC 
GF_M2TS_VIDEO_SHVC_TEMPORAL 
GF_M2TS_VIDEO_MHVC 
GF_M2TS_VIDEO_MHVC_TEMPORAL 
GF_M2TS_GREEN 
GF_M2TS_MHAS_MAIN 
GF_M2TS_MHAS_AUX 
GF_M2TS_QUALITY_SEC 
GF_M2TS_MORE_SEC 
GF_M2TS_VIDEO_HEVC_MCTS 
GF_M2TS_JPEG_XS 
GF_M2TS_VIDEO_VVC 
GF_M2TS_VIDEO_VVC_TEMPORAL 
GF_M2TS_HLS_AC3_CRYPT 
GF_M2TS_HLS_EC3_CRYPT 
GF_M2TS_HLS_AAC_CRYPT 
GF_M2TS_HLS_AVC_CRYPT 
GF_M2TS_VIDEO_VC1 
GF_M2TS_VIDEO_DCII 
GF_M2TS_AUDIO_AC3 
GF_M2TS_AUDIO_DTS 
GF_M2TS_AUDIO_TRUEHD 
GF_M2TS_AUDIO_EC3 
GF_M2TS_SCTE35_SPLICE_INFO_SECTIONS 
GF_M2TS_MPE_SECTIONS 
GF_M2TS_SUBTITLE_DVB 
GF_M2TS_AUDIO_OPUS 
GF_M2TS_VIDEO_AV1 
GF_M2TS_DVB_TELETEXT 
GF_M2TS_DVB_VBI 
GF_M2TS_DVB_SUBTITLE 
GF_M2TS_METADATA_ID3_HLS 
GF_M2TS_METADATA_ID3_KLVA 

◆ anonymous enum

anonymous enum

MPEG-2 TS Registration codes types

Enumerator
GF_M2TS_RA_STREAM_AC3 
GF_M2TS_RA_STREAM_EAC3 
GF_M2TS_RA_STREAM_VC1 
GF_M2TS_RA_STREAM_HEVC 
GF_M2TS_RA_STREAM_DTS1 
GF_M2TS_RA_STREAM_DTS2 
GF_M2TS_RA_STREAM_DTS3 
GF_M2TS_RA_STREAM_OPUS 
GF_M2TS_RA_STREAM_DOVI 
GF_M2TS_RA_STREAM_AV1 
GF_M2TS_RA_STREAM_SCTE35 
GF_M2TS_RA_STREAM_GPAC 

◆ anonymous enum

anonymous enum

MPEG-2 Descriptor tags

Enumerator
GF_M2TS_AFDESC_TIMELINE_DESCRIPTOR 
GF_M2TS_AFDESC_LOCATION_DESCRIPTOR 
GF_M2TS_AFDESC_BASEURL_DESCRIPTOR 

◆ GF_M2TSPesFraming

PES data framing modes

Enumerator
GF_M2TS_PES_FRAMING_SKIP 
GF_M2TS_PES_FRAMING_SKIP_NO_RESET 
GF_M2TS_PES_FRAMING_RAW 
GF_M2TS_PES_FRAMING_DEFAULT 

◆ anonymous enum

anonymous enum

PES packet flags

Enumerator
GF_M2TS_PES_PCK_RAP 

PES packet is RAP

GF_M2TS_PES_PCK_AU_START 

PES packet contains an AU start

GF_M2TS_PES_PCK_I_FRAME 

visual frame starting in this packet is an I frame or IDR (AVC/H264)

GF_M2TS_PES_PCK_P_FRAME 

visual frame starting in this packet is a P frame

GF_M2TS_PES_PCK_B_FRAME 

visual frame starting in this packet is a B frame

GF_M2TS_PES_PCK_DISCONTINUITY 

Possible PCR discontinuity from this packet on

◆ anonymous enum

anonymous enum

Events used by the MPEGTS demuxer

Enumerator
GF_M2TS_EVT_PAT_FOUND 

PAT has been found (service connection) - no associated parameter

GF_M2TS_EVT_PAT_UPDATE 

PAT has been updated - no associated parameter

GF_M2TS_EVT_PAT_REPEAT 

repeated PAT has been found (carousel) - no associated parameter

GF_M2TS_EVT_PMT_FOUND 

PMT has been found (service tune-in) - associated parameter: new PMT

GF_M2TS_EVT_PMT_REPEAT 

repeated PMT has been found (carousel) - associated parameter: updated PMT

GF_M2TS_EVT_PMT_UPDATE 

PMT has been changed - associated parameter: updated PMT

GF_M2TS_EVT_SDT_FOUND 

SDT has been received - associated parameter: none

GF_M2TS_EVT_SDT_REPEAT 

repeated SDT has been found (carousel) - associated parameter: none

GF_M2TS_EVT_SDT_UPDATE 

SDT has been received - associated parameter: none

GF_M2TS_EVT_INT_FOUND 

INT has been received - associated parameter: none

GF_M2TS_EVT_INT_REPEAT 

repeated INT has been found (carousel) - associated parameter: none

GF_M2TS_EVT_INT_UPDATE 

INT has been received - associated parameter: none

GF_M2TS_EVT_PES_PCK 

PES packet has been received - associated parameter: PES packet

GF_M2TS_EVT_PES_PCR 

PCR has been received - associated parameter: PES packet with no data

GF_M2TS_EVT_PES_TIMING 

PTS/DTS/PCR info - associated parameter: PES packet with no data

GF_M2TS_EVT_SL_PCK 

An MPEG-4 SL Packet has been received in a section - associated parameter: SL packet

GF_M2TS_EVT_IP_DATAGRAM 

An IP datagram has been received in a section - associated parameter: IP datagram

GF_M2TS_EVT_DURATION_ESTIMATED 

Duration has been estimated - associated parameter: PES packet with no data, PTS is duration in msec

GF_M2TS_EVT_PCK 

TS packet processed - associated parameter: pointer to a GF_M2TS_TSPCK structure

GF_M2TS_EVT_AAC_CFG 

AAC config has been extracted - associated parameter: PES Packet with encoded M4ADecSpecInfo in its data THIS MUST BE CLEANED UP

GF_M2TS_EVT_TDT 

A message to inform about the current date and time in the TS

GF_M2TS_EVT_TOT 

A message to inform about the current time offset in the TS

GF_M2TS_EVT_DVB_GENERAL 

A generic event message for EIT, TDT, TOT etc

GF_M2TS_EVT_DVB_MPE 

MPE / MPE-FEC frame extraction and IP datagrams decryptation

GF_M2TS_EVT_CAT_FOUND 

CAT has been found (service tune-in) - associated parameter: new CAT

GF_M2TS_EVT_CAT_REPEAT 

repeated CAT has been found (carousel) - associated parameter: updated CAT

GF_M2TS_EVT_CAT_UPDATE 

CAT has been changed - associated parameter: updated PMT

GF_M2TS_EVT_AIT_FOUND 

AIT has been found (carousel)

GF_M2TS_EVT_DSMCC_FOUND 

DSCM-CC has been found (carousel)

GF_M2TS_EVT_TEMI_LOCATION 

a TEMI locator has been found or repeated

GF_M2TS_EVT_TEMI_TIMECODE 

a TEMI timecode has been found

GF_M2TS_EVT_SCTE35_SPLICE_INFO 

a SCTE35 splice info has been found

GF_M2TS_EVT_ID3 

a generic ID3 tag has been found

GF_M2TS_EVT_STREAM_REMOVED 

a stream is about to be removed - - associated parameter: pointer to GF_M2TS_ES being removed

◆ anonymous enum

anonymous enum

table parsing state

Enumerator
GF_M2TS_TABLE_START 

flag set for start of the table

GF_M2TS_TABLE_END 

flag set for end of the table

GF_M2TS_TABLE_FOUND 

flag set when first occurence of the table

GF_M2TS_TABLE_UPDATE 

flag set when update of the table

GF_M2TS_TABLE_REPEAT 

flag set when repetition of the table - both update and repeat flags may be set if data has changed

◆ metadata_carriage

metadata carriage types

Enumerator
METADATA_CARRIAGE_SAME_TS 
METADATA_CARRIAGE_DIFFERENT_TS 
METADATA_CARRIAGE_PS 
METADATA_CARRIAGE_OTHER 

◆ anonymous enum

anonymous enum

ES flags

Enumerator
GF_M2TS_ES_IS_PES 

ES is a PES stream

GF_M2TS_ES_IS_SECTION 

ES is a section stream

GF_M2TS_ES_IS_FMC 

ES is an mpeg-4 flexmux stream

GF_M2TS_ES_IS_SL 

ES is an mpeg-4 SL-packetized stream

GF_M2TS_ES_IS_MPEG4_OD 

ES is an mpeg-4 Object Descriptor SL-packetized stream

GF_M2TS_ES_IS_MPE 

ES is a DVB MPE stream

GF_M2TS_INHERIT_PCR 

stream is used to send PCR to upper layer

GF_M2TS_FAKE_PCR 

signals the stream is used to send the PCR, but is not the original PID carrying it

GF_M2TS_GPAC_CODEC_ID 

signals the stream type is a gpac codec id

GF_M2TS_ES_IS_PMT 

signals the stream is a PMT

GF_M2TS_ES_IS_PCR_REUSE 

signals the stream is reused (fake pcr streams), i.e. present twice in ess[] list

GF_M2TS_ES_STATIC_FLAGS_MASK 

all flags above this mask are used by demultiplexer users

GF_M2TS_ES_SEND_REPEATED_SECTIONS 

always send sections regardless of their version_number

GF_M2TS_ES_IGNORE_NEXT_DISCONTINUITY 

flag used to signal next discontinuity on stream should be ignored

GF_M2TS_ES_ALREADY_DECLARED 

flag used by importers/readers to mark streams that have been seen already in PMT process (update/found)

GF_M2TS_ES_TEMI_INFO 

flag indicates TEMI info is declared on this stream

GF_M2TS_ES_FULL_AU 

flag indicates each PES is a full AU

GF_M2TS_CHECK_DISC 

flag indicates ES is not sparse (AV), used to check discontinuity - set by user

GF_M2TS_CHECK_VC1 

flag indicates VC1 sequence header is to be checked - set by user

◆ anonymous enum

anonymous enum

adaptation field type

Enumerator
GF_M2TS_ADAPTATION_RESERVED 

reserved

GF_M2TS_ADAPTATION_NONE 

no adaptation (payload only)

GF_M2TS_ADAPTATION_ONLY 

adaptation only (no payload)

GF_M2TS_ADAPTATION_AND_PAYLOAD 

adaptation and payload

◆ anonymous enum

anonymous enum

MPEG-4 systems signaling mode

Enumerator
GF_M2TS_MPEG4_SIGNALING_NONE 

no MPEG-4 signaling

GF_M2TS_MPEG4_SIGNALING_FULL 

Full MPEG-4 signaling

GF_M2TS_MPEG4_SIGNALING_SCENE 

◆ GF_M2TS_PackMode

AU packing per pes configuration

Enumerator
GF_M2TS_PACK_AUDIO_ONLY 

only audio AUs are packed in a single PES, video and systems are not (recommended default)

GF_M2TS_PACK_NONE 

never pack AUs in a single PES

GF_M2TS_PACK_ALL 

always try to pack AUs in a single PES

◆ GF_M2TSMuxState

state of multiplexer

Enumerator
GF_M2TS_STATE_IDLE 

multiplexer is idle, nothing to produce (real-time mux only)

GF_M2TS_STATE_DATA 

multiplexer is sending data

GF_M2TS_STATE_PADDING 

multiplexer is sending padding (no input data and fixed rate required)

GF_M2TS_STATE_EOS 

multiplexer is done

Function Documentation

◆ gf_m2ts_get_stream_name()

const char* gf_m2ts_get_stream_name ( GF_M2TSStreamType  streamType)

gets the stream name for an MPEG-2 stream type

Parameters
streamTypethe target stream type
Returns
name of the stream type
+ Here is the caller graph for this function:

◆ gf_m2ts_probe_file()

Bool gf_m2ts_probe_file ( const char *  fileName)

probes a file for MPEG-2 TS format

Parameters
fileNamename / path of the file to brobe
Returns
GF_TRUE if file is an MPEG-2 TS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_probe_data()

Bool gf_m2ts_probe_data ( const u8 data,
u32  size 
)

probes a buffer for MPEG-2 TS format

Parameters
datadata buffer to probe
sizesize of buffer to probe
Returns
GF_TRUE if file is an MPEG-2 TS
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_restamp()

GF_Err gf_m2ts_restamp ( u8 buffer,
u32  size,
s64  ts_shift,
u8  is_pes[GF_M2TS_MAX_STREAMS] 
)

restamps a set of TS packets by shifting all timing by the given value

Parameters
bufferdata buffer to restamp
sizesize of buffer
ts_shiftclock shift in 90 kHz
is_pesarray of GF_M2TS_MAX_STREAMS u8 set to 1 for PES PIDs to be restamped, 0 to stream to left untouched
Returns
error if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_demux_new()

GF_M2TS_Demuxer* gf_m2ts_demux_new ( )

creates a new MPEG-2 TS demultiplexer

Returns
a new demultiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_demux_del()

void gf_m2ts_demux_del ( GF_M2TS_Demuxer demux)

destroys a new MPEG-2 TS demultiplexer

Parameters
demuxthe target MPEG-2 TS demultiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_reset_parsers()

void gf_m2ts_reset_parsers ( GF_M2TS_Demuxer demux)

resets all parsers (PES, sections) of the demultiplexer and trash any pending data in the demux input

Parameters
demuxthe target MPEG-2 TS demultiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mark_seg_start()

void gf_m2ts_mark_seg_start ( GF_M2TS_Demuxer demux)

set all streams is_seg_start variable to GF_TRUE

Parameters
demuxthe target MPEG-2 TS demultiplexer
+ Here is the caller graph for this function:

◆ gf_m2ts_reset_parsers_for_program()

void gf_m2ts_reset_parsers_for_program ( GF_M2TS_Demuxer demux,
GF_M2TS_Program program 
)

resets all parsers (PES, sections) of a given program

Parameters
demuxthe target MPEG-2 TS demultiplexer
programthe target MPEG-2 TS program
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_set_pes_framing()

GF_Err gf_m2ts_set_pes_framing ( GF_M2TS_PES *  pes,
GF_M2TSPesFraming  mode 
)

sets PES framing mode of a stream

Parameters
pesthe target MPEG-2 TS stream
modethe desired PES framing mode
Returns
error if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_process_data()

GF_Err gf_m2ts_process_data ( GF_M2TS_Demuxer demux,
u8 data,
u32  data_size 
)

processes input buffer. This will resync the input data to a TS packet start if needed

Parameters
demuxthe target MPEG-2 TS demultiplexer
datathe data to process
data_sizesize of the date to process
Returns
error if any
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_demux_dmscc_init()

void gf_m2ts_demux_dmscc_init ( GF_M2TS_Demuxer demux)

initializes DSM-CC object carousel reception

Parameters
demuxthe target MPEG-2 TS demultiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_sdt_info()

GF_M2TS_SDT* gf_m2ts_get_sdt_info ( GF_M2TS_Demuxer demux,
u32  program_id 
)

gets SDT info for a given program

Parameters
demuxthe target MPEG-2 TS demultiplexer
program_idID of the target MPEG-2 TS program
Returns
an SDT description, or NULL if not found
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_flush_pes()

void gf_m2ts_flush_pes ( GF_M2TS_Demuxer demux,
GF_M2TS_PES *  pes,
u32  force_flush 
)

flushes a given stream. This is used to flush internal demultiplexer buffers on end of stream

Parameters
demuxthe target MPEG-2 demultiplexer
pesthe target stream to flush
force_flushif >0, flushes all streams, otherwise do not flush stream with known PES length and not yet completed (for HLS)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_flush_all()

void gf_m2ts_flush_all ( GF_M2TS_Demuxer demux,
Bool  no_force_flush 
)

flushes all streams in the mux. This is used to flush internal demultiplexer buffers on end of stream

Parameters
demuxthe target MPEG-2 demultiplexer
no_force_flushdo not force a flush of incomplete PES (used for HLS)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_new()

GF_M2TS_Mux* gf_m2ts_mux_new ( u32  mux_rate,
u32  pat_refresh_rate,
Bool  real_time 
)

creates a new MPEG-2 TS multiplexer

Parameters
mux_ratetarget mux rate in kbps, can be 0 for VBR
pat_refresh_ratePAT refresh rate in ms
real_timeindicates if real-time production should be used
Returns
a new MPEG-2 TS multiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_del()

void gf_m2ts_mux_del ( GF_M2TS_Mux *  muxer)

destroys a TS muxer

Parameters
muxerthe target MPEG-2 TS multiplexer
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_set_pcr_max_interval()

void gf_m2ts_mux_set_pcr_max_interval ( GF_M2TS_Mux *  muxer,
u32  pcr_update_ms 
)

sets max interval between two PCR. Default/max interval is 100 milliseconds

Parameters
muxerthe target MPEG-2 TS multiplexer
pcr_update_msPCR interval in milliseconds
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_add()

GF_M2TS_Mux_Program* gf_m2ts_mux_program_add ( GF_M2TS_Mux *  muxer,
u32  program_number,
u32  pmt_pid,
u32  pmt_refresh_rate,
u64  pcr_offset,
u32  mpeg4_signaling,
u32  pmt_version,
Bool  initial_disc,
u64  force_first_pts 
)

adds a new program to the muxer

Parameters
muxerthe target MPEG-2 TS multiplexer
program_numbernumber of program to add
pmt_pidvalue of program PMT packet identifier
pmt_refresh_raterefresh rate in milliseconds of PMT. 0 only sends PMT once
pcr_offsetinitial offset in 90 kHz to add to PCR values (usually to compensate for large frame sending times)
mpeg4_signalingtype of MPEG-4 signaling used
pmt_versioninitial version of the PMT
initial_discif GF_TRUE, signals packet discontinuity on the first packet of eact stream in the program
force_first_ptsif not 0, the first PTS written in the program will have the indicated value (in 90khz)
Returns
a TS multiplexer program
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_program_stream_add()

GF_M2TS_Mux_Stream* gf_m2ts_program_stream_add ( GF_M2TS_Mux_Program *  program,
GF_ESInterface ifce,
u32  pid,
Bool  is_pcr,
Bool  force_pes_mode,
Bool  needs_mutex 
)

adds a stream to a program

Parameters
programthe target program
ifcethe stream interface object for packet and properties query
pidthe packet identifier for the stream
is_pcrif GF_TRUE, this stream is the clock reference of the program
force_pes_modeif GF_TRUE, forces PES packetization (used for streams carried over PES or sections, such as metadata and MPEG-4)
needs_mutexindicates a mutex is required before calling the stream interface object
Returns
a TS multiplexer program
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_update_config()

void gf_m2ts_mux_update_config ( GF_M2TS_Mux *  muxer,
Bool  reset_time 
)

updates muxer configuration

Parameters
muxerthe target MPEG-2 TS multiplexer
reset_timeif GF_TRUE, resets multiplexer time to 0
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_program_stream_remove()

void gf_m2ts_program_stream_remove ( GF_M2TS_Mux_Stream stream)

removes stream from program, triggering PMT update as well

Parameters
streamthe target stream to remove
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_find()

GF_M2TS_Mux_Program* gf_m2ts_mux_program_find ( GF_M2TS_Mux *  muxer,
u32  program_number 
)

finds a program by its number

Parameters
muxerthe target MPEG-2 TS multiplexer
program_numbernumber of program to retrieve
Returns
a TS multiplexer program or NULL of not found
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_count()

u32 gf_m2ts_mux_program_count ( GF_M2TS_Mux *  muxer)

gets number of program in a multiplex

Parameters
muxerthe target MPEG-2 TS multiplexer
Returns
number of programs
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_get_stream_count()

u32 gf_m2ts_mux_program_get_stream_count ( GF_M2TS_Mux_Program *  program)

gets number of stream in a program

Parameters
programthe target program
Returns
number of streams
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_get_pmt_pid()

u32 gf_m2ts_mux_program_get_pmt_pid ( GF_M2TS_Mux_Program *  program)

gets the packet identifier of the PMT of a program

Parameters
programthe target program
Returns
PID of the PMT
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_get_pcr_pid()

u32 gf_m2ts_mux_program_get_pcr_pid ( GF_M2TS_Mux_Program *  program)

gets the packet identifier of the PCR stream of a program

Parameters
programthe target program
Returns
PID of the PCR
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_process()

const u8* gf_m2ts_mux_process ( GF_M2TS_Mux *  muxer,
GF_M2TSMuxState status,
u32 usec_till_next 
)

produces one packet of the multiplex

Parameters
muxerthe target MPEG-2 TS multiplexer
statusset to the current state of the multiplexer
usec_till_nextthe target MPEG-2 TS multiplexer
Returns
packet produced or NULL if error or idle
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_sys_clock()

u32 gf_m2ts_get_sys_clock ( GF_M2TS_Mux *  muxer)

gets the system clock of the multiplexer (time elapsed since start)

Parameters
muxerthe target MPEG-2 TS multiplexer
Returns
system clock of the multiplexer in milliseconds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_ts_clock()

u32 gf_m2ts_get_ts_clock ( GF_M2TS_Mux *  muxer)

gets the multiplexer clock (computed from mux rate and packet sent)

Parameters
muxerthe target MPEG-2 TS multiplexer
Returns
multiplexer clock in milliseconds
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_ts_clock_90k()

u64 gf_m2ts_get_ts_clock_90k ( GF_M2TS_Mux *  muxer)

gets the multiplexer clock (computed from mux rate and packet sent)

Parameters
muxerthe target MPEG-2 TS multiplexer
Returns
multiplexer clock in 90kHz scale
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_use_single_au_pes_mode()

GF_Err gf_m2ts_mux_use_single_au_pes_mode ( GF_M2TS_Mux *  muxer,
GF_M2TS_PackMode  au_pes_mode 
)

set AU per PES packetization mode

Parameters
muxerthe target MPEG-2 TS multiplexer
au_pes_modeAU packetization mode to use
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_set_initial_pcr()

GF_Err gf_m2ts_mux_set_initial_pcr ( GF_M2TS_Mux *  muxer,
u64  init_pcr_value 
)

sets initial PCR value for all programs in multiplex. If this is not called, each program will use a random initial PCR

Parameters
muxerthe target MPEG-2 TS multiplexer
init_pcr_valueinitial PCR value in 90kHz
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_enable_pcr_only_packets()

GF_Err gf_m2ts_mux_enable_pcr_only_packets ( GF_M2TS_Mux *  muxer,
Bool  enable_forced_pcr 
)

enables pure PCR packets (no payload). This can be needed for some DVB constraints on PCR refresh rate (less than one frame duration) when next video frame is not yet ready to be muxed.

Parameters
muxerthe target MPEG-2 TS multiplexer
enable_forced_pcrif GF_TRUE, the multiplexer may use PCR-only packets; otherwise, it will wait for a frame to be ready on the PCR stream before sending a PCR
Returns
error if any
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_set_name()

void gf_m2ts_mux_program_set_name ( GF_M2TS_Mux_Program *  program,
const char *  program_name,
const char *  mux_provider_name 
)

sets program name and provider

Parameters
programthe target program
program_namethe program name (UTF-8)
mux_provider_namethe provider name (UTF-8)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_force_keep_ts()

void gf_m2ts_mux_program_force_keep_ts ( GF_M2TS_Mux_Program *  program)

forces keeping DTS CTS untouched (no remap of first packet to 0) - needed when doing stateless dashing

Parameters
programthe target program

◆ gf_m2ts_mux_enable_sdt()

void gf_m2ts_mux_enable_sdt ( GF_M2TS_Mux *  muxer,
u32  refresh_rate_ms 
)

enables sending DVB SDT

Parameters
muxerthe target program
refresh_rate_msthe refresh rate for the SDT. A value of 0 only sends the SDT once
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_table_update()

void gf_m2ts_mux_table_update ( GF_M2TS_Mux_Stream stream,
u8  table_id,
u16  table_id_extension,
u8 table_payload,
u32  table_payload_length,
Bool  use_syntax_indicator,
Bool  private_indicator 
)

update a given table

Parameters
streamtarget stream carrying the section
table_idID of the table
table_id_extensionextended ID of the table
table_payloadpayload to send
table_payload_lengthpayload length to send
use_syntax_indicatorinject section syntax extension (extended ID and fragmentation info of the table)
private_indicatorprivate indicator flag of section header
+ Here is the call graph for this function:
+ Here is the caller graph for this function: