libgpac
Documentation of the core library of GPAC
Content Protection
+ Collaboration diagram for Content Protection:

Data Structures

struct  GF_ISMASample
 

Enumerations

enum  {
  GF_ISOM_BOX_UUID_PSEC = GF_4CC( 'P', 'S', 'E', 'C' ) , GF_ISOM_BOX_TYPE_SENC = GF_4CC( 's', 'e', 'n', 'c') , GF_ISOM_BOX_TYPE_PSSH = GF_4CC( 'p', 's', 's', 'h') , GF_ISOM_ISMACRYP_SCHEME = GF_4CC( 'i', 'A', 'E', 'C' ) ,
  GF_ISOM_OMADRM_SCHEME = GF_4CC('o','d','k','m') , GF_ISOM_CENC_SCHEME = GF_4CC('c','e','n','c') , GF_ISOM_CBC_SCHEME = GF_4CC('c','b','c','1') , GF_ISOM_ADOBE_SCHEME = GF_4CC('a','d','k','m') ,
  GF_ISOM_CENS_SCHEME = GF_4CC('c','e','n','s') , GF_ISOM_CBCS_SCHEME = GF_4CC('c','b','c','s') , GF_ISOM_PIFF_SCHEME = GF_4CC('p','i','f','f') , GF_ISOM_SVE1_SCHEME = GF_4CC('s','v','e','1')
}
 
enum  GF_ISOISMACrypFlags { GF_ISOM_ISMA_USE_SEL_ENC = 1 , GF_ISOM_ISMA_IS_ENCRYPTED = 2 }
 

Functions

Bool gf_isom_is_track_encrypted (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_ISMASamplegf_isom_ismacryp_new_sample ()
 
void gf_isom_ismacryp_delete_sample (GF_ISMASample *samp)
 
GF_ISMASamplegf_isom_ismacryp_sample_from_data (u8 *data, u32 dataLength, Bool use_selective_encryption, u8 KI_length, u8 IV_length)
 
GF_ISMASamplegf_isom_get_ismacryp_sample (GF_ISOFile *isom_file, u32 trackNumber, const GF_ISOSample *samp, u32 sampleDescriptionIndex)
 
u32 gf_isom_is_media_encrypted (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
Bool gf_isom_is_ismacryp_media (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
Bool gf_isom_is_omadrm_media (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_omadrm_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion, const char **outContentID, const char **outRightsIssuerURL, const char **outTextualHeaders, u32 *outTextualHeadersLen, u64 *outPlaintextLength, u32 *outEncryptionType, Bool *outSelectiveEncryption, u32 *outIVLength, u32 *outKeyIndicationLength)
 
GF_Err gf_isom_get_ismacryp_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion, const char **outSchemeURI, const char **outKMS_URI, Bool *outSelectiveEncryption, u32 *outIVLength, u32 *outKeyIndicationLength)
 
GF_Err gf_isom_get_original_format_type (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat)
 
GF_Err gf_isom_set_ismacryp_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 scheme_type, u32 scheme_version, char *scheme_uri, char *kms_URI, Bool selective_encryption, u32 KI_length, u32 IV_length)
 
GF_Err gf_isom_change_ismacryp_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, char *scheme_uri, char *kms_uri)
 
GF_Err gf_isom_set_oma_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, char *contentID, char *kms_URI, u32 encryption_type, u64 plainTextLength, char *textual_headers, u32 textual_headers_len, Bool selective_encryption, u32 KI_length, u32 IV_length)
 
GF_Err gf_isom_set_generic_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 scheme_type, u32 scheme_version, char *scheme_uri, char *kms_URI)
 
GF_Err gf_isom_cenc_allocate_storage (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_piff_allocate_storage (GF_ISOFile *isom_file, u32 trackNumber, u32 AlgorithmID, u8 IV_size, bin128 KID)
 
GF_Err gf_isom_track_cenc_add_sample_info (GF_ISOFile *isom_file, u32 trackNumber, u32 container_type, u8 *buf, u32 len, Bool use_subsamples, Bool use_saio_32bit, Bool is_multi_key)
 
GF_Err gf_isom_set_cenc_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 scheme_type, u32 scheme_version, u32 default_IsEncrypted, u32 default_crypt_byte_block, u32 default_skip_byte_block, u8 *key_info, u32 key_info_size)
 
GF_Err gf_isom_set_cenc_protection_mkey (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 scheme_type, u32 scheme_version, u32 default_IsEncrypted, u32 default_crypt_byte_block, u32 default_skip_byte_block, u8 *key_info, u32 key_info_size)
 
GF_Err gf_cenc_set_pssh (GF_ISOFile *isom_file, bin128 systemID, u32 version, u32 KID_count, bin128 *KID, u8 *data, u32 len, u32 pssh_mode)
 
GF_Err gf_isom_remove_samp_enc_box (GF_ISOFile *isom_file, u32 trackNumber)
 
GF_Err gf_isom_remove_samp_group_box (GF_ISOFile *isom_file, u32 trackNumber)
 
Bool gf_isom_is_adobe_protection_media (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_adobe_protection_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion, const char **outMetadata)
 
GF_Err gf_isom_set_adobe_protection (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 scheme_type, u32 scheme_version, Bool is_selective_enc, char *metadata, u32 len)
 
Bool gf_isom_is_cenc_media (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex)
 
GF_Err gf_isom_get_cenc_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *outOriginalFormat, u32 *outSchemeType, u32 *outSchemeVersion)
 
GF_Err gf_isom_cenc_get_sample_aux_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, u32 sampleDescIndex, u32 *container_type, u8 **out_buffer, u32 *outSize)
 
GF_Err gf_isom_cenc_get_default_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleDescriptionIndex, u32 *container_type, Bool *default_IsEncrypted, u32 *crypt_byte_block, u32 *skip_byte_block, const u8 **key_info, u32 *key_info_size)
 
u32 gf_isom_get_pssh_count (GF_ISOFile *isom_file)
 
GF_Err gf_isom_get_pssh_info (GF_ISOFile *isom_file, u32 pssh_index, bin128 SystemID, u32 *version, u32 *KID_count, const bin128 **KIDs, const u8 **private_data, u32 *private_data_size)
 
GF_Err gf_isom_dump_ismacryp_protection (GF_ISOFile *isom_file, u32 trackNumber, FILE *trace)
 
GF_Err gf_isom_dump_ismacryp_sample (GF_ISOFile *isom_file, u32 trackNumber, u32 SampleNum, FILE *trace)
 
GF_Err gf_isom_get_sample_cenc_info (GF_ISOFile *isom_file, u32 trackNumber, u32 sampleNumber, Bool *IsEncrypted, u32 *crypt_byte_block, u32 *skip_byte_block, const u8 **key_info, u32 *key_info_size)
 

Detailed Description


Data Structure Documentation

◆ GF_ISMASample

struct GF_ISMASample

ISMA sample

Data Fields
u64 IV

IV in ISMACryp is Byte Stream Offset

u8 IV_length

IV size in bytes, repeated from sampleDesc for convenience

u8 * key_indicator

key indicator

u8 KI_length

key indicator size, repeated from sampleDesc for convenience

u32 dataLength

payload size

u8 * data

payload

u32 flags

flags

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

DRM related code points

Enumerator
GF_ISOM_BOX_UUID_PSEC 

Storage location of CENC sample auxiliary in PSEC UUID box

GF_ISOM_BOX_TYPE_SENC 

Storage location of CENC sample auxiliary in senc box

GF_ISOM_BOX_TYPE_PSSH 

PSSH box type

GF_ISOM_ISMACRYP_SCHEME 

ISMA Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_OMADRM_SCHEME 

OMA DRM Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_CENC_SCHEME 

CENC AES-CTR Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_CBC_SCHEME 

CENC AES-CBC Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_ADOBE_SCHEME 

Adobe Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_CENS_SCHEME 

CENC AES-CTR Pattern Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_CBCS_SCHEME 

CENC AES-CBC Pattern Encryption Scheme Type in the SchemeTypeInfoBox

GF_ISOM_PIFF_SCHEME 

PIFF Scheme Type in the SchemeTypeInfoBox

GF_ISOM_SVE1_SCHEME 

CENC sensitive encryption

◆ GF_ISOISMACrypFlags

flags for GF_ISMASample

Enumerator
GF_ISOM_ISMA_USE_SEL_ENC 

signals the stream the sample belongs to uses selective encryption

GF_ISOM_ISMA_IS_ENCRYPTED 

signals the sample is encrypted

Function Documentation

◆ gf_isom_is_track_encrypted()

Bool gf_isom_is_track_encrypted ( GF_ISOFile isom_file,
u32  trackNumber 
)

checks if a track is encrypted or protected

Parameters
isom_filethe target ISO file
trackNumberthe target track
Returns
GF_TRUE if track is protected, GF_FALSE otherwise

◆ gf_isom_ismacryp_new_sample()

GF_ISMASample* gf_isom_ismacryp_new_sample ( )

creates a new empty ISMA sample

Returns
a new empty ISMA sample

◆ gf_isom_ismacryp_delete_sample()

void gf_isom_ismacryp_delete_sample ( GF_ISMASample samp)

delete an ISMA sample.

Note
the buffer content will be destroyed by default. If you wish to keep the buffer, set dataLength to 0 in the sample before deleting it
Parameters
sampthe target ISMA sample

◆ gf_isom_ismacryp_sample_from_data()

GF_ISMASample* gf_isom_ismacryp_sample_from_data ( u8 data,
u32  dataLength,
Bool  use_selective_encryption,
u8  KI_length,
u8  IV_length 
)

decodes ISMACryp sample based on all info in ISMACryp sample description

Parameters
datasample data
dataLengthsample data size in bytes
use_selective_encryptionset to GF_TRUE if sample uses selective encryption
KI_lengthset to the size in bytes of the key indicator - 0 means no key roll
IV_lengthset to the size in bytes of the initialization vector
Returns
a newly allocated ISMA sample with the parsed data

◆ gf_isom_get_ismacryp_sample()

GF_ISMASample* gf_isom_get_ismacryp_sample ( GF_ISOFile isom_file,
u32  trackNumber,
const GF_ISOSample samp,
u32  sampleDescriptionIndex 
)

decodes ISMACryp sample based on sample and its descrition index

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampthe sample to decode
sampleDescriptionIndexthe sample description index of the sample to decode
Returns
the ISMA sample or NULL if not an ISMA sample or error

◆ gf_isom_is_media_encrypted()

u32 gf_isom_is_media_encrypted ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if sample description is protected or not

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index. If 0, checks all sample descriptions for protected ones
Returns
scheme protection 4CC or 0 if not protected

◆ gf_isom_is_ismacryp_media()

Bool gf_isom_is_ismacryp_media ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if sample description is protected with ISMACryp

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
Returns
GF_TRUE if ISMA protection is used

◆ gf_isom_is_omadrm_media()

Bool gf_isom_is_omadrm_media ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if sample description is protected with OMA DRM

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
Returns
GF_TRUE if OMA DRM protection is used

◆ gf_isom_get_omadrm_info()

GF_Err gf_isom_get_omadrm_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 outOriginalFormat,
u32 outSchemeType,
u32 outSchemeVersion,
const char **  outContentID,
const char **  outRightsIssuerURL,
const char **  outTextualHeaders,
u32 outTextualHeadersLen,
u64 outPlaintextLength,
u32 outEncryptionType,
Bool outSelectiveEncryption,
u32 outIVLength,
u32 outKeyIndicationLength 
)

gets OMA DRM configuration - all output parameters are optional and may be NULL

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
outOriginalFormatfour character code of the unprotected sample description
outSchemeTypeset to four character code of the protection scheme type
outSchemeVersionset to scheme protection version
outContentIDset to associated ID of content
outRightsIssuerURLset to the rights issuer (license server) URL
outTextualHeadersset to OMA textual headers
outTextualHeadersLenset to the size in bytes of OMA textual headers
outPlaintextLengthset to the size in bytes of clear data in file
outEncryptionTypeset to the OMA encryption type used
outSelectiveEncryptionset to GF_TRUE if sample description uses selective encryption
outIVLengthset to the size of the initialization vector
outKeyIndicationLengthset to the size of the key indicator
Returns
error if any

◆ gf_isom_get_ismacryp_info()

GF_Err gf_isom_get_ismacryp_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 outOriginalFormat,
u32 outSchemeType,
u32 outSchemeVersion,
const char **  outSchemeURI,
const char **  outKMS_URI,
Bool outSelectiveEncryption,
u32 outIVLength,
u32 outKeyIndicationLength 
)

retrieves ISMACryp info for the given track & SDI - all output parameters are optional - URIs SHALL NOT BE MODIFIED BY USER

Note
outSelectiveEncryption, outIVLength and outKeyIndicationLength are usually not needed to decode an ISMA sample when using gf_isom_get_ismacryp_sample
Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
outOriginalFormatset to orginal unprotected media format
outSchemeTypeset to 4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
outSchemeVersionset to version of protection scheme (1 in ISMACryp 1.0)
outSchemeURIset to URI location of scheme
outKMS_URIset to URI location of key management system - only valid with ISMACryp 1.0
outSelectiveEncryptionset to whether sample-based encryption is used in media - only valid with ISMACryp 1.0
outIVLengthset to length of Initial Vector - only valid with ISMACryp 1.0
outKeyIndicationLengthset to length of key indicator - only valid with ISMACryp 1.0
Returns
error if any

◆ gf_isom_get_original_format_type()

GF_Err gf_isom_get_original_format_type ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 outOriginalFormat 
)

gets original format four character code type of a protected media sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index. If 0, checks all sample descriptions for a protected one
outOriginalFormatset to orginal unprotected media format
Returns
error if any

◆ gf_isom_set_ismacryp_protection()

GF_Err gf_isom_set_ismacryp_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  scheme_type,
u32  scheme_version,
char *  scheme_uri,
char *  kms_URI,
Bool  selective_encryption,
u32  KI_length,
u32  IV_length 
)

creates ISMACryp protection info for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_type4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
scheme_versionversion of protection scheme (1 in ISMACryp 1.0)
scheme_uriURI location of scheme
kms_URIURI location of key management system - only valid with ISMACryp 1.0
selective_encryptionwhether sample-based encryption is used in media - only valid with ISMACryp 1.0
KI_lengthlength of key indicator - only valid with ISMACryp 1.0
IV_lengthlength of Initial Vector - only valid with ISMACryp 1.0
Returns
error if any

◆ gf_isom_change_ismacryp_protection()

GF_Err gf_isom_change_ismacryp_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
char *  scheme_uri,
char *  kms_uri 
)

changes scheme URI and/or KMS URI for crypted files. Other params cannot be changed once the media is crypted

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_urinew scheme URI, or NULL to keep previous
kms_urinew KMS URI, or NULL to keep previous
Returns
error if any

◆ gf_isom_set_oma_protection()

GF_Err gf_isom_set_oma_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
char *  contentID,
char *  kms_URI,
u32  encryption_type,
u64  plainTextLength,
char *  textual_headers,
u32  textual_headers_len,
Bool  selective_encryption,
u32  KI_length,
u32  IV_length 
)

creates OMA DRM protection for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
contentIDassociated ID of content
kms_URIthe rights issuer (license server) URL
encryption_typethe OMA encryption type used
plainTextLengththe size in bytes of clear data in file
textual_headersOMA textual headers
textual_headers_lenthe size in bytes of OMA textual headers
selective_encryptionGF_TRUE if sample description uses selective encryption
KI_lengththe size of the key indicator
IV_lengththe size of the initialization vector
Returns
error if any

◆ gf_isom_set_generic_protection()

GF_Err gf_isom_set_generic_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  scheme_type,
u32  scheme_version,
char *  scheme_uri,
char *  kms_URI 
)

creates a generic protection for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_type4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
scheme_versionversion of protection scheme (1 in ISMACryp 1.0)
scheme_uriURI location of scheme
kms_URIthe rights issuer (license server) URL
Returns
error if any

◆ gf_isom_cenc_allocate_storage()

GF_Err gf_isom_cenc_allocate_storage ( GF_ISOFile isom_file,
u32  trackNumber 
)

allocates storage for CENC side data in a senc box

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

◆ gf_isom_piff_allocate_storage()

GF_Err gf_isom_piff_allocate_storage ( GF_ISOFile isom_file,
u32  trackNumber,
u32  AlgorithmID,
u8  IV_size,
bin128  KID 
)

allocates storage for CENC side data in a PIFF senc UUID box

Parameters
isom_filethe target ISO file
trackNumberthe target track
AlgorithmIDalgorith ID, usually 0
IV_sizethe size of the init vector
KIDthe default Key ID
Returns
error if any

◆ gf_isom_track_cenc_add_sample_info()

GF_Err gf_isom_track_cenc_add_sample_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  container_type,
u8 buf,
u32  len,
Bool  use_subsamples,
Bool  use_saio_32bit,
Bool  is_multi_key 
)

adds cenc SAI for the last sample added to a track

Parameters
isom_filethe target ISO file
trackNumberthe target track
container_typethe code of the container (currently 'senc' for CENC or 'PSEC' for smooth)
bufthe SAI buffer
lenthe size of the SAI buffer. If buf is NULL or len is 0, this adds an unencrypted entry (not written to file)
use_subsamplesif GF_TRUE, the media format uses CENC subsamples
use_saio_32bitforces usage of 32-bit saio boxes
is_multi_keyindicates if multi key is in use (required to tag saio and saiz boxes)
Returns
error if any

◆ gf_isom_set_cenc_protection()

GF_Err gf_isom_set_cenc_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  scheme_type,
u32  scheme_version,
u32  default_IsEncrypted,
u32  default_crypt_byte_block,
u32  default_skip_byte_block,
u8 key_info,
u32  key_info_size 
)

creates CENC protection for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_type4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
scheme_versionversion of protection scheme (1 in ISMACryp 1.0)
default_IsEncrypteddefault isEncrypted flag
default_crypt_byte_blockdefault crypt block size for pattern encryption
default_skip_byte_blockdefault skip block size for pattern encryption
key_infokey descriptor formatted as a multi-key info (cf GF_PROP_PID_CENC_KEY)
key_info_sizekey descriptor size
Returns
error if any

◆ gf_isom_set_cenc_protection_mkey()

GF_Err gf_isom_set_cenc_protection_mkey ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  scheme_type,
u32  scheme_version,
u32  default_IsEncrypted,
u32  default_crypt_byte_block,
u32  default_skip_byte_block,
u8 key_info,
u32  key_info_size 
)

creates CENC protection for a multi-key sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_type4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
scheme_versionversion of protection scheme (1 in ISMACryp 1.0)
default_IsEncrypteddefault isEncrypted flag
default_crypt_byte_blockdefault crypt block size for pattern encryption
default_skip_byte_blockdefault skip block size for pattern encryption
key_infokey info (cf CENC and GF_PROP_PID_CENC_KEY)
key_info_sizekey info size
Returns
error if any

◆ gf_cenc_set_pssh()

GF_Err gf_cenc_set_pssh ( GF_ISOFile isom_file,
bin128  systemID,
u32  version,
u32  KID_count,
bin128 KID,
u8 data,
u32  len,
u32  pssh_mode 
)

adds PSSH info for a file, can be called several time per system ID

Parameters
isom_filethe target ISO file
systemIDthe ID of the protection system
versionthe version of the protection system
KID_countthe number of key IDs
KIDthe list of key IDs
dataopaque data for the protection system
lensize of the opaque data
pssh_mode0: regular PSSH in moov, 1: PIFF PSSH in moov, 2: regular PSSH in meta
Returns
error if any

◆ gf_isom_remove_samp_enc_box()

GF_Err gf_isom_remove_samp_enc_box ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes CENC senc box info

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

◆ gf_isom_remove_samp_group_box()

GF_Err gf_isom_remove_samp_group_box ( GF_ISOFile isom_file,
u32  trackNumber 
)

removes all CENC sample groups

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

◆ gf_isom_is_adobe_protection_media()

Bool gf_isom_is_adobe_protection_media ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks if sample description is protected with Adobe systems

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
Returns
GF_TRUE if ADOBE protection is used

◆ gf_isom_get_adobe_protection_info()

GF_Err gf_isom_get_adobe_protection_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 outOriginalFormat,
u32 outSchemeType,
u32 outSchemeVersion,
const char **  outMetadata 
)

gets adobe protection information for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
outOriginalFormatset to orginal unprotected media format
outSchemeTypeset to 4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
outSchemeVersionset to version of protection scheme (1 in ISMACryp 1.0)
outMetadataset to adobe metadata string
Returns
GF_TRUE if ADOBE protection is used

◆ gf_isom_set_adobe_protection()

GF_Err gf_isom_set_adobe_protection ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32  scheme_type,
u32  scheme_version,
Bool  is_selective_enc,
char *  metadata,
u32  len 
)

creates an adobe protection for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
scheme_type4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
scheme_versionversion of protection scheme (1 in ISMACryp 1.0)
is_selective_encindicates if selective encryption is used
metadatametadata information
lensize of metadata information in bytes
Returns
error if any

◆ gf_isom_is_cenc_media()

Bool gf_isom_is_cenc_media ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex 
)

checks of sample description is protected with CENC

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index. If 0, checks all sample descriptions for protected ones
Returns
GF_TRUE if sample protection is CENC

◆ gf_isom_get_cenc_info()

GF_Err gf_isom_get_cenc_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 outOriginalFormat,
u32 outSchemeType,
u32 outSchemeVersion 
)

gets CENC information of a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
outOriginalFormatset to orginal unprotected media format
outSchemeTypeset to 4CC of protection scheme (GF_ISOM_ISMACRYP_SCHEME = iAEC in ISMACryp 1.0)
outSchemeVersionset to version of protection scheme (1 in ISMACryp 1.0)
Returns
error if any

◆ gf_isom_cenc_get_sample_aux_info()

GF_Err gf_isom_cenc_get_sample_aux_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
u32  sampleDescIndex,
u32 container_type,
u8 **  out_buffer,
u32 outSize 
)

gets CENC auxiliary info of a sample as a buffer

Note
the serialized buffer format is exactly a CencSampleAuxiliaryDataFormat
Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample
sampleDescIndexthe sample description index
container_typeis type of box which contains the sample auxiliary information. Now we have two type: GF_ISOM_BOX_UUID_PSEC and GF_ISOM_BOX_TYPE_SENC
out_bufferset to a newly allocated buffer, or reallocated buffer if not NULL
outSizeset to the size of the serialized buffer. If an existing buffer was passed, the passed value shall be the allocated buffer size (the returned value is still the buffer size)
Returns
error if any

◆ gf_isom_cenc_get_default_info()

GF_Err gf_isom_cenc_get_default_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleDescriptionIndex,
u32 container_type,
Bool default_IsEncrypted,
u32 crypt_byte_block,
u32 skip_byte_block,
const u8 **  key_info,
u32 key_info_size 
)

gets CENC default info for a sample description

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleDescriptionIndexthe sample description index
container_typeset to the container type of SAI data
default_IsEncryptedset to default isEncrypted flag
crypt_byte_blockset to default crypt block size for pattern encryption
skip_byte_blockset to default skip block size for pattern encryption
key_infoset to multikey descriptor (cf CENC and GF_PROP_PID_CENC_KEY)
key_info_sizeset to multikey descriptor size
Returns
error if any

◆ gf_isom_get_pssh_count()

u32 gf_isom_get_pssh_count ( GF_ISOFile isom_file)

gets the number of PSSH defined

Parameters
isom_filethe target ISO file
Returns
number of PSSH defined

◆ gf_isom_get_pssh_info()

GF_Err gf_isom_get_pssh_info ( GF_ISOFile isom_file,
u32  pssh_index,
bin128  SystemID,
u32 version,
u32 KID_count,
const bin128 **  KIDs,
const u8 **  private_data,
u32 private_data_size 
)

gets PSS info

Parameters
isom_filethe target ISO file
pssh_index1-based index of PSSH to query, see gf_isom_get_pssh_count
SystemIDset to the protection system ID
versionset to the protection system version
KID_countset to the number of key IDs defined
KIDsarray of defined key IDs
private_dataset to a buffer containing system ID private data
private_data_sizeset to the size of the system ID private data
Returns
error if any

◆ gf_isom_dump_ismacryp_protection()

GF_Err gf_isom_dump_ismacryp_protection ( GF_ISOFile isom_file,
u32  trackNumber,
FILE *  trace 
)

dumps ismacrypt protection of sample descriptions to xml trace

Parameters
isom_filethe target ISO file
trackNumberthe target track
tracethe file object to dump to
Returns
error if any

◆ gf_isom_dump_ismacryp_sample()

GF_Err gf_isom_dump_ismacryp_sample ( GF_ISOFile isom_file,
u32  trackNumber,
u32  SampleNum,
FILE *  trace 
)

dumps ismacrypt sample to xml trace

Parameters
isom_filethe target ISO file
trackNumberthe target track
SampleNumthe target sample number
tracethe file object to dump to
Returns
error if any

◆ gf_isom_get_sample_cenc_info()

GF_Err gf_isom_get_sample_cenc_info ( GF_ISOFile isom_file,
u32  trackNumber,
u32  sampleNumber,
Bool IsEncrypted,
u32 crypt_byte_block,
u32 skip_byte_block,
const u8 **  key_info,
u32 key_info_size 
)

gets CENC configuration for a given sample

Parameters
isom_filethe target ISO file
trackNumberthe target track
sampleNumberthe target sample number
IsEncryptedset to GF_TRUE if the sample is encrypted, GF_FALSE otherwise (optional can be NULL)
crypt_byte_blockset to crypt block count for pattern encryption (optional can be NULL)
skip_byte_blockset to skip block count for pattern encryption (optional can be NULL)
key_infoset to key descriptor (cf GF_PROP_PID_CENC_KEY)
key_info_sizeset to key descriptor size
Returns
error if any