libgpac
Documentation of the core library of GPAC
Sample Groups
+ Collaboration diagram for Sample Groups:

Enumerations

enum  {
  GF_ISOM_SAMPLE_GROUP_ROLL = GF_4CC( 'r', 'o', 'l', 'l') , GF_ISOM_SAMPLE_GROUP_PROL = GF_4CC( 'p', 'r', 'o', 'l') , GF_ISOM_SAMPLE_GROUP_RAP = GF_4CC( 'r', 'a', 'p', ' ' ) , GF_ISOM_SAMPLE_GROUP_SEIG = GF_4CC( 's', 'e', 'i', 'g' ) ,
  GF_ISOM_SAMPLE_GROUP_OINF = GF_4CC( 'o', 'i', 'n', 'f') , GF_ISOM_SAMPLE_GROUP_LINF = GF_4CC( 'l', 'i', 'n', 'f') , GF_ISOM_SAMPLE_GROUP_TRIF = GF_4CC( 't', 'r', 'i', 'f' ) , GF_ISOM_SAMPLE_GROUP_NALM = GF_4CC( 'n', 'a', 'l', 'm') ,
  GF_ISOM_SAMPLE_GROUP_TELE = GF_4CC( 't', 'e', 'l', 'e') , GF_ISOM_SAMPLE_GROUP_SAP = GF_4CC( 's', 'a', 'p', ' ') , GF_ISOM_SAMPLE_GROUP_ALST = GF_4CC( 'a', 'l', 's', 't') , GF_ISOM_SAMPLE_GROUP_RASH = GF_4CC( 'r', 'a', 's', 'h') ,
  GF_ISOM_SAMPLE_GROUP_AVLL = GF_4CC( 'a', 'v', 'l', 'l') , GF_ISOM_SAMPLE_GROUP_AVSS = GF_4CC( 'a', 'v', 's', 's') , GF_ISOM_SAMPLE_GROUP_DTRT = GF_4CC( 'd', 't', 'r', 't') , GF_ISOM_SAMPLE_GROUP_MVIF = GF_4CC( 'm', 'v', 'i', 'f') ,
  GF_ISOM_SAMPLE_GROUP_SCIF = GF_4CC( 's', 'c', 'i', 'f') , GF_ISOM_SAMPLE_GROUP_SCNM = GF_4CC( 's', 'c', 'n', 'm') , GF_ISOM_SAMPLE_GROUP_STSA = GF_4CC( 's', 't', 's', 'a') , GF_ISOM_SAMPLE_GROUP_TSAS = GF_4CC( 't', 's', 'a', 's') ,
  GF_ISOM_SAMPLE_GROUP_SYNC = GF_4CC( 's', 'y', 'n', 'c') , GF_ISOM_SAMPLE_GROUP_TSCL = GF_4CC( 't', 's', 'c', 'l') , GF_ISOM_SAMPLE_GROUP_VIPR = GF_4CC( 'v', 'i', 'p', 'r') , GF_ISOM_SAMPLE_GROUP_LBLI = GF_4CC( 'l', 'b', 'l', 'i') ,
  GF_ISOM_SAMPLE_GROUP_3GAG = GF_4CC( '3', 'g', 'a', 'g') , GF_ISOM_SAMPLE_GROUP_AVCB = GF_4CC( 'a', 'v', 'c', 'b') , GF_ISOM_SAMPLE_GROUP_SPOR = GF_4CC( 's', 'p', 'o', 'r') , GF_ISOM_SAMPLE_GROUP_SULM = GF_4CC( 's', 'u', 'l', 'm') ,
  GF_ISOM_SAMPLE_GROUP_ESGH = GF_4CC( 'e', 's', 'g', 'h') , GF_ISOM_SAMPLE_GROUP_ILCE = GF_4CC( 'i', 'l', 'c', 'e')
}
 

Functions

GF_Err gf_isom_get_sample_rap_roll_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, Bool *is_rap, GF_ISOSampleRollType *roll_type, s32 *roll_distance)
 
Bool gf_isom_get_sample_group_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_group_description_index, u32 grouping_type, u32 *default_index, const u8 **data, u32 *size)
 
GF_Err gf_isom_get_sample_to_group_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_number, u32 grouping_type, u32 grouping_type_parameter, u32 *sampleGroupDescIndex)
 
Bool gf_isom_has_cenc_sample_group (GF_ISOFile *isom_file, u32 trackNumber, Bool *has_selective, Bool *has_roll)
 
Bool gf_isom_get_tile_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_group_description_index, u32 *default_sample_group_index, u32 *id, u32 *independent, Bool *full_frame, u32 *x, u32 *y, u32 *w, u32 *h)
 
GF_Err gf_isom_enum_sample_group (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_number, u32 *sgrp_idx, u32 *sgrp_type, u32 *sgrp_flags, u32 *sgrp_parameter, u8 **sgrp_data, u32 *sgrp_size)
 
GF_Err gf_isom_enum_sample_aux_data (GF_ISOFile *isom_file, u32 trackNumber, u32 sample_number, u32 *sai_idx, u32 *sai_type, u32 *sai_parameter, u8 **sai_data, u32 *sai_size)
 
GF_Err gf_isom_set_sample_rap_group (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, Bool is_rap, u32 num_leading_samples)
 
GF_Err gf_isom_set_sample_roll_group (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, GF_ISOSampleRollType roll_type, s16 roll_distance)
 
GF_Err gf_isom_set_sample_cenc_group (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u8 isEncrypted, u32 crypt_byte_block, u32 skip_byte_block, u8 *key_info, u32 key_info_size)
 
GF_Err gf_isom_set_sample_cenc_default_group (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber)
 
GF_Err gf_isom_add_sample_group_info (GF_ISOFile *isom_file, u32 trackNumber, u32 grouping_type, void *data, u32 data_size, Bool is_default, u32 *sampleGroupDescriptionIndex)
 
GF_Err gf_isom_remove_sample_group (GF_ISOFile *isom_file, u32 trackNumber, u32 grouping_type)
 
GF_Err gf_isom_set_sample_group_description (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 grouping_type, u32 grouping_type_parameter, void *data, u32 data_size, u32 sgpd_flags)
 
GF_Err gf_isom_add_sample_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 grouping_type, u32 sampleGroupDescriptionIndex, u32 grouping_type_parameter)
 
GF_Err gf_isom_set_sample_group_in_traf (GF_ISOFile *isom_file)
 
GF_Err gf_isom_set_sample_references (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, s32 ID, u32 nb_refs, s32 *refs)
 
GF_Err gf_isom_get_sample_references (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 *refID, u32 *nb_refs, const u32 **refs)
 
GF_Err gf_isom_fragment_add_sample_references (GF_ISOFile *isom_file, GF_ISOTrackID TrackID, s32 refID, u32 nb_refs, s32 *refs)
 

Detailed Description

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

defined sample groups in GPAC

Function Documentation

◆ gf_isom_get_sample_rap_roll_info()

GF_Err gf_isom_get_sample_rap_roll_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
Bool is_rap,
GF_ISOSampleRollType roll_type,
s32 roll_distance 
)

gets 'rap ' and 'roll' group info for the given sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
is_rapset to GF_TRUE if sample is a rap (open gop), GF_FALSE otherwise
roll_typeset to GF_ISOM_SAMPLE_ROLL if sample has roll information, GF_ISOM_SAMPLE_PREROLL if sample has preroll information, GF_ISOM_SAMPLE_ROLL_NONE otherwise
roll_distanceif sample has roll information, set to roll distance
Returns
error if any

◆ gf_isom_get_sample_group_info()

Bool gf_isom_get_sample_group_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_group_description_index,
u32  grouping_type,
u32 default_index,
const u8 **  data,
u32 size 
)

returns opaque data of sample group

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_group_description_indexindex of sample group description entry to query
grouping_typefour character code of grouping type of sample group description to query
default_indexset to the default index for this sample group description if any, 0 otherwise (no defaults)
dataset to the internal sample group description data buffer
sizeset to size of the sample group description data buffer
Returns
GF_TRUE if found, GF_FALSE otherwise

◆ gf_isom_get_sample_to_group_info()

GF_Err gf_isom_get_sample_to_group_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_number,
u32  grouping_type,
u32  grouping_type_parameter,
u32 sampleGroupDescIndex 
)

gets sample group description index for a given sample and grouping type.

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_numbersample number to query
grouping_typefour character code of grouping type of sample group description to query
grouping_type_parametergrouping type parameter of sample group description to query
sampleGroupDescIndexset to the 1-based sample group description index, or 0 if no sample group of this type is associated
Returns
error if any

◆ gf_isom_has_cenc_sample_group()

Bool gf_isom_has_cenc_sample_group ( GF_ISOFile isom_file,
u32  trackNumber,
Bool has_selective,
Bool has_roll 
)

checks if a track as a CENC seig sample group used for key rolling

Parameters
isom_filethe target ISO file
trackNumberthe target track
has_selectiveset to TRUE if some entries describe unprotected samples - may be NULL
has_rollset to TRUE if more than one key defined - may be NULL
Returns
GF_TRUE if found, GF_FALSE otherwise

◆ gf_isom_get_tile_info()

Bool gf_isom_get_tile_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_group_description_index,
u32 default_sample_group_index,
u32 id,
u32 independent,
Bool full_frame,
u32 x,
u32 y,
u32 w,
u32 h 
)

gets HEVC tiling info

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_group_description_indexindex of sample group description entry to query
default_sample_group_indexset to the default index for this sample group description if any, 0 otherwise (no defaults)
idset to the tile group ID
independentset to independent flag of the tile group (0: not constrained, 1: constrained in layer, 2: all intra slices)
full_frameset to GF_TRUE if the tile corresponds to the entire picture
xset to the horizontal position in pixels
yset to the vertical position in pixels
wset to the width in pixels
hset to the height in pixels
Returns
GF_TRUE if found, GF_FALSE otherwise

◆ gf_isom_enum_sample_group()

GF_Err gf_isom_enum_sample_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_number,
u32 sgrp_idx,
u32 sgrp_type,
u32 sgrp_flags,
u32 sgrp_parameter,
u8 **  sgrp_data,
u32 sgrp_size 
)

enumerates custom sample groups (not natively supported by this library) for a given sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_numberthe target sample
sgrp_idxthe current index. Must be set to 0 on first call, incremented by this call on each success, must not be NULL
sgrp_typeset to the grouping type, or set to 0 if no more sample group descriptions, must not be NULL
sgrp_flagsset to the grouping flags, (0x1: static_group_description, 0x2: static_mapping)
sgrp_parameterset to the grouping_type_parameter or 0 if not defined
sgrp_dataset to the sample group description data, may be NULL - MUST be freed by caller
sgrp_sizeset to the sample group description size, may be NULL
Returns
error if any

◆ gf_isom_enum_sample_aux_data()

GF_Err gf_isom_enum_sample_aux_data ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sample_number,
u32 sai_idx,
u32 sai_type,
u32 sai_parameter,
u8 **  sai_data,
u32 sai_size 
)

enumerates custom sample auxiliary data (not natively supported by this library) for a given sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
sample_numberthe target sample
sai_idxthe current index. Must be et to 0 on first call, incremented by this call on each success, must not be NULL
sai_typeset to the grouping type, or set to 0 if no more sample group descriptions, must not be NULL
sai_parameterset to the grouping_type_parameter or 0 if not defined
sai_dataset (allocated) to the sample group description data, must not be NULL and must be freed by caller
sai_sizeset to the sample group description size, must not be NULL
Returns
error if any

◆ gf_isom_set_sample_rap_group()

GF_Err gf_isom_set_sample_rap_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
Bool  is_rap,
u32  num_leading_samples 
)

sets rap flag for sample_number - this is used by non-IDR RAPs in AVC (also in USAC) were SYNC flag (stss table) cannot be used

Warning
Sample group info MUST be added in order (no insertion in the tables)
Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
is_rapindicates if the sample is a RAP (open gop) sample
num_leading_samplesindicates the number of leading samples (samples after this RAP that have dependences on samples before this RAP and hence should be discarded when tuning in)
Returns
error if any

◆ gf_isom_set_sample_roll_group()

GF_Err gf_isom_set_sample_roll_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
GF_ISOSampleRollType  roll_type,
s16  roll_distance 
)

sets roll_distance info for sample_number (number of frames before (<0) or after (>0) this sample to have a complete refresh of the decoded data (used by GDR in AVC)

Warning
Sample group info MUST be added in order (no insertion in the tables)
Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number. If 0, assumes last added sample. If 0xFFFFFFFF, marks all samples as belonging to the roll group
roll_typeindicates the sample roll recovery type
roll_distanceindicates the roll distance before a correct decoding is produced
Returns
error if any

◆ gf_isom_set_sample_cenc_group()

GF_Err gf_isom_set_sample_cenc_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u8  isEncrypted,
u32  crypt_byte_block,
u32  skip_byte_block,
u8 key_info,
u32  key_info_size 
)

sets encryption group for a sample number

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
isEncryptedisEncrypted flag
crypt_byte_blockcrypt block size for pattern encryption, can be 0
skip_byte_blockskip block size for pattern encryption, can be 0
key_infomultikey descriptor (cf CENC and GF_PROP_PID_CENC_KEY)
key_info_sizemultikey descriptor size
Returns
error if any

◆ gf_isom_set_sample_cenc_default_group()

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

sets a sample using the default CENC parameters in a CENC saig sample group SEIG, creating a sample group description if needed (when seig is already defined)

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
Returns
error if any

◆ gf_isom_add_sample_group_info()

GF_Err gf_isom_add_sample_group_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  grouping_type,
void *  data,
u32  data_size,
Bool  is_default,
u32 sampleGroupDescriptionIndex 
)

adds the given blob as a sample group description entry of the given grouping type.

Parameters
isom_filethe target ISO file
trackNumberthe target track
grouping_typethe four character code of the grouping type
datathe payload of the sample group description
data_sizethe size of the payload
is_defaultif GF_TRUE, thie created entry will be marked as the default entry for the sample group description
sampleGroupDescriptionIndexis set to the sample group description index (optional, can be NULL)
Returns
error if any

◆ gf_isom_remove_sample_group()

GF_Err gf_isom_remove_sample_group ( GF_ISOFile isom_file,
u32  trackNumber,
u32  grouping_type 
)

removes a sample group description of the give grouping type, if found

Parameters
isom_filethe target ISO file
trackNumberthe target track
grouping_typethe four character code of the grouping type
Returns
error if any

◆ gf_isom_set_sample_group_description()

GF_Err gf_isom_set_sample_group_description ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32  grouping_type,
u32  grouping_type_parameter,
void *  data,
u32  data_size,
u32  sgpd_flags 
)

adds the given blob as a sample group description entry of the given grouping type for the given sample.

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number.Use 0 for setting sample group info to last sample in a track fragment
grouping_typethe four character code of the grouping type
grouping_type_parameterassociated grouping type parameter (usually 0)
datathe payload of the sample group description
data_sizethe size of the payload
sgpd_flagsflags for sgpd: 1: static description, 2, static mapping, 1<<30: essential sample group, 1<<31: default sample description
Returns
error if any

◆ gf_isom_add_sample_info()

GF_Err gf_isom_add_sample_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32  grouping_type,
u32  sampleGroupDescriptionIndex,
u32  grouping_type_parameter 
)

adds a sample to the given sample group

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
grouping_typethe four character code of the grouping type
sampleGroupDescriptionIndexthe 1-based index of the sample group description entry
grouping_type_parameterthe grouping type paramter (see ISO/IEC 14496-12)
Returns
error if any

◆ gf_isom_set_sample_group_in_traf()

GF_Err gf_isom_set_sample_group_in_traf ( GF_ISOFile isom_file)

sets sample group descriptions storage in trafs and not in initial movie (Smooth compatibility)

Parameters
isom_filethe target ISO file
Returns
error if any

◆ gf_isom_set_sample_references()

GF_Err gf_isom_set_sample_references ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
s32  ID,
u32  nb_refs,
s32 refs 
)

sets sample references

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number - currently restricted to be the last sample
IDID for the sample
nb_refsnumber of references for this sample, may be 0 if none (IDR)
refsIDs of samples this sample depends on
Returns
error if any

◆ gf_isom_get_sample_references()

GF_Err gf_isom_get_sample_references ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32 refID,
u32 nb_refs,
const u32 **  refs 
)

gets sample references

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
refIDID for the sample
nb_refsnumber of references for this sample, may be 0 if none (IDR)
refsIDs of samples this sample depends on. Do NOT modify
Returns
error if any, GF_NOT_FOUND if no such info

◆ gf_isom_fragment_add_sample_references()

GF_Err gf_isom_fragment_add_sample_references ( GF_ISOFile isom_file,
GF_ISOTrackID  TrackID,
s32  refID,
u32  nb_refs,
s32 refs 
)

sets sample references for fragmented mode

Parameters
isom_filethe target ISO file
TrackIDthe target track ID
refIDID for the sample
nb_refsnumber of references for this sample, may be 0 if none (IDR)
refsIDs of samples this sample depends on
Returns
error if any