1 /*
2  *			GPAC - Multimedia Framework C SDK
3  *
4  *			Authors: Jean Le Feuvre
5  *			Copyright (c) Telecom ParisTech 2000-2012
6  *					All rights reserved
7  *
8  *  This file is part of GPAC / modules interfaces
9  *
10  *  GPAC is free software; you can redistribute it and/or modify
11  *  it under the terms of the GNU Lesser General Public License as published by
12  *  the Free Software Foundation; either version 2, or (at your option)
13  *  any later version.
14  *
15  *  GPAC is distributed in the hope that it will be useful,
16  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  *  GNU Lesser General Public License for more details.
19  *
20  *  You should have received a copy of the GNU Lesser General Public
21  *  License along with this library; see the file COPYING.  If not, write to
22  *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
23  *
24  */
25 
26 
27 #ifndef _GF_MODULE_IPMP_H_
28 #define _GF_MODULE_IPMP_H_
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #include <gpac/module.h>
35 
36 /*
37 	NOTE ON IPMP TOOLS
38 
39   The current implementation is very basic and does not follow MPEG-4 IPMPX architecture
40   This is just a place holder for ISMA/OMA-like schemes
41   Currently all operations are synchronous...
42 */
43 
44 enum
45 {
46 	/*push some configuration data to the IPMP tool*/
47 	GF_IPMP_TOOL_SETUP,
48 	/*request access to the object (eg, PLAY)*/
49 	GF_IPMP_TOOL_GRANT_ACCESS,
50 	/*release access to the object (eg, STOP)*/
51 	GF_IPMP_TOOL_RELEASE_ACCESS,
52 	/*push some configuration data to the IPMP tool*/
53 	GF_IPMP_TOOL_PROCESS_DATA,
54 };
55 
56 typedef struct
57 {
58 	u32 scheme_version;
59 	u32 scheme_type;
60 	const char *scheme_uri;
61 	const char *kms_uri;
62 } GF_ISMACrypConfig;
63 
64 typedef struct
65 {
66 	u32 scheme_version;
67 	u32 scheme_type;
68 	u32 PSSH_count;
69 	GF_NetComDRMConfigPSSH *PSSHs;
70 } GF_CENCConfig;
71 
72 typedef struct
73 {
74 	u32 scheme_version;
75 	u32 scheme_type;
76 	const char *scheme_uri;
77 	const char *kms_uri;
78 	/*SHA-1 hash*/
79 	u8 hash[20];
80 
81 	const char *contentID;
82 	u32 oma_drm_crypt_type;
83 	Bool oma_drm_use_pad, oma_drm_use_hdr;
84 	const char *oma_drm_textual_headers;
85 	u32 oma_drm_textual_headers_len;
86 } GF_OMADRM2Config;
87 
88 /*IPMP events*/
89 typedef struct
90 {
91 	/*event type*/
92 	u32 event_type;
93 
94 	/*gpac's channel triggering this event, NULL if unknown/unspecified*/
95 	struct _es_channel *channel;
96 
97 	/*identifier of the config data (GF_IPMP_TOOL_SETUP)*/
98 	u32 config_data_code;
99 	/*config data (GF_IPMP_TOOL_SETUP). Type depends on the config_data_code*/
100 	void *config_data;
101 
102 	Bool restart_requested;
103 
104 	/*data manipulation (GF_IPMP_TOOL_PROCESS_DATA) - data is always processed in-place in a
105 	synchronous way*/
106 	char *data;
107 	u32 data_size;
108 	u32 out_data_size;
109 	/*indicates if payload passed is encrypted or not - this is used by ISMA, OMA and 3GP*/
110 	Bool is_encrypted;
111 	/*ISMA payload resync indicator*/
112 	u64 isma_BSO;
113 	/*CENC sample auxiliary information*/
114 	char *sai;
115 	u8 IV_size;
116 	u32 saiz;
117 	//for CENC pattern encryption mode
118 	u8 crypt_byte_block, skip_byte_block;
119 	u8 constant_IV_size;
120 	bin128 constant_IV;
121 } GF_IPMPEvent;
122 
123 /*interface name and version for IPMP tools*/
124 #define GF_IPMP_TOOL_INTERFACE		GF_4CC('G','I','P', '1')
125 
126 typedef struct _ipmp_tool GF_IPMPTool;
127 
128 struct _ipmp_tool
129 {
130 	/* interface declaration*/
131 	GF_DECL_MODULE_INTERFACE
132 
133 	/*process an ipmp event*/
134 	GF_Err (*process)(GF_IPMPTool *dr, GF_IPMPEvent *evt);
135 	/*tool private*/
136 	void *udta;
137 
138 };
139 
140 
141 #ifdef __cplusplus
142 }
143 #endif
144 
145 
146 #endif	/*#define _GF_MODULE_IPMP_H_
147 */
148 
149