libgpac
Documentation of the core library of GPAC
|
Data Structures | |
struct | GF_ISOFragmentBoundaryInfo |
Enumerations | |
enum | GF_ISOSegOpenMode { GF_ISOM_SEGMENT_NO_ORDER_FLAG = 1 , GF_ISOM_SEGMENT_SCALABLE_FLAG = 1<<1 } |
Functions | |
Bool | gf_isom_is_fragmented (GF_ISOFile *isom_file) |
Bool | gf_isom_is_track_fragmented (GF_ISOFile *isom_file, GF_ISOTrackID TrackID) |
Bool | gf_isom_has_segment (GF_ISOFile *isom_file, u32 *brand, u32 *version) |
u32 | gf_isom_segment_get_fragment_count (GF_ISOFile *isom_file) |
u32 | gf_isom_segment_get_track_fragment_count (GF_ISOFile *isom_file, u32 moof_index) |
u32 | gf_isom_segment_get_track_fragment_decode_time (GF_ISOFile *isom_file, u32 moof_index, u32 traf_index, u64 *decode_time) |
u64 | gf_isom_segment_get_fragment_size (GF_ISOFile *isom_file, u32 moof_index, u32 *moof_size) |
void | gf_isom_set_single_moof_mode (GF_ISOFile *isom_file, Bool mode) |
GF_Err | gf_isom_get_file_offset_for_time (GF_ISOFile *isom_file, Double start_time, u64 *offset) |
GF_Err | gf_isom_get_sidx_duration (GF_ISOFile *isom_file, u64 *sidx_dur, u32 *sidx_timescale) |
GF_Err | gf_isom_refresh_fragmented (GF_ISOFile *isom_file, u64 *MissingBytes, const char *new_location) |
u64 | gf_isom_get_current_tfdt (GF_ISOFile *isom_file, u32 trackNumber) |
u64 | gf_isom_get_smooth_next_tfdt (GF_ISOFile *isom_file, u32 trackNumber) |
Bool | gf_isom_is_smooth_streaming_moov (GF_ISOFile *isom_file) |
GF_Err | gf_isom_get_fragment_defaults (GF_ISOFile *isom_file, u32 trackNumber, u32 *defaultDuration, u32 *defaultSize, u32 *defaultDescriptionIndex, u32 *defaultRandomAccess, u8 *defaultPadding, u16 *defaultDegradationPriority) |
Bool | gf_isom_get_last_producer_time_box (GF_ISOFile *isom_file, GF_ISOTrackID *refTrackID, u64 *ntp, u64 *timestamp, Bool reset_info) |
void | gf_isom_enable_traf_map_templates (GF_ISOFile *isom_file) |
Bool | gf_isom_get_root_sidx_offsets (GF_ISOFile *isom_file, u64 *start, u64 *end) |
Bool | gf_isom_sample_is_fragment_start (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNum, GF_ISOFragmentBoundaryInfo *frag_info) |
GF_Err | gf_isom_release_segment (GF_ISOFile *isom_file, Bool reset_tables) |
GF_Err | gf_isom_reset_tables (GF_ISOFile *isom_file, Bool reset_sample_count) |
GF_Err | gf_isom_reset_data_offset (GF_ISOFile *isom_file, u64 *top_box_start) |
GF_Err | gf_isom_open_segment (GF_ISOFile *isom_file, const char *fileName, u64 start_range, u64 end_range, GF_ISOSegOpenMode flags) |
GF_ISOTrackID | gf_isom_get_highest_track_in_scalable_segment (GF_ISOFile *isom_file, u32 for_base_track) |
void | gf_isom_reset_fragment_info (GF_ISOFile *isom_file, Bool keep_sample_count) |
void | gf_isom_reset_sample_count (GF_ISOFile *isom_file) |
void | gf_isom_reset_seq_num (GF_ISOFile *isom_file) |
u64 | gf_isom_get_fragmented_duration (GF_ISOFile *isom_file) |
u32 | gf_isom_get_fragments_count (GF_ISOFile *isom_file, Bool segments_only) |
GF_Err | gf_isom_get_fragmented_samples_info (GF_ISOFile *isom_file, GF_ISOTrackID trackID, u32 *nb_samples, u64 *duration) |
u32 | gf_isom_get_next_moof_number (GF_ISOFile *isom_file) |
This describes function specific to fragmented ISOBMF files
struct GF_ISOFragmentBoundaryInfo |
Segment boundary information
Data Fields | ||
---|---|---|
u64 | frag_start |
fragment start offset |
u64 | mdat_end |
mdat end offset |
u64 | seg_start_plus_one | |
const u8 * | moof_template |
serialized array of styp (if present) sidx (if present) and moof with only the current traf |
u32 | moof_template_size |
size of serialized buffer |
u64 | sidx_start |
sidx start, 0 if absent |
u64 | sidx_end |
sidx end, 0 if absent |
u64 | first_dts |
DTS of first sample in this fragment fotr the queried track |
enum GF_ISOSegOpenMode |
Bool gf_isom_is_fragmented | ( | GF_ISOFile * | isom_file | ) |
checks if a movie file is fragmented
isom_file | the target ISO file |
Bool gf_isom_is_track_fragmented | ( | GF_ISOFile * | isom_file, |
GF_ISOTrackID | TrackID | ||
) |
checks if a movie file is fragmented
isom_file | the target ISO file |
TrackID | the target track |
checks if a file has a top styp box
isom_file | the target ISO file |
brand | set to the major brand of the styp box |
version | set to version of the styp box |
u32 gf_isom_segment_get_fragment_count | ( | GF_ISOFile * | isom_file | ) |
gets number of movie fragments in the file
isom_file | the target ISO file |
gets number of track fragments in the indicated movie fragment
isom_file | the target ISO file |
moof_index | the target movie fragment (1-based index) |
u32 gf_isom_segment_get_track_fragment_decode_time | ( | GF_ISOFile * | isom_file, |
u32 | moof_index, | ||
u32 | traf_index, | ||
u64 * | decode_time | ||
) |
get the track fragment decode time of a track fragment
isom_file | the target ISO file |
moof_index | the target movie fragment (1-based index) |
traf_index | the target track fragment (1-based index) |
decode_time | set to the track fragment decode time if present, 0 otherwise |
get the movie fragment size, i.e. the size of moof, mdat and related boxes before moof/mdat
isom_file | the target ISO file |
moof_index | the target movie fragment (1-based index) |
moof_size | set to moof box size, may be NULL |
void gf_isom_set_single_moof_mode | ( | GF_ISOFile * | isom_file, |
Bool | mode | ||
) |
enables single moof mode. In single moof mode, file is parsed only one moof/mdat at a time in order to proceed to next moof, gf_isom_reset_data_offset must be called to parse the next moof
isom_file | the target ISO file |
mode | if GF_TRUE, enables single moof mode; otherwise disables it |
gets closest file offset for the given time, when the file uses an segment index (sidx)
isom_file | the target ISO file |
start_time | the start time in seconds |
offset | set to the file offset of the segment containing the desired time |
gets sidx duration, when the file uses an segment index (sidx)
isom_file | the target ISO file |
sidx_dur | set to the total duration documented in the segment index |
sidx_timescale | set timescale used to represent the duration in the segment index |
GF_Err gf_isom_refresh_fragmented | ( | GF_ISOFile * | isom_file, |
u64 * | MissingBytes, | ||
const char * | new_location | ||
) |
refreshes a fragmented file A file being downloaded may be a fragmented file. In this case only partial info is available once the file is successfully open (gf_isom_open_progressive), and since there is no information wrt number fragments (which could actually be generated on the fly at the sender side), you must call this function on regular basis in order to load newly downloaded fragments. Note this may result in Track/Movie duration changes and SampleCount change too ...
This function should also be called when using memory read (gmem://) to refresh the underlying bitstream after appendin data to your blob. In the case where the file is not fragmented, no further box parsing will be done.
isom_file | the target ISO file |
MissingBytes | set to the number of missing bytes to parse the last incomplete top-level box found |
new_location | if set, the previous bitstream is changed to this new location, otherwise it is refreshed (disk flush) |
gets the current track fragment decode time of the track (the one of the last fragment parsed).
isom_file | the target ISO file |
trackNumber | the target track |
gets the estimated DTS of the first sample of the next segment for SmoothStreaming files (no tfdt, no tfxd)
isom_file | the target ISO file |
trackNumber | the target track |
Bool gf_isom_is_smooth_streaming_moov | ( | GF_ISOFile * | isom_file | ) |
checks if the movie is a smooth streaming recomputed initial movie
isom_file | the target ISO file |
GF_Err gf_isom_get_fragment_defaults | ( | GF_ISOFile * | isom_file, |
u32 | trackNumber, | ||
u32 * | defaultDuration, | ||
u32 * | defaultSize, | ||
u32 * | defaultDescriptionIndex, | ||
u32 * | defaultRandomAccess, | ||
u8 * | defaultPadding, | ||
u16 * | defaultDegradationPriority | ||
) |
gets default values of samples in a track to use for track fragments default. Each variable is optional and if set will contain the default value for this track samples
isom_file | the target ISO file |
trackNumber | the target track |
defaultDuration | set to the default duration of samples, 0 if not computable |
defaultSize | set to the default size of samples, 0 if not computable |
defaultDescriptionIndex | set to the default sample description index of samples, 0 if not computable |
defaultRandomAccess | set to the default sync flag of samples, 0 if not computable |
defaultPadding | set to the default padding bits of samples, 0 if not computable |
defaultDegradationPriority | set to the default degradation priority of samples, 0 if not computable |
Bool gf_isom_get_last_producer_time_box | ( | GF_ISOFile * | isom_file, |
GF_ISOTrackID * | refTrackID, | ||
u64 * | ntp, | ||
u64 * | timestamp, | ||
Bool | reset_info | ||
) |
gets last UTC/timestamp values indicated for the reference track in the file if any (pfrt box)
isom_file | the target ISO file |
refTrackID | set to the ID of the reference track used by the pfrt box |
ntp | set to the NTP timestamp found |
timestamp | set to the corresponding media timestamp in refTrackID timescale |
reset_info | if GF_TRUE, discards current NTP mapping info; this will trigger parsing of the next prft box found. If not set, subsequent pfrt boxes will not be parsed until the function is called with reset_info=GF_TRUE |
void gf_isom_enable_traf_map_templates | ( | GF_ISOFile * | isom_file | ) |
enables storage of traf templates (serialized sidx/moof/traf without trun/senc) at segment boundaries This is mostly used to recreate identical segment information when refragmenting a file
isom_file | the target ISO file |
get byte range of root sidx if any
isom_file | the target ISO file |
start | set to start offset (0=first byte) of the root sidx |
end | set to end offset (0 if no sidx) of the root sidx |
Bool gf_isom_sample_is_fragment_start | ( | GF_ISOFile * | isom_file, |
u32 | trackNumber, | ||
u32 | sampleNum, | ||
GF_ISOFragmentBoundaryInfo * | frag_info | ||
) |
checks if a sample is a fragment start Only use this function if gf_isom_enable_traf_map_templates has been called
isom_file | the target ISO file |
trackNumber | the target track |
sampleNum | the target sample number |
frag_info | filled with information on fragment boundaries (optional - can be NULL) |
releases current movie segment. This closes the associated file IO object.
isom_file | the target ISO file |
reset_tables | if set, sample information for all tracks setup as segment are destroyed, along with all PSSH boxes. This allows keeping the memory footprint low when playing segments. |
resets sample information for all tracks setup. This allows keeping the memory footprint low when playing DASH/CMAF segments
isom_file | the target ISO file |
reset_sample_count | if GF_TRUE, sets sample count of all tracks back to 0 |
sets the offset for parsing from the input buffer to 0 (used to reclaim input buffer)
isom_file | the target ISO file |
top_box_start | set to the byte offset in the source buffer of the first top level box, may be NULL |
GF_Err gf_isom_open_segment | ( | GF_ISOFile * | isom_file, |
const char * | fileName, | ||
u64 | start_range, | ||
u64 | end_range, | ||
GF_ISOSegOpenMode | flags | ||
) |
opens a new segment file. Access to samples in previous segments is no longer possible if end_range>start_range, restricts the URL to the given byterange when parsing
isom_file | the target ISO file |
fileName | the file name of the new segment to open |
start_range | the start offset in bytes in the file of the segment data |
end_range | the end offset in bytes in the file of the segment data |
flags | flags to use when opening the segment |
GF_ISOTrackID gf_isom_get_highest_track_in_scalable_segment | ( | GF_ISOFile * | isom_file, |
u32 | for_base_track | ||
) |
returns the track ID of the track containing the highest enhancement layer for the given base track
isom_file | the target ISO file |
for_base_track | the number of the base track |
void gf_isom_reset_fragment_info | ( | GF_ISOFile * | isom_file, |
Bool | keep_sample_count | ||
) |
resets internal info (track fragement decode time, number of samples, next moof number)used with fragments and segment.
isom_file | the target ISO file |
keep_sample_count | if GF_TRUE, does not reset the sample count on tracks |
void gf_isom_reset_sample_count | ( | GF_ISOFile * | isom_file | ) |
resets sample count to 0 and next moof number to 0. When doing scalable media, should be called before opening the segment containing the base layer in order to make sure the sample count base number is always the same (ie 1) on all tracks
isom_file | the target ISO file |
void gf_isom_reset_seq_num | ( | GF_ISOFile * | isom_file | ) |
resets moof sequence number to 0
isom_file | the target ISO file |
u64 gf_isom_get_fragmented_duration | ( | GF_ISOFile * | isom_file | ) |
gets the duration of movie+fragments
isom_file | the target ISO file |
gets the number of fragments or segments when the file is opened in GF_ISOM_OPEN_READ_DUMP mode
isom_file | the target ISO file |
segments_only | if set to GF_TRUE, counts segments (sidx), otherwise counts fragments |
GF_Err gf_isom_get_fragmented_samples_info | ( | GF_ISOFile * | isom_file, |
GF_ISOTrackID | trackID, | ||
u32 * | nb_samples, | ||
u64 * | duration | ||
) |
gets total sample number and duration when the file is opened in GF_ISOM_OPEN_READ_DUMP mode
isom_file | the target ISO file |
trackID | the ID of the target track |
nb_samples | set to the number of samples in the track |
duration | set to the total duration in media timescale |
u32 gf_isom_get_next_moof_number | ( | GF_ISOFile * | isom_file | ) |
gets the number of the next moof to be produced
isom_file | the target ISO file |