libgpac
Documentation of the core library of GPAC
ISOBMF Helper tools

media tools helper for importing, exporting and analysing. More...

+ Collaboration diagram for ISOBMF Helper tools:

Functions

GF_Err gf_media_get_file_hash (const char *file, u8 hash[20])
 
GF_ESDgf_media_map_esd (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_ESDgf_media_map_item_esd (GF_ISOFile *mp4, u32 item_id)
 
GF_Err gf_media_get_rfc_6381_codec_name (GF_ISOFile *isom_file, u32 trackNumber, char *szCodec, Bool force_inband_xps, Bool force_sbr)
 
GF_Err gf_media_change_par (GF_ISOFile *isom_file, u32 trackNumber, s32 ar_num, s32 ar_den, Bool force_par, Bool rewrite_par)
 
GF_Err gf_media_change_color (GF_ISOFile *isom_file, u32 trackNumber, s32 fullrange, s32 video_format, s32 color_primaries, s32 transfer, s32 color_matrix)
 
GF_Err gf_media_remove_non_rap (GF_ISOFile *isom_file, u32 trackNumber, Bool non_ref_only)
 
void gf_media_update_bitrate (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_media_av1_layer_size_get (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_number, u8 op_index, u32 layer_size[3])
 

Detailed Description

This section documents media tools functions .

Function Documentation

◆ gf_media_get_file_hash()

GF_Err gf_media_get_file_hash ( const char *  file,
u8  hash[20] 
)

computes file hash. If file is ISOBMFF based, computes hash according to OMA (P)DCF (without MutableDRMInformation box). Otherwise this is equivalent to gf_sha1_file

Parameters
filethe source file to hash
hashthe 20 bytes buffer in which sha128 is performed for this file
Returns
error if any.

◆ gf_media_map_esd()

GF_ESD* gf_media_map_esd ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

Creates (if needed) a GF_ESD for the given track - THIS IS RESERVED for local playback only, since the OTI/codecid used when emulated is not standard...

Parameters
isom_filesource file
trackNumbertrack for which the esd is to be emulated
sampleDescriptionIndexindicates the default sample description to map. 0 is equivalent to 1, first sample description
Returns
rebuilt ESD. It is the caller responsibility to delete it.

◆ gf_media_map_item_esd()

GF_ESD* gf_media_map_item_esd ( GF_ISOFile mp4,
u32  item_id 
)

Creates (if needed) a GF_ESD for the given image item - THIS IS RESERVED for local playback only, since the OTI/codecid used when emulated is not standard...

Parameters
mp4source file
item_iditem for which the esd is to be emulated
Returns
rebuilt ESD. It is the caller responsibility to delete it.

◆ gf_media_get_rfc_6381_codec_name()

GF_Err gf_media_get_rfc_6381_codec_name ( GF_ISOFile isom_file,
u32  trackNumber,
char *  szCodec,
Bool  force_inband_xps,
Bool  force_sbr 
)

Get RFC 6381 description for a given track.

Parameters
isom_filesource ISOBMF file
trackNumbertrack to check
szCodeca pointer to an already allocated string of size RFC6381_CODEC_NAME_SIZE_MAX bytes.
force_inband_xpsforce inband signaling of parameter sets.
force_sbrforces using explicit signaling for SBR.
Returns
error if any.

◆ gf_media_change_par()

GF_Err gf_media_change_par ( GF_ISOFile isom_file,
u32  trackNumber,
s32  ar_num,
s32  ar_den,
Bool  force_par,
Bool  rewrite_par 
)

Changes pixel aspect ratio for visual tracks if supported. Negative values remove any PAR info

Parameters
isom_filetarget ISOBMF file
trackNumbertarget track
ar_numaspect ratio numerator. A value of 0 removes PAR info, a value of -1 gets info from video bitstream for BOTH num and den
ar_denaspect ratio denominator. A value of 0 removes PAR info, a value of -1 gets info from video bitstream for BOTH num and den
force_paraspect ratio is always written even when 1:1, otherwise aspect ratio info is removed if 1:1
rewrite_paraspect ratio is modified in bitstream. Ignored if ar_num or ar_den are not strictly positive
Returns
error if any

◆ gf_media_change_color()

GF_Err gf_media_change_color ( GF_ISOFile isom_file,
u32  trackNumber,
s32  fullrange,
s32  video_format,
s32  color_primaries,
s32  transfer,
s32  color_matrix 
)

Changes color property of the media (bitstream rewrite) - only AVC/H264 supported for now. See CICP for value types Negative values keep source settings for the corresponding flags. If source stream has no VUI info, create one and set corresponding flags to specified values. In this case, any other flags are set to preferred values (typically, flag=0 or value=undef).

Parameters
isom_filetarget ISOBMF file
trackNumbertarget track
fullrangefullrange flag
video_formatvideo format type
color_primariescolor primaries
transfertransfer characteristics
color_matrixolor matrix
Returns
error if any

◆ gf_media_remove_non_rap()

GF_Err gf_media_remove_non_rap ( GF_ISOFile isom_file,
u32  trackNumber,
Bool  non_ref_only 
)

Removes all non rap samples (sync and other RAP sample group info) from the track.

Parameters
isom_filetarget ISOBMF file
trackNumbertarget track
non_ref_onlyif GF_TRUE, removes only non-reference pictures
Returns
error if any

◆ gf_media_update_bitrate()

void gf_media_update_bitrate ( GF_ISOFile isom_file,
u32  trackNumber 
)

updates bitrate info on given track.

Parameters
isom_filetarget ISOBMF file
trackNumbertarget track

◆ gf_media_av1_layer_size_get()

GF_Err gf_media_av1_layer_size_get ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_number,
u8  op_index,
u32  layer_size[3] 
)

gets AV1 scalable layer byte offsets of a sample for a1lx box

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_numberthe target sample to query
op_indexAV1 operating point index to retrieve sizes for
layer_sizereturned 3 layer sizes (4th is implied, see a1lx spec)
Returns
error if any