libgpac
Documentation of the core library of GPAC
m2ts_mux.c File Reference
#include <gpac/mpegts.h>
#include <gpac/constants.h>
#include <gpac/media_tools.h>
+ Include dependency graph for m2ts_mux.c:

Macros

#define BITRATE_UPDATE_WINDOW   90000
 
#define ADAPTATION_LENGTH_LENGTH   1
 
#define ADAPTATION_FLAGS_LENGTH   1
 
#define ADAPTATION_EXTENSION_LENGTH_LENGTH   1
 
#define ADAPTATION_EXTENSION_FLAGS_LENGTH   1
 
#define PCR_LENGTH   6
 
#define GF_LANG_UNKNOWN   GF_4CC('u','n','d',' ')
 
#define FORCE_PCR_FIRST   0
 

Enumerations

enum  { GF_SEG_BOUNDARY_NONE =0 , GF_SEG_BOUNDARY_START , GF_SEG_BOUNDARY_FORCE_PMT , GF_SEG_BOUNDARY_FORCE_PCR }
 

Functions

static GFINLINE Bool gf_m2ts_time_less (GF_M2TS_Time *a, GF_M2TS_Time *b)
 
static GFINLINE Bool gf_m2ts_time_equal (GF_M2TS_Time *a, GF_M2TS_Time *b)
 
static GFINLINE Bool gf_m2ts_time_less_or_equal (GF_M2TS_Time *a, GF_M2TS_Time *b)
 
static GFINLINE void gf_m2ts_time_inc (GF_M2TS_Time *time, u64 delta_inc_num, u32 delta_inc_den)
 
static GFINLINE s32 gf_m2ts_time_diff_us (GF_M2TS_Time *a, GF_M2TS_Time *b)
 
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)
 
void gf_m2ts_mux_table_update_bitrate (GF_M2TS_Mux *mux, GF_M2TS_Mux_Stream *stream)
 
void gf_m2ts_mux_table_update_mpeg4 (GF_M2TS_Mux_Stream *stream, u8 table_id, u16 table_id_extension, char *table_payload, u32 table_payload_length, Bool use_syntax_indicator, Bool private_indicator, Bool increment_version_number)
 
static u32 gf_m2ts_add_adaptation (GF_M2TS_Mux_Program *prog, GF_BitStream *bs, u16 pid, Bool has_pcr, u64 pcr_time, Bool is_rap, u32 padding_length, char *af_descriptors, u32 af_descriptors_size, Bool set_discontinuity)
 
static void gf_m2ts_mux_table_get_next_packet (GF_M2TS_Mux *mux, GF_M2TS_Mux_Stream *stream, char *packet)
 
static u32 gf_m2ts_stream_process_sdt (GF_M2TS_Mux *muxer, GF_M2TS_Mux_Stream *stream)
 
static u32 gf_m2ts_stream_process_pat (GF_M2TS_Mux *muxer, GF_M2TS_Mux_Stream *stream)
 
static void gf_m2ts_program_stream_format_updated (GF_M2TS_Mux_Stream *stream)
 
static s32 gf_m2ts_find_stream (GF_M2TS_Mux_Program *program, u32 pid, u32 stream_id, GF_M2TS_Mux_Stream **out_stream)
 
static u32 gf_m2ts_stream_process_pmt (GF_M2TS_Mux *muxer, GF_M2TS_Mux_Stream *stream)
 
static void gf_m2ts_remap_timestamps_for_pes (GF_M2TS_Mux_Stream *stream, u32 pck_flags, u64 *dts, u64 *cts, u32 *duration)
 
static Bool gf_m2ts_adjust_next_stream_time_for_pcr (GF_M2TS_Mux *muxer, GF_M2TS_Mux_Stream *stream)
 
static void id3_write_size (GF_BitStream *bs, u32 len)
 
static void m2ts_id3_tag_create (u8 **input, u32 *len)
 
static u32 gf_m2ts_stream_process_pes (GF_M2TS_Mux *muxer, GF_M2TS_Mux_Stream *stream)
 
static GFINLINE u64 gf_m2ts_get_pcr (GF_M2TS_Mux_Stream *stream)
 
void gf_m2ts_stream_update_data_following (GF_M2TS_Mux_Stream *stream)
 
Bool gf_m2ts_stream_compute_pes_length (GF_M2TS_Mux_Stream *stream, u32 payload_length)
 
static u32 gf_m2ts_stream_get_pes_header_length (GF_M2TS_Mux_Stream *stream)
 
u32 gf_m2ts_stream_add_pes_header (GF_BitStream *bs, GF_M2TS_Mux_Stream *stream)
 
void gf_m2ts_mux_pes_get_next_packet (GF_M2TS_Mux_Stream *stream, char *packet)
 
GF_M2TS_Mux_Streamgf_m2ts_stream_new (u32 pid)
 
GF_Err gf_m2ts_output_ctrl (GF_ESInterface *_self, u32 ctrl_type, void *param)
 
static void gf_m2ts_stream_set_default_slconfig (GF_M2TS_Mux_Stream *stream)
 
static void gf_m2ts_stream_add_hierarchy_descriptor (GF_M2TS_Mux_Stream *stream)
 
static void gf_m2ts_stream_add_metadata_pointer_descriptor (GF_M2TS_Mux_Program *program)
 
static void gf_m2ts_stream_add_metadata_descriptor (GF_M2TS_Mux_Stream *stream)
 
GF_EXPORT u32 gf_m2ts_mux_program_get_pmt_pid (GF_M2TS_Mux_Program *prog)
 
GF_EXPORT u32 gf_m2ts_mux_program_get_pcr_pid (GF_M2TS_Mux_Program *prog)
 
GF_EXPORT u32 gf_m2ts_mux_program_get_stream_count (GF_M2TS_Mux_Program *prog)
 
GF_EXPORT GF_M2TS_Mux_Streamgf_m2ts_program_stream_add (GF_M2TS_Mux_Program *program, struct __elementary_stream_ifce *ifce, u32 pid, Bool is_pcr, Bool force_pes, Bool needs_mutex)
 
GF_EXPORT GF_M2TS_Mux_Program * gf_m2ts_mux_program_find (GF_M2TS_Mux *muxer, u32 program_number)
 
GF_EXPORT u32 gf_m2ts_mux_program_count (GF_M2TS_Mux *muxer)
 
GF_EXPORT 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_EXPORT void gf_m2ts_mux_program_set_name (GF_M2TS_Mux_Program *program, const char *program_name, const char *provider_name)
 
void gf_m2ts_mux_program_force_keep_ts (GF_M2TS_Mux_Program *program)
 
GF_EXPORT GF_M2TS_Mux * gf_m2ts_mux_new (u32 mux_rate, u32 pat_refresh_rate, Bool real_time)
 
GF_EXPORT void gf_m2ts_mux_enable_sdt (GF_M2TS_Mux *mux, u32 refresh_rate_ms)
 
GF_EXPORT void gf_m2ts_mux_set_pcr_max_interval (GF_M2TS_Mux *muxer, u32 pcr_update_ms)
 
void gf_m2ts_mux_stream_del (GF_M2TS_Mux_Stream *st)
 
void gf_m2ts_mux_program_del (GF_M2TS_Mux_Program *prog)
 
GF_EXPORT void gf_m2ts_program_stream_remove (GF_M2TS_Mux_Stream *stream)
 
GF_EXPORT void gf_m2ts_mux_del (GF_M2TS_Mux *mux)
 
GF_EXPORT void gf_m2ts_mux_update_config (GF_M2TS_Mux *mux, Bool reset_time)
 
GF_EXPORT u32 gf_m2ts_get_sys_clock (GF_M2TS_Mux *muxer)
 
GF_EXPORT u32 gf_m2ts_get_ts_clock (GF_M2TS_Mux *muxer)
 
GF_EXPORT u64 gf_m2ts_get_ts_clock_90k (GF_M2TS_Mux *muxer)
 
GF_EXPORT GF_Err gf_m2ts_mux_use_single_au_pes_mode (GF_M2TS_Mux *muxer, GF_M2TS_PackMode au_pes_mode)
 
GF_EXPORT GF_Err gf_m2ts_mux_set_initial_pcr (GF_M2TS_Mux *muxer, u64 init_pcr_value)
 
GF_EXPORT GF_Err gf_m2ts_mux_enable_pcr_only_packets (GF_M2TS_Mux *muxer, Bool enable_forced_pcr)
 
static Bool gf_m2ts_stream_too_early (GF_M2TS_Mux_Stream *stream, GF_M2TS_Mux *muxer)
 
GF_EXPORT const u8gf_m2ts_mux_process (GF_M2TS_Mux *muxer, GF_M2TSMuxState *status, u32 *usec_till_next)
 

Macro Definition Documentation

◆ BITRATE_UPDATE_WINDOW

#define BITRATE_UPDATE_WINDOW   90000

◆ ADAPTATION_LENGTH_LENGTH

#define ADAPTATION_LENGTH_LENGTH   1

◆ ADAPTATION_FLAGS_LENGTH

#define ADAPTATION_FLAGS_LENGTH   1

◆ ADAPTATION_EXTENSION_LENGTH_LENGTH

#define ADAPTATION_EXTENSION_LENGTH_LENGTH   1

◆ ADAPTATION_EXTENSION_FLAGS_LENGTH

#define ADAPTATION_EXTENSION_FLAGS_LENGTH   1

◆ PCR_LENGTH

#define PCR_LENGTH   6

◆ GF_LANG_UNKNOWN

#define GF_LANG_UNKNOWN   GF_4CC('u','n','d',' ')

◆ FORCE_PCR_FIRST

#define FORCE_PCR_FIRST   0

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

DASH segment boundary information - these are internal to the muxer

Enumerator
GF_SEG_BOUNDARY_NONE 

not a segment boundary

GF_SEG_BOUNDARY_START 

segment start

GF_SEG_BOUNDARY_FORCE_PMT 

segment start with forced PMT - triggered by setting struct __m2ts_mux.force_pat, triggers a forced PCR

GF_SEG_BOUNDARY_FORCE_PCR 

segment start with forced PCR

Function Documentation

◆ gf_m2ts_time_less()

static GFINLINE Bool gf_m2ts_time_less ( GF_M2TS_Time a,
GF_M2TS_Time b 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_time_equal()

static GFINLINE Bool gf_m2ts_time_equal ( GF_M2TS_Time a,
GF_M2TS_Time b 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_time_less_or_equal()

static GFINLINE Bool gf_m2ts_time_less_or_equal ( GF_M2TS_Time a,
GF_M2TS_Time b 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_time_inc()

static GFINLINE void gf_m2ts_time_inc ( GF_M2TS_Time time,
u64  delta_inc_num,
u32  delta_inc_den 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_time_diff_us()

static GFINLINE s32 gf_m2ts_time_diff_us ( GF_M2TS_Time a,
GF_M2TS_Time b 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_table_update_bitrate()

void gf_m2ts_mux_table_update_bitrate ( GF_M2TS_Mux *  mux,
GF_M2TS_Mux_Stream stream 
)
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_table_update_mpeg4()

void gf_m2ts_mux_table_update_mpeg4 ( GF_M2TS_Mux_Stream stream,
u8  table_id,
u16  table_id_extension,
char *  table_payload,
u32  table_payload_length,
Bool  use_syntax_indicator,
Bool  private_indicator,
Bool  increment_version_number 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_add_adaptation()

static u32 gf_m2ts_add_adaptation ( GF_M2TS_Mux_Program *  prog,
GF_BitStream *  bs,
u16  pid,
Bool  has_pcr,
u64  pcr_time,
Bool  is_rap,
u32  padding_length,
char *  af_descriptors,
u32  af_descriptors_size,
Bool  set_discontinuity 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_table_get_next_packet()

static void gf_m2ts_mux_table_get_next_packet ( GF_M2TS_Mux *  mux,
GF_M2TS_Mux_Stream stream,
char *  packet 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_process_sdt()

static u32 gf_m2ts_stream_process_sdt ( GF_M2TS_Mux *  muxer,
GF_M2TS_Mux_Stream stream 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_process_pat()

static u32 gf_m2ts_stream_process_pat ( GF_M2TS_Mux *  muxer,
GF_M2TS_Mux_Stream stream 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_program_stream_format_updated()

static void gf_m2ts_program_stream_format_updated ( GF_M2TS_Mux_Stream stream)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_find_stream()

static s32 gf_m2ts_find_stream ( GF_M2TS_Mux_Program *  program,
u32  pid,
u32  stream_id,
GF_M2TS_Mux_Stream **  out_stream 
)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_process_pmt()

static u32 gf_m2ts_stream_process_pmt ( GF_M2TS_Mux *  muxer,
GF_M2TS_Mux_Stream stream 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_remap_timestamps_for_pes()

static void gf_m2ts_remap_timestamps_for_pes ( GF_M2TS_Mux_Stream stream,
u32  pck_flags,
u64 dts,
u64 cts,
u32 duration 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_adjust_next_stream_time_for_pcr()

static Bool gf_m2ts_adjust_next_stream_time_for_pcr ( GF_M2TS_Mux *  muxer,
GF_M2TS_Mux_Stream stream 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ id3_write_size()

static void id3_write_size ( GF_BitStream *  bs,
u32  len 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ m2ts_id3_tag_create()

static void m2ts_id3_tag_create ( u8 **  input,
u32 len 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_process_pes()

static u32 gf_m2ts_stream_process_pes ( GF_M2TS_Mux *  muxer,
GF_M2TS_Mux_Stream stream 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_get_pcr()

static GFINLINE u64 gf_m2ts_get_pcr ( GF_M2TS_Mux_Stream stream)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_update_data_following()

void gf_m2ts_stream_update_data_following ( GF_M2TS_Mux_Stream stream)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_compute_pes_length()

Bool gf_m2ts_stream_compute_pes_length ( GF_M2TS_Mux_Stream stream,
u32  payload_length 
)
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_get_pes_header_length()

static u32 gf_m2ts_stream_get_pes_header_length ( GF_M2TS_Mux_Stream stream)
static
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_add_pes_header()

u32 gf_m2ts_stream_add_pes_header ( GF_BitStream *  bs,
GF_M2TS_Mux_Stream stream 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_pes_get_next_packet()

void gf_m2ts_mux_pes_get_next_packet ( GF_M2TS_Mux_Stream stream,
char *  packet 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_new()

GF_M2TS_Mux_Stream* gf_m2ts_stream_new ( u32  pid)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_output_ctrl()

GF_Err gf_m2ts_output_ctrl ( GF_ESInterface _self,
u32  ctrl_type,
void *  param 
)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_set_default_slconfig()

static void gf_m2ts_stream_set_default_slconfig ( GF_M2TS_Mux_Stream stream)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_add_hierarchy_descriptor()

static void gf_m2ts_stream_add_hierarchy_descriptor ( GF_M2TS_Mux_Stream stream)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_add_metadata_pointer_descriptor()

static void gf_m2ts_stream_add_metadata_pointer_descriptor ( GF_M2TS_Mux_Program *  program)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_add_metadata_descriptor()

static void gf_m2ts_stream_add_metadata_descriptor ( GF_M2TS_Mux_Stream stream)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_program_stream_add()

GF_EXPORT GF_M2TS_Mux_Stream* gf_m2ts_program_stream_add ( GF_M2TS_Mux_Program *  program,
struct __elementary_stream_ifce *  ifce,
u32  pid,
Bool  is_pcr,
Bool  force_pes,
Bool  needs_mutex 
)
+ Here is the call graph for this function:

◆ gf_m2ts_mux_stream_del()

void gf_m2ts_mux_stream_del ( GF_M2TS_Mux_Stream st)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_mux_program_del()

void gf_m2ts_mux_program_del ( GF_M2TS_Mux_Program *  prog)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ gf_m2ts_stream_too_early()

static Bool gf_m2ts_stream_too_early ( GF_M2TS_Mux_Stream stream,
GF_M2TS_Mux *  muxer 
)
static
+ Here is the call graph for this function:
+ Here is the caller graph for this function: