ISOBMFF
ISO Base Media File Format Reference Software Documentation
 
Loading...
Searching...
No Matches
Meta data functions

These functions allow you to manage meta boxes (atoms) at file, movie, and track level, and the items they contain. More...

Functions

ISOErr ISONewFileMeta (ISOMovie theMovie, u32 metaType, ISOMeta *meta)
 Creates a new meta box (atom), with the indicated ‘handler’ type, at the file level.
 
ISOErr ISONewMovieMeta (ISOMovie theMovie, u32 metaType, ISOMeta *meta)
 Creates a new meta box (atom), with the indicated ‘handler’ type, in the movie box (atom).
 
ISOErr ISONewTrackMeta (ISOTrack theTrack, u32 metaType, ISOMeta *meta)
 Creates a new meta box (atom), with the indicated ‘handler’ type, in the indicated track box (atom).
 
ISOErr ISOAddMetaBoxRelation (ISOMeta first_meta, ISOMeta second_meta, u8 relation_type)
 Adds a meta box relation box to the additional meta data box, related to first and second meta box.
 
ISOErr ISOGetMetaBoxRelation (ISOMeta first_meta, ISOMeta second_meta, u8 *relation_type)
 Get the reletation type.
 
ISOErr ISOAddMetaDataReference (ISOMeta meta, u16 *out_ref, ISOHandle urlHandle, ISOHandle urnHandle)
 Adds a data reference to the given meta-data.
 
ISOErr ISOAddMetaItem (ISOMeta meta, ISOMetaItem *outItem, u64 base_offset, u16 data_ref_index)
 Creates a new meta-data item, and returns an opaque pointer to it.
 
ISOErr ISOAddMetaItemWithID (ISOMeta meta, ISOMetaItem *outItem, u64 base_offset, u16 data_ref_index, u16 item_ID)
 Creates a new meta-data item with specific ID, and returns an opaque pointer to it.
 
ISOErr ISOAddItemExtent (ISOMetaItem item, MP4Handle data)
 Adds some data to the given item, as its first (perhaps only) extent.
 
ISOErr ISOAddItemExtentReference (ISOMetaItem item, u64 offset, u64 length)
 Adds a reference to the data.
 
ISOErr ISOAddItemExtentUsingItemData (ISOMetaItem item, MP4Handle data)
 Adds some data to the given item, as its first (perhaps only) extent.
 
ISOErr ISOAddItemExtentItem (ISOMetaItem item, ISOMetaItem extent_item, u32 offset, u32 length)
 Indicates that the data for this extent is located at another item’s extends.
 
ISOErr ISOAddItemReference (ISOMetaItem item, u32 reference_type, u32 to_item_ID, u32 *outIndex)
 This function adds an item reference to the item reference box.
 
ISOErr ISOAddItemReferences (ISOMetaItem item, u32 reference_type, u16 reference_count, MP4Handle to_item_IDs)
 This function adds multiple item references to the item reference box.
 
MP4Err ISOAddItemRelation (ISOMetaItem fromItem, ISOMetaItem toItem, u32 relationType)
 
ISOErr ISOGetItemReferences (ISOMetaItem item, u32 reference_type, u16 *reference_count, MP4Handle to_item_IDs)
 This function collects all item references of the item / reference_type combination.
 
ISOErr ISOGetItemReference (ISOMetaItem item, u32 reference_type, u16 reference_index, ISOMetaItem *outItem)
 Get an item by reference type and index.
 
ISOErr ISOAddPrimaryData (ISOMeta meta, u32 box_type, MP4Handle data, u8 is_full_atom)
 Places the indicated data inside a box in the meta-box, with the indicated box type (e.g.
 
ISOErr ISOGetPrimaryData (ISOMeta meta, u32 box_type, MP4Handle data, u8 is_full_atom)
 Finds the box of the given type inside the meta box, and returns its contents.
 
ISOErr ISOGetPrimaryItemData (ISOMeta meta, u32 box_type, MP4Handle data, u8 is_full_atom)
 Finds the box of the given type inside the meta box, and returns its contents.
 
ISOErr ISOSetPrimaryItem (ISOMeta meta, ISOMetaItem item)
 Sets the item of the indicated ID as the primary item (using a primary item box).
 
ISOErr ISOGetPrimaryItemID (ISOMeta meta, u16 *ID)
 Finds the ID of the primary item.
 
ISOErr ISOGetItemID (ISOMetaItem item, u16 *ID)
 Gets the ID of the indicated item.
 
ISOErr ISOSetItemInfo (ISOMetaItem item, u16 protection_index, char *name, char *content_type, char *content_encoding)
 Sets the information for the indicated item.
 
ISOErr ISOSetItemInfoExtension (ISOMetaItem item, MP4Handle extension, u32 extension_type)
 Adds an item info extension to an existing item info entry.
 
ISOErr ISOGetItemInfoExtension (ISOMetaItem item, MP4Handle extension, u32 *extension_type)
 Gets an item info extension and its extension type from an item.
 
ISOErr ISOSetItemInfoItemType (ISOMetaItem item, u32 item_type, char *item_uri_type)
 Adds an item info item type to an existing item info entry.
 
ISOErr ISOHideItem (ISOMetaItem item)
 Hide item by setting the (flags & 1) = 1.
 
ISOErr ISOIsItemHidden (ISOMetaItem item)
 Check if item is hiden.
 
ISOErr ISOGetItemInfoItemType (ISOMetaItem item, u32 *item_type, char **item_uri_type)
 Gets an item info item type from an existing item info entry.
 
ISOErr ISOGetFileMeta (ISOMovie theMovie, ISOMeta *meta, u32 inMetaType, u32 *outMetaType)
 Gets a reference to the file-level meta data.
 
ISOErr ISOGetMovieMeta (ISOMovie theMovie, ISOMeta *meta, u32 inMetaType, u32 *outMetaType)
 Gets a reference to the movie-level meta data.
 
ISOErr ISOGetTrackMeta (ISOTrack theTrack, ISOMeta *meta, u32 inMetaType, u32 *outMetaType)
 Gets a reference to the track-level meta data.
 
ISOErr ISOGetAllItemsWithType (ISOMeta meta, u32 type, ISOMetaItem **items, u32 *numberOfItemsFound)
 Collects all items of a given type and presents the result in form of an array.
 
ISOErr ISOFindItemByName (ISOMeta meta, ISOMetaItem *item, char *name, u8 exact_case)
 Finds an item that has the associated name in its item information.
 
ISOErr ISOFindItemByID (ISOMeta meta, ISOMetaItem *item, u16 ID)
 Gets a reference to an item by its ID.
 
ISOErr ISOGetItemData (ISOMetaItem item, MP4Handle data, u64 *base_offset)
 Reads and returns the data associated with all the extents of the given item, concatenating them.
 
ISOErr ISOGetItemInfo (ISOMetaItem item, u16 *protection_index, char *name, char *content_type, char *content_encoding)
 Returns the information for a given item.
 
MP4Err ISOCheckMetaDataReferences (ISOMeta meta)
 Checks that all the data references used by the meta-data are accessible.
 
MP4Err ISONewMetaProtection (ISOMeta meta, u32 sch_type, u32 sch_version, char *sch_url, u16 *protection_index)
 Creates a new item protection information inside the given meta-data box.
 
MP4Err ISOAddMetaProtectionInfo (ISOMeta meta, u16 protection_index, MP4GenericAtom schi_atom)
 Adds an arbitrary atom to the scheme information of the associated protection information.
 
MP4Err ISOGetMetaProtection (ISOMeta meta, u16 protection_index, u32 *sch_type, u32 *sch_version, char *sch_url)
 Gets the scheme type, version, and URL associated with the protection information of the given index.
 
MP4Err ISOGetMetaProtectionInfo (ISOMeta meta, u16 protection_index, u32 atom_type, MP4GenericAtom *schi_atom)
 Finds and returns the atom of the given type inside the scheme information of the protection scheme at the given index.
 
MP4Err ISOAddMetaItemProperty (ISOMetaItem item, MP4GenericAtom *itemProperty, u8 essential)
 Adds an item property, which can be any MP4GenericAtom, to an ISOMetaItem.
 
MP4Err ISOGetProperitesOfMetaItem (ISOMetaItem item, MP4GenericAtom **properties, u32 *propertiesFound)
 Retruns an array of MP4GenericAtom pointers, which represent the item properties found for the item given.
 
ISOErr ISONewEntityGroup (ISOMeta meta, u32 grouping_type, u32 group_id)
 Add new EntityToGroupBox (creates grpl if needed)
 
ISOErr ISOAddEntityIDToGroup (ISOMeta meta, u32 group_id, u32 entity_id)
 Add entity_id to EntityToGroupBox.
 
ISOErr ISOGetEntityIDCnt (ISOMeta meta, u32 group_id, u32 *num_entities_in_group)
 Get number of entries in the EntityToGroupBox.
 
ISOErr ISOGetEntityGroupEntries (ISOMeta meta, EntityGroupEntryPtr *pEntries, u32 *cnt)
 Get common data for all EntityToGroup entries.
 

Detailed Description

These functions allow you to manage meta boxes (atoms) at file, movie, and track level, and the items they contain.

The meta-type in the following functions can be a four-character code, or one of the pre-defined codes:

Type four CC
MP7TextHandlerType mp7t
7BinaryHandlerType mp7b
MP21HandlerType mp21
MP4NullHandlerType null

Function Documentation

◆ ISOAddEntityIDToGroup()

ISOErr ISOAddEntityIDToGroup ( ISOMeta  meta,
u32  group_id,
u32  entity_id 
)

Add entity_id to EntityToGroupBox.

Parameters
metaMetaBox on which we are operating
group_idunique group ID to which we want to add the entity_id
entity_identity ID value

◆ ISOAddItemExtent()

ISOErr ISOAddItemExtent ( ISOMetaItem  item,
MP4Handle  data 
)

Adds some data to the given item, as its first (perhaps only) extent.

Should generally be called only when the data reference for the item was supplied as zero. The data will be added to the related mdat box.

Note
If there are multiple extents for one item, their data must be added using the same ISOAddItemExtent() function.

◆ ISOAddItemExtentItem()

ISOErr ISOAddItemExtentItem ( ISOMetaItem  item,
ISOMetaItem  extent_item,
u32  offset,
u32  length 
)

Indicates that the data for this extent is located at another item’s extends.

Note
If there are multiple extents for one item, their data must be added using the same ISOAddItemExtent() function.

◆ ISOAddItemExtentReference()

ISOErr ISOAddItemExtentReference ( ISOMetaItem  item,
u64  offset,
u64  length 
)

Adds a reference to the data.

Should generally be called only when a non-zero data reference was supplied for the item.

Note
If there are multiple extents for one item, their data must be added using the same ISOAddItemExtent() function.

◆ ISOAddItemExtentUsingItemData()

ISOErr ISOAddItemExtentUsingItemData ( ISOMetaItem  item,
MP4Handle  data 
)

Adds some data to the given item, as its first (perhaps only) extent.

The data will be added to an item data box, which is contained in the meta data box.

Note
If there are multiple extents for one item, their data must be added using the same ISOAddItemExtent() function.

◆ ISOAddItemReference()

ISOErr ISOAddItemReference ( ISOMetaItem  item,
u32  reference_type,
u32  to_item_ID,
u32 *  outIndex 
)

This function adds an item reference to the item reference box.

If there is no existing item reference box, it will be created.

Parameters
outIndexwill contain the position of the to_item_ID in all to_item_IDs of this item and reference_type combination.

◆ ISOAddItemReferences()

ISOErr ISOAddItemReferences ( ISOMetaItem  item,
u32  reference_type,
u16  reference_count,
MP4Handle  to_item_IDs 
)

This function adds multiple item references to the item reference box.

If there is no existing item reference box, it will be created.

Note
If there are already existing references of this item / reference_type combination, they will be overwritten.

◆ ISOAddItemRelation()

MP4Err ISOAddItemRelation ( ISOMetaItem  fromItem,
ISOMetaItem  toItem,
u32  relationType 
)
Parameters
fromItemThe relation points from this item to the toItem
toItemThe relation points to this item from the fromItem
relationTypeThe 4cc relation type

◆ ISOAddMetaBoxRelation()

ISOErr ISOAddMetaBoxRelation ( ISOMeta  first_meta,
ISOMeta  second_meta,
u8  relation_type 
)

Adds a meta box relation box to the additional meta data box, related to first and second meta box.

Note
Both meta boxes must live on the same level (file, movie, track).
Deprecated:
This box has been deprecated and is no longer defined in ISOBMFF

◆ ISOAddMetaDataReference()

ISOErr ISOAddMetaDataReference ( ISOMeta  meta,
u16 *  out_ref,
ISOHandle  urlHandle,
ISOHandle  urnHandle 
)

Adds a data reference to the given meta-data.

The returned reference can later be passed to the ISOAddMetaItem().

◆ ISOAddMetaItem()

ISOErr ISOAddMetaItem ( ISOMeta  meta,
ISOMetaItem outItem,
u64  base_offset,
u16  data_ref_index 
)

Creates a new meta-data item, and returns an opaque pointer to it.

Parameters
metainput meta object
outItemoutput pointer to created meta item object
base_offsetshould generally be zero. The software will increment this to reflect the actual base offset of the item’s first extent in the file
data_ref_indexcan be zero (for items to be in the same file) or as returned by ISOAddMetaDataReference().

◆ ISOAddMetaItemProperty()

MP4Err ISOAddMetaItemProperty ( ISOMetaItem  item,
MP4GenericAtom itemProperty,
u8  essential 
)

Adds an item property, which can be any MP4GenericAtom, to an ISOMetaItem.

Parameters
essentialThe essential flag can be set with 1 and unset with 0.

◆ ISOAddMetaItemWithID()

ISOErr ISOAddMetaItemWithID ( ISOMeta  meta,
ISOMetaItem outItem,
u64  base_offset,
u16  data_ref_index,
u16  item_ID 
)

Creates a new meta-data item with specific ID, and returns an opaque pointer to it.

See also
ISOAddMetaItem

◆ ISOAddPrimaryData()

ISOErr ISOAddPrimaryData ( ISOMeta  meta,
u32  box_type,
MP4Handle  data,
u8  is_full_atom 
)

Places the indicated data inside a box in the meta-box, with the indicated box type (e.g.

ISOXMLAtomType or ISOBinaryXMLAtomType).

Parameters
is_full_atomThis flag can be used to insert the four bytes of version and flags required in a full atom.

◆ ISOGetEntityGroupEntries()

ISOErr ISOGetEntityGroupEntries ( ISOMeta  meta,
EntityGroupEntryPtr pEntries,
u32 *  cnt 
)

Get common data for all EntityToGroup entries.

Note
Each call of this function allocates memory in pEntries and you are responsible to clean.
Parameters
metaMetaBox on which we are operating
pEntries[out] An array of EntityGroup entries with common data (id's, count, etc.)
cnt[out] Number of EntityGroup entries (size of EntityGroupEntryPtr array)

◆ ISOGetEntityIDCnt()

ISOErr ISOGetEntityIDCnt ( ISOMeta  meta,
u32  group_id,
u32 *  num_entities_in_group 
)

Get number of entries in the EntityToGroupBox.

Parameters
metaMetaBox on which we are operating
group_idgroup ID
num_entities_in_group[out] number of entities in group

◆ ISOGetFileMeta()

ISOErr ISOGetFileMeta ( ISOMovie  theMovie,
ISOMeta meta,
u32  inMetaType,
u32 *  outMetaType 
)

Gets a reference to the file-level meta data.

The input parameter meta-type, if non-zero, can be used to check that the associated meta-data is of the given type. The output always supplies the type.

◆ ISOGetItemData()

ISOErr ISOGetItemData ( ISOMetaItem  item,
MP4Handle  data,
u64 *  base_offset 
)

Reads and returns the data associated with all the extents of the given item, concatenating them.

The returned base offset will be adjusted to represent the offset in the resulting handle (which will generally match the value passed in to ISOAddMetaItem(), typically zero).

◆ ISOGetItemInfo()

ISOErr ISOGetItemInfo ( ISOMetaItem  item,
u16 *  protection_index,
char *  name,
char *  content_type,
char *  content_encoding 
)

Returns the information for a given item.

Note
It is your responsibility to make sure the buffers are large enough for the strings.

◆ ISOGetItemInfoItemType()

ISOErr ISOGetItemInfoItemType ( ISOMetaItem  item,
u32 *  item_type,
char **  item_uri_type 
)

Gets an item info item type from an existing item info entry.

Parameters
item_uri_typecould be NULL, if the item_type is not ‘uri ‘.

◆ ISOGetMetaBoxRelation()

ISOErr ISOGetMetaBoxRelation ( ISOMeta  first_meta,
ISOMeta  second_meta,
u8 *  relation_type 
)

Get the reletation type.

Parameters
relation_typewill contain the type found in a meta box relation box or 0.

◆ ISOGetMovieMeta()

ISOErr ISOGetMovieMeta ( ISOMovie  theMovie,
ISOMeta meta,
u32  inMetaType,
u32 *  outMetaType 
)

Gets a reference to the movie-level meta data.

The input parameter meta-type, if non-zero, can be used to check that the associated meta-data is of the given type. The output always supplies the type.

◆ ISOGetPrimaryData()

ISOErr ISOGetPrimaryData ( ISOMeta  meta,
u32  box_type,
MP4Handle  data,
u8  is_full_atom 
)

Finds the box of the given type inside the meta box, and returns its contents.

Parameters
is_full_atomcan be used to skip the four bytes of version and flags of a full atom.

◆ ISOGetPrimaryItemData()

ISOErr ISOGetPrimaryItemData ( ISOMeta  meta,
u32  box_type,
MP4Handle  data,
u8  is_full_atom 
)

Finds the box of the given type inside the meta box, and returns its contents.

Like ISOGetPrimaryData(), but probably more useful, as if a box of the given type does not exist, finds the primary item and returns its data. Gives an error indication if neither the box nor the primary item exist.

◆ ISOGetProperitesOfMetaItem()

MP4Err ISOGetProperitesOfMetaItem ( ISOMetaItem  item,
MP4GenericAtom **  properties,
u32 *  propertiesFound 
)

Retruns an array of MP4GenericAtom pointers, which represent the item properties found for the item given.

Parameters
propertiesFoundindicates the amount of items found and the size of the array, that is returned.

◆ ISOGetTrackMeta()

ISOErr ISOGetTrackMeta ( ISOTrack  theTrack,
ISOMeta meta,
u32  inMetaType,
u32 *  outMetaType 
)

Gets a reference to the track-level meta data.

The input parameter meta-type, if non-zero, can be used to check that the associated meta-data is of the given type. The output always supplies the type.

◆ ISOHideItem()

ISOErr ISOHideItem ( ISOMetaItem  item)

Hide item by setting the (flags & 1) = 1.

Parameters
itemItem to hide

◆ ISOIsItemHidden()

ISOErr ISOIsItemHidden ( ISOMetaItem  item)

Check if item is hiden.

Parameters
itemItem to check
Returns
MP4NoErr if item is hidden, MP4NotFoundErr if not, MP4InvalidMediaErr otherwise

◆ ISONewEntityGroup()

ISOErr ISONewEntityGroup ( ISOMeta  meta,
u32  grouping_type,
u32  group_id 
)

Add new EntityToGroupBox (creates grpl if needed)

Parameters
metaMetaBox where the new EntityToGroupBox should be added to
grouping_typegrouping type
group_idgroup ID

◆ ISONewFileMeta()

ISOErr ISONewFileMeta ( ISOMovie  theMovie,
u32  metaType,
ISOMeta meta 
)

Creates a new meta box (atom), with the indicated ‘handler’ type, at the file level.

If there is already a meta box present, a additional meta box atom will be created and the new meta box will be added inside.

Parameters
theMovieinput movie object
metaTypemetadata type fourcc
metaoutput meta object

◆ ISONewMovieMeta()

ISOErr ISONewMovieMeta ( ISOMovie  theMovie,
u32  metaType,
ISOMeta meta 
)

Creates a new meta box (atom), with the indicated ‘handler’ type, in the movie box (atom).

If there is already a meta box present, a additional meta box atom will be created and the new meta box will be added inside.

Parameters
theMovieinput movie object
metaTypemetadata type fourcc
metaoutput meta object

◆ ISONewTrackMeta()

ISOErr ISONewTrackMeta ( ISOTrack  theTrack,
u32  metaType,
ISOMeta meta 
)

Creates a new meta box (atom), with the indicated ‘handler’ type, in the indicated track box (atom).

If there is already a meta box present, a additional meta box atom will be created and the new meta box will be added inside

Parameters
theTrackinput track object
metaTypemetadata type fourcc
metaoutput meta object

◆ ISOSetItemInfo()

ISOErr ISOSetItemInfo ( ISOMetaItem  item,
u16  protection_index,
char *  name,
char *  content_type,
char *  content_encoding 
)

Sets the information for the indicated item.

Parameters
protection_indexis returned by ISONewMetaProtection()

◆ ISOSetItemInfoItemType()

ISOErr ISOSetItemInfoItemType ( ISOMetaItem  item,
u32  item_type,
char *  item_uri_type 
)

Adds an item info item type to an existing item info entry.

Parameters
item_uri_typecan be NULL, if the item_type is not ‘uri ‘