GPAC
Open Source Multimedia Framework. For more information, check out http://gpac.wp.mines-telecom.fr
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups
dash_segmenter.c File Reference
#include <gpac/internal/media_dev.h>
#include <gpac/constants.h>
#include <gpac/mpegts.h>
#include <gpac/config_file.h>
#include <gpac/network.h>
#include <time.h>
#include <gpac/internal/isomedia_dev.h>
+ Include dependency graph for dash_segmenter.c:

Data Structures

struct  _dash_component
 
struct  GF_DASHSegmenterOptions
 
struct  GF_DashSegInput
 
struct  GF_ISOMTrackFragmenter
 
struct  GF_TSSegmenter
 

Macros

#define EXTRACT_FORMAT(_nb_chars)
 
#define NB_TSPCK_IO_BYTES   18800
 

Functions

GF_Err gf_media_mpd_format_segment_name (GF_DashTemplateSegmentType seg_type, Bool is_bs_switching, char *segment_name, const char *output_file_name, const char *rep_id, const char *seg_rad_name, const char *seg_ext, u64 start_time, u32 bandwidth, u32 segment_number, Bool use_segment_timeline)
 
GF_Err gf_dasher_store_segment_info (GF_DASHSegmenterOptions *dash_cfg, const char *SegmentName, Double segStartTime)
 
GF_Err gf_media_get_rfc_6381_codec_name (GF_ISOFile *movie, u32 track, char *szCodec)
 
static u64 isom_get_next_sap_time (GF_ISOFile *input, u32 track, u32 sample_count, u32 sample_num)
 
static GF_Err gf_media_isom_segment_file (GF_ISOFile *input, const char *output_file, Double max_duration_sec, GF_DASHSegmenterOptions *dash_cfg, GF_DashSegInput *dash_input, Bool first_in_set)
 
static GF_Err dasher_isom_get_input_components_info (GF_DashSegInput *input, GF_DASHSegmenterOptions *opts)
 
static GF_Err dasher_isom_classify_input (GF_DashSegInput *dash_inputs, u32 nb_dash_inputs, u32 input_idx, u32 *current_group_id, u32 *max_sap_type)
 
static GF_Err dasher_isom_create_init_segment (GF_DashSegInput *dash_inputs, u32 nb_dash_inputs, u32 adaptation_set, char *szInitName, const char *tmpdir, GF_DASHSegmenterOptions *dash_opts, Bool *disable_bs_switching)
 
static GF_Err dasher_isom_segment_file (GF_DashSegInput *dash_input, const char *szOutName, GF_DASHSegmenterOptions *dash_cfg, Bool first_in_set)
 
static GF_Err dasher_generic_classify_input (GF_DashSegInput *dash_inputs, u32 nb_dash_inputs, u32 input_idx, u32 *current_group_id, u32 *max_sap_type)
 
static GF_Err dasher_generic_get_components_info (GF_DashSegInput *input, GF_DASHSegmenterOptions *opts)
 
static void m2ts_sidx_add_entry (GF_SegmentIndexBox *sidx, Bool ref_type, u32 size, u32 duration, Bool first_is_SAP, u32 sap_type, u32 RAP_delta_time)
 
static void m2ts_sidx_finalize_size (GF_TSSegmenter *index_info, u64 file_size)
 
static void m2ts_sidx_flush_entry (GF_TSSegmenter *index_info)
 
static void m2ts_check_indexing (GF_TSSegmenter *index_info)
 
static void dash_m2ts_event_check_pat (GF_M2TS_Demuxer *ts, u32 evt_type, void *par)
 
static void dash_m2ts_event (GF_M2TS_Demuxer *ts, u32 evt_type, void *par)
 
static GF_Err dasher_get_ts_demux (GF_TSSegmenter *ts_seg, const char *file, u32 probe_mode)
 
static void dasher_del_ts_demux (GF_TSSegmenter *ts_seg)
 
static GF_Err dasher_mp2t_get_components_info (GF_DashSegInput *dash_input, GF_DASHSegmenterOptions *dash_opts)
 
static GF_Err dasher_mp2t_segment_file (GF_DashSegInput *dash_input, const char *szOutName, GF_DASHSegmenterOptions *dash_cfg, Bool first_in_set)
 
static char * gf_dash_get_representationID (GF_DashSegInput *inputs, u32 nb_dash_inputs, const char *file_name, u32 trackNum)
 
GF_Err gf_dash_segmenter_probe_input (GF_DashSegInput **io_dash_inputs, u32 *nb_dash_inputs, u32 idx)
 
static GF_Err write_mpd_header (FILE *mpd, const char *mpd_name, GF_Config *dash_ctx, GF_DashProfile profile, Bool is_mpeg2, const char *title, const char *source, const char *copyright, const char *moreInfoURL, const char **mpd_base_urls, u32 nb_mpd_base_urls, Bool dash_dynamic, u32 time_shift_depth, Double mpd_duration, Double mpd_update_period, Double min_buffer, u32 ast_shift_sec)
 
static GF_Err write_period_header (FILE *mpd, const char *szID, Double period_start, Double period_duration, Bool dash_dynamic)
 
static GF_Err write_adaptation_header (FILE *mpd, GF_DashProfile profile, Bool use_url_template, u32 single_file_mode, GF_DashSegInput *first_rep, Bool bitstream_switching_mode, u32 max_width, u32 max_height, char *szMaxFPS, char *szLang, const char *szInitSegment)
 
static GF_Err gf_dasher_init_context (GF_Config *dash_ctx, u32 *dynamic, u32 *timeShiftBufferDepth, const char *periodID, u32 ast_shift_sec)
 
u32 gf_dasher_next_update_time (GF_Config *dash_ctx, u32 mpd_update_time)
 
static Bool gf_dasher_cleanup (GF_Config *dash_ctx, u32 dash_dynamic, u32 mpd_update_time, u32 time_shift_depth, Double dash_duration, u32 ast_shift_sec)
 
static u32 gf_dash_get_dependency_bandwidth (GF_DashSegInput *inputs, u32 nb_dash_inputs, const char *file_name, u32 trackNum)
 
GF_Err gf_dasher_segment_files (const char *mpdfile, GF_DashSegmenterInput *inputs, u32 nb_inputs, GF_DashProfile dash_profile, const char *mpd_title, const char *mpd_source, const char *mpd_copyright, const char *mpd_moreInfoURL, const char **mpd_base_urls, u32 nb_mpd_base_urls, u32 use_url_template, Bool use_segment_timeline, Bool single_segment, Bool single_file, GF_DashSwitchingMode bitstream_switching, Bool seg_at_rap, Double dash_duration, char *seg_name, char *seg_ext, u32 segment_marker_4cc, Double frag_duration, s32 subsegs_per_sidx, Bool daisy_chain_sidx, Bool frag_at_rap, const char *tmpdir, GF_Config *dash_ctx, u32 dash_dynamic, u32 mpd_update_time, u32 time_shift_depth, Double subduration, Double min_buffer, u32 ast_shift_sec, u32 dash_scale, Bool fragments_in_memory, u32 initial_moof_sn, u64 initial_tfdt, Bool no_fragments_defaults, Bool pssh_moof)
 

Data Structure Documentation

struct _dash_component
+ Collaboration diagram for _dash_component:
Data Fields
u32 ID
u32 media_type
char szCodec[50]
u32 width
u32 height
u32 fps_num
u32 fps_denum
u32 sar_num
u32 sar_denum
u32 max_sap
u32 sample_rate
u32 channels
char szLang[5]
struct GF_DASHSegmenterOptions
+ Collaboration diagram for GF_DASHSegmenterOptions:
Data Fields
Double segment_duration
Double subduration
Double fragment_duration
u32 dash_scale
Bool segments_start_with_rap
FILE * mpd
const char * mpd_name
const char * seg_rad_name
const char * seg_ext
s32 subsegs_per_sidx
Bool daisy_chain_sidx
u32 use_url_template
Bool use_segment_timeline
u32 single_file_mode
u32 segment_marker_4cc
s32 time_shift_depth
const char * bs_switch_segment_file
Bool inband_param_set
Bool variable_seg_rad_name
Bool fragments_start_with_rap
Bool memory_mode
Bool pssh_moof
GF_Config * dash_ctx
const char * tmpdir
u32 initial_moof_sn
u64 initial_tfdt
Bool no_fragments_defaults
struct GF_ISOMTrackFragmenter
+ Collaboration diagram for GF_ISOMTrackFragmenter:
Data Fields
Bool is_ref_track
Bool done
u32 TrackID
u32 SampleNum
u32 SampleCount
u64 FragmentLength
u32 OriginalTrack
u32 finalSampleDescriptionIndex
u32 TimeScale
u32 MediaType
u32 DefaultDuration
u32 InitialTSOffset
u64 last_sample_cts
u64 next_sample_dts
Bool all_sample_raps
Bool splitable
u32 split_sample_dts_shift
s32 media_time_to_pres_time_shift
struct GF_TSSegmenter
+ Collaboration diagram for GF_TSSegmenter:
Data Fields
FILE * src
GF_M2TS_Demuxer * ts
u64 file_size
u32 bandwidth
Bool has_seen_pat
u64 suspend_indexing
Double segment_duration
Bool segment_at_rap
FILE * index_file
GF_BitStream * index_bs
u32 subduration
u32 skip_nb_segments
u64 duration_at_last_pass
GF_SegmentIndexBox * sidx
GF_PcrInfoBox * pcrb
u32 reference_pid
GF_M2TS_PES * reference_stream
u32 nb_pes_in_segment
u64 first_PTS
u64 PCR_DTS_initial_diff
u64 base_PTS
u64 base_offset
u64 last_PTS
u64 last_DTS
u32 last_offset
u32 last_frame_duration
u64 prev_base_PTS
u64 prev_base_offset
u64 prev_last_PTS
u32 prev_last_offset
u32 SAP_type
Bool first_pes_sap
u64 first_SAP_PTS
u32 first_SAP_offset
u64 prev_last_SAP_PTS
u32 prev_last_SAP_offset
u64 last_SAP_PTS
u32 last_SAP_offset
Bool pes_after_last_pat_is_sap
u64 interpolated_pcr_value
u64 last_pcr_value
u32 last_pat_position
u32 first_pat_position
u32 prev_last_pat_position
Bool first_pat_position_valid
Bool first_pes_after_last_pat
u32 pat_version
u32 last_cat_position
u32 first_cat_position
u32 prev_last_cat_position
Bool first_cat_position_valid
u32 cat_version
u32 last_pmt_position
u32 first_pmt_position
u32 prev_last_pmt_position
Bool first_pmt_position_valid
u32 pmt_version
u32 last_pcr_position
u32 first_pcr_position
Bool first_pcr_position_valid
u32 prev_last_pcr_position

Macro Definition Documentation

#define EXTRACT_FORMAT (   _nb_chars)
Value:
strcpy(szFmt, "%d"); \
char_template+=_nb_chars; \
if (seg_rad_name[char_template]=='%') { \
char *sep = strchr(seg_rad_name+char_template, '$'); \
if (sep) { \
sep[0] = 0; \
strcpy(szFmt, seg_rad_name+char_template); \
char_template += (u32) strlen(seg_rad_name+char_template); \
sep[0] = '$'; \
} \
} \
char_template+=1; \
uint32_t u32
Definition: setup.h:246
#define NB_TSPCK_IO_BYTES   18800

Function Documentation

GF_Err gf_media_mpd_format_segment_name ( GF_DashTemplateSegmentType  seg_type,
Bool  is_bs_switching,
char *  segment_name,
const char *  output_file_name,
const char *  rep_id,
const char *  seg_rad_name,
const char *  seg_ext,
u64  start_time,
u32  bandwidth,
u32  segment_number,
Bool  use_segment_timeline 
)

+ Here is the caller graph for this function:

GF_Err gf_dasher_store_segment_info ( GF_DASHSegmenterOptions dash_cfg,
const char *  SegmentName,
Double  segStartTime 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GF_Err gf_media_get_rfc_6381_codec_name ( GF_ISOFile *  movie,
u32  track,
char *  szCodec 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u64 isom_get_next_sap_time ( GF_ISOFile *  input,
u32  track,
u32  sample_count,
u32  sample_num 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err gf_media_isom_segment_file ( GF_ISOFile *  input,
const char *  output_file,
Double  max_duration_sec,
GF_DASHSegmenterOptions dash_cfg,
GF_DashSegInput *  dash_input,
Bool  first_in_set 
)
static

+ Here is the caller graph for this function:

static GF_Err dasher_isom_get_input_components_info ( GF_DashSegInput *  input,
GF_DASHSegmenterOptions opts 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_isom_classify_input ( GF_DashSegInput *  dash_inputs,
u32  nb_dash_inputs,
u32  input_idx,
u32 current_group_id,
u32 max_sap_type 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_isom_create_init_segment ( GF_DashSegInput *  dash_inputs,
u32  nb_dash_inputs,
u32  adaptation_set,
char *  szInitName,
const char *  tmpdir,
GF_DASHSegmenterOptions dash_opts,
Bool disable_bs_switching 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_isom_segment_file ( GF_DashSegInput *  dash_input,
const char *  szOutName,
GF_DASHSegmenterOptions dash_cfg,
Bool  first_in_set 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_generic_classify_input ( GF_DashSegInput *  dash_inputs,
u32  nb_dash_inputs,
u32  input_idx,
u32 current_group_id,
u32 max_sap_type 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_generic_get_components_info ( GF_DashSegInput *  input,
GF_DASHSegmenterOptions opts 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void m2ts_sidx_add_entry ( GF_SegmentIndexBox sidx,
Bool  ref_type,
u32  size,
u32  duration,
Bool  first_is_SAP,
u32  sap_type,
u32  RAP_delta_time 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void m2ts_sidx_finalize_size ( GF_TSSegmenter index_info,
u64  file_size 
)
static

+ Here is the caller graph for this function:

static void m2ts_sidx_flush_entry ( GF_TSSegmenter index_info)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void m2ts_check_indexing ( GF_TSSegmenter index_info)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dash_m2ts_event_check_pat ( GF_M2TS_Demuxer *  ts,
u32  evt_type,
void *  par 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dash_m2ts_event ( GF_M2TS_Demuxer *  ts,
u32  evt_type,
void *  par 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_get_ts_demux ( GF_TSSegmenter ts_seg,
const char *  file,
u32  probe_mode 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static void dasher_del_ts_demux ( GF_TSSegmenter ts_seg)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_mp2t_get_components_info ( GF_DashSegInput *  dash_input,
GF_DASHSegmenterOptions dash_opts 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err dasher_mp2t_segment_file ( GF_DashSegInput *  dash_input,
const char *  szOutName,
GF_DASHSegmenterOptions dash_cfg,
Bool  first_in_set 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static char* gf_dash_get_representationID ( GF_DashSegInput *  inputs,
u32  nb_dash_inputs,
const char *  file_name,
u32  trackNum 
)
static

+ Here is the caller graph for this function:

GF_Err gf_dash_segmenter_probe_input ( GF_DashSegInput **  io_dash_inputs,
u32 nb_dash_inputs,
u32  idx 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err write_mpd_header ( FILE *  mpd,
const char *  mpd_name,
GF_Config *  dash_ctx,
GF_DashProfile  profile,
Bool  is_mpeg2,
const char *  title,
const char *  source,
const char *  copyright,
const char *  moreInfoURL,
const char **  mpd_base_urls,
u32  nb_mpd_base_urls,
Bool  dash_dynamic,
u32  time_shift_depth,
Double  mpd_duration,
Double  mpd_update_period,
Double  min_buffer,
u32  ast_shift_sec 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err write_period_header ( FILE *  mpd,
const char *  szID,
Double  period_start,
Double  period_duration,
Bool  dash_dynamic 
)
static

+ Here is the caller graph for this function:

static GF_Err write_adaptation_header ( FILE *  mpd,
GF_DashProfile  profile,
Bool  use_url_template,
u32  single_file_mode,
GF_DashSegInput *  first_rep,
Bool  bitstream_switching_mode,
u32  max_width,
u32  max_height,
char *  szMaxFPS,
char *  szLang,
const char *  szInitSegment 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static GF_Err gf_dasher_init_context ( GF_Config *  dash_ctx,
u32 dynamic,
u32 timeShiftBufferDepth,
const char *  periodID,
u32  ast_shift_sec 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

u32 gf_dasher_next_update_time ( GF_Config *  dash_ctx,
u32  mpd_update_time 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static Bool gf_dasher_cleanup ( GF_Config *  dash_ctx,
u32  dash_dynamic,
u32  mpd_update_time,
u32  time_shift_depth,
Double  dash_duration,
u32  ast_shift_sec 
)
static

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

static u32 gf_dash_get_dependency_bandwidth ( GF_DashSegInput *  inputs,
u32  nb_dash_inputs,
const char *  file_name,
u32  trackNum 
)
static

+ Here is the caller graph for this function:

GF_Err gf_dasher_segment_files ( const char *  mpdfile,
GF_DashSegmenterInput inputs,
u32  nb_inputs,
GF_DashProfile  dash_profile,
const char *  mpd_title,
const char *  mpd_source,
const char *  mpd_copyright,
const char *  mpd_moreInfoURL,
const char **  mpd_base_urls,
u32  nb_mpd_base_urls,
u32  use_url_template,
Bool  use_segment_timeline,
Bool  single_segment,
Bool  single_file,
GF_DashSwitchingMode  bitstream_switching,
Bool  seg_at_rap,
Double  dash_duration,
char *  seg_name,
char *  seg_ext,
u32  segment_marker_4cc,
Double  frag_duration,
s32  subsegs_per_sidx,
Bool  daisy_chain_sidx,
Bool  frag_at_rap,
const char *  tmpdir,
GF_Config *  dash_ctx,
u32  dash_dynamic,
u32  mpd_update_time,
u32  time_shift_depth,
Double  subduration,
Double  min_buffer,
u32  ast_shift_sec,
u32  dash_scale,
Bool  fragments_in_memory,
u32  initial_moof_sn,
u64  initial_tfdt,
Bool  no_fragments_defaults,
Bool  pssh_moof 
)

+ Here is the call graph for this function:

+ Here is the caller graph for this function: