--- /dev/null
+/*\r
+ * GPAC - Multimedia Framework C SDK\r
+ *\r
+ * Copyright (c) Jean Le Feuvre 2000-2005 \r
+ * All rights reserved\r
+ *\r
+ * This file is part of GPAC / Authoring Tools sub-project\r
+ *\r
+ * GPAC is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU Lesser General Public License as published by\r
+ * the Free Software Foundation; either version 2, or (at your option)\r
+ * any later version.\r
+ * \r
+ * GPAC is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\r
+ * GNU Lesser General Public License for more details.\r
+ * \r
+ * You should have received a copy of the GNU Lesser General Public\r
+ * License along with this library; see the file COPYING. If not, write to\r
+ * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
+ *\r
+ */\r
+\r
+#ifndef _GF_ISMACRYP_H_\r
+#define _GF_ISMACRYP_H_\r
+\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+#include <gpac/isomedia.h>\r
+\r
+enum\r
+{\r
+ /*no selective encryption*/\r
+ GF_ISMACRYP_SELENC_NONE = 0,\r
+ /*only encrypts RAP samples*/\r
+ GF_ISMACRYP_SELENC_RAP = 1,\r
+ /*only encrypts non-RAP samples*/\r
+ GF_ISMACRYP_SELENC_NON_RAP = 2,\r
+ /*selective encryption of random samples*/\r
+ GF_ISMACRYP_SELENC_RAND = 3,\r
+ /*selective encryption of a random sample in given range*/\r
+ GF_ISMACRYP_SELENC_RAND_RANGE = 4,\r
+ /*selective encryption of first sample in given range*/\r
+ GF_ISMACRYP_SELENC_RANGE = 5,\r
+ /*encryption of all samples but the preview range*/\r
+ GF_ISMACRYP_SELENC_PREVIEW = 6,\r
+};\r
+\r
+typedef struct\r
+{\r
+ /*0: ISMACryp - 1: OMA DRM*/\r
+ u32 enc_type;\r
+ u32 trackID;\r
+ unsigned char key[16];\r
+ unsigned char salt[16];\r
+\r
+ /*the rest is only used for encryption*/\r
+ char KMS_URI[5000];\r
+ char Scheme_URI[5000];\r
+ /*selecive encryption type*/\r
+ u32 sel_enc_type;\r
+ u32 sel_enc_range;\r
+ /*IPMP signaling: 0: none, 1: IPMP, 2: IPMPX\r
+ when IPMP signaling is enabled, the OD stream will be updated with\r
+ IPMP Update commands*/\r
+ u32 ipmp_type;\r
+ /*if not set and IPMP enabled, defaults to TrackID*/\r
+ u32 ipmp_desc_id;\r
+\r
+ /*OMA extensions*/\r
+ /*0: none, 1: AES CBC, 2: AES CTR*/\r
+ u8 encryption;\r
+ char TextualHeaders[5000];\r
+ u32 TextualHeadersLen;\r
+ char TransactionID[17];\r
+\r
+} GF_TrackCryptInfo;\r
+\r
+/*encrypts track - logs, progress: info callbacks, NULL for stdout*/\r
+GF_Err gf_ismacryp_encrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u32 done, u32 total), void *cbk);\r
+\r
+/*decrypts track - logs, progress: info callbacks, NULL for stdout*/\r
+GF_Err gf_ismacryp_decrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u32 done, u32 total), void *cbk);\r
+\r
+/*decrypt a file \r
+@drm_file: location of DRM data (cf MP4Box doc).\r
+@LogMsg: redirection for message or NULL for stdout\r
+*/\r
+GF_Err gf_ismacryp_decrypt_file(GF_ISOFile *mp4file, const char *drm_file);\r
+\r
+/*Crypt a the file \r
+@drm_file: location of DRM data.\r
+@LogMsg: redirection for message or NULL for stdout\r
+*/\r
+GF_Err gf_ismacryp_crypt_file(GF_ISOFile *mp4file, const char *drm_file);\r
+\r
+/*loads key and salt from a LOCAL gpac-DRM file (cf MP4Box doc)*/\r
+GF_Err gf_ismacryp_gpac_get_info(u32 stream_id, char *drm_file, char *key, char *salt);\r
+\r
+/*loads key and salt for MPEG4IP protected files*/\r
+Bool gf_ismacryp_mpeg4ip_get_info(char *kms_uri, char *key, char *salt);\r
+\r
+/*computes file hash. If file is ISO-based, computre hash according to OMA (P)DCF (without MutableDRMInformation box)*/\r
+GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]);\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r
+\r
+#endif /*_GF_ISMACRYP_H_*/\r
+\r