libgpac
Documentation of the core library of GPAC
|
MPEG-TS demultiplexer and multiplexer APIs. More...
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_MetadataPointerDescriptor |
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_MetadataDescriptor |
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) |
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_Demuxer * | gf_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_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) |
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 u8 * | gf_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) |
This section documents the MPEG-TS demultiplexer and multiplexer APIs.
struct GF_M2TS_Section |
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 |
struct GF_M2TS_SectionFilter |
MPEG-2 TS demuxer section filter
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 |
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 |
struct GF_M2TS_TemiLocationDescriptor |
struct GF_M2TS_TemiTimecodeDescriptor |
struct GF_M2TS_Program |
MPEG-2 TS program object
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 |
struct tag_m2ts_es |
abstract Section/PES stream object
MPEG-2 TS demuxer elementary stream
struct GF_M2TS_PESHeader |
struct tag_m2ts_section_es |
Section elementary stream
MPEG-2 TS demuxer elementary stream section
Data Fields | ||
---|---|---|
ABSTRACT_ES GF_M2TS_SectionFilter * | sec |
derive from base M2TS stream section reassembler |
struct GF_M2TS_DVB_Subtitling_Descriptor |
struct GF_M2TS_DVB_Teletext_Descriptor |
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 |
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 |
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 |
struct GF_M2TS_Mux_Section |
struct GF_M2TS_Mux_Table |
struct GF_M2TS_Time |
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 |
struct GF_M2TSDescriptor |
struct __m2ts_mux_program |
MPEG-2 TS muxer program info
MPEG-2 TS muxer 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 |
struct __m2ts_mux |
MPEG-2 TS muxer
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) |
#define SECTION_HEADER_LENGTH 3 |
header till the last bit of the section_length field
#define SECTION_ADDITIONAL_HEADER_LENGTH 5 |
header from the last bit of the section_length field to the payload
#define CRC_LENGTH 4 |
CRC32 length
#define GF_M2TS_MAX_STREAMS 8192 |
Maximum number of streams in a TS
#define GF_M2TS_MAX_SERVICES 65535 |
Maximum number of service in a TS
#define GF_M2TS_UDP_BUFFER_SIZE 0x40000 |
Maximum size of the buffer in UDP
#define GF_M2TS_MAX_PCR 2576980377811ULL |
Maximum PCR value
#define ABSTRACT_ES |
macro for abstract Section/PES stream object, only used for type casting
#define GF_M2TS_PSI_DEFAULT_REFRESH_RATE 200 |
default refresh rate for PSI data
typedef struct tag_m2ts_demux GF_M2TS_Demuxer |
MPEG-2 TS 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) |
section callback function
demux | the target MPEG-2 TS demultiplexer |
es | the target section stream |
sections | the list of gathered sections |
table_id | the ID of the table |
ex_table_id | the extended ID of the table |
version_number | the version number of the table |
last_section_number | the last section number of the table for fragmented cases |
status | the parsing status flags |
anonymous enum |
anonymous enum |
MPEG-2 Descriptor tags
anonymous enum |
anonymous enum |
max size includes first header, second header, payload and CRC
enum GF_M2TSStreamType |
MPEG-2 TS Media types
anonymous enum |
MPEG-2 TS Registration codes types
anonymous enum |
enum GF_M2TSPesFraming |
anonymous enum |
PES packet flags
anonymous enum |
Events used by the MPEGTS demuxer
anonymous enum |
table parsing state
enum metadata_carriage |
anonymous enum |
ES flags
anonymous enum |
anonymous enum |
enum GF_M2TS_PackMode |
enum GF_M2TSMuxState |
const char* gf_m2ts_get_stream_name | ( | GF_M2TSStreamType | streamType | ) |
gets the stream name for an MPEG-2 stream type
streamType | the target stream type |
Bool gf_m2ts_probe_file | ( | const char * | fileName | ) |
probes a file for MPEG-2 TS format
fileName | name / path of the file to brobe |
probes a buffer for MPEG-2 TS format
data | data buffer to probe |
size | size of buffer to probe |
restamps a set of TS packets by shifting all timing by the given value
buffer | data buffer to restamp |
size | size of buffer |
ts_shift | clock shift in 90 kHz |
is_pes | array of GF_M2TS_MAX_STREAMS u8 set to 1 for PES PIDs to be restamped, 0 to stream to left untouched |
GF_M2TS_Demuxer* gf_m2ts_demux_new | ( | ) |
creates a new MPEG-2 TS demultiplexer
void gf_m2ts_demux_del | ( | GF_M2TS_Demuxer * | demux | ) |
destroys a new MPEG-2 TS demultiplexer
demux | the target MPEG-2 TS demultiplexer |
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
demux | the target MPEG-2 TS demultiplexer |
void gf_m2ts_mark_seg_start | ( | GF_M2TS_Demuxer * | demux | ) |
set all streams is_seg_start variable to GF_TRUE
demux | the target MPEG-2 TS demultiplexer |
void gf_m2ts_reset_parsers_for_program | ( | GF_M2TS_Demuxer * | demux, |
GF_M2TS_Program * | program | ||
) |
resets all parsers (PES, sections) of a given program
demux | the target MPEG-2 TS demultiplexer |
program | the target MPEG-2 TS program |
GF_Err gf_m2ts_set_pes_framing | ( | GF_M2TS_PES * | pes, |
GF_M2TSPesFraming | mode | ||
) |
sets PES framing mode of a stream
pes | the target MPEG-2 TS stream |
mode | the desired PES framing mode |
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
demux | the target MPEG-2 TS demultiplexer |
data | the data to process |
data_size | size of the date to process |
void gf_m2ts_demux_dmscc_init | ( | GF_M2TS_Demuxer * | demux | ) |
initializes DSM-CC object carousel reception
demux | the target MPEG-2 TS demultiplexer |
GF_M2TS_SDT* gf_m2ts_get_sdt_info | ( | GF_M2TS_Demuxer * | demux, |
u32 | program_id | ||
) |
gets SDT info for a given program
demux | the target MPEG-2 TS demultiplexer |
program_id | ID of the target MPEG-2 TS program |
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
demux | the target MPEG-2 demultiplexer |
pes | the target stream to flush |
force_flush | if >0, flushes all streams, otherwise do not flush stream with known PES length and not yet completed (for HLS) |
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
demux | the target MPEG-2 demultiplexer |
no_force_flush | do not force a flush of incomplete PES (used for HLS) |
creates a new MPEG-2 TS multiplexer
mux_rate | target mux rate in kbps, can be 0 for VBR |
pat_refresh_rate | PAT refresh rate in ms |
real_time | indicates if real-time production should be used |
void gf_m2ts_mux_del | ( | GF_M2TS_Mux * | muxer | ) |
destroys a TS muxer
muxer | the target MPEG-2 TS multiplexer |
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
muxer | the target MPEG-2 TS multiplexer |
pcr_update_ms | PCR interval in milliseconds |
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
muxer | the target MPEG-2 TS multiplexer |
program_number | number of program to add |
pmt_pid | value of program PMT packet identifier |
pmt_refresh_rate | refresh rate in milliseconds of PMT. 0 only sends PMT once |
pcr_offset | initial offset in 90 kHz to add to PCR values (usually to compensate for large frame sending times) |
mpeg4_signaling | type of MPEG-4 signaling used |
pmt_version | initial version of the PMT |
initial_disc | if GF_TRUE, signals packet discontinuity on the first packet of eact stream in the program |
force_first_pts | if not 0, the first PTS written in the program will have the indicated value (in 90khz) |
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
program | the target program |
ifce | the stream interface object for packet and properties query |
pid | the packet identifier for the stream |
is_pcr | if GF_TRUE, this stream is the clock reference of the program |
force_pes_mode | if GF_TRUE, forces PES packetization (used for streams carried over PES or sections, such as metadata and MPEG-4) |
needs_mutex | indicates a mutex is required before calling the stream interface object |
void gf_m2ts_mux_update_config | ( | GF_M2TS_Mux * | muxer, |
Bool | reset_time | ||
) |
updates muxer configuration
muxer | the target MPEG-2 TS multiplexer |
reset_time | if GF_TRUE, resets multiplexer time to 0 |
void gf_m2ts_program_stream_remove | ( | GF_M2TS_Mux_Stream * | stream | ) |
removes stream from program, triggering PMT update as well
stream | the target stream to remove |
GF_M2TS_Mux_Program* gf_m2ts_mux_program_find | ( | GF_M2TS_Mux * | muxer, |
u32 | program_number | ||
) |
finds a program by its number
muxer | the target MPEG-2 TS multiplexer |
program_number | number of program to retrieve |
u32 gf_m2ts_mux_program_count | ( | GF_M2TS_Mux * | muxer | ) |
gets number of program in a multiplex
muxer | the target MPEG-2 TS multiplexer |
u32 gf_m2ts_mux_program_get_stream_count | ( | GF_M2TS_Mux_Program * | program | ) |
gets number of stream in a program
program | the target program |
u32 gf_m2ts_mux_program_get_pmt_pid | ( | GF_M2TS_Mux_Program * | program | ) |
gets the packet identifier of the PMT of a program
program | the target program |
u32 gf_m2ts_mux_program_get_pcr_pid | ( | GF_M2TS_Mux_Program * | program | ) |
gets the packet identifier of the PCR stream of a program
program | the target program |
const u8* gf_m2ts_mux_process | ( | GF_M2TS_Mux * | muxer, |
GF_M2TSMuxState * | status, | ||
u32 * | usec_till_next | ||
) |
produces one packet of the multiplex
muxer | the target MPEG-2 TS multiplexer |
status | set to the current state of the multiplexer |
usec_till_next | the target MPEG-2 TS multiplexer |
u32 gf_m2ts_get_sys_clock | ( | GF_M2TS_Mux * | muxer | ) |
gets the system clock of the multiplexer (time elapsed since start)
muxer | the target MPEG-2 TS multiplexer |
u32 gf_m2ts_get_ts_clock | ( | GF_M2TS_Mux * | muxer | ) |
gets the multiplexer clock (computed from mux rate and packet sent)
muxer | the target MPEG-2 TS multiplexer |
u64 gf_m2ts_get_ts_clock_90k | ( | GF_M2TS_Mux * | muxer | ) |
gets the multiplexer clock (computed from mux rate and packet sent)
muxer | the target MPEG-2 TS multiplexer |
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
muxer | the target MPEG-2 TS multiplexer |
au_pes_mode | AU packetization mode to use |
sets initial PCR value for all programs in multiplex. If this is not called, each program will use a random initial PCR
muxer | the target MPEG-2 TS multiplexer |
init_pcr_value | initial PCR value in 90kHz |
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.
muxer | the target MPEG-2 TS multiplexer |
enable_forced_pcr | if 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 |
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
program | the target program |
program_name | the program name (UTF-8) |
mux_provider_name | the provider name (UTF-8) |
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
program | the target program |
void gf_m2ts_mux_enable_sdt | ( | GF_M2TS_Mux * | muxer, |
u32 | refresh_rate_ms | ||
) |
enables sending DVB SDT
muxer | the target program |
refresh_rate_ms | the refresh rate for the SDT. A value of 0 only sends the SDT once |
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
stream | target stream carrying the section |
table_id | ID of the table |
table_id_extension | extended ID of the table |
table_payload | payload to send |
table_payload_length | payload length to send |
use_syntax_indicator | inject section syntax extension (extended ID and fragmentation info of the table) |
private_indicator | private indicator flag of section header |