OSDN Git Service

stop using trunk directory in rectool
[rec10/rec10-git.git] / tstools / DtsEdit / src / gpac / ismacryp.h
1 /*\r
2  *                      GPAC - Multimedia Framework C SDK\r
3  *\r
4  *                      Copyright (c) Jean Le Feuvre 2000-2005 \r
5  *                                      All rights reserved\r
6  *\r
7  *  This file is part of GPAC / Authoring Tools sub-project\r
8  *\r
9  *  GPAC is free software; you can redistribute it and/or modify\r
10  *  it under the terms of the GNU Lesser General Public License as published by\r
11  *  the Free Software Foundation; either version 2, or (at your option)\r
12  *  any later version.\r
13  *   \r
14  *  GPAC is distributed in the hope that it will be useful,\r
15  *  but WITHOUT ANY WARRANTY; without even the implied warranty of\r
16  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
17  *  GNU Lesser General Public License for more details.\r
18  *   \r
19  *  You should have received a copy of the GNU Lesser General Public\r
20  *  License along with this library; see the file COPYING.  If not, write to\r
21  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. \r
22  *\r
23  */\r
24 \r
25 #ifndef _GF_ISMACRYP_H_\r
26 #define _GF_ISMACRYP_H_\r
27 \r
28 \r
29 #ifdef __cplusplus\r
30 extern "C" {\r
31 #endif\r
32 \r
33 #include <gpac/isomedia.h>\r
34 \r
35 enum\r
36 {\r
37         /*no selective encryption*/\r
38         GF_ISMACRYP_SELENC_NONE = 0,\r
39         /*only encrypts RAP samples*/\r
40         GF_ISMACRYP_SELENC_RAP = 1,\r
41         /*only encrypts non-RAP samples*/\r
42         GF_ISMACRYP_SELENC_NON_RAP = 2,\r
43         /*selective encryption of random samples*/\r
44         GF_ISMACRYP_SELENC_RAND = 3,\r
45         /*selective encryption of a random sample in given range*/\r
46         GF_ISMACRYP_SELENC_RAND_RANGE = 4,\r
47         /*selective encryption of first sample in given range*/\r
48         GF_ISMACRYP_SELENC_RANGE = 5,\r
49         /*encryption of all samples but the preview range*/\r
50         GF_ISMACRYP_SELENC_PREVIEW = 6,\r
51 };\r
52 \r
53 typedef struct\r
54 {\r
55         /*0: ISMACryp - 1: OMA DRM*/\r
56         u32 enc_type;\r
57         u32 trackID;\r
58         unsigned char key[16];\r
59         unsigned char salt[16];\r
60 \r
61         /*the rest is only used for encryption*/\r
62         char KMS_URI[5000];\r
63         char Scheme_URI[5000];\r
64         /*selecive encryption type*/\r
65         u32 sel_enc_type;\r
66         u32 sel_enc_range;\r
67         /*IPMP signaling: 0: none, 1: IPMP, 2: IPMPX\r
68         when IPMP signaling is enabled, the OD stream will be updated with\r
69         IPMP Update commands*/\r
70         u32 ipmp_type;\r
71         /*if not set and IPMP enabled, defaults to TrackID*/\r
72         u32 ipmp_desc_id;\r
73 \r
74         /*OMA extensions*/\r
75         /*0: none, 1: AES CBC, 2: AES CTR*/\r
76         u8 encryption;\r
77         char TextualHeaders[5000];\r
78         u32 TextualHeadersLen;\r
79         char TransactionID[17];\r
80 \r
81 } GF_TrackCryptInfo;\r
82 \r
83 /*encrypts track - logs, progress: info callbacks, NULL for stdout*/\r
84 GF_Err gf_ismacryp_encrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u32 done, u32 total), void *cbk);\r
85 \r
86 /*decrypts track - logs, progress: info callbacks, NULL for stdout*/\r
87 GF_Err gf_ismacryp_decrypt_track(GF_ISOFile *mp4, GF_TrackCryptInfo *tci, void (*progress)(void *cbk, u32 done, u32 total), void *cbk);\r
88 \r
89 /*decrypt a file \r
90 @drm_file: location of DRM data (cf MP4Box doc).\r
91 @LogMsg: redirection for message or NULL for stdout\r
92 */\r
93 GF_Err gf_ismacryp_decrypt_file(GF_ISOFile *mp4file, const char *drm_file);\r
94 \r
95 /*Crypt a the file \r
96 @drm_file: location of DRM data.\r
97 @LogMsg: redirection for message or NULL for stdout\r
98 */\r
99 GF_Err gf_ismacryp_crypt_file(GF_ISOFile *mp4file, const char *drm_file);\r
100 \r
101 /*loads key and salt from a LOCAL gpac-DRM file (cf MP4Box doc)*/\r
102 GF_Err gf_ismacryp_gpac_get_info(u32 stream_id, char *drm_file, char *key, char *salt);\r
103 \r
104 /*loads key and salt for MPEG4IP protected files*/\r
105 Bool gf_ismacryp_mpeg4ip_get_info(char *kms_uri, char *key, char *salt);\r
106 \r
107 /*computes file hash. If file is ISO-based, computre hash according to OMA (P)DCF (without MutableDRMInformation box)*/\r
108 GF_Err gf_media_get_file_hash(const char *file, u8 hash[20]);\r
109 \r
110 #ifdef __cplusplus\r
111 }\r
112 #endif\r
113 \r
114 \r
115 #endif  /*_GF_ISMACRYP_H_*/\r
116 \r