#this is an example BT file for most supported IPMPX descriptors and data in MP4Box. 
#Some of the IPMPX_Data used will likely never be sent on the wire (only sent through tools) but 
#their coding is still supported
#for XMT syntax, do as usual in gpac: MP4Box -xmt file.bt
#As a general note, it is almost useless to try to use IPMPX without the spec :)
#Please be aware that the IPMPX data described in this file is useless in terms of protection & IPMPX usage in MPEG-4 content, it is
#just here for IPMPX encoding/decoding testing...

InitialObjectDescriptor {
 esDescr [
  ES_Descriptor {
  	ES_ID 1
   decConfigDescr DecoderConfigDescriptor {
    streamType 3
   }
  }
  ES_Descriptor {
  	ES_ID 2
   decConfigDescr DecoderConfigDescriptor {
    streamType 1
   }
  }
 ]
 ipmpDescr [
	IPMP_Descriptor {
		IPMP_DescriptorID	0xff
		IPMPS_Type		0xffff
		IPMP_DescriptorIDEx	69
		IPMP_ToolID		123
		controlPointCode	0x01 
		sequenceCode		0x00
	}
 ]
 toolListDescr IPMP_ToolListDescriptor {
	ipmpTool [
	 #GPAC DOES NOT support alternativeTools and ParametricDescription in IPMP_Tool yet !!
	 IPMP_Tool {
		IPMP_ToolID	128
		ToolURL "http://gpac.io/ipmp/tools/gpac_decrypt"
	 }
  ]
 }
}

OrderedGroup {
    children [
		Sound2D {
			source AudioSource {
				url "myfile.avi#audio"
			} 
		}
		Shape {
			geometry Bitmap {}
			appearance Appearance {
				texture MovieTexture {
					url "myfile.avi#video"
				}
			}
		}
	 ]
}

UPDATE IPMPDX [
	IPMP_Descriptor {
		IPMP_DescriptorID	0xff
		IPMPS_Type		0xffff
		IPMP_DescriptorIDEx	79
		IPMP_ToolID		123
		controlPointCode	0x01
		sequenceCode		0x00
		IPMPX_Data [
			IPMP_KeyData {
				#GPAC also accepts the syntax: keyBody "snclsdjlvksjdls" for IPMPX ByteArray in BT format. This is what will be used later on
				keyBody {
				  array  "keybody_bytearray"
				}
		    hasStartDTS		FALSE
		    hasStartPacketID  	FALSE
		    hasExpireDTS      	FALSE
		    hasExpirePacketID	FALSE
		    opaqueData "IPMPkey-opaquedata byte array"
      }
			IPMP_SecureContainer {
				encryptedData "the encrypted data"
				MAC "the mac data"
			}
			IPMP_InitAuthentication {
				Context 32
				AuthType 5
			}
			IPMP_MutualAuthentication {
				candidateAlgorithms [
					IPMP_AlgorithmDescriptor { regAlgoID 102 }
					IPMP_AlgorithmDescriptor { regAlgoID 103 }
				]
				AuthenticationData "dbs,qbdjsqbxkjqsl"
				
				trustData IPMP_TrustSecurityMetadata {
					trustedTools [
						IPMP_TrustedTool {
							toolID 1245
							trustSpecifications [
								IPMP_TrustSpecification {
									attackerProfile 98
									trustedDuration 123258
								}
							]
						}
					]
				}
				#the syntax here is a bit weird, the list of IPMPX_ByteArray is just the list of each array content. XMT syntax is cleaner
				certificates [
					"khdhskncksdnfk",
					"vghjxdbjzhfkjerunxinqms"
				]
				publicKey IPMP_KeyDescriptor {
					keyBody "key descriptor body data"
			  }
			  opaque "mutual authentication opaque data"
			  authCodes "mutual authentication codes"
			}
			IPMP_ToolParamCapabilitiesQuery {
				description IPMP_ParametricDescription {
					majorVersion 2
					minorVersion 1
					descriptionComment "This is a parametric description"
					descriptions [
						IPMP_ParametricDescriptionItem {
							class "encryption"
							subClass "DES"
							typeData "char"
							type "algo"
							addedData "fgsdjkjé"
						}
					]
				}
			}
			IPMP_ToolParamCapabilitiesResponse {
				capabilitiesSupported FALSE
			}
			IPMP_ConnectTool {
				toolDescriptor IPMP_Descriptor {
					IPMP_DescriptorID	0xff
					IPMPS_Type		0xffff
					IPMP_DescriptorIDEx	71
					IPMP_ToolID		122
					controlPointCode	0x01
					sequenceCode		0x00
				}
			}
			IPMP_DisconnectTool {
				IPMP_ToolContextID 325
			}
			IPMP_GetToolContext {
				scope 2
				IPMP_DescriptorIDEx 127
			}
			IPMP_GetToolContextResponse {
				OD_ID 10
				ESD_ID 5
				IPMP_ToolContextID 325
			}
			#eventType is a comma-separated list - this should not be needed for authoring, this msg is typically sent by loaded tools (runtime only)
			IPMP_AddToolNotificationListener {
				eventType "0,1,2"
				scope 2
			}
			#eventType is a comma-separated list - this should not be needed for authoring, this msg is typically sent by loaded tools (runtime only)
			IPMP_RemoveToolNotificationListener {
				eventType "0,1,2"
			}
			IPMP_NotifyToolEvent {
				OD_ID 10
				ESD_ID 5
				IPMP_ToolContextID 325
				eventType 2
			}
			IPMP_CanProcess {
			 canProcess TRUE
			}
			IPMP_RightsData {
				rightsInfo "rightsdataarray"
			}
			IPMP_OpaqueData {
				opaqueData "opaquedataarray"
			}
			IPMP_ToolAPI_Config {
				Instantiation_API_ID 10
				Messaging_API_ID 20
				opaqueData "APIopaquedata"
			}
			IPMP_AudioWatermarkingInit {
				inputFormat 0x01
				requiredOp	2
				nChannels 2
				bitPerSample 16
				frequency 44100
				wmPayload "gduhxwksjkeochxb"
			}
			IPMP_SendAudioWatermark {
				wm_status 0x01
				compression_status	2
				payload "gduhxwksjkeochxb"
				opaqueData "op_wm"
			}
       IPMP_SelectiveDecryptionInit {
				mediaTypeExtension 0
				mediaTypeIndication 0x40
				profileLevelIndication 0xF
				compliance 1
				SelectiveBuffers [
					IPMP_SelectiveBuffer {
						cipher_id 1233546
						mode 123
						blockSize 32
						keySize 32
					}
					IPMP_SelectiveBuffer {
						cipher_id 1233555
						StreamCipher "jqsyjnxsq,hdkq"
					}
				]
				SelectiveFields[
					IPMP_SelectiveField {
						field_id 12
						field_scope 3
						buf 1
						#mappingTable is a comma-separated list of u16 integers
						mappingTable "1,2,1,3,4,5"
						shuffleSpecificInfo "shuffle_BA"
					}
				]
       }
		]
	}
]

