libgpac
Documentation of the core library of GPAC
ISOBMFF Reading
+ Collaboration diagram for ISOBMFF Reading:

Data Structures

struct  GF_AudioChannelLayout
 
struct  GF_ContentLightLevelInfo
 
struct  GF_MasteringDisplayColourVolumeInfo
 
struct  GF_AudioChannelLayout.layouts
 
struct  GF_MasteringDisplayColourVolumeInfo.display_primaries
 

Macros

#define GF_ISOM_MAC_TIME_OFFSET   2082844800
 

Functions

Bool gf_isom_moov_first (GF_ISOFile *isom_file)
 
GF_Err gf_isom_set_byte_offset (GF_ISOFile *isom_file, s64 byte_offset)
 
GF_Err gf_isom_open_progressive (const char *fileName, u64 start_range, u64 end_range, Bool enable_frag_templates, GF_ISOFile **isom_file, u64 *BytesMissing)
 
GF_Err gf_isom_open_progressive_ex (const char *fileName, u64 start_range, u64 end_range, Bool enable_frag_templates, GF_ISOFile **isom_file, u64 *BytesMissing, u32 *topBoxType)
 
u64 gf_isom_get_missing_bytes (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_has_movie (GF_ISOFile *isom_file)
 
u32 gf_isom_get_track_count (GF_ISOFile *isom_file)
 
u32 gf_isom_get_timescale (GF_ISOFile *isom_file)
 
u64 gf_isom_get_duration (GF_ISOFile *isom_file)
 
u64 gf_isom_get_original_duration (GF_ISOFile *isom_file)
 
GF_Err gf_isom_get_creation_time (GF_ISOFile *isom_file, u64 *creationTime, u64 *modificationTime)
 
GF_Err gf_isom_get_track_creation_time (GF_ISOFile *isom_file, u32 trackNumber, u64 *creationTime, u64 *modificationTime)
 
GF_ISOTrackID gf_isom_get_track_id (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_track_by_id (GF_ISOFile *isom_file, GF_ISOTrackID trackID)
 
GF_ISOTrackID gf_isom_get_track_original_id (GF_ISOFile *isom_file, u32 trackNumber)
 
u8 gf_isom_is_track_enabled (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_track_flags (GF_ISOFile *isom_file, u32 trackNumber)
 
u64 gf_isom_get_track_duration (GF_ISOFile *isom_file, u32 trackNumber)
 
u64 gf_isom_get_track_duration_orig (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_media_type (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_media_subtype (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_media_time (GF_ISOFile *isom_file, u32 trackNumber, u32 movieTime, u64 *mediaTime)
 
u32 gf_isom_get_sample_description_count (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_sample_description_index (GF_ISOFile *isom_file, u32 trackNumber, u64 for_time)
 
Bool gf_isom_is_self_contained (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
u64 gf_isom_get_media_duration (GF_ISOFile *isom_file, u32 trackNumber)
 
u64 gf_isom_get_media_original_duration (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_media_timescale (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_chunks_infos (GF_ISOFile *isom_file, u32 trackNumber, u32 *dur_min, u32 *dur_avg, u32 *dur_max, u32 *size_min, u32 *size_avg, u32 *size_max)
 
GF_Err gf_isom_get_handler_name (GF_ISOFile *isom_file, u32 trackNumber, const char **outName)
 
GF_Err gf_isom_check_data_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_data_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, const char **outURL, const char **outURN)
 
u32 gf_isom_get_sample_count (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_constant_sample_size (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_constant_sample_duration (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_enable_raw_pack (GF_ISOFile *isom_file, u32 trackNumber, u32 pack_num_samples)
 
u64 gf_isom_get_media_data_size (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_set_sample_padding (GF_ISOFile *isom_file, u32 trackNumber, u32 padding_bytes)
 
GF_ISOSamplegf_isom_get_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *sampleDescriptionIndex)
 
GF_ISOSamplegf_isom_get_sample_ex (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *sampleDescriptionIndex, GF_ISOSample *static_sample, u64 *data_offset)
 
GF_ISOSamplegf_isom_get_sample_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *sampleDescriptionIndex, u64 *data_offset)
 
GF_ISOSamplegf_isom_get_sample_info_ex (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *sampleDescriptionIndex, u64 *data_offset, GF_ISOSample *static_sample)
 
u64 gf_isom_get_sample_dts (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
u32 gf_isom_get_sample_duration (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
u32 gf_isom_get_sample_size (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
u32 gf_isom_get_max_sample_size (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_avg_sample_size (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_max_sample_delta (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_avg_sample_delta (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_max_sample_cts_offset (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_get_sample_sync (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
GF_Err gf_isom_get_sample_flags (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *is_leading, u32 *dependsOn, u32 *dependedOn, u32 *redundant)
 
GF_Err gf_isom_get_sample_for_media_time (GF_ISOFile *isom_file, u32 trackNumber, u64 desiredTime, u32 *sampleDescriptionIndex, GF_ISOSearchMode SearchMode, GF_ISOSample **sample, u32 *sample_number, u64 *data_offset)
 
u32 gf_isom_get_sample_from_dts (GF_ISOFile *isom_file, u32 trackNumber, u64 dts)
 
const GF_ISOTrackIDgf_isom_enum_track_references (GF_ISOFile *isom_file, u32 trackNumber, u32 idx, u32 *referenceType, u32 *referenceCount)
 
s32 gf_isom_get_reference_count (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType)
 
GF_Err gf_isom_get_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType, u32 referenceIndex, u32 *refTrack)
 
GF_Err gf_isom_get_reference_ID (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType, u32 referenceIndex, GF_ISOTrackID *refTrackID)
 
u32 gf_isom_has_track_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType, GF_ISOTrackID refTrackID)
 
u32 gf_isom_is_track_referenced (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType)
 
GF_Err gf_isom_get_sample_for_movie_time (GF_ISOFile *isom_file, u32 trackNumber, u64 movieTime, u32 *sampleDescriptionIndex, GF_ISOSearchMode SearchMode, GF_ISOSample **sample, u32 *sample_number, u64 *data_offset)
 
Bool gf_isom_get_edit_list_type (GF_ISOFile *isom_file, u32 trackNumber, s64 *mediaOffset)
 
u32 gf_isom_get_edits_count (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_edit (GF_ISOFile *isom_file, u32 trackNumber, u32 EditIndex, u64 *EditTime, u64 *SegmentDuration, u64 *MediaTime, GF_ISOEditType *EditMode)
 
u32 gf_isom_get_copyright_count (GF_ISOFile *isom_file)
 
GF_Err gf_isom_get_copyright (GF_ISOFile *isom_file, u32 Index, const char **threeCharCodes, const char **notice)
 
u32 gf_isom_get_chapter_count (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_chapter (GF_ISOFile *isom_file, u32 trackNumber, u32 Index, u64 *chapter_time, const char **name)
 
u8 gf_isom_has_sync_points (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_sync_point_count (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_has_time_offset (GF_ISOFile *isom_file, u32 trackNumber)
 
s64 gf_isom_get_cts_to_dts_shift (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_has_sync_shadows (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_has_sample_dependency (GF_ISOFile *isom_file, u32 trackNumber)
 
u64 gf_isom_estimate_size (GF_ISOFile *isom_file)
 
u32 gf_isom_get_next_alternate_group_id (GF_ISOFile *isom_file)
 
const char * gf_isom_get_filename (GF_ISOFile *isom_file)
 
GF_Err gf_isom_get_brand_info (GF_ISOFile *isom_file, u32 *brand, u32 *minorVersion, u32 *AlternateBrandsCount)
 
GF_Err gf_isom_get_alternate_brand (GF_ISOFile *isom_file, u32 BrandIndex, u32 *brand)
 
const u32gf_isom_get_brands (GF_ISOFile *isom_file)
 
GF_Err gf_isom_get_sample_padding_bits (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u8 *NbBits)
 
Bool gf_isom_has_padding_bits (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_visual_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *Width, u32 *Height)
 
GF_Err gf_isom_get_visual_bit_depth (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u16 *bitDepth)
 
GF_Err gf_isom_get_audio_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *SampleRate, u32 *Channels, u32 *bitsPerSample)
 
GF_Err gf_isom_get_audio_layout (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, GF_AudioChannelLayout *layout)
 
GF_Err gf_isom_get_track_layout_info (GF_ISOFile *isom_file, u32 trackNumber, u32 *width, u32 *height, s32 *translation_x, s32 *translation_y, s16 *layer)
 
GF_Err gf_isom_get_track_matrix (GF_ISOFile *isom_file, u32 trackNumber, u32 matrix[9])
 
GF_Err gf_isom_get_pixel_aspect_ratio (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *hSpacing, u32 *vSpacing)
 
GF_Err gf_isom_get_color_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *colour_type, u16 *colour_primaries, u16 *transfer_characteristics, u16 *matrix_coefficients, Bool *full_range_flag)
 
GF_Err gf_isom_get_icc_profile (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, Bool *icc_restricted, const u8 **icc, u32 *icc_size)
 
GF_Err gf_isom_get_clean_aperture (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *cleanApertureWidthN, u32 *cleanApertureWidthD, u32 *cleanApertureHeightN, u32 *cleanApertureHeightD, s32 *horizOffN, u32 *horizOffD, s32 *vertOffN, u32 *vertOffD)
 
const GF_MasteringDisplayColourVolumeInfogf_isom_get_mastering_display_colour_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
const GF_ContentLightLevelInfogf_isom_get_content_light_level_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_media_language (GF_ISOFile *isom_file, u32 trackNumber, char **lang)
 
u32 gf_isom_get_track_kind_count (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_track_kind (GF_ISOFile *isom_file, u32 trackNumber, u32 index, char **scheme, char **value)
 
u64 gf_isom_get_track_magic (GF_ISOFile *isom_file, u32 trackNumber)
 
u32 gf_isom_get_track_group (GF_ISOFile *isom_file, u32 trackNumber, u32 track_group_type)
 
Bool gf_isom_enum_track_group (GF_ISOFile *isom_file, u32 trackNumber, u32 *idx, u32 *track_group_type, u32 *track_group_id)
 
Bool gf_isom_is_single_av (GF_ISOFile *isom_file)
 
u32 gf_isom_guess_specification (GF_ISOFile *isom_file)
 
u32 gf_isom_get_nalu_length_field (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_bitrate (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *average_bitrate, u32 *max_bitrate, u32 *decode_buffer_size)
 
GF_Err gf_isom_get_track_template (GF_ISOFile *isom_file, u32 trackNumber, u8 **output, u32 *output_size)
 
GF_Err gf_isom_get_trex_template (GF_ISOFile *isom_file, u32 trackNumber, u8 **output, u32 *output_size)
 
GF_Err gf_isom_set_removed_bytes (GF_ISOFile *isom_file, u64 bytes_removed)
 
GF_Err gf_isom_get_current_top_box_offset (GF_ISOFile *isom_file, u64 *current_top_box_offset)
 
GF_Err gf_isom_purge_samples (GF_ISOFile *isom_file, u32 trackNumber, u32 nb_samples)
 
GF_Err gf_isom_dump (GF_ISOFile *isom_file, FILE *trace, Bool skip_init, Bool skip_samples)
 
u32 gf_isom_get_chunk_count (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_chunk_info (GF_ISOFile *isom_file, u32 trackNumber, u32 chunkNumber, u64 *chunk_offset, u32 *first_sample_num, u32 *sample_per_chunk, u32 *sample_desc_idx, u32 *cache_1, u32 *cache_2)
 
u64 gf_isom_get_first_mdat_start (GF_ISOFile *isom_file)
 
u64 gf_isom_get_unused_box_bytes (GF_ISOFile *isom_file)
 

Detailed Description

ISOBMF file reading


Data Structure Documentation

◆ GF_AudioChannelLayout

struct GF_AudioChannelLayout

Audio channel layout description, ISOBMFF style

Data Fields
u8 stream_structure

stream structure flags, 1: has channel layout, 2: has objects

u8 format_ordering

order of formats in the stream : 0 unknown, 1: Channels, possibly followed by Objects, 2 Objects, possibly followed by Channels

u8 base_channel_count

combined channel count of the channel layout and the object count

u8 definedLayout

defined CICP channel layout

u8 channel_order_definition

indicates where the ordering of the audio channels for the definedLayout are specified 0: as listed for the ChannelConfigurations in ISO/IEC 23091-3 1: Default order of audio codec specification 2: Channel ordering #2 of audio codec specification 3: Channel ordering #3 of audio codec specification 4: Channel ordering #4 of audio codec specification

u8 omitted_channels_present

indicates if omittedChannelsMap is present

u32 channels_count

number of channels

struct GF_AudioChannelLayout layouts[64]
u64 omittedChannelsMap

bit-map of omitted channels using bit positions defined in CICP - only valid if definedLayout is not 0

u8 object_count

number of objects in the stream

◆ GF_ContentLightLevelInfo

struct GF_ContentLightLevelInfo

content light level info

Data Fields
u16 max_content_light_level

max content ligth level

u16 max_pic_average_light_level

max picture average ligth level

◆ GF_MasteringDisplayColourVolumeInfo

struct GF_MasteringDisplayColourVolumeInfo

mastering display colour volume info

Data Fields
struct GF_MasteringDisplayColourVolumeInfo display_primaries[3]

display primaries

u16 white_point_x

X white point

u16 white_point_y

Y white point

u32 max_display_mastering_luminance
u32 min_display_mastering_luminance

min display mastering luminance

◆ GF_AudioChannelLayout.layouts

struct GF_AudioChannelLayout.layouts
Data Fields
u8 position

speaker position

s8 elevation

speaker elevation if position==126

s16 azimuth

speaker azimuth if position==126

◆ GF_MasteringDisplayColourVolumeInfo.display_primaries

struct GF_MasteringDisplayColourVolumeInfo.display_primaries

display primaries

Data Fields
u16 x
u16 y

Macro Definition Documentation

◆ GF_ISOM_MAC_TIME_OFFSET

#define GF_ISOM_MAC_TIME_OFFSET   2082844800

time offset since UNIX EPOC for MP4/QT/MJ2K files

Function Documentation

◆ gf_isom_moov_first()

Bool gf_isom_moov_first ( GF_ISOFile isom_file)

checks if moov box is before any mdat box

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if if moov box is before any mdat box, GF_FALSE otherwise

◆ gf_isom_set_byte_offset()

GF_Err gf_isom_set_byte_offset ( GF_ISOFile isom_file,
s64  byte_offset 
)

when reading a file, indicates that file data is missing the indicated bytes

Parameters
isom_filethe target ISO file
byte_offsetnumber of bytes not present at the beginning of the file
Returns
error if any

◆ gf_isom_open_progressive()

GF_Err gf_isom_open_progressive ( const char *  fileName,
u64  start_range,
u64  end_range,
Bool  enable_frag_templates,
GF_ISOFile **  isom_file,
u64 BytesMissing 
)

opens a movie that can be uncomplete in READ_ONLY mode to use for http streaming & co

start_range and end_range restricts the media byte range in the URL (used by DASH) if 0 or end_range<=start_range, the entire URL is used when parsing

If the url indicates a gfio or gmem resource, the file can be played from the associated underlying buffer. For gmem, you must call gf_isom_refresh_fragmented and gf_isom_set_removed_bytes whenever the underlying buffer is modified.

Parameters
fileNamethe name of the local file or cache to open, gmem:// or gfio://
start_rangeonly loads starting from indicated byte range
end_rangeloading stops at indicated byte range
enable_frag_templatesloads fragment and segment boundaries in an internal table
isom_filepointer set to the opened file if success
BytesMissingis set to the predicted number of bytes missing for the file to be loaded Note that if the file is not optimized for streaming, this number is not accurate If the movie is successfully loaded (isom_file non-NULL), BytesMissing is zero
Returns
error if any

◆ gf_isom_open_progressive_ex()

GF_Err gf_isom_open_progressive_ex ( const char *  fileName,
u64  start_range,
u64  end_range,
Bool  enable_frag_templates,
GF_ISOFile **  isom_file,
u64 BytesMissing,
u32 topBoxType 
)

same as gf_isom_open_progressive but allows fetching the incomplete box type

Parameters
fileNamethe name of the local file or cache to open
start_rangeonly loads starting from indicated byte range
end_rangeloading stops at indicated byte range
enable_frag_templatesloads fragment and segment boundaries in an internal table
isom_filepointer set to the opened file if success
BytesMissingis set to the predicted number of bytes missing for the file to be loaded
topBoxTypeis set to the 4CC of the incomplete top-level box found - may be NULL Note that if the file is not optimized for streaming, this number is not accurate If the movie is successfully loaded (isom_file non-NULL), BytesMissing is zero
Returns
error if any

◆ gf_isom_get_missing_bytes()

u64 gf_isom_get_missing_bytes ( GF_ISOFile isom_file,
u32  trackNumber 
)

retrieves number of bytes missing. if requesting a sample fails with error GF_ISOM_INCOMPLETE_FILE, use this function to get the number of bytes missing to retrieve the sample

Parameters
isom_filethe target ISO file
trackNumberthe desired track to query
Returns
the number of bytes missing to fetch the sample

◆ gf_isom_has_movie()

Bool gf_isom_has_movie ( GF_ISOFile isom_file)

checks if a file has movie info (moov box with tracks & dynamic media). Some files may just use the base IsoMedia structure without "moov" container

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if the file has a movie, GF_FALSE otherwise

◆ gf_isom_get_track_count()

u32 gf_isom_get_track_count ( GF_ISOFile isom_file)

gets number of tracks

Parameters
isom_filethe target ISO file
Returns
the number of tracks in the movie, or -1 if error

◆ gf_isom_get_timescale()

u32 gf_isom_get_timescale ( GF_ISOFile isom_file)

gets the movie timescale

Parameters
isom_filethe target ISO file
Returns
the timescale of the movie, 0 if error

◆ gf_isom_get_duration()

u64 gf_isom_get_duration ( GF_ISOFile isom_file)

gets the movie duration computed based on media samples and edit lists

Parameters
isom_filethe target ISO file
Returns
the computed duration of the movie, 0 if error

◆ gf_isom_get_original_duration()

u64 gf_isom_get_original_duration ( GF_ISOFile isom_file)

gets the original movie duration as written in the file, regardless of the media data

Parameters
isom_filethe target ISO file
Returns
the duration of the movie

◆ gf_isom_get_creation_time()

GF_Err gf_isom_get_creation_time ( GF_ISOFile isom_file,
u64 creationTime,
u64 modificationTime 
)

gets the creation info of the movie

Parameters
isom_filethe target ISO file
creationTimeset to the creation time of the movie
modificationTimeset to the modification time of the movie
Returns
error if any

◆ gf_isom_get_track_creation_time()

GF_Err gf_isom_get_track_creation_time ( GF_ISOFile isom_file,
u32  trackNumber,
u64 creationTime,
u64 modificationTime 
)

gets the creation info of the movie

Parameters
isom_filethe target ISO file
trackNumberthe target track
creationTimeset to the creation time of the movie
modificationTimeset to the modification time of the movie
Returns
error if any

◆ gf_isom_get_track_id()

GF_ISOTrackID gf_isom_get_track_id ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the ID of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the trackID of the track, or 0 if error

◆ gf_isom_get_track_by_id()

u32 gf_isom_get_track_by_id ( GF_ISOFile isom_file,
GF_ISOTrackID  trackID 
)

gets a track number by its ID

Parameters
isom_filethe target ISO file
trackIDthe target track ID
Returns
the track number of the track, or 0 if error

◆ gf_isom_get_track_original_id()

GF_ISOTrackID gf_isom_get_track_original_id ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the track original ID (before cloning from another file)

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the original trackID of the track, or 0 if error

◆ gf_isom_is_track_enabled()

u8 gf_isom_is_track_enabled ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the enable flag of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
0: not enabled, 1: enabled, 2: error

◆ gf_isom_get_track_flags()

u32 gf_isom_get_track_flags ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets track flags

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the track flags

◆ gf_isom_get_track_duration()

u64 gf_isom_get_track_duration ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the track duration - this will try to fix any discrepencies between media duration+edit lists vs track duration

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the track duration in movie timescale, or 0 if error

◆ gf_isom_get_track_duration_orig()

u64 gf_isom_get_track_duration_orig ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the unmodified track duration - mus be called before any call to gf_isom_get_track_duration

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the track duration in movie timescale, or 0 if error

◆ gf_isom_get_media_type()

u32 gf_isom_get_media_type ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the media type (audio, video, etc) of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the media type four character code of the media

◆ gf_isom_get_media_subtype()

u32 gf_isom_get_media_subtype ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

gets media subtype of a sample description entry

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
Returns
the media type four character code of the given sample description

◆ gf_isom_get_media_time()

GF_Err gf_isom_get_media_time ( GF_ISOFile isom_file,
u32  trackNumber,
u32  movieTime,
u64 mediaTime 
)

gets the composition time (media time) given the absolute time in the Movie

Parameters
isom_filethe target ISO file
trackNumberthe target track
movieTimedesired time in movie timescale
mediaTimeis set to 0 if the media is not playing at that time (empty time segment)
Returns
error if any

◆ gf_isom_get_sample_description_count()

u32 gf_isom_get_sample_description_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of sample descriptions in the media - a media can have several stream descriptions (eg different codec configurations, different protetcions, different visual sizes).

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the number of sample descriptions

◆ gf_isom_get_sample_description_index()

u32 gf_isom_get_sample_description_index ( GF_ISOFile isom_file,
u32  trackNumber,
u64  for_time 
)

gets the stream description index for a given time in media time

Parameters
isom_filethe target ISO file
trackNumberthe target track
for_timethe desired time in media timescale
Returns
the sample description index, or 0 if error or if empty

◆ gf_isom_is_self_contained()

Bool gf_isom_is_self_contained ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if a sample stream description is self-contained (samples located in the file)

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
Returns
GF_TRUE if samples referring to the given stream description are present in the file, GF_FALSE otherwise

◆ gf_isom_get_media_duration()

u64 gf_isom_get_media_duration ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the media duration (without edit) based on sample table

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the media duration, 0 if no samples

◆ gf_isom_get_media_original_duration()

u64 gf_isom_get_media_original_duration ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the original media duration (without edit) as indicated in the file

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the media duration

◆ gf_isom_get_media_timescale()

u32 gf_isom_get_media_timescale ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the media timescale

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the timeScale of the media

◆ gf_isom_get_chunks_infos()

GF_Err gf_isom_get_chunks_infos ( GF_ISOFile isom_file,
u32  trackNumber,
u32 dur_min,
u32 dur_avg,
u32 dur_max,
u32 size_min,
u32 size_avg,
u32 size_max 
)

gets media chunking information for non-fragmented files

Parameters
isom_filethe target ISO file
trackNumberthe target track
dur_minset to minimum chunk duration in media timescale (optional, can be NULL)
dur_avgset to average chunk duration in media timescale (optional, can be NULL)
dur_maxset to maximum chunk duration in media timescale (optional, can be NULL)
size_minset to smallest chunk size in bytes (optional, can be NULL)
size_avgset to average chunk size in bytes (optional, can be NULL)
size_maxset to largest chunk size in bytes (optional, can be NULL)
Returns
error if any

◆ gf_isom_get_handler_name()

GF_Err gf_isom_get_handler_name ( GF_ISOFile isom_file,
u32  trackNumber,
const char **  outName 
)

gets the handler name. The outName must be:

Parameters
isom_filethe target ISO file
trackNumberthe target track
outNameset to the handler name (must be non NULL)
Returns
error if any

◆ gf_isom_check_data_reference()

GF_Err gf_isom_check_data_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if the data reference for the given track and sample description is valid and supported (a data Reference allows to construct a file without integrating the media data, however this library only handles local storage external data references)

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
Returns
error if any

◆ gf_isom_get_data_reference()

GF_Err gf_isom_get_data_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
const char **  outURL,
const char **  outURN 
)

gets the location of the data. If both outURL and outURN are set to NULL, the data is in this file

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
outURLset to URL value of the data reference
outURNset to URN value of the data reference
Returns
error if any

◆ gf_isom_get_sample_count()

u32 gf_isom_get_sample_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of samples in a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the number of samples, or 0 if error

◆ gf_isom_get_constant_sample_size()

u32 gf_isom_get_constant_sample_size ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the constant sample size for samples of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
constant size of samples or 0 if size not constant

◆ gf_isom_get_constant_sample_duration()

u32 gf_isom_get_constant_sample_duration ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the constant sample duration for samples of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
constant duration of samples, or 0 if duration not constant

◆ gf_isom_enable_raw_pack()

Bool gf_isom_enable_raw_pack ( GF_ISOFile isom_file,
u32  trackNumber,
u32  pack_num_samples 
)

sets max audio sample packing in a single ISOSample. This is mostly used when processing raw audio tracks, for which extracting samples per samples would be too time consuming

Parameters
isom_filethe target ISO file
trackNumberthe target track
pack_num_samplesthe target number of samples to pack in one ISOSample
Returns
GF_TRUE if packing was successful, GF_FALSE otherwise (non constant size and non constant duration)

◆ gf_isom_get_media_data_size()

u64 gf_isom_get_media_data_size ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the total media data size of a track (whether in the file or not)

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
total amount of media bytes in track

◆ gf_isom_set_sample_padding()

GF_Err gf_isom_set_sample_padding ( GF_ISOFile isom_file,
u32  trackNumber,
u32  padding_bytes 
)

sets sample padding bytes when reading a sample It may be desired to fetch samples with a bigger allocated buffer than their real size, in case the decoder reads more data than available. This sets the amount of extra bytes to allocate when reading samples from this track

Note
The dataLength of the sample does NOT include padding
Parameters
isom_filethe target ISO file
trackNumberthe target track
padding_bytesthe amount of bytes to add at the end of a sample data buffer
Returns
error if any

◆ gf_isom_get_sample()

GF_ISOSample* gf_isom_get_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 sampleDescriptionIndex 
)

fetches a sample from a track. The sample must be destroyed using gf_isom_sample_del

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
sampleDescriptionIndexset to the sample description index corresponding to this sample
Returns
the ISO sample or NULL if not found or end of stream or incomplete file. Use gf_isom_last_error to check the error code

◆ gf_isom_get_sample_ex()

GF_ISOSample* gf_isom_get_sample_ex ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 sampleDescriptionIndex,
GF_ISOSample static_sample,
u64 data_offset 
)

fetches a sample from a track without allocating a new sample. This function is the same as gf_isom_get_sample except that it fills in the static_sample passed as argument, potentially reallocating buffers

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
sampleDescriptionIndexset to the sample description index corresponding to this sample
static_samplea caller-allocated ISO sample to use as the returned sample
data_offsetset to data offset in file / current bitstream - may be NULL
Returns
the ISO sample or NULL if not found or end of stream or incomplete file. Use gf_isom_last_error to check the error code
Note
If the function returns NULL, the static_sample and its associated data are NOT destroyed

◆ gf_isom_get_sample_info()

GF_ISOSample* gf_isom_get_sample_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 sampleDescriptionIndex,
u64 data_offset 
)

gets sample information. This is the same as gf_isom_get_sample but doesn't fetch media data

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
sampleDescriptionIndexset to the sample description index corresponding to this sample (optional, can be NULL)
data_offsetset to the sample start offset in file (optional, can be NULL)
Note
When both sampleDescriptionIndex and data_offset are NULL, only DTS, CTS_Offset and RAP indications are retrieved (faster)
Returns
the ISO sample without data or NULL if not found or end of stream or incomplete file. Use gf_isom_last_error to check the error code

◆ gf_isom_get_sample_info_ex()

GF_ISOSample* gf_isom_get_sample_info_ex ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 sampleDescriptionIndex,
u64 data_offset,
GF_ISOSample static_sample 
)

gets sample information with a user-allocated sample. This is the same as gf_isom_get_sample_info but uses a static allocated sample as input

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
sampleDescriptionIndexset to the sample description index corresponding to this sample (optional, can be NULL)
data_offsetset to the sample start offset in file (optional, can be NULL)
Note
When both sampleDescriptionIndex and data_offset are NULL, only DTS, CTS_Offset and RAP indications are retrieved (faster)
Parameters
static_samplea caller-allocated ISO sample to use as the returned sample
Returns
the ISO sample without data or NULL if not found or end of stream or incomplete file. Use gf_isom_last_error to check the error code
Note
If the function returns NULL, the static_sample and its associated data if any are NOT destroyed

◆ gf_isom_get_sample_dts()

u64 gf_isom_get_sample_dts ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber 
)

get sample decoding time

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
Returns
decoding time in media timescale

◆ gf_isom_get_sample_duration()

u32 gf_isom_get_sample_duration ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber 
)

gets sample duration

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
Returns
sample duration in media timescale

◆ gf_isom_get_sample_size()

u32 gf_isom_get_sample_size ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber 
)

gets sample size

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
Returns
sample size in bytes

◆ gf_isom_get_max_sample_size()

u32 gf_isom_get_max_sample_size ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets maximum sample size in track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
max size of any sample in track

◆ gf_isom_get_avg_sample_size()

u32 gf_isom_get_avg_sample_size ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets average sample size in a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
average size of sample in track

◆ gf_isom_get_max_sample_delta()

u32 gf_isom_get_max_sample_delta ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets maximum sample duration in track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
max sample delta in media timescale

◆ gf_isom_get_avg_sample_delta()

u32 gf_isom_get_avg_sample_delta ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets average sample duration in track, i.e. the sample delta occuring most often

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
average sample delta in media timescale

◆ gf_isom_get_max_sample_cts_offset()

u32 gf_isom_get_max_sample_cts_offset ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets max sample CTS offset (CTS-DTS) in track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
max sample cts offset in media timescale

◆ gf_isom_get_sample_sync()

Bool gf_isom_get_sample_sync ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber 
)

gets sample sync flag. This does not check other sample groups ('rap ' or 'sap ')

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
Returns
GF_TRUE if sample is sync, GF_FALSE otherwise

◆ gf_isom_get_sample_flags()

GF_Err gf_isom_get_sample_flags ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 is_leading,
u32 dependsOn,
u32 dependedOn,
u32 redundant 
)

gets sample dependency flags - see ISO/IEC 14496-12 and gf_filter_pck_set_dependency_flags

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
is_leadingset to 1 if sample is a leading picture
dependsOnset to the depends_on flag
dependedOnset to the depended_on flag
redundantset to the redundant flag
Returns
error if any

◆ gf_isom_get_sample_for_media_time()

GF_Err gf_isom_get_sample_for_media_time ( GF_ISOFile isom_file,
u32  trackNumber,
u64  desiredTime,
u32 sampleDescriptionIndex,
GF_ISOSearchMode  SearchMode,
GF_ISOSample **  sample,
u32 sample_number,
u64 data_offset 
)

gets a sample given a desired decoding time and set the sampleDescriptionIndex of this sample

Warning
The sample may not be sync even though the sync was requested (depends on the media and the editList) the SampleNum is optional. If non-NULL, will contain the sampleNumber
Parameters
isom_filethe target ISO file
trackNumberthe target track
desiredTimethe desired time in media timescale
sampleDescriptionIndexset to the sample description index corresponding to this sample (optional, can be NULL)
SearchModethe search direction mode
sampleset to the fetched sample if any. If NULL, sample is not fetched (optional, can be NULL)
sample_numberset to the fetched sample number if any, set to 0 otherwise (optional, can be NULL)
data_offsetset to the sample start offset in file (optional, can be NULL)
Returns
GF_EOS if the desired time exceeds the media duration or error if any

◆ gf_isom_get_sample_from_dts()

u32 gf_isom_get_sample_from_dts ( GF_ISOFile isom_file,
u32  trackNumber,
u64  dts 
)

gets sample number for a given decode time

Parameters
isom_filethe target ISO file
trackNumberthe target track
dtsthe desired decode time in media timescale
Returns
the sample number or 0 if not found

◆ gf_isom_enum_track_references()

const GF_ISOTrackID* gf_isom_enum_track_references ( GF_ISOFile isom_file,
u32  trackNumber,
u32  idx,
u32 referenceType,
u32 referenceCount 
)

enumerates the type and references IDs of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
idx0-based index of reference to query
referenceTypeset to the four character code of the reference entry
referenceCountset to the number of track ID references for the reference entry
Returns
list of track IDs, NULL if no references - do NOT modify !

◆ gf_isom_get_reference_count()

s32 gf_isom_get_reference_count ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType 
)

get the number of track references of a track for a given ReferenceType

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference to query
Returns
-1 if error or the number of references

◆ gf_isom_get_reference()

GF_Err gf_isom_get_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType,
u32  referenceIndex,
u32 refTrack 
)

get the referenced track number for a track and a given ReferenceType and Index

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference to query
referenceIndexthe 1-based index of the reference to query (see gf_isom_get_reference_count)
refTrackset to the track number of the referenced track
Returns
error if any

◆ gf_isom_get_reference_ID()

GF_Err gf_isom_get_reference_ID ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType,
u32  referenceIndex,
GF_ISOTrackID refTrackID 
)

get the referenced track ID for a track and a given ReferenceType and Index

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference to query
referenceIndexthe 1-based index of the reference to query (see gf_isom_get_reference_count)
refTrackIDset to the track ID of the referenced track
Returns
error if any

◆ gf_isom_has_track_reference()

u32 gf_isom_has_track_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType,
GF_ISOTrackID  refTrackID 
)

checks if a track has a reference of given type to another track

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference to query
refTrackIDset to the track number of the referenced track
Returns
the reference index if the given track has a reference of type referenceType to refTreckID, 0 otherwise

◆ gf_isom_is_track_referenced()

u32 gf_isom_is_track_referenced ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType 
)

checks if a track is referenced by another track wuth the given reference type

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference to query
Returns
the track number of the first track referencing the target track, 0 otherwise

◆ gf_isom_get_sample_for_movie_time()

GF_Err gf_isom_get_sample_for_movie_time ( GF_ISOFile isom_file,
u32  trackNumber,
u64  movieTime,
u32 sampleDescriptionIndex,
GF_ISOSearchMode  SearchMode,
GF_ISOSample **  sample,
u32 sample_number,
u64 data_offset 
)

fetches a sample for a given movie time, handling possible track edit lists.

if no sample is playing, an empty sample is returned with no data and a DTS set to MovieTime when searching in sync modes if no sample is playing, the closest sample in the edit time-line is returned when searching in regular modes

Warning
The sample may not be sync even though the sync was requested (depends on the media and the editList)
Note
This function will handle re-timestamping the sample according to the mapping of the media time-line on the track time-line. The sample TSs (DTS / CTS offset) are expressed in MEDIA TIME SCALE (to match the media stream TS resolution as indicated in media header / SLConfig)
Parameters
isom_filethe target ISO file
trackNumberthe target track
movieTimethe desired movie time in media timescale
sampleDescriptionIndexset to the sample description index corresponding to this sample (optional, can be NULL)
SearchModethe search direction mode
sampleset to the fetched sample if any. If NULL, sample is not fetched (optional, can be NULL)
sample_numberset to the fetched sample number if any, set to 0 otherwise (optional, can be NULL)
data_offsetset to the sample start offset in file (optional, can be NULL)
Returns
error if any

◆ gf_isom_get_edit_list_type()

Bool gf_isom_get_edit_list_type ( GF_ISOFile isom_file,
u32  trackNumber,
s64 mediaOffset 
)

gets edit list type

Parameters
isom_filethe target ISO file
trackNumberthe target track
mediaOffsetset to the media offset of the edit for time-shifting edits
Returns
GF_TRUE if complex edit list, GF_FALSE if no edit list or time-shifting only edit list, in which case mediaOffset is set to the CTS of the first sample to present at presentation time 0 A negative value implies that the samples with CTS between 0 and mediaOffset should not be presented (skip) A positive value value implies that there is nothing to present between 0 and CTS (hold)

◆ gf_isom_get_edits_count()

u32 gf_isom_get_edits_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of edits in an edit list

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
number of edits

◆ gf_isom_get_edit()

GF_Err gf_isom_get_edit ( GF_ISOFile isom_file,
u32  trackNumber,
u32  EditIndex,
u64 EditTime,
u64 SegmentDuration,
u64 MediaTime,
GF_ISOEditType EditMode 
)

gets the desired edit information

Parameters
isom_filethe target ISO file
trackNumberthe target track
EditIndexindex of the edit to query (1-based index)
EditTimeset to the edit time in movie timescale
SegmentDurationset to the edit duration in movie timescale
MediaTimeset to the edit media start time in media timescale
EditModeset to the mode of the edit
Returns
error if any

◆ gf_isom_get_copyright_count()

u32 gf_isom_get_copyright_count ( GF_ISOFile isom_file)

gets the number of languages for the copyright

Parameters
isom_filethe target ISO file
Returns
number of languages, 0 if no copyright

◆ gf_isom_get_copyright()

GF_Err gf_isom_get_copyright ( GF_ISOFile isom_file,
u32  Index,
const char **  threeCharCodes,
const char **  notice 
)

gets a copyright and its language code

Parameters
isom_filethe target ISO file
Indexthe 1-based index of the copyright notice to query
threeCharCodesset to the copyright language code
noticeset to the copyright notice
Returns
error if any

◆ gf_isom_get_chapter_count()

u32 gf_isom_get_chapter_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of chapter for movie or track (chapters can be assigned to tracks or to movies)

Parameters
isom_filethe target ISO file
trackNumberthe target track to queryy. If 0, looks for chapter at the movie level
Returns
number of chapters

◆ gf_isom_get_chapter()

GF_Err gf_isom_get_chapter ( GF_ISOFile isom_file,
u32  trackNumber,
u32  Index,
u64 chapter_time,
const char **  name 
)

gets the given chapter time and name for a movie or track

Parameters
isom_filethe target ISO file
trackNumberthe target track to queryy. If 0, looks for chapter at the movie level
Indexthe index of the ckhapter to queryy
chapter_timeset to chapter start time in milliseconds (optional, may be NULL)
nameset to chapter name (optional, may be NULL)
Returns
error if any

◆ gf_isom_has_sync_points()

u8 gf_isom_has_sync_points ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a media has sync points

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
0 if the media has no sync point info (eg, all samples are RAPs), 1 if the media has sync points (eg some samples are RAPs), 2 if the media has empty sync point info (no samples are RAPs - this will likely only happen in scalable context)

◆ gf_isom_get_sync_point_count()

u32 gf_isom_get_sync_point_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of sync points in a media

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
number of sync points

◆ gf_isom_has_time_offset()

u32 gf_isom_has_time_offset ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a media track hhas composition time offset

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
1 if the track uses unsigned compositionTime offsets (B-frames or similar), 2 if the track uses signed compositionTime offsets (B-frames or similar), 0 if the track does not use compositionTime offsets (CTS == DTS)

◆ gf_isom_get_cts_to_dts_shift()

s64 gf_isom_get_cts_to_dts_shift ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets cts to dts shift value if defined. This shift is defined only in cases of negative CTS offset (ctts version 1) and not always present in files! Adding shift to CTS guarantees that the shifted CTS is always greater than the DTS for any sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the shift from composition time to decode time for that track if indicated, or 0 if not found

◆ gf_isom_has_sync_shadows()

Bool gf_isom_has_sync_shadows ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a track has sync shadow samples (RAP samples replacing non RAP ones)

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
GF_TRUE if the track has sync shadow samples

◆ gf_isom_has_sample_dependency()

Bool gf_isom_has_sample_dependency ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a track has sample dependencoes indicated

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
GF_TRUE if the track has sample dep indications

◆ gf_isom_estimate_size()

u64 gf_isom_estimate_size ( GF_ISOFile isom_file)

gets a rough estimation of file size. This only works for completely self-contained files and without fragmentation for the current time

Parameters
isom_filethe target ISO file
Returns
estimated file size in bytes

◆ gf_isom_get_next_alternate_group_id()

u32 gf_isom_get_next_alternate_group_id ( GF_ISOFile isom_file)

gets next alternate group ID available

Parameters
isom_filethe target ISO file
Returns
next available ID for alternate groups

◆ gf_isom_get_filename()

const char* gf_isom_get_filename ( GF_ISOFile isom_file)

gets file name of an opened ISO file

Parameters
isom_filethe target ISO file
Returns
the file name

◆ gf_isom_get_brand_info()

GF_Err gf_isom_get_brand_info ( GF_ISOFile isom_file,
u32 brand,
u32 minorVersion,
u32 AlternateBrandsCount 
)

gets file brand information The brand is used to

  • differenciate MP4, MJPEG2000 and QT while indicating compatibilities
  • identify tools that shall be supported for correct parsing of the file

The function will set brand, minorVersion and AlternateBrandsCount to 0 if no brand indication is found in the file

Parameters
isom_filethe target ISO file
brandset to the four character code of the brand
minorVersionset to an informative integer for the minor version of the major brand (optional, can be NULL)
AlternateBrandsCountset to the number of compatible brands (optional, can be NULL).
Returns
error if any

◆ gf_isom_get_alternate_brand()

GF_Err gf_isom_get_alternate_brand ( GF_ISOFile isom_file,
u32  BrandIndex,
u32 brand 
)

gets an alternate brand indication

Note
the Major brand should always be indicated in the alternate brands
Parameters
isom_filethe target ISO file
BrandIndex1-based index of alternate brand to query (cf gf_isom_get_brand_info)
brandset to the four character code of the brand
Returns
error if any

◆ gf_isom_get_brands()

const u32* gf_isom_get_brands ( GF_ISOFile isom_file)

gets the internal list of brands

Parameters
isom_filethe target ISO file
Returns
the internal list of brands. DO NOT MODIFY the content

◆ gf_isom_get_sample_padding_bits()

GF_Err gf_isom_get_sample_padding_bits ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u8 NbBits 
)

gets the number of padding bits at the end of a given sample if any

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe desired sample number (1-based index)
NbBitsset to the number of padded bits at the end of the sample
Returns
error if any

◆ gf_isom_has_padding_bits()

Bool gf_isom_has_padding_bits ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a track samples use padding bits or not

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
GF_TRUE if samples have padding bits information, GF_FALSE otherwise

◆ gf_isom_get_visual_info()

GF_Err gf_isom_get_visual_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 Width,
u32 Height 
)

gets information of a visual track for a given sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
Widthset to the width of the sample description in pixels
Heightset to the height of the sample description in pixels
Returns
error if any

◆ gf_isom_get_visual_bit_depth()

GF_Err gf_isom_get_visual_bit_depth ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u16 bitDepth 
)

gets bit depth of a sample description of a visual track (for uncompressed media usually)

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
bitDepththe bit depth of each pixel (eg 24 for RGB, 32 for RGBA)
Returns
error if any

◆ gf_isom_get_audio_info()

GF_Err gf_isom_get_audio_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 SampleRate,
u32 Channels,
u32 bitsPerSample 
)

gets information of an audio track for a given sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
SampleRateset to the audio sample rate of the sample description
Channelsset to the audio channel count of the sample description
bitsPerSampleset to the audio bits per sample for raw audio of the sample description
Returns
error if any

◆ gf_isom_get_audio_layout()

GF_Err gf_isom_get_audio_layout ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
GF_AudioChannelLayout layout 
)

get channel layout info for an audio track, ISOBMFF style

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
layoutset to the channel/object layout info for this track
Returns
GF_NOT_FOUND if not set in file, or other error if any

◆ gf_isom_get_track_layout_info()

GF_Err gf_isom_get_track_layout_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32 width,
u32 height,
s32 translation_x,
s32 translation_y,
s16 layer 
)

gets visual track layout information

Parameters
isom_filethe target ISO file
trackNumberthe target track
widthset to the width of the track in pixels
heightset to the height of the track in pixels
translation_xset to the horizontal translation of the track in pixels
translation_yset to the vertical translation of the track in pixels
layerset to the z-order of the track
Returns
error if any

◆ gf_isom_get_track_matrix()

GF_Err gf_isom_get_track_matrix ( GF_ISOFile isom_file,
u32  trackNumber,
u32  matrix[9] 
)

gets matrix of a visual track

Parameters
isom_filethe target ISO file
trackNumberthe target track
matrixset to the track matrix - all coord values are expressed as 16.16 fixed point floats
Returns
error if any

◆ gf_isom_get_pixel_aspect_ratio()

GF_Err gf_isom_get_pixel_aspect_ratio ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 hSpacing,
u32 vSpacing 
)

gets sample (pixel) aspect ratio information of a visual track for a given sample description The aspect ratio is hSpacing divided by vSpacing

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
hSpacinghorizontal spacing
vSpacingvertical spacing
Returns
error if any

◆ gf_isom_get_color_info()

GF_Err gf_isom_get_color_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 colour_type,
u16 colour_primaries,
u16 transfer_characteristics,
u16 matrix_coefficients,
Bool full_range_flag 
)

gets color information of a visual track for a given sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
colour_typeset to the four character code of the colour type mode used (nclx, nclc, prof or ricc currently defined)
colour_primariesset to the colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
transfer_characteristicsset to the colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
matrix_coefficientsset to the colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
full_range_flagset to the colour primaries for nclc as defined in ISO/IEC 23001-8
Returns
error if any

◆ gf_isom_get_icc_profile()

GF_Err gf_isom_get_icc_profile ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
Bool icc_restricted,
const u8 **  icc,
u32 icc_size 
)

gets ICC profile

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
icc_restrictedset to GF_TRUE of restricted ICC profile, GF_FALSE otherwise
iccset to profile data, NULL if none
icc_sizeset to profile size, 0 if none
Returns
error if any

◆ gf_isom_get_clean_aperture()

GF_Err gf_isom_get_clean_aperture ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 cleanApertureWidthN,
u32 cleanApertureWidthD,
u32 cleanApertureHeightN,
u32 cleanApertureHeightD,
s32 horizOffN,
u32 horizOffD,
s32 vertOffN,
u32 vertOffD 
)

gets clean aperture (crop window, see ISO/IEC 14496-12) for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
cleanApertureWidthNset to nominator of clean aperture horizontal size, may be NULL
cleanApertureWidthDset to denominator of clean aperture horizontal size, may be NULL
cleanApertureHeightNset to nominator of clean aperture vertical size, may be NULL
cleanApertureHeightDset to denominator of clean aperture vertical size, may be NULL
horizOffNset to nominator of horizontal offset of clean aperture center minus (width-1)/2 (eg 0 sets center to center of video), may be NULL
horizOffDset to denominator of horizontal offset of clean aperture center minus (width-1)/2 (eg 0 sets center to center of video), may be NULL
vertOffNset to nominator of vertical offset of clean aperture center minus (height-1)/2 (eg 0 sets center to center of video), may be NULL
vertOffDset to denominator of vertical offset of clean aperture center minus (height-1)/2 (eg 0 sets center to center of video), may be NULL
Returns
error if any

◆ gf_isom_get_mastering_display_colour_info()

const GF_MasteringDisplayColourVolumeInfo* gf_isom_get_mastering_display_colour_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

gets master display colour info if any

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
Returns
the mdcv info, or NULL if none or not a valid video track

◆ gf_isom_get_content_light_level_info()

const GF_ContentLightLevelInfo* gf_isom_get_content_light_level_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

gets content light level info if any

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
Returns
the clli info, or NULL if none or not a valid video track

◆ gf_isom_get_media_language()

GF_Err gf_isom_get_media_language ( GF_ISOFile isom_file,
u32  trackNumber,
char **  lang 
)

gets the media language code of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
langset to a newly allocated string containg 3 chars (if old files) or longer form (BCP-47) - shall be freed by caller
Returns
error if any

◆ gf_isom_get_track_kind_count()

u32 gf_isom_get_track_kind_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the number of kind (media role) for a given track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
number of kind defined

◆ gf_isom_get_track_kind()

GF_Err gf_isom_get_track_kind ( GF_ISOFile isom_file,
u32  trackNumber,
u32  index,
char **  scheme,
char **  value 
)

gets a given kind (media role) information for a given track

Parameters
isom_filethe target ISO file
trackNumberthe target track
indexthe 1-based index of the kind to retrieve
schemeset to the scheme of the kind information - shall be freed by caller
valueset to the value of the kind information - shall be freed by caller
Returns
error if any

◆ gf_isom_get_track_magic()

u64 gf_isom_get_track_magic ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets the magic number associated with a track. The magic number is usually set by a file muxer, and is not serialized to file

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
the magic number (0 by default)

◆ gf_isom_get_track_group()

u32 gf_isom_get_track_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  track_group_type 
)

gets track group ID of a given track group type for this track

Parameters
isom_filethe target ISO file
trackNumberthe target track
track_group_typethe target track group type
Returns
the track group ID, 0 if not found

◆ gf_isom_enum_track_group()

Bool gf_isom_enum_track_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32 idx,
u32 track_group_type,
u32 track_group_id 
)

gets track group ID of a given track group type for this track

Parameters
isom_filethe target ISO file
trackNumberthe target track
idx0-based index of enumeration, incremented by the function if success
track_group_typeset to the track group type - may be NULL
track_group_idset to the track group ID - may be NULL
Returns
GF_TRUE if success, GF_FALSE otherwise

◆ gf_isom_is_single_av()

Bool gf_isom_is_single_av ( GF_ISOFile isom_file)

checks if file is a single AV file with max one audio, one video, one text and basic od/bifs

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if file is single AV, GF_FALSE otherwise

◆ gf_isom_guess_specification()

u32 gf_isom_guess_specification ( GF_ISOFile isom_file)

guesses which specification this file refers to.

Parameters
isom_filethe target ISO file
Returns
possible values are: GF_ISOM_BRAND_ISOM: unrecognized std GF_ISOM_BRAND_3GP5: 3GP file (max 1 audio, 1 video) without text track GF_ISOM_BRAND_3GP6: 3GP file (max 1 audio, 1 video) with text track GF_ISOM_BRAND_3GG6: 3GP file multitrack file GF_ISOM_BRAND_3G2A: 3GP2 file GF_ISOM_BRAND_AVC1: AVC file FCC("ISMA"): ISMA file (may overlap with 3GP) GF_ISOM_BRAND_MP42: any generic MP4 file (eg with BIFS/OD/MPEG-4 systems stuff)

for files without movie, returns the file meta handler type

◆ gf_isom_get_nalu_length_field()

u32 gf_isom_get_nalu_length_field ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

gets the nalu_length_field size used for this sample description if NALU-based (AVC/HEVC/...)

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
Returns
number of bytes used to code the NALU size, or 0 if not NALU-based

◆ gf_isom_get_bitrate()

GF_Err gf_isom_get_bitrate ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 average_bitrate,
u32 max_bitrate,
u32 decode_buffer_size 
)

gets max/average rate information as indicated in ESDS or BTRT boxes. If not found all values are set to 0 if sampleDescriptionIndex is 0, gather for all sample descriptions

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index (1-based)
average_bitrateset to the average bitrate in bits per second of the media
max_bitrateset to the maximum bitrate in bits per second of the media
decode_buffer_sizeset to the decoder buffer size in bytes of the media
Returns
error if any

◆ gf_isom_get_track_template()

GF_Err gf_isom_get_track_template ( GF_ISOFile isom_file,
u32  trackNumber,
u8 **  output,
u32 output_size 
)

gets the track template of a track. This serializes track box without serializing sample tables nor sample description info

Parameters
isom_filethe destination ISO file
trackNumberthe destination track
outputwill be set to a newly allocated buffer containing the serialized box - caller shall free it
output_sizewill be set to the size of the allocated buffer
Returns
error if any

◆ gf_isom_get_trex_template()

GF_Err gf_isom_get_trex_template ( GF_ISOFile isom_file,
u32  trackNumber,
u8 **  output,
u32 output_size 
)

gets the trex template of a track. This serializes trex box

Parameters
isom_filethe destination ISO file
trackNumberthe destination track
outputwill be set to a newly allocated buffer containing the serialized box - caller shall free it
output_sizewill be set to the size of the allocated buffer
Returns
error if any

◆ gf_isom_set_removed_bytes()

GF_Err gf_isom_set_removed_bytes ( GF_ISOFile isom_file,
u64  bytes_removed 
)

sets the number of removed bytes form the input bitstream when using gmem:// url The number of bytes shall be the total number since the opening of the movie

Parameters
isom_filethe target ISO file
bytes_removednumber of bytes removed
Returns
error if any

◆ gf_isom_get_current_top_box_offset()

GF_Err gf_isom_get_current_top_box_offset ( GF_ISOFile isom_file,
u64 current_top_box_offset 
)

gets the current file offset of the current incomplete top level box not parsed This shall be checked to avoid discarding bytes at or after the current top box header

Parameters
isom_filethe target ISO file
current_top_box_offsetset to the offset from file first byte
Returns
error if any

◆ gf_isom_purge_samples()

GF_Err gf_isom_purge_samples ( GF_ISOFile isom_file,
u32  trackNumber,
u32  nb_samples 
)

purges the given number of samples, starting from the first sample, from a track of a fragmented file. This avoids having sample tables growing in size when reading a fragmented file in pure streaming mode (no seek). You should always keep one sample in the track

Parameters
isom_filethe target ISO file
trackNumberthe desired track to purge
nb_samplesthe number of samples to remove
Returns
error if any

◆ gf_isom_dump()

GF_Err gf_isom_dump ( GF_ISOFile isom_file,
FILE *  trace,
Bool  skip_init,
Bool  skip_samples 
)

dumps file structures into XML trace file

Parameters
isom_filethe target ISO file
tracethe file object to dump to
skip_initdoes not dump init segment structure
skip_samplesdoes not dump sample tables
Returns
error if any

◆ gf_isom_get_chunk_count()

u32 gf_isom_get_chunk_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets number of chunks in track

Parameters
isom_filethe target ISO file
trackNumberthe desired track to purge
Returns
number of chunks in track

◆ gf_isom_get_chunk_info()

GF_Err gf_isom_get_chunk_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  chunkNumber,
u64 chunk_offset,
u32 first_sample_num,
u32 sample_per_chunk,
u32 sample_desc_idx,
u32 cache_1,
u32 cache_2 
)

gets info for a given chunk in track

Parameters
isom_filethe target ISO file
trackNumberthe desired track to purge
chunkNumberthe 1-based index of the desired chunk
chunk_offsetset to the chunk offset in bytes from start of file
first_sample_numset to the sample number of the first sample in the chunk
sample_per_chunkset to number of samples per chunk
sample_desc_idxset to sample desc index of samples of this chunk
cache_1updated by function at each call. May be NULL (slower). Must be set to 0 if not querying consecutive chunks
cache_2updated by function at each call. May be NULL (slower). Must be set to 0 if not querying consecutive chunks
Returns
error if any

◆ gf_isom_get_first_mdat_start()

u64 gf_isom_get_first_mdat_start ( GF_ISOFile isom_file)

gets the file offset of the first usable byte of the first mdat box in the file

Parameters
isom_filethe target ISO file
Returns
byte offset

◆ gf_isom_get_unused_box_bytes()

u64 gf_isom_get_unused_box_bytes ( GF_ISOFile isom_file)

gets the size of all skip, free and wide boxes present in the file and bytes skipped during parsing (assumes a single file was opened)

Parameters
isom_filethe target ISO file
Returns
size