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

Functions

u32 gf_isom_get_udta_count (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_get_udta_type (GF_ISOFile *isom_file, u32 trackNumber, u32 udta_idx, u32 *UserDataType, bin128 *UUID)
 
u32 gf_isom_get_user_data_count (GF_ISOFile *isom_file, u32 trackNumber, u32 UserDataType, bin128 UUID)
 
GF_Err gf_isom_get_user_data (GF_ISOFile *isom_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex, u8 **userData, u32 *userDataSize)
 
GF_Err gf_isom_add_user_data (GF_ISOFile *isom_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u8 *data, u32 size)
 
GF_Err gf_isom_remove_user_data (GF_ISOFile *isom_file, u32 trackNumber, u32 UserDataType, bin128 UUID)
 
GF_Err gf_isom_remove_user_data_item (GF_ISOFile *isom_file, u32 trackNumber, u32 UserDataType, bin128 UUID, u32 UserDataIndex)
 
GF_Err gf_isom_add_user_data_boxes (GF_ISOFile *isom_file, u32 trackNumber, u8 *data, u32 size)
 
GF_Err gf_isom_get_raw_user_data (GF_ISOFile *isom_file, u8 **output, u32 *output_size)
 

Detailed Description

                            User Data Manipulation

You can add specific typed data to either a track or the movie: the UserData The type must be formatted as a FourCC if you have a registered 4CC type but the usual is to set a UUID (128 bit ID for box type) which never conflict with existing structures in the format To manipulate a UUID user data set the UserDataType to 0 and specify a valid UUID. Otherwise the UUID parameter is ignored Several items with the same ID or UUID can be added (this allows you to store any kind/number of private information under a unique ID / UUID)

Function Documentation

◆ gf_isom_get_udta_count()

u32 gf_isom_get_udta_count ( GF_ISOFile isom_file,
u32  trackNumber 
)

gets number of udta (user data) entries of a movie or track

Parameters
isom_filethe target ISO file
trackNumberthe target track if not 0; if 0, the movie udta is checked
Returns
the number of entries in UDTA

◆ gf_isom_get_udta_type()

GF_Err gf_isom_get_udta_type ( GF_ISOFile isom_file,
u32  trackNumber,
u32  udta_idx,
u32 UserDataType,
bin128 UUID 
)

checks type of a given udta entry

Parameters
isom_filethe target ISO file
trackNumberthe target track if not 0; if 0, the movie udta is checked
udta_idx1-based index of the user data to query
UserDataTypeset to the four character code of the user data entry (optional, can be NULL)
UUIDset to the UUID of the user data entry (optional, can be NULL)
Returns
error if any

◆ gf_isom_get_user_data_count()

u32 gf_isom_get_user_data_count ( GF_ISOFile isom_file,
u32  trackNumber,
u32  UserDataType,
bin128  UUID 
)

gets the number of UserDataItems with the same ID / UUID in the desired track or movie

Parameters
isom_filethe target ISO file
trackNumberthe target track if not 0; if 0, the movie udta is checked
UserDataTypethe four character code of the user data entry to query
UUIDthe UUID of the user data entry
Returns
number of UDTA entries with the given type

◆ gf_isom_get_user_data()

GF_Err gf_isom_get_user_data ( GF_ISOFile isom_file,
u32  trackNumber,
u32  UserDataType,
bin128  UUID,
u32  UserDataIndex,
u8 **  userData,
u32 userDataSize 
)

gets the UserData for the specified item from the track or the movie

Parameters
isom_filethe target ISO file
trackNumberthe target track if not 0; if 0, the movie udta is checked
UserDataTypethe four character code of the user data entry to query
UUIDthe UUID of the user data entry
UserDataIndex1-based index of the user data of the given type to fetch. If 0, all boxes with type==UserDataType will be serialized (including box header and size) in the output buffer
userDataset to a newly allocated buffer containing the serialized data - shall be freed by caller, you must pass (userData != NULL && *userData=NULL)
userDataSizeset to the size of the allocated buffer
Returns
error if any

◆ gf_isom_add_user_data()

GF_Err gf_isom_add_user_data ( GF_ISOFile isom_file,
u32  trackNumber,
u32  UserDataType,
bin128  UUID,
u8 data,
u32  size 
)

adds a user data item in the desired track or in the movie

Parameters
isom_filethe target ISO file
trackNumberthe target track for the user data; if 0, adds user data to the movie
UserDataTypethe user data four character code type
UUIDthe user data UUID
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_remove_user_data()

GF_Err gf_isom_remove_user_data ( GF_ISOFile isom_file,
u32  trackNumber,
u32  UserDataType,
bin128  UUID 
)

removes all user data items from a track or movie

Parameters
isom_filethe target ISO file
trackNumberthe target track for the user data; if 0, adds user data to the movie
UserDataTypethe user data four character code type
UUIDthe user data UUID
Returns
error if any

◆ gf_isom_remove_user_data_item()

GF_Err gf_isom_remove_user_data_item ( GF_ISOFile isom_file,
u32  trackNumber,
u32  UserDataType,
bin128  UUID,
u32  UserDataIndex 
)

removes a user data item from a track or movie use the UDAT read functions to get the item index

Parameters
isom_filethe target ISO file
trackNumberthe target track for the user data; if 0, adds user data to the movie
UserDataTypethe user data four character code type
UUIDthe user data UUID
UserDataIndexthe 1-based index of the user data item to remove - see gf_isom_get_user_data_count
Returns
error if any

◆ gf_isom_add_user_data_boxes()

GF_Err gf_isom_add_user_data_boxes ( GF_ISOFile isom_file,
u32  trackNumber,
u8 data,
u32  size 
)

adds a user data item in a track or movie using a serialzed buffer of ISOBMFF boxes

Parameters
isom_filethe target ISO file
trackNumberthe target track for the udta box; if 0, add the udta to the movie;
datathe serialized udta box to add, shall not be NULL
sizethe size of the data to add
Returns
error if any

◆ gf_isom_get_raw_user_data()

GF_Err gf_isom_get_raw_user_data ( GF_ISOFile isom_file,
u8 **  output,
u32 output_size 
)

gets serialized user data box of a movie

Parameters
isom_filethe destination ISO file
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