• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* ------------------------------------------------------------------
2  * Copyright (C) 1998-2009 PacketVideo
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
13  * express or implied.
14  * See the License for the specific language governing permissions
15  * and limitations under the License.
16  * -------------------------------------------------------------------
17  */
18 #ifndef PVMF_CPMPLUGIN_ACCESS_INTERFACE_H_INCLUDED
19 #define PVMF_CPMPLUGIN_ACCESS_INTERFACE_H_INCLUDED
20 
21 #ifndef OSCL_BASE_H_INCLUDED
22 #include "oscl_base.h"
23 #endif
24 #ifndef OSCL_TYPES_H_INCLUDED
25 #include "oscl_types.h"
26 #endif
27 #ifndef PV_UUID_H_INCLUDED
28 #include "pv_uuid.h"
29 #endif
30 #ifndef PV_INTERFACE_H_INCLUDED
31 #include "pv_interface.h"
32 #endif
33 #ifndef OSCL_FILE_IO_H_INCLUDED
34 #include "oscl_file_io.h"
35 #endif
36 #ifndef PVMF_RETURN_CODES_H_INCLUDED
37 #include "pvmf_return_codes.h"
38 #endif
39 #ifndef PVMI_DATA_STREAM_INTERFACE_H_INCLUDED
40 #include "pvmi_data_stream_interface.h"
41 #endif
42 
43 #define PVMF_CPMPLUGIN_ACCESS_INTERFACE_MIMETYPE "pvxxx/pvmf/cpm/plugin/access_interface"
44 #define PVMFCPMPluginAccessInterfaceUuid PVUuid(0xc5f05532,0x7bcb,0x4186,0x85,0xa6,0xfa,0x9e,0x42,0x2d,0xb7,0x6d)
45 
46 /**
47  * Base Content Access Interface for all Content Policy Manager Plugins
48  */
49 class PVMFCPMPluginAccessInterface : public PVInterface
50 {
51     public:
52         virtual void Init(void) = 0;
53         virtual void Reset(void) = 0;
54 };
55 
56 #define PVMF_CPMPLUGIN_DECRYPTION_INTERFACE_MIMETYPE "pvxxx/pvmf/cpm/plugin/remote_sync_access_interface"
57 #define PVMFCPMPluginDecryptionInterfaceUuid PVUuid(0x1e14b2fe,0x947b,0x49c8,0x8b,0x11,0xe9,0xec,0x4c,0x11,0xa2,0x8f)
58 
59 /**
60  * Access Unit Decryption Interface for Content Policy Manager Plugins
61  */
62 class PVMFCPMPluginAccessUnitDecryptionInterface : public PVMFCPMPluginAccessInterface
63 {
64     public:
65         /**
66          * DecryptAccessUnit operation
67          * Decrypts input buffer of size 'aInputSizeInBytes'
68          *
69          * @param aInputBuffer pointer to input buffer containing
70          *                     encrypted data of type uint8*
71          *
72          * @param aInputBufferSizeInBytes  input buffer size in bytes,
73          *
74          * @param aOutputBuffer pointer to output buffer containing
75          *                      decrypted data of type uint8*,
76             *                      memory for the buffer allocated by the caller
77          *
78          * @param aOutputBufferSizeInBytes   size of allocated output buffer
79          *                                   in bytes
80          *
81          * @return returns true on successful decryption, false otherwise
82          */
83         virtual bool DecryptAccessUnit(uint8*& aInputBuffer,
84                                        uint32  aInputBufferSizeInBytes,
85                                        uint8*& aOutputBuffer,
86                                        uint32& aOutputBufferSizeInBytes,
87                                        uint32  aTrackID = 0,
88                                        uint32  aAccesUnitTimeStamp = 0) = 0;
89         virtual int32 GetDecryptError() = 0;
90 
91         /**
92         * For in-place decryption
93         */
94         virtual bool CanDecryptInPlace() = 0;
95         virtual bool DecryptAccessUnit(uint8*& aInputBuffer,
96                                        uint32  aInputBufferSizeInBytes,
97                                        uint32  aTrackID = 0,
98                                        uint32  aAccesUnitTimeStamp = 0) = 0;
99 
100         /**
101         * Optional version of DecryptAccessUnit with a decrypt context
102         */
103         virtual bool DecryptAccessUnit(uint8*& aInputBuffer,
104                                        uint32  aInputBufferSizeInBytes,
105                                        uint32  aTrackID ,
106                                        uint32  aAccesUnitTimeStamp,
107                                        PVInterface* aContext = NULL)
108         {
109             OSCL_UNUSED_ARG(aInputBuffer);
110             OSCL_UNUSED_ARG(aInputBufferSizeInBytes);
111             OSCL_UNUSED_ARG(aTrackID);
112             OSCL_UNUSED_ARG(aAccesUnitTimeStamp);
113             OSCL_UNUSED_ARG(aContext);
114             return false;
115         }
116 
117 };
118 
119 
120 #endif //PVMF_CPMPLUGIN_ACCESS_INTERFACE_H_INCLUDED
121 
122