|
1 /* |
|
2 * Copyright (c) 2004 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 the License "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: DRM helper for Media files.* |
|
15 */ |
|
16 |
|
17 |
|
18 |
|
19 #ifndef MEDIAPLAYERDRMHELPER_H |
|
20 #define MEDIAPLAYERDRMHELPER_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32std.h> |
|
24 #include <MPFileDetails.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CDRMHelper; |
|
28 class CDRMHelperRightsConstraints; |
|
29 class MDesCArray; |
|
30 class CCoeEnv; |
|
31 class CMPFileDetails; |
|
32 namespace DRM |
|
33 { |
|
34 class CDrmUtility; |
|
35 class CDrmUiHandling; |
|
36 } |
|
37 |
|
38 // CONSTANTS |
|
39 const TInt KMediaPlayerRightsAboutToExpire = -40000; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * DRM helper for Media files. |
|
45 * |
|
46 * @lib MPFileDetailsDialog.lib |
|
47 * @since 3.2 |
|
48 */ |
|
49 NONSHARABLE_CLASS( CMediaPlayerDrmHelper ) : public CBase |
|
50 { |
|
51 public: // Constructors and destructor |
|
52 |
|
53 /** |
|
54 * Two-phased constructor called by CMPVideoPlayerUIController class |
|
55 * @param aDrmHelper Pointer to CDRMHelper class. Ownership is not transferred. |
|
56 */ |
|
57 static CMediaPlayerDrmHelper* NewL(CDRMHelper* aDrmHelper, CMPVideoPlayerUIController* aUIController); |
|
58 |
|
59 /** |
|
60 * Two-phased constructor called by CMPFileDetailsDialog class or MediaPlayerUtility class |
|
61 * @param aDrmHelper Pointer to CDRMHelper class. Ownership is not transferred. |
|
62 */ |
|
63 static CMediaPlayerDrmHelper* NewL(CDRMHelper* aDrmHelper ); |
|
64 |
|
65 /** |
|
66 * Destructor. |
|
67 */ |
|
68 virtual ~CMediaPlayerDrmHelper(); |
|
69 |
|
70 public: // New functions |
|
71 |
|
72 /** |
|
73 * Loads usage rights information for a particular media file using |
|
74 * CDRMHelper. The loaded constraint is DRMCommon::EPlay. |
|
75 * @since 3.2 |
|
76 * @param aFileName File path, which usage rights info is loaded. |
|
77 */ |
|
78 void LoadDrmUsageRightsInfoL(const TDesC& aFileName); |
|
79 |
|
80 /** |
|
81 * Loads usage rights information for a particular media file using |
|
82 * CDRMHelper. The loaded constraint is DRMCommon::EPlay. |
|
83 * @since 3.2 |
|
84 * @param aFile File handle, which usage rights info is loaded. |
|
85 */ |
|
86 void LoadDrmUsageRightsInfoL( |
|
87 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
88 RFile64& aFile); |
|
89 #else |
|
90 RFile& aFile); |
|
91 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
92 |
|
93 /** |
|
94 * Gets usage rigths status. |
|
95 * @since 3.2 |
|
96 * @param aStatus: |
|
97 * EMediaPlayerDrmFull: Full rights |
|
98 * EMediaPlayerDrmMissing: Rights missing |
|
99 * EMediaPlayerDrmRestricted: Restricted rights |
|
100 * EMediaPlayerDrmExpired: Expired rights (could be also future rights) |
|
101 * EMediaPlayerDrmPreview: Preview rights |
|
102 */ |
|
103 void GetDrmUsageRightsStatus(TMediaPlayerRightsStatus& aStatus); |
|
104 |
|
105 /** |
|
106 * Gets start time of time based rights. |
|
107 * @since 3.2 |
|
108 * @param aStartTime Start time. |
|
109 * @return Error code: |
|
110 * KErrNone: Start time returned. |
|
111 * KErrNotFound: Object doesn't have time based rights. |
|
112 * KErrNotReady: Usage rights info not loaded. |
|
113 */ |
|
114 TInt GetDrmStartTime(TTime& aStartTime); |
|
115 |
|
116 /** |
|
117 * Get pointer to DRMHelper object (as given in constructor). |
|
118 * @since 3.2 |
|
119 * @return Pointer to DRMHelper. Ownership not transferred. |
|
120 */ |
|
121 CDRMHelper* DrmHelper(); |
|
122 |
|
123 /** |
|
124 * Creates a file handle to the file passed in the aName parameter. |
|
125 * @param aHandle Handle to a file |
|
126 * @param aName Name of the file |
|
127 * @param aFileMode Mode to open file handle in |
|
128 */ |
|
129 static void CreateFileHandleLC( |
|
130 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
131 RFile64& aHandle, |
|
132 #else |
|
133 RFile& aHandle, |
|
134 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API |
|
135 const TDesC& aName, |
|
136 TUint aFileMode); |
|
137 |
|
138 private: // Private contructors |
|
139 |
|
140 /** |
|
141 * C++ default constructor. |
|
142 */ |
|
143 CMediaPlayerDrmHelper(CDRMHelper* aDrmHelper, CMPVideoPlayerUIController* aUIController); |
|
144 |
|
145 /** |
|
146 * C++ default constructor. |
|
147 */ |
|
148 CMediaPlayerDrmHelper(CDRMHelper* aDrmHelper ); |
|
149 |
|
150 /** |
|
151 * By default Symbian 2nd phase constructor is private. |
|
152 */ |
|
153 void ConstructL(); |
|
154 |
|
155 private: // Data |
|
156 |
|
157 CDRMHelper* iDrmHelper; |
|
158 HBufC* iFileName; |
|
159 CDRMHelperRightsConstraints* iRightsConstraints; |
|
160 CCoeEnv* iEnv; |
|
161 DRM::CDrmUtility* iDrmUtility; // not owned |
|
162 DRM::CDrmUiHandling* iDrmUiHandling; |
|
163 TBool iOMAProtected; // ETrue if protected content is OMA, EFalse if it is WMDRM |
|
164 |
|
165 TBool iProtected; |
|
166 TBool iExpired; |
|
167 TBool iDrmSendingAllowed; |
|
168 HBufC8* iInfoUrl; |
|
169 HBufC8* iPreviewUri; |
|
170 }; |
|
171 |
|
172 #endif // MEDIAPLAYERDRMHELPER_H |
|
173 |
|
174 // End of File |