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

Typedefs

typedef GF_Err(* gf_isom_on_block_out) (void *usr_data, u8 *block, u32 block_size, void *sample_cbk_data, u32 sample_cbk_magic)
 
typedef GF_Err(* gf_isom_on_block_patch) (void *usr_data, u8 *block, u32 block_size, u64 block_offset, Bool is_insert)
 
typedef void(* gf_isom_on_last_block_start) (void *usr_data)
 

Enumerations

enum  GF_ISOStorageMode {
  GF_ISOM_STORE_FLAT = 1 , GF_ISOM_STORE_STREAMABLE , GF_ISOM_STORE_INTERLEAVED , GF_ISOM_STORE_DRIFT_INTERLEAVED ,
  GF_ISOM_STORE_TIGHT , GF_ISOM_STORE_FASTSTART
}
 
enum  GF_ISOMTrackFlagOp { GF_ISOM_TKFLAGS_SET = 1 , GF_ISOM_TKFLAGS_REM , GF_ISOM_TKFLAGS_ADD }
 
enum  { GF_ISOM_TK_ENABLED = 1 , GF_ISOM_TK_IN_MOVIE = 1<<1 , GF_ISOM_TK_IN_PREVIEW = 1<<2 , GF_ISOM_TK_SIZE_IS_AR = 1<<3 }
 
enum  GF_ISOCompressMode {
  GF_ISOM_COMP_NONE =0 , GF_ISOM_COMP_MOOV , GF_ISOM_COMP_MOOF , GF_ISOM_COMP_MOOF_SIDX ,
  GF_ISOM_COMP_MOOF_SSIX , GF_ISOM_COMP_ALL
}
 
enum  { GF_ISOM_COMP_FORCE_ALL = 0x01 , GF_ISOM_COMP_WRAP_FTYPE = 0x02 }
 
enum  GF_AudioSampleEntryImportMode {
  GF_IMPORT_AUDIO_SAMPLE_ENTRY_NOT_SET = 0 , GF_IMPORT_AUDIO_SAMPLE_ENTRY_v0_BS , GF_IMPORT_AUDIO_SAMPLE_ENTRY_v0_2 , GF_IMPORT_AUDIO_SAMPLE_ENTRY_v1_MPEG ,
  GF_IMPORT_AUDIO_SAMPLE_ENTRY_v1_QTFF
}
 
enum  GF_ISOTrackCloneFlags { GF_ISOM_CLONE_TRACK_KEEP_DREF = 1 , GF_ISOM_CLONE_TRACK_NO_QT = 1<<1 , GF_ISOM_CLONE_TRACK_DROP_ID = 1<<2 , GF_ISOM_CLONE_RESET_DURATION = 1<<3 }
 

Functions

GF_Err gf_isom_freeze_order (GF_ISOFile *isom_file)
 
void gf_isom_keep_utc_times (GF_ISOFile *isom_file, Bool keep_utc)
 
Bool gf_isom_has_keep_utc_times (GF_ISOFile *isom_file)
 
GF_Err gf_isom_set_timescale (GF_ISOFile *isom_file, u32 timeScale)
 
GF_Err gf_isom_load_extra_boxes (GF_ISOFile *isom_file, u8 *moov_boxes, u32 moov_boxes_size, Bool udta_only)
 
u32 gf_isom_new_track (GF_ISOFile *isom_file, GF_ISOTrackID trackID, u32 MediaType, u32 TimeScale)
 
u32 gf_isom_new_track_from_template (GF_ISOFile *isom_file, GF_ISOTrackID trackID, u32 MediaType, u32 TimeScale, u8 *tk_box, u32 tk_box_size, Bool udta_only)
 
GF_Err gf_isom_remove_track (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_set_track_enabled (GF_ISOFile *isom_file, u32 trackNumber, Bool enableTrack)
 
GF_Err gf_isom_set_track_flags (GF_ISOFile *isom_file, u32 trackNumber, u32 flags, GF_ISOMTrackFlagOp op)
 
GF_Err gf_isom_set_creation_time (GF_ISOFile *isom_file, u64 create_time, u64 modif_time)
 
GF_Err gf_isom_set_track_creation_time (GF_ISOFile *isom_file, u32 trackNumber, u64 create_time, u64 modif_time)
 
GF_Err gf_isom_set_media_creation_time (GF_ISOFile *isom_file, u32 trackNumber, u64 create_time, u64 modif_time)
 
GF_Err gf_isom_set_track_id (GF_ISOFile *isom_file, u32 trackNumber, GF_ISOTrackID trackID)
 
GF_Err gf_isom_rewrite_track_dependencies (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_add_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, const GF_ISOSample *sample)
 
GF_Err gf_isom_copy_sample_info (GF_ISOFile *dst, u32 dst_track, GF_ISOFile *src, u32 src_track, u32 sampleNumber)
 
GF_Err gf_isom_add_sample_shadow (GF_ISOFile *isom_file, u32 trackNumber, GF_ISOSample *sample)
 
GF_Err gf_isom_append_sample_data (GF_ISOFile *isom_file, u32 trackNumber, u8 *data, u32 data_size)
 
GF_Err gf_isom_add_sample_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, GF_ISOSample *sample, u64 dataOffset)
 
GF_Err gf_isom_set_last_sample_duration (GF_ISOFile *isom_file, u32 trackNumber, u32 duration)
 
GF_Err gf_isom_set_last_sample_duration_ex (GF_ISOFile *isom_file, u32 trackNumber, u32 dur_num, u32 dur_den)
 
GF_Err gf_isom_patch_last_sample_duration (GF_ISOFile *isom_file, u32 trackNumber, u64 next_dts)
 
GF_Err gf_isom_set_track_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 referenceType, GF_ISOTrackID ReferencedTrackID)
 
GF_Err gf_isom_remove_track_references (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_purge_track_reference (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_remove_track_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 ref_type)
 
GF_Err gf_isom_set_handler_name (GF_ISOFile *isom_file, u32 trackNumber, const char *nameUTF8)
 
GF_Err gf_isom_refresh_size_info (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_update_duration (GF_ISOFile *isom_file)
 
GF_Err gf_isom_update_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, Bool data_only)
 
GF_Err gf_isom_update_sample_reference (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, GF_ISOSample *sample, u64 data_offset)
 
GF_Err gf_isom_remove_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
GF_Err gf_isom_set_media_timescale (GF_ISOFile *isom_file, u32 trackNumber, u32 new_timescale, u32 new_tsinc, u32 force_rescale_type)
 
GF_Err gf_isom_add_sample_aux_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 aux_type, u32 aux_info, u8 *data, u32 size)
 
GF_Err gf_isom_set_final_name (GF_ISOFile *isom_file, char *filename)
 
GF_Err gf_isom_set_storage_mode (GF_ISOFile *isom_file, GF_ISOStorageMode storage_mode)
 
GF_Err gf_isom_set_interleave_time (GF_ISOFile *isom_file, u32 InterleaveTime)
 
GF_Err gf_isom_force_64bit_chunk_offset (GF_ISOFile *isom_file, Bool set_on)
 
GF_Err gf_isom_enable_compression (GF_ISOFile *isom_file, GF_ISOCompressMode compress_mode, u32 compress_flags)
 
GF_Err gf_isom_set_copyright (GF_ISOFile *isom_file, const char *threeCharCode, char *notice)
 
GF_Err gf_isom_add_track_kind (GF_ISOFile *isom_file, u32 trackNumber, const char *schemeURI, const char *value)
 
GF_Err gf_isom_remove_track_kind (GF_ISOFile *isom_file, u32 trackNumber, const char *schemeURI, const char *value)
 
GF_Err gf_isom_set_media_type (GF_ISOFile *isom_file, u32 trackNumber, u32 new_type)
 
GF_Err gf_isom_set_media_subtype (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 new_type)
 
GF_Err gf_isom_set_alternate_group_id (GF_ISOFile *isom_file, u32 trackNumber, u32 groupId)
 
GF_Err gf_isom_add_chapter (GF_ISOFile *isom_file, u32 trackNumber, u64 timestamp, char *name)
 
GF_Err gf_isom_remove_chapter (GF_ISOFile *isom_file, u32 trackNumber, u32 index)
 
GF_Err gf_isom_set_edit (GF_ISOFile *isom_file, u32 trackNumber, u64 EditTime, u64 EditDuration, u64 MediaTime, GF_ISOEditType EditMode)
 
GF_Err gf_isom_set_edit_with_rate (GF_ISOFile *isom_file, u32 trackNumber, u64 EditTime, u64 EditDuration, u64 MediaTime, u32 MediaRate)
 
GF_Err gf_isom_modify_edit (GF_ISOFile *isom_file, u32 trackNumber, u32 edit_index, u64 EditDuration, u64 MediaTime, GF_ISOEditType EditMode)
 
GF_Err gf_isom_append_edit (GF_ISOFile *isom_file, u32 trackNumber, u64 EditDuration, u64 MediaTime, GF_ISOEditType EditMode)
 
GF_Err gf_isom_remove_edits (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_remove_edit (GF_ISOFile *isom_file, u32 trackNumber, u32 edit_index)
 
GF_Err gf_isom_update_edit_list_duration (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_remove_uuid (GF_ISOFile *isom_file, u32 trackNumber, bin128 UUID)
 
GF_Err gf_isom_add_uuid (GF_ISOFile *isom_file, u32 trackNumber, bin128 UUID, const u8 *data, u32 size)
 
GF_Err gf_isom_use_compact_size (GF_ISOFile *isom_file, u32 trackNumber, Bool CompactionOn)
 
GF_Err gf_isom_disable_brand_rewrite (GF_ISOFile *isom_file, Bool do_disable)
 
GF_Err gf_isom_set_brand_info (GF_ISOFile *isom_file, u32 MajorBrand, u32 MinorVersion)
 
GF_Err gf_isom_modify_alternate_brand (GF_ISOFile *isom_file, u32 Brand, Bool AddIt)
 
GF_Err gf_isom_reset_alt_brands (GF_ISOFile *isom_file)
 
GF_Err gf_isom_reset_alt_brands_ex (GF_ISOFile *isom_file, Bool leave_empty)
 
GF_Err gf_isom_set_sample_flags (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 isLeading, u32 dependsOn, u32 dependedOn, u32 redundant)
 
GF_Err gf_isom_set_visual_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 Width, u32 Height)
 
GF_Err gf_isom_set_visual_bit_depth (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u16 bitDepth)
 
GF_Err gf_isom_set_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_set_track_matrix (GF_ISOFile *isom_file, u32 trackNumber, s32 matrix[9])
 
GF_Err gf_isom_set_pixel_aspect_ratio (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, s32 hSpacing, s32 vSpacing, Bool force_par)
 
GF_Err gf_isom_set_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)
 
GF_Err gf_isom_update_aperture_info (GF_ISOFile *isom_file, u32 trackNumber, Bool remove)
 
GF_Err gf_isom_set_high_dynamic_range_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, GF_MasteringDisplayColourVolumeInfo *mdcv, GF_ContentLightLevelInfo *clli)
 
GF_Err gf_isom_set_dolby_vision_profile (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, GF_DOVIDecoderConfigurationRecord *dvcc)
 
GF_Err gf_isom_set_image_sequence_coding_constraints (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, Bool remove, Bool all_ref_pics_intra, Bool intra_pred_used, u32 max_ref_per_pic)
 
GF_Err gf_isom_set_image_sequence_alpha (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, Bool remove)
 
GF_Err gf_isom_set_visual_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, u8 *icc_data, u32 icc_size)
 
GF_Err gf_isom_set_audio_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 sampleRate, u32 nbChannels, u8 bitsPerSample, GF_AudioSampleEntryImportMode asemode)
 
GF_Err gf_isom_set_audio_layout (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, GF_AudioChannelLayout *layout)
 
GF_Err gf_isom_set_cts_packing (GF_ISOFile *isom_file, u32 trackNumber, Bool unpack)
 
GF_Err gf_isom_shift_cts_offset (GF_ISOFile *isom_file, u32 trackNumber, s32 offset_shift)
 
GF_Err gf_isom_set_composition_offset_mode (GF_ISOFile *isom_file, u32 trackNumber, Bool use_negative_offsets)
 
GF_Err gf_isom_set_ctts_v1 (GF_ISOFile *isom_file, u32 trackNumber, u32 ctts_shift)
 
GF_Err gf_isom_set_media_language (GF_ISOFile *isom_file, u32 trackNumber, char *code)
 
GF_ISOTrackID gf_isom_get_last_created_track_id (GF_ISOFile *isom_file)
 
GF_Err gf_isom_apply_box_patch (GF_ISOFile *isom_file, GF_ISOTrackID trackID, const char *box_patch_filename, Bool for_fragments)
 
GF_Err gf_isom_set_track_magic (GF_ISOFile *isom_file, u32 trackNumber, u64 magic)
 
GF_Err gf_isom_set_track_index (GF_ISOFile *isom_file, u32 trackNumber, u32 index, void(*track_num_changed)(void *udta, u32 old_track_num, u32 new_track_num), void *udta)
 
GF_Err gf_isom_remove_stream_description (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_update_bitrate (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 average_bitrate, u32 max_bitrate, u32 decode_buffer_size)
 
GF_Err gf_isom_clone_track (GF_ISOFile *orig_file, u32 orig_track, GF_ISOFile *dest_file, GF_ISOTrackCloneFlags flags, u32 *dest_track)
 
GF_Err gf_isom_set_track_interleaving_group (GF_ISOFile *isom_file, u32 trackNumber, u32 GroupID)
 
GF_Err gf_isom_set_track_priority_in_group (GF_ISOFile *isom_file, u32 trackNumber, u32 InversePriority)
 
GF_Err gf_isom_hint_max_chunk_size (GF_ISOFile *isom_file, u32 trackNumber, u32 maxChunkSize)
 
GF_Err gf_isom_hint_max_chunk_duration (GF_ISOFile *isom_file, u32 trackNumber, u32 maxChunkDur)
 
GF_Err gf_isom_make_interleave (GF_ISOFile *isom_file, Double TimeInSec)
 
GF_Err gf_isom_make_interleave_ex (GF_ISOFile *isom_file, GF_Fraction *fTimeInSec)
 
void gf_isom_set_progress_callback (GF_ISOFile *isom_file, void(*progress_cbk)(void *udta, u64 nb_done, u64 nb_total), void *progress_cbk_udta)
 
GF_Err gf_isom_set_write_callback (GF_ISOFile *isom_file, gf_isom_on_block_out on_block_out, gf_isom_on_block_patch on_block_patch, gf_isom_on_last_block_start on_last_block_start, void *usr_data, u32 block_size)
 
Bool gf_isom_is_inplace_rewrite (GF_ISOFile *isom_file)
 
void gf_isom_disable_inplace_rewrite (GF_ISOFile *isom_file)
 
GF_Err gf_isom_set_inplace_padding (GF_ISOFile *isom_file, u32 padding)
 

Detailed Description

ISOBMF file writing

Typedef Documentation

◆ gf_isom_on_block_out

typedef GF_Err(* gf_isom_on_block_out) (void *usr_data, u8 *block, u32 block_size, void *sample_cbk_data, u32 sample_cbk_magic)

Callback function to receive new data blocks

Parameters
usr_datauser callback, as passed to gf_isom_set_write_callback
blockdata block to write
block_sizedata block size in bytes
sample_cbk_datacallback data of sample or NULL
sample_cbk_magiccallback magic of sample or 0
Returns
error if any

◆ gf_isom_on_block_patch

typedef GF_Err(* gf_isom_on_block_patch) (void *usr_data, u8 *block, u32 block_size, u64 block_offset, Bool is_insert)

Callback function to receive new data blocks, only used in non-fragmented mode:

  • to patch mdat size
  • to inject moov for GF_ISOM_STORE_FASTSTART mode
    Parameters
    usr_datauser callback, as passed to gf_isom_set_write_callback
    blockdata block to write
    block_sizedata block size in bytes
    block_offsetoffset in file for block to patch
    is_insertif GF_TRUE, indicates the bytes must be inserted at the given offset. Otherwise bytes are to be replaced
    Returns
    error if any

◆ gf_isom_on_last_block_start

typedef void(* gf_isom_on_last_block_start) (void *usr_data)

Callback function to indicate the last call to gf_isom_on_block_out is about to be produced for a segment, unused for non-fragmented or non-dash cases

Parameters
usr_datauser callback, as passed to gf_isom_set_write_callback

Enumeration Type Documentation

◆ GF_ISOStorageMode

Movie Storage modes

Enumerator
GF_ISOM_STORE_FLAT 

FLAT: the MediaData is stored at the beginning of the file

GF_ISOM_STORE_STREAMABLE 

STREAMABLE: the MetaData (File Info) is stored at the beginning of the file for fast access during download

GF_ISOM_STORE_INTERLEAVED 

INTERLEAVED: Same as STREAMABLE, plus the media data is mixed by chunk of fixed duration

GF_ISOM_STORE_DRIFT_INTERLEAVED 

INTERLEAVED +DRIFT: Same as INTERLEAVED, and adds time drift control to avoid creating too long chunks

GF_ISOM_STORE_TIGHT 

tightly interleaves samples based on their DTS, therefore allowing better placement of samples in the file. This is used for both http interleaving and Hinting optimizations

GF_ISOM_STORE_FASTSTART 

FASTSTART: same as FLAT but moves moov before mdat at the end

◆ GF_ISOMTrackFlagOp

Track header flags operation type

Enumerator
GF_ISOM_TKFLAGS_SET 

set flags, erasing previous value

GF_ISOM_TKFLAGS_REM 

add flags

GF_ISOM_TKFLAGS_ADD 

remove flags

◆ anonymous enum

anonymous enum

Track header flags

Enumerator
GF_ISOM_TK_ENABLED 

track is enabled

GF_ISOM_TK_IN_MOVIE 

track is in regular presentation

GF_ISOM_TK_IN_PREVIEW 

track is in preview

GF_ISOM_TK_SIZE_IS_AR 

track size is an aspect ratio indicator only

◆ GF_ISOCompressMode

compression mode of top-level boxes

Enumerator
GF_ISOM_COMP_NONE 

no compression is used

GF_ISOM_COMP_MOOV 

only moov box is compressed

GF_ISOM_COMP_MOOF 

only moof boxes are compressed

GF_ISOM_COMP_MOOF_SIDX 

only moof and sidx boxes are compressed

GF_ISOM_COMP_MOOF_SSIX 

only moof, sidx and ssix boxes are compressed

GF_ISOM_COMP_ALL 

all (moov, moof, sidx and ssix) boxes are compressed

◆ anonymous enum

anonymous enum
Enumerator
GF_ISOM_COMP_FORCE_ALL 

forces compressed box even if compress size is larger than uncompressed size

GF_ISOM_COMP_WRAP_FTYPE 

wraps ftyp in otyp

◆ GF_AudioSampleEntryImportMode

Audio Sample Description signaling mode

Enumerator
GF_IMPORT_AUDIO_SAMPLE_ENTRY_NOT_SET 

use ISOBMF sample entry v0

GF_IMPORT_AUDIO_SAMPLE_ENTRY_v0_BS 

use ISOBMF sample entry v0

GF_IMPORT_AUDIO_SAMPLE_ENTRY_v0_2 

use ISOBMF sample entry v0 and forces channel count to 2

GF_IMPORT_AUDIO_SAMPLE_ENTRY_v1_MPEG 

use ISOBMF sample entry v1

GF_IMPORT_AUDIO_SAMPLE_ENTRY_v1_QTFF 

use QTFF sample entry v1

◆ GF_ISOTrackCloneFlags

track clone flags

Enumerator
GF_ISOM_CLONE_TRACK_KEEP_DREF 

set this flag to keep data reference entries while cloning track

GF_ISOM_CLONE_TRACK_NO_QT 

set this flag to avoid cloning track as a QT track while cloning track

GF_ISOM_CLONE_TRACK_DROP_ID 

drop track ID while importing

GF_ISOM_CLONE_RESET_DURATION 

reset media duration when cloning

Function Documentation

◆ gf_isom_freeze_order()

GF_Err gf_isom_freeze_order ( GF_ISOFile isom_file)

freezes order of the current box tree in the file. By default the library always reorder boxes in the recommended order in the various specifications implemented. New created tracks or meta items will not have a frozen order of boxes, but the function can be called several time

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_keep_utc_times()

void gf_isom_keep_utc_times ( GF_ISOFile isom_file,
Bool  keep_utc 
)

keeps UTC edit times when storing

Parameters
isom_filethe target ISO file
keep_utcif GF_TRUE, do not edit times

◆ gf_isom_has_keep_utc_times()

Bool gf_isom_has_keep_utc_times ( GF_ISOFile isom_file)

Checks if UTC keeping is enabled

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if UTC keeping is enabled

◆ gf_isom_set_timescale()

GF_Err gf_isom_set_timescale ( GF_ISOFile isom_file,
u32  timeScale 
)

sets the timescale of the movie. This rescales times expressed in movie timescale in edit lists and mvex boxes

Parameters
isom_filethe target ISO file
timeScalethe target timescale
Returns
error if any

◆ gf_isom_load_extra_boxes()

GF_Err gf_isom_load_extra_boxes ( GF_ISOFile isom_file,
u8 moov_boxes,
u32  moov_boxes_size,
Bool  udta_only 
)

loads a set of top-level boxes in moov udta and child boxes. UDTA will be replaced if already present

Parameters
isom_filethe target ISO file
moov_boxesa serialized array of boxes to add
moov_boxes_sizethe size of the serialized array of boxes
udta_onlyonly replace/inject udta box and entries
Returns
error if any

◆ gf_isom_new_track()

u32 gf_isom_new_track ( GF_ISOFile isom_file,
GF_ISOTrackID  trackID,
u32  MediaType,
u32  TimeScale 
)

creates a new track

Parameters
isom_filethe target ISO file
trackIDthe ID of the track - if 0, the track ID is chosen by the API
MediaTypethe handler type (four character code) of the media
TimeScalethe time scale of the media
Returns
the track number or 0 if error

◆ gf_isom_new_track_from_template()

u32 gf_isom_new_track_from_template ( GF_ISOFile isom_file,
GF_ISOTrackID  trackID,
u32  MediaType,
u32  TimeScale,
u8 tk_box,
u32  tk_box_size,
Bool  udta_only 
)

creates a new track from an encoded trak box.

Parameters
isom_filethe target ISO file
trackIDthe ID of the track - if 0, the track ID is chosen by the API
MediaTypethe handler type (four character code) of the media
TimeScalethe time scale of the media
tk_boxa serialized trak box to use as template
tk_box_sizethe size of the serialized trak box
udta_onlyonly replace/inject udta box and entries
Returns
the track number or 0 if error

◆ gf_isom_remove_track()

GF_Err gf_isom_remove_track ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes a track - internal cross dependencies will be updated.

Warning
Any OD streams with references to this track through ODUpdate, ESDUpdate, ESDRemove commands will be rewritten
Parameters
isom_filethe target ISO file
trackNumberthe target track to remove file
Returns
error if any

◆ gf_isom_set_track_enabled()

GF_Err gf_isom_set_track_enabled ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  enableTrack 
)

sets the enable flag of a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
enableTrackif GF_TRUE, track is enabled, otherwise disabled
Returns
error if any

◆ gf_isom_set_track_flags()

GF_Err gf_isom_set_track_flags ( GF_ISOFile isom_file,
u32  trackNumber,
u32  flags,
GF_ISOMTrackFlagOp  op 
)

toggles track flags on or off

Parameters
isom_filethe target ISO file
trackNumberthe target track
flagsflags to modify
opflag operation mode
Returns
error if any

◆ gf_isom_set_creation_time()

GF_Err gf_isom_set_creation_time ( GF_ISOFile isom_file,
u64  create_time,
u64  modif_time 
)

sets creationTime and modificationTime of the movie to the specified dates (no validty check)

Parameters
isom_filethe target ISO file
create_timethe new creation time
modif_timethe new modification time
Returns
error if any

◆ gf_isom_set_track_creation_time()

GF_Err gf_isom_set_track_creation_time ( GF_ISOFile isom_file,
u32  trackNumber,
u64  create_time,
u64  modif_time 
)

sets creationTime and modificationTime of the track to the specified dates

Parameters
isom_filethe target ISO file
trackNumberthe target track
create_timethe new creation time
modif_timethe new modification time
Returns
error if any

◆ gf_isom_set_media_creation_time()

GF_Err gf_isom_set_media_creation_time ( GF_ISOFile isom_file,
u32  trackNumber,
u64  create_time,
u64  modif_time 
)

sets creationTime and modificationTime of the track media header to the specified dates

Parameters
isom_filethe target ISO file
trackNumberthe target track
create_timethe new creation time
modif_timethe new modification time
Returns
error if any

◆ gf_isom_set_track_id()

GF_Err gf_isom_set_track_id ( GF_ISOFile isom_file,
u32  trackNumber,
GF_ISOTrackID  trackID 
)

changes the ID of a track - all track references present in the file are updated

Parameters
isom_filethe target ISO file
trackNumberthe target track
trackIDthe new track ID
Returns
error if trackID is already in used in the file

◆ gf_isom_rewrite_track_dependencies()

GF_Err gf_isom_rewrite_track_dependencies ( GF_ISOFile isom_file,
u32  trackNumber 
)

forces to rewrite all dependencies when track ID changes. Used to check if track references are broken during import of a single track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_add_sample()

GF_Err gf_isom_add_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
const GF_ISOSample sample 
)

adds a sample to a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index associated with the sample
samplethe target sample to add
Returns
error if any

◆ gf_isom_copy_sample_info()

GF_Err gf_isom_copy_sample_info ( GF_ISOFile dst,
u32  dst_track,
GF_ISOFile src,
u32  src_track,
u32  sampleNumber 
)

copies all sample dependency, subSample and sample group information from the given sampleNumber in source file to the last added sample in dest file

Parameters
dstthe destination ISO file
dst_trackthe destination track
srcthe source ISO file
src_trackthe source track
sampleNumberthe source sample number
Returns
error if any

◆ gf_isom_add_sample_shadow()

GF_Err gf_isom_add_sample_shadow ( GF_ISOFile isom_file,
u32  trackNumber,
GF_ISOSample sample 
)

adds a sync shadow sample to a track.

  • There must be a regular sample with the same DTS.
  • Sync Shadow samples MUST be RAP and can only use the same sample description as the sample they shadow
  • Currently, adding sync shadow must be done in order (no sample insertion)
Parameters
isom_filethe target ISO file
trackNumberthe target track
samplethe target shadow sample to add
Returns
error if any

◆ gf_isom_append_sample_data()

GF_Err gf_isom_append_sample_data ( GF_ISOFile isom_file,
u32  trackNumber,
u8 data,
u32  data_size 
)

adds data to current sample in the track. This will update the data size. CANNOT be used with OD media type There shall not be any other

Parameters
isom_filethe target ISO file
trackNumberthe target track
datathe data to append to the sample
data_sizethe size of the data to append
Returns
error if any

◆ gf_isom_add_sample_reference()

GF_Err gf_isom_add_sample_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
GF_ISOSample sample,
u64  dataOffset 
)

adds sample references to a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index associated with the sample
samplethe target sample to add
dataOffsetis the offset in bytes of the data in the referenced file.
Returns
error if any

◆ gf_isom_set_last_sample_duration()

GF_Err gf_isom_set_last_sample_duration ( GF_ISOFile isom_file,
u32  trackNumber,
u32  duration 
)

sets the duration of the last media sample. If not set, the duration of the last sample is the duration of the previous one if any, or media TimeScale (default value). This does not modify the edit list if any, you must modify this using gf_isom_set_edit

Parameters
isom_filethe target ISO file
trackNumberthe target track
durationduration of last sample in media timescale
Returns
error if any

◆ gf_isom_set_last_sample_duration_ex()

GF_Err gf_isom_set_last_sample_duration_ex ( GF_ISOFile isom_file,
u32  trackNumber,
u32  dur_num,
u32  dur_den 
)

sets the duration of the last media sample. If not set, the duration of the last sample is the duration of the previous one if any, or media TimeScale (default value). This does not modify the edit list if any, you must modify this using gf_isom_set_edit. If both dur_num and dur_den are both zero, forces last sample duration to be the same as previous sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
dur_numduration num value
dur_denduration num value
Returns
error if any

◆ gf_isom_patch_last_sample_duration()

GF_Err gf_isom_patch_last_sample_duration ( GF_ISOFile isom_file,
u32  trackNumber,
u64  next_dts 
)

patches last stts entry to make sure the cumulated duration equals the given next_dts value - this will overrite timing of all previous samples using an average dur

Parameters
isom_filethe target ISO file
trackNumberthe target track
next_dtstarget decode time of next sample
Returns
error if any

◆ gf_isom_set_track_reference()

GF_Err gf_isom_set_track_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  referenceType,
GF_ISOTrackID  ReferencedTrackID 
)

adds a track reference to another track

Parameters
isom_filethe target ISO file
trackNumberthe target track
referenceTypethe four character code of the reference
ReferencedTrackIDthe ID of the track referred to
Returns
error if any

◆ gf_isom_remove_track_references()

GF_Err gf_isom_remove_track_references ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes all track references

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_purge_track_reference()

GF_Err gf_isom_purge_track_reference ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes any track reference poiting to a non-existing track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_remove_track_reference()

GF_Err gf_isom_remove_track_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  ref_type 
)

removes all track references of a given type

Parameters
isom_filethe target ISO file
trackNumberthe target track
ref_typethe reference type to remove
Returns
error if any

◆ gf_isom_set_handler_name()

GF_Err gf_isom_set_handler_name ( GF_ISOFile isom_file,
u32  trackNumber,
const char *  nameUTF8 
)

sets track handler name.

Parameters
isom_filethe target ISO file
trackNumberthe target track
nameUTF8the handler name; either NULL (reset), a UTF-8 formatted string or a UTF8 file resource in the form "file://path/to/file_utf8"
Returns
error if any

◆ gf_isom_refresh_size_info()

GF_Err gf_isom_refresh_size_info ( GF_ISOFile isom_file,
u32  trackNumber 
)

updates the sample size table - this is needed when using gf_isom_append_sample_data in case the resulting samples are of same sizes (typically in 3GP speech tracks)

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_update_duration()

GF_Err gf_isom_update_duration ( GF_ISOFile isom_file)

updates the duration of the movie.This is done automatically when storing the file or editing timesales/edit list, but it is not done when adding samples.

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_update_sample()

GF_Err gf_isom_update_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
GF_ISOSample sample,
Bool  data_only 
)

updates a given sample of the media. This function updates both media data of sample and sample properties (DTS, CTS, SAP type)

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe number of the sample to update
samplethe new sample
data_onlyif set to GF_TRUE, only the sample data is updated, not other info
Returns
error if any

◆ gf_isom_update_sample_reference()

GF_Err gf_isom_update_sample_reference ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
GF_ISOSample sample,
u64  data_offset 
)

updates a sample reference in the media. Note that the sample MUST exists, and that sample->data MUST be NULL and sample->dataLength must be NON NULL.

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe number of the sample to update
samplethe new sample
data_offsetnew offset of sample in referenced file
Returns
error if any

◆ gf_isom_remove_sample()

GF_Err gf_isom_remove_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber 
)

removes a given sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe number of the sample to update
Returns
error if any

◆ gf_isom_set_media_timescale()

GF_Err gf_isom_set_media_timescale ( GF_ISOFile isom_file,
u32  trackNumber,
u32  new_timescale,
u32  new_tsinc,
u32  force_rescale_type 
)

changes media time scale

Parameters
isom_filethe target ISO file
trackNumberthe target track
new_timescalethe new timescale to set
new_tsincif not 0, changes sample duration and composition offsets to new_tsinc/new_timescale. If non-constant sample dur is used, uses the samllest sample dur in the track. Otherwise, only changes the timescale
force_rescale_typetype fo rescaling, Ignored if new_tsinc is not 0:
  • if set to 0, rescale timings.
  • if set to 1, only the media timescale is changed but media times are not updated.
  • if set to 2, media timescale is updated if new_timescale is set, and all sample durations are set to new_tsinc
Returns
GF_EOS if no action taken (same config), or error if any

◆ gf_isom_add_sample_aux_info()

GF_Err gf_isom_add_sample_aux_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32  aux_type,
u32  aux_info,
u8 data,
u32  size 
)

adds sample auxiliary data

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe sample number. Must be equal or larger to last auxiliary
aux_typeauxiliary sample data type, shall not be 0
aux_infoauxiliary sample data specific info type, may be 0
datadata to add
sizesize of data to add
Returns
error if any

◆ gf_isom_set_final_name()

GF_Err gf_isom_set_final_name ( GF_ISOFile isom_file,
char *  filename 
)

sets the save file name of the (edited) movie. If the movie is edited, the default fileName is the open name suffixed with an internally defined extension "%p_isotmp")"

Note
you cannot save an edited file under the same name (overwrite not allowed) If the movie is created (WRITE mode), the default filename is $OPEN_NAME
Parameters
isom_filethe target ISO file
filenamethe new final filename
Returns
error if any

◆ gf_isom_set_storage_mode()

GF_Err gf_isom_set_storage_mode ( GF_ISOFile isom_file,
GF_ISOStorageMode  storage_mode 
)

sets the storage mode of a file (FLAT, STREAMABLE, INTERLEAVED)

Parameters
isom_filethe target ISO file
storage_modethe target storage mode
Returns
error if any

◆ gf_isom_set_interleave_time()

GF_Err gf_isom_set_interleave_time ( GF_ISOFile isom_file,
u32  InterleaveTime 
)

sets the interleaving time of media data (INTERLEAVED mode only)

Parameters
isom_filethe target ISO file
InterleaveTimethe target interleaving time in movie timescale
Returns
error if any

◆ gf_isom_force_64bit_chunk_offset()

GF_Err gf_isom_force_64bit_chunk_offset ( GF_ISOFile isom_file,
Bool  set_on 
)

forces usage of 64 bit chunk offsets

Parameters
isom_filethe target ISO file
set_onif GF_TRUE, 64 bit chunk offsets are always used; otherwise, they are used only for large files
Returns
error if any

◆ gf_isom_enable_compression()

GF_Err gf_isom_enable_compression ( GF_ISOFile isom_file,
GF_ISOCompressMode  compress_mode,
u32  compress_flags 
)

sets compression mode of file

Parameters
isom_filethe target ISO file
compress_modethe desired compress mode
compress_flagscompress mode flags
Returns
error if any

◆ gf_isom_set_copyright()

GF_Err gf_isom_set_copyright ( GF_ISOFile isom_file,
const char *  threeCharCode,
char *  notice 
)

sets the copyright in one language

Parameters
isom_filethe target ISO file
threeCharCodethe ISO three character language code for copyright
noticethe copyright notice to add
Returns
error if any

◆ gf_isom_add_track_kind()

GF_Err gf_isom_add_track_kind ( GF_ISOFile isom_file,
u32  trackNumber,
const char *  schemeURI,
const char *  value 
)

adds a kind type to a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
schemeURIthe scheme URI of the added kind
valuethe value of the added kind
Returns
error if any

◆ gf_isom_remove_track_kind()

GF_Err gf_isom_remove_track_kind ( GF_ISOFile isom_file,
u32  trackNumber,
const char *  schemeURI,
const char *  value 
)

removes a kind type to the track, all if NULL params

Parameters
isom_filethe target ISO file
trackNumberthe target track
schemeURIthe scheme URI of the removed kind
valuethe value of the removed kind
Returns
error if any

◆ gf_isom_set_media_type()

GF_Err gf_isom_set_media_type ( GF_ISOFile isom_file,
u32  trackNumber,
u32  new_type 
)

changes the handler type of the media

Warning
This may completely breaks the parsing of the media track
Parameters
isom_filethe target ISO file
trackNumberthe target track
new_typethe new handler four character type
Returns
error if any

◆ gf_isom_set_media_subtype()

GF_Err gf_isom_set_media_subtype ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  new_type 
)

changes the type of the sampleDescriptionBox

Warning
This may completely breaks the parsing of the media track
Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe target sample description index
new_typethe new four character code type of the smaple description
Returns
error if any

◆ gf_isom_set_alternate_group_id()

GF_Err gf_isom_set_alternate_group_id ( GF_ISOFile isom_file,
u32  trackNumber,
u32  groupId 
)

sets a track in an alternate group

Parameters
isom_filethe target ISO file
trackNumberthe target track
groupIdthe alternate group ID
Returns
error if any

◆ gf_isom_add_chapter()

GF_Err gf_isom_add_chapter ( GF_ISOFile isom_file,
u32  trackNumber,
u64  timestamp,
char *  name 
)

adds chapter info:

Parameters
isom_filethe target ISO file
trackNumberthe target track. If 0, the chapter info is added to the movie, otherwise to the track
timestampthe chapter start time in milliseconds. Chapters are added in order to the file. If a chapter with same timestamp is found, its name is updated but no entry is created.
namethe chapter name. If NULL, defaults to 'Chapter N'
Returns
error if any

◆ gf_isom_remove_chapter()

GF_Err gf_isom_remove_chapter ( GF_ISOFile isom_file,
u32  trackNumber,
u32  index 
)

deletes copyright

Parameters
isom_filethe target ISO file
trackNumberthe target track
indexthe 1-based index of the copyright notice to remove, or 0 to remove all chapters
Returns
error if any

◆ gf_isom_set_edit()

GF_Err gf_isom_set_edit ( GF_ISOFile isom_file,
u32  trackNumber,
u64  EditTime,
u64  EditDuration,
u64  MediaTime,
GF_ISOEditType  EditMode 
)

updates or inserts a new edit in the track time line. Edits are used to modify the media normal timing. EditTime and EditDuration are expressed in movie timescale

Note
If a segment with EditTime already exists, it is erase
If there is a segment before this new one, its duration is adjust to match EditTime of the new segment
Warning
The first segment always have an EditTime of 0. You should insert an empty or dwelled segment first
Parameters
isom_filethe target ISO file
trackNumberthe target track
EditTimethe start of the edit in movie timescale
EditDurationthe duration of the edit in movie timecale
MediaTimethe corresponding media time of the start of the edit, in media timescale. -1 for empty edits
EditModethe edit mode
Returns
error if any, GF_EOS if empty edit was inserted

◆ gf_isom_set_edit_with_rate()

GF_Err gf_isom_set_edit_with_rate ( GF_ISOFile isom_file,
u32  trackNumber,
u64  EditTime,
u64  EditDuration,
u64  MediaTime,
u32  MediaRate 
)

updates or inserts a new edit in the track time line. Edits are used to modify the media normal timing. EditTime and EditDuration are expressed in movie timescale

Note
If a segment with EditTime already exists, it is erase
If there is a segment before this new one, its duration is adjust to match EditTime of the new segment
Warning
The first segment always have an EditTime of 0. You should insert an empty or dwelled segment first
Parameters
isom_filethe target ISO file
trackNumberthe target track
EditTimethe start of the edit in movie timescale
EditDurationthe duration of the edit in movie timecale
MediaTimethe corresponding media time of the start of the edit, in media timescale. -1 for empty edits
MediaRatea 16.16 rate (0x10000 means normal playback)
Returns
error if any

◆ gf_isom_modify_edit()

GF_Err gf_isom_modify_edit ( GF_ISOFile isom_file,
u32  trackNumber,
u32  edit_index,
u64  EditDuration,
u64  MediaTime,
GF_ISOEditType  EditMode 
)

same as gf_isom_set_edit except only modifies duration type and mediaType

Parameters
isom_filethe target ISO file
trackNumberthe target track
edit_indexthe 1-based index of the edit to update
EditDurationduration of the edit in movie timescale
MediaTimethe corresponding media time of the start of the edit, in media timescale. -1 for empty edits
EditModethe edit mode
Returns
error if any

◆ gf_isom_append_edit()

GF_Err gf_isom_append_edit ( GF_ISOFile isom_file,
u32  trackNumber,
u64  EditDuration,
u64  MediaTime,
GF_ISOEditType  EditMode 
)

same as gf_isom_modify_edit except only appends new segment

Parameters
isom_filethe target ISO file
trackNumberthe target track
EditDurationduration of the edit in movie timescale
MediaTimethe corresponding media time of the start of the edit, in media timescale. -1 for empty edits
EditModethe edit mode
Returns
error if any

◆ gf_isom_remove_edits()

GF_Err gf_isom_remove_edits ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes all edits in the track

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_remove_edit()

GF_Err gf_isom_remove_edit ( GF_ISOFile isom_file,
u32  trackNumber,
u32  edit_index 
)

removes the given edit. If this is not the last segment, the next segment duration is updated to maintain a continous timeline

Parameters
isom_filethe target ISO file
trackNumberthe target track
edit_indexthe 1-based index of the edit to update
Returns
error if any

◆ gf_isom_update_edit_list_duration()

GF_Err gf_isom_update_edit_list_duration ( GF_ISOFile isom_file,
u32  trackNumber 
)

updates edit list after track edition. All edit entries with a duration or media starttime larger than the media duration are clamped to media duration

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
error if any

◆ gf_isom_remove_uuid()

GF_Err gf_isom_remove_uuid ( GF_ISOFile isom_file,
u32  trackNumber,
bin128  UUID 
)

remove track, moov or file-level UUID box of matching type

Parameters
isom_filethe target ISO file
trackNumberthe target track for the UUID box; if 0, removes from movie; if 0xFFFFFFFF, removes from file
UUIDthe UUID of the box to remove
Returns
error if any

◆ gf_isom_add_uuid()

GF_Err gf_isom_add_uuid ( GF_ISOFile isom_file,
u32  trackNumber,
bin128  UUID,
const u8 data,
u32  size 
)

adds track, moov or file-level UUID box

Parameters
isom_filethe target ISO file
trackNumberthe target track for the UUID box; if 0, removes from movie; if 0xFFFFFFFF, removes from file
UUIDthe UUID of the box to remove
datathe data to add, may be NULL
sizethe size of the data to add, shall be 0 when data is NULL
Returns
error if any

◆ gf_isom_use_compact_size()

GF_Err gf_isom_use_compact_size ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  CompactionOn 
)

uses a compact track version for sample size. This is not usually recommended except for speech codecs where the track has a lot of small samples compaction is done automatically while writing based on the track's sample sizes

Parameters
isom_filethe target ISO file
trackNumberthe target track for the udta box; if 0, add the udta to the movie;
CompactionOnif set to GF_TRUE, compact size tables are used; otherwise regular size tables are used
Returns
error if any

◆ gf_isom_disable_brand_rewrite()

GF_Err gf_isom_disable_brand_rewrite ( GF_ISOFile isom_file,
Bool  do_disable 
)

disabled brand rewrite for file, usually done for temporary import in an existing file

Parameters
isom_filethe target ISO file
do_disableif true, brand rewrite is disabled, otherwise enabled
Returns
error if any

◆ gf_isom_set_brand_info()

GF_Err gf_isom_set_brand_info ( GF_ISOFile isom_file,
u32  MajorBrand,
u32  MinorVersion 
)

sets the brand of the movie

Note
this automatically adds the major brand to the set of alternate brands if not present
Parameters
isom_filethe target ISO file
MajorBrandfour character code of the major brand to set
MinorVersionversion of the brand
Returns
error if any

◆ gf_isom_modify_alternate_brand()

GF_Err gf_isom_modify_alternate_brand ( GF_ISOFile isom_file,
u32  Brand,
Bool  AddIt 
)

adds or removes an alternate brand for the movie.

Note
When removing an alternate brand equal to the major brand, the major brand is updated with the first alternate brand remaining, or 'isom' otherwise
Parameters
isom_filethe target ISO file
Brandfour character code of the brand to add or remove
AddItif set to GF_TRUE, the brand is added, otherwise it is removed
Returns
error if any

◆ gf_isom_reset_alt_brands()

GF_Err gf_isom_reset_alt_brands ( GF_ISOFile isom_file)

removes all alternate brands except major brand

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_reset_alt_brands_ex()

GF_Err gf_isom_reset_alt_brands_ex ( GF_ISOFile isom_file,
Bool  leave_empty 
)

removes all alternate brands except major brand

Parameters
isom_filethe target ISO file
leave_emptyif GF_TRUE, does not create a default alternate brand matching the major brand
Returns
error if any

◆ gf_isom_set_sample_flags()

GF_Err gf_isom_set_sample_flags ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32  isLeading,
u32  dependsOn,
u32  dependedOn,
u32  redundant 
)

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

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleNumberthe target sample number
isLeadingindicates that the sample is a leading picture
dependsOnindicates the sample dependency towards other samples
dependedOnindicates the sample dependency from other samples
redundantindicates that the sample contains redundant coding
Returns
error if any

◆ gf_isom_set_visual_info()

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

sets size information of a sample description of a visual track

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
Widththe width in pixels
Heightthe height in pixels
Returns
error if any

◆ gf_isom_set_visual_bit_depth()

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

sets 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_set_track_layout_info()

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

sets a visual track layout info

Parameters
isom_filethe target ISO file
trackNumberthe target track number
widththe track width in pixels
heightthe track height in pixels
translation_xthe horizontal translation (from the left) of the track in the movie canvas, expressed as 16.16 fixed point float
translation_ythe vertical translation (from the top) of the track in the movie canvas, expressed as 16.16 fixed point float
layerz order of the track on the canvas
Returns
error if any

◆ gf_isom_set_track_matrix()

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

sets track matrix

Parameters
isom_filethe target ISO file
trackNumberthe target track number
matrixthe transformation matrix of the track on the movie canvas; all coeficients are expressed as 16.16 floating points
Returns
error if any

◆ gf_isom_set_pixel_aspect_ratio()

GF_Err gf_isom_set_pixel_aspect_ratio ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
s32  hSpacing,
s32  vSpacing,
Bool  force_par 
)

sets the pixel aspect ratio for a sample description

Note
the aspect ratio is expressed as hSpacing divided by vSpacing; 2:1 means pixel is twice as wide as it is high
Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
hSpacinghorizontal spacing of the aspect ratio; a value of 0 removes PAR; negative value means 1
vSpacingvertical spacing of the aspect ratio; a value of 0 removes PAR; negative value means 1
force_parif set, forces PAR to 1:1 when hSpacing=vSpacing; otherwise removes PAR when hSpacing=vSpacing
Returns
error if any

◆ gf_isom_set_clean_aperture()

GF_Err gf_isom_set_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 
)

sets 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
cleanApertureWidthNnominator of clean aperture horizontal size
cleanApertureWidthDdenominator of clean aperture horizontal size
cleanApertureHeightNnominator of clean aperture vertical size
cleanApertureHeightDdenominator of clean aperture vertical size
horizOffNnominator of horizontal offset of clean aperture center minus (width-1)/2 (eg 0 sets center to center of video)
horizOffDdenominator of horizontal offset of clean aperture center minus (width-1)/2 (eg 0 sets center to center of video)
vertOffNnominator of vertical offset of clean aperture center minus (height-1)/2 (eg 0 sets center to center of video)
vertOffDdenominator of vertical offset of clean aperture center minus (height-1)/2 (eg 0 sets center to center of video)
Returns
error if any

◆ gf_isom_update_aperture_info()

GF_Err gf_isom_update_aperture_info ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  remove 
)

updates track aperture information for QT/ProRes

Parameters
isom_filethe target ISO file
trackNumberthe target track number
removeif GF_TRUE, remove track aperture information, otherwise updates it
Returns
error if any

◆ gf_isom_set_high_dynamic_range_info()

GF_Err gf_isom_set_high_dynamic_range_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
GF_MasteringDisplayColourVolumeInfo mdcv,
GF_ContentLightLevelInfo clli 
)

sets high dynamic range information for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
mdcvthe mastering display colour volume to set, if NULL removes the info
cllithe content light level to set, if NULL removes the info
Returns
error if any

◆ gf_isom_set_dolby_vision_profile()

GF_Err gf_isom_set_dolby_vision_profile ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
GF_DOVIDecoderConfigurationRecord dvcc 
)

force Dolby Vision profile: mainly used when the bitstream doesn't contain all the necessary information

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
dvccthe Dolby Vision configuration
Returns
error if any

◆ gf_isom_set_image_sequence_coding_constraints()

GF_Err gf_isom_set_image_sequence_coding_constraints ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
Bool  remove,
Bool  all_ref_pics_intra,
Bool  intra_pred_used,
u32  max_ref_per_pic 
)

sets image sequence coding constraints (mostly used for HEIF image files)

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
removeif set to GF_TRUE, removes coding constraints
all_ref_pics_intraindicates if all reference pictures are intra frames
intra_pred_usedindicates if intra prediction is used
max_ref_per_picindicates the max number of reference images per picture
Returns
error if any

◆ gf_isom_set_image_sequence_alpha()

GF_Err gf_isom_set_image_sequence_alpha ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
Bool  remove 
)

sets image sequence alpha flag (mostly used for HEIF image files). The alpha flag indicates the image sequence is an alpha plane or has an alpha channel

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
removeif set to GF_TRUE, removes coding constraints
Returns
error if any

◆ gf_isom_set_visual_color_info()

GF_Err gf_isom_set_visual_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,
u8 icc_data,
u32  icc_size 
)

sets colour information for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
colour_typethe four character code of the colour type to set (nclc, nclx, prof, ricc); if 0, removes all color info
colour_primariesthe colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
transfer_characteristicsthe colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
matrix_coefficientsthe colour primaries for nclc/nclx as defined in ISO/IEC 23001-8
full_range_flagthe colour primaries for nclc as defined in ISO/IEC 23001-8
icc_datathe icc data pto set for prof and ricc types
icc_sizethe size of the icc data
Returns
error if any

◆ gf_isom_set_audio_info()

GF_Err gf_isom_set_audio_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  sampleRate,
u32  nbChannels,
u8  bitsPerSample,
GF_AudioSampleEntryImportMode  asemode 
)

sets audio format information for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
sampleRatethe audio sample rate
nbChannelsthe number of audio channels
bitsPerSamplethe number of bits per sample, mostly used for raw audio
asemodetype of audio entry signaling desired
Returns
error if any

◆ gf_isom_set_audio_layout()

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

sets audio channel and object layout information for a sample description, ISOBMFF style

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description index
layoutthe layout information
Returns
error if any

◆ gf_isom_set_cts_packing()

GF_Err gf_isom_set_cts_packing ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  unpack 
)

sets CTS unpack mode (used for B-frames & like): in unpack mode, each sample uses one entry in CTTS tables

Parameters
isom_filethe target ISO file
trackNumberthe target track number
unpackif GF_TRUE, sets unpack on, creating a ctts table if none found; if GF_FALSE, sets unpack off and repacks all table info
Returns
error if any

◆ gf_isom_shift_cts_offset()

GF_Err gf_isom_shift_cts_offset ( GF_ISOFile isom_file,
u32  trackNumber,
s32  offset_shift 
)

shifts all CTS with the given offset. This MUST be called in unpack mode only

Parameters
isom_filethe target ISO file
trackNumberthe target track number
offset_shiftCTS offset shift in media timescale
Returns
error if any

◆ gf_isom_set_composition_offset_mode()

GF_Err gf_isom_set_composition_offset_mode ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  use_negative_offsets 
)

enables negative composition offset in track

Note
this will compute the composition to decode time information
Parameters
isom_filethe target ISO file
trackNumberthe target track
use_negative_offsetsif GF_TRUE, negative offsets are used, otherwise they are disabled
Returns
error if any

◆ gf_isom_set_ctts_v1()

GF_Err gf_isom_set_ctts_v1 ( GF_ISOFile isom_file,
u32  trackNumber,
u32  ctts_shift 
)

enables negative composition offset in track and shift offsets

Parameters
isom_filethe target ISO file
trackNumberthe target track
ctts_shiftshif CTS offsets by the given time in media timescale if positive offsets only are used
Returns
error if any

◆ gf_isom_set_media_language()

GF_Err gf_isom_set_media_language ( GF_ISOFile isom_file,
u32  trackNumber,
char *  code 
)

sets language for a track

Parameters
isom_filethe target ISO file
trackNumberthe target track number
code3-character code or BCP-47 code media language
Returns
error if any

◆ gf_isom_get_last_created_track_id()

GF_ISOTrackID gf_isom_get_last_created_track_id ( GF_ISOFile isom_file)

gets the ID of the last created track

Parameters
isom_filethe target ISO file
Returns
the last created track ID

◆ gf_isom_apply_box_patch()

GF_Err gf_isom_apply_box_patch ( GF_ISOFile isom_file,
GF_ISOTrackID  trackID,
const char *  box_patch_filename,
Bool  for_fragments 
)

applies a box patch to the file. See examples in gpac test suite, media/boxpatch/

Parameters
isom_filethe target ISO file
trackIDthe ID of the track to patch, in case one of the box patch applies to a track
box_patch_filenamethe name of the file containing the box patches
for_fragmentsindicates if the patch targets movie fragments or regular moov
Returns
error if any

◆ gf_isom_set_track_magic()

GF_Err gf_isom_set_track_magic ( GF_ISOFile isom_file,
u32  trackNumber,
u64  magic 
)

sets track magic number

Parameters
isom_filethe target ISO file
trackNumberthe target track
magicthe magic number to set; magic number is not written to file
Returns
error if any

◆ gf_isom_set_track_index()

GF_Err gf_isom_set_track_index ( GF_ISOFile isom_file,
u32  trackNumber,
u32  index,
void(*)(void *udta, u32 old_track_num, u32 new_track_num)  track_num_changed,
void *  udta 
)

sets track index in moov

Parameters
isom_filethe target ISO file
trackNumberthe target track
indexthe 1-based index to set. Tracks will be reordered after this!
track_num_changedcallback function used to notify track changes during the call to this function
udtaopaque user data for the callback function
Returns
error if any

◆ gf_isom_remove_stream_description()

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

removes a sample description with the given index

Warning
This does not remove any added samples for that stream description, nor rewrite the sample to chunk and other boxes referencing the sample description index !
Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description to remove
Returns
error if any

◆ gf_isom_update_bitrate()

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

updates average and max bitrate of a sample description if both average_bitrate and max_bitrate are 0, this removes any bitrate information

Parameters
isom_filethe target ISO file
trackNumberthe target track number
sampleDescriptionIndexthe target sample description
average_bitratethe average bitrate of the media for that sample description
max_bitratethe maximum bitrate of the media for that sample description
decode_buffer_sizethe decoder buffer size in bytes for that sample description
Returns
error if any

◆ gf_isom_clone_track()

GF_Err gf_isom_clone_track ( GF_ISOFile orig_file,
u32  orig_track,
GF_ISOFile dest_file,
GF_ISOTrackCloneFlags  flags,
u32 dest_track 
)

clones a track. This clones everything except media data and sample info (DTS, CTS, RAPs, etc...), and also clones sample descriptions

Parameters
orig_filethe source ISO file
orig_trackthe source track
dest_filethe destination ISO file
flagsflags to use during clone
dest_trackset to the track number of cloned track
Returns
error if any

◆ gf_isom_set_track_interleaving_group()

GF_Err gf_isom_set_track_interleaving_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  GroupID 
)

sets the GroupID of a track (only used for optimized interleaving). By setting GroupIDs you can specify the storage order for media data of a group of streams. This is useful for BIFS presentation so that static resources of the scene can be downloaded before BIFS

Parameters
isom_filethe target ISO file
trackNumberthe target track
GroupIDthe desired group ID
Returns
error if any

◆ gf_isom_set_track_priority_in_group()

GF_Err gf_isom_set_track_priority_in_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  InversePriority 
)

sets the priority of a track within a Group (used for optimized interleaving and hinting). This allows tracks to be stored before other within a same group, for instance the hint track data can be stored just before the media data, reducing disk seeking

Parameters
isom_filethe target ISO file
trackNumberthe target track
InversePrioritythe desired priority. For a same time, within a group of tracks, the track with the lowest InversePriority will be written first
Returns
error if any

◆ gf_isom_hint_max_chunk_size()

GF_Err gf_isom_hint_max_chunk_size ( GF_ISOFile isom_file,
u32  trackNumber,
u32  maxChunkSize 
)

sets the maximum chunk size for a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
maxChunkSizethe maximum chunk size in bytes
Returns
error if any

◆ gf_isom_hint_max_chunk_duration()

GF_Err gf_isom_hint_max_chunk_duration ( GF_ISOFile isom_file,
u32  trackNumber,
u32  maxChunkDur 
)

sets the maximum chunk duration for a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
maxChunkDurthe maximum chunk duration in media timescale
Returns
error if any

◆ gf_isom_make_interleave()

GF_Err gf_isom_make_interleave ( GF_ISOFile isom_file,
Double  TimeInSec 
)

sets up interleaving for storage (shortcut for storeage mode + interleave_time)

Parameters
isom_filethe target ISO file
TimeInSecthe desired interleaving time in seconds
Returns
error if any

◆ gf_isom_make_interleave_ex()

GF_Err gf_isom_make_interleave_ex ( GF_ISOFile isom_file,
GF_Fraction fTimeInSec 
)

sets up interleaving for storage (shortcut for storeage mode + interleave_time)

Parameters
isom_filethe target ISO file
fTimeInSecthe desired interleaving time in seconds, as a fraction
Returns
error if any

◆ gf_isom_set_progress_callback()

void gf_isom_set_progress_callback ( GF_ISOFile isom_file,
void(*)(void *udta, u64 nb_done, u64 nb_total)  progress_cbk,
void *  progress_cbk_udta 
)

sets progress callback when writing a file

Parameters
isom_filethe target ISO file
progress_cbkthe progress callback function
progress_cbk_udtaopaque data passed to the progress callback function

◆ gf_isom_set_write_callback()

GF_Err gf_isom_set_write_callback ( GF_ISOFile isom_file,
gf_isom_on_block_out  on_block_out,
gf_isom_on_block_patch  on_block_patch,
gf_isom_on_last_block_start  on_last_block_start,
void *  usr_data,
u32  block_size 
)

sets write callback functions for in-memory file writing

Parameters
isom_filethe target ISO file
on_block_outthe block write callback function, mandatory
on_block_patchthe block patch callback function, may be NULL if only fragmented files or very small files are being produced
on_last_block_startcalled before writing the last block of a sequence of movie fragments
usr_dataopaque user data passed to callback functions
block_sizedesired block size in bytes
Returns
error if any

◆ gf_isom_is_inplace_rewrite()

Bool gf_isom_is_inplace_rewrite ( GF_ISOFile isom_file)

checks if file will use in-place rewriting or not

Parameters
isom_filethe target ISO file
Returns
GF_TRUE if in-place rewrite is used, GF_FALSE otherwise

◆ gf_isom_disable_inplace_rewrite()

void gf_isom_disable_inplace_rewrite ( GF_ISOFile isom_file)

Disables inplace rewrite. Once in-place rewrite is disabled, the file can no longer be rewrittten in place.

In-place rewriting allows editing the file structure (ftyp, moov and meta boxes) without modifying the media data size.

In-place rewriting is disabled for any of the following:

  • specifying a storage mode using gf_isom_set_storage_mode
  • removing or adding tracks or items
  • removing, adding or updating samples
  • using stdout, redirect file "_gpac_isobmff_redirect", memory file " gmem://"

In-place rewriting is enabled by default on files open in edit mode.

Parameters
isom_filethe target ISO file

◆ gf_isom_set_inplace_padding()

GF_Err gf_isom_set_inplace_padding ( GF_ISOFile isom_file,
u32  padding 
)

sets amount of bytes to reserve after moov for future in-place editing. This may be ignored depending on the final write mode

Parameters
isom_filethe target ISO file
paddingamount of bytes to reserve
Returns
error if any