|
1 /* |
|
2 * Copyright (c) 2006 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: Implementation of drm media agent base class |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <caf/data.h> |
|
20 #include "mpxmedia.h" |
|
21 #include "mpxmediadrmdefs.h" |
|
22 #include "mpxdrmmediaagent.h" |
|
23 #include "mpxlog.h" |
|
24 |
|
25 // CONSTANTS |
|
26 |
|
27 // ---------------------------------------------------------------------------- |
|
28 // Closes and uninitializes the agent and cleans up member variables |
|
29 // ---------------------------------------------------------------------------- |
|
30 // |
|
31 void CMPXDrmMediaAgent::Close() |
|
32 { |
|
33 MPX_DEBUG1("CMPXDrmMediaAgent::Close() entering"); |
|
34 delete iMedia; |
|
35 iMedia = NULL; |
|
36 delete iData; |
|
37 iData = NULL; |
|
38 MPX_DEBUG1("CMPXDrmMediaAgent::Close() exiting"); |
|
39 } |
|
40 |
|
41 // ---------------------------------------------------------------------------- |
|
42 // Creates a new media object |
|
43 // ---------------------------------------------------------------------------- |
|
44 // |
|
45 void CMPXDrmMediaAgent::CreateMediaL() |
|
46 { |
|
47 MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() entering"); |
|
48 |
|
49 // Create media |
|
50 RArray<TInt> supportedIds; |
|
51 CleanupClosePushL( supportedIds ); |
|
52 supportedIds.AppendL(KMPXMediaIdDrm); |
|
53 iMedia = CMPXMedia::NewL( supportedIds.Array() ); |
|
54 CleanupStack::PopAndDestroy( &supportedIds ); |
|
55 |
|
56 MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() exiting"); |
|
57 } |
|
58 |
|
59 // ---------------------------------------------------------------------------- |
|
60 // Gets the protected attribute if not already obtained |
|
61 // ---------------------------------------------------------------------------- |
|
62 // |
|
63 void CMPXDrmMediaAgent::GetProtectedL() |
|
64 { |
|
65 MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() entering"); |
|
66 |
|
67 if ( !iMedia->IsSupported( KMPXMediaDrmProtected )) |
|
68 { |
|
69 TBool prot( EFalse ); |
|
70 User::LeaveIfError( iData->GetAttribute( EIsProtected, prot )); |
|
71 iMedia->SetTObjectValueL( KMPXMediaDrmProtected, |
|
72 prot ); |
|
73 MPX_DEBUG2("CMPXDrmMediaAgent::GetProtectedL() protected = %d", prot); |
|
74 } |
|
75 |
|
76 MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() exiting"); |
|
77 } |
|
78 |
|
79 |
|
80 // end of file |