|
1 /* |
|
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: This class handles the DRM functions for the playback plugin |
|
15 * |
|
16 */ |
|
17 |
|
18 // Version : %version: 5 % |
|
19 |
|
20 |
|
21 #include "mpxvideodrmhelper.h" |
|
22 #include "mpxvideo_debug.h" |
|
23 |
|
24 _LIT( KDrmRightsFile, "c:\\vhpp_drmrights.txt" ); |
|
25 |
|
26 CMpxVideoDrmHelper::CMpxVideoDrmHelper() |
|
27 { |
|
28 } |
|
29 |
|
30 CMpxVideoDrmHelper::~CMpxVideoDrmHelper() |
|
31 { |
|
32 } |
|
33 |
|
34 |
|
35 CMpxVideoDrmHelper* CMpxVideoDrmHelper::NewL() |
|
36 { |
|
37 CMpxVideoDrmHelper* self = new( ELeave ) CMpxVideoDrmHelper(); |
|
38 CleanupStack::PushL( self ); |
|
39 self->ConstructL(); |
|
40 CleanupStack::Pop(); |
|
41 return self; |
|
42 } |
|
43 |
|
44 void CMpxVideoDrmHelper::ConstructL() |
|
45 { |
|
46 } |
|
47 |
|
48 // ------------------------------------------------------------------------------------------------ |
|
49 // CMpxVideoDrmHelper::IsProtected() |
|
50 // ------------------------------------------------------------------------------------------------ |
|
51 // |
|
52 TBool CMpxVideoDrmHelper::IsProtected( RFile& aFile ) |
|
53 { |
|
54 TBool drmProtected = EFalse; |
|
55 |
|
56 RFs fs; |
|
57 RFile file; |
|
58 |
|
59 fs.Connect(); |
|
60 |
|
61 TInt openError = file.Open( fs, KDrmRightsFile, EFileRead | EFileShareAny ); |
|
62 |
|
63 if ( openError == KErrNone ) |
|
64 { |
|
65 drmProtected = ETrue; |
|
66 file.Close(); |
|
67 } |
|
68 |
|
69 fs.Close(); |
|
70 |
|
71 return drmProtected; |
|
72 } |
|
73 |
|
74 // ------------------------------------------------------------------------------------------------ |
|
75 // CMpxVideoDrmHelper::GetDrmRightsStatus() |
|
76 // ------------------------------------------------------------------------------------------------ |
|
77 // |
|
78 TInt CMpxVideoDrmHelper::GetDrmRightsStatus( RFile& aFile ) |
|
79 { |
|
80 MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus()")); |
|
81 |
|
82 TInt drmError = KErrNone; |
|
83 |
|
84 MPX_DEBUG(_L("CMpxVideoDrmHelper::GetDrmRightsStatus() drmError = %d"), drmError); |
|
85 |
|
86 RFs fs; |
|
87 RFile file; |
|
88 |
|
89 fs.Connect(); |
|
90 |
|
91 TInt openError = file.Open( fs, KDrmRightsFile, EFileRead | EFileShareAny ); |
|
92 |
|
93 if ( openError == KErrNone ) |
|
94 { |
|
95 HBufC8* fBuf = HBufC8::NewL( 16 ); |
|
96 TPtr8 fileBuf = fBuf->Des(); |
|
97 |
|
98 file.Read( fileBuf, 16 ); |
|
99 |
|
100 TLex8 number( fileBuf ); |
|
101 number.Val( drmError ); |
|
102 |
|
103 file.Close(); |
|
104 } |
|
105 |
|
106 fs.Close(); |
|
107 |
|
108 return drmError; |
|
109 } |
|
110 |
|
111 TBool CMpxVideoDrmHelper::IsTvOutAllowedL( RFile& aFile ) |
|
112 { |
|
113 TBool tvOutAllowed = ETrue; |
|
114 |
|
115 return tvOutAllowed; |
|
116 } |
|
117 |
|
118 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
119 |
|
120 // ------------------------------------------------------------------------------------------------ |
|
121 // CMpxVideoDrmHelper::IsProtected64() |
|
122 // ------------------------------------------------------------------------------------------------ |
|
123 // |
|
124 TBool CMpxVideoDrmHelper::IsProtected64( RFile64& aFile ) |
|
125 { |
|
126 TBool drmProtected = EFalse; |
|
127 |
|
128 RFs fs; |
|
129 RFile64 file; |
|
130 |
|
131 fs.Connect(); |
|
132 |
|
133 TInt openError = file.Open( fs, KDrmRightsFile, EFileRead | EFileShareAny ); |
|
134 |
|
135 if ( openError == KErrNone ) |
|
136 { |
|
137 drmProtected = ETrue; |
|
138 file.Close(); |
|
139 } |
|
140 |
|
141 fs.Close(); |
|
142 |
|
143 return drmProtected; |
|
144 } |
|
145 |
|
146 // ------------------------------------------------------------------------------------------------ |
|
147 // CMpxVideoDrmHelper::GetDrmRightsStatus64() |
|
148 // ------------------------------------------------------------------------------------------------ |
|
149 // |
|
150 TInt CMpxVideoDrmHelper::GetDrmRightsStatus64( RFile64& aFile ) |
|
151 { |
|
152 MPX_ENTER_EXIT(_L("CMpxVideoDrmHelper::GetDrmRightsStatus()")); |
|
153 |
|
154 TInt drmError = KErrNone; |
|
155 |
|
156 MPX_DEBUG(_L("CMpxVideoDrmHelper::GetDrmRightsStatus() drmError = %d"), drmError); |
|
157 |
|
158 RFs fs; |
|
159 RFile64 file; |
|
160 |
|
161 fs.Connect(); |
|
162 |
|
163 TInt openError = file.Open( fs, KDrmRightsFile, EFileRead | EFileShareAny ); |
|
164 |
|
165 if ( openError == KErrNone ) |
|
166 { |
|
167 HBufC8* fBuf = HBufC8::NewL( 16 ); |
|
168 TPtr8 fileBuf = fBuf->Des(); |
|
169 |
|
170 file.Read( fileBuf, 16 ); |
|
171 |
|
172 TLex8 number( fileBuf ); |
|
173 number.Val( drmError ); |
|
174 |
|
175 file.Close(); |
|
176 } |
|
177 |
|
178 fs.Close(); |
|
179 |
|
180 return drmError; |
|
181 } |
|
182 |
|
183 // ------------------------------------------------------------------------------------------------ |
|
184 // CMpxVideoDrmHelper::IsTvOutAllowed64L() |
|
185 // ------------------------------------------------------------------------------------------------ |
|
186 // |
|
187 TBool CMpxVideoDrmHelper::IsTvOutAllowed64L( RFile64& aFile ) |
|
188 { |
|
189 TBool tvOutAllowed = ETrue; |
|
190 |
|
191 return tvOutAllowed; |
|
192 } |
|
193 |
|
194 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
195 |
|
196 // EOF |