mpx/commonframework/common/src/mpxdrmmediaagent.cpp
changeset 0 a2952bb97e68
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mpx/commonframework/common/src/mpxdrmmediaagent.cpp	Thu Dec 17 08:55:47 2009 +0200
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2006 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:  Implementation of drm media agent base class
+*
+*/
+
+
+#include <caf/data.h>
+#include "mpxmedia.h"
+#include "mpxmediadrmdefs.h"
+#include "mpxdrmmediaagent.h"
+#include "mpxlog.h"
+
+// CONSTANTS
+
+// ----------------------------------------------------------------------------
+// Closes and uninitializes the agent and cleans up member variables
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmMediaAgent::Close()
+    {
+    MPX_DEBUG1("CMPXDrmMediaAgent::Close() entering");
+    delete iMedia;
+    iMedia = NULL;
+    delete iData;
+    iData = NULL;
+    MPX_DEBUG1("CMPXDrmMediaAgent::Close() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Creates a new media object
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmMediaAgent::CreateMediaL()
+    {
+    MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() entering");
+
+    // Create media
+    RArray<TInt> supportedIds;
+    CleanupClosePushL( supportedIds );
+    supportedIds.AppendL(KMPXMediaIdDrm);
+    iMedia = CMPXMedia::NewL( supportedIds.Array() );
+    CleanupStack::PopAndDestroy( &supportedIds );
+    
+    MPX_DEBUG1("CMPXDrmMediaAgent::CreateMediaL() exiting");
+    }
+
+// ----------------------------------------------------------------------------
+// Gets the protected attribute if not already obtained
+// ----------------------------------------------------------------------------
+//
+void CMPXDrmMediaAgent::GetProtectedL()
+    {
+    MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() entering");
+    
+    if ( !iMedia->IsSupported( KMPXMediaDrmProtected ))
+        {
+        TBool prot( EFalse );
+        User::LeaveIfError( iData->GetAttribute( EIsProtected, prot ));
+        iMedia->SetTObjectValueL( KMPXMediaDrmProtected,
+                                  prot );
+        MPX_DEBUG2("CMPXDrmMediaAgent::GetProtectedL() protected = %d", prot);
+        }
+    
+    MPX_DEBUG1("CMPXDrmMediaAgent::GetProtectedL() exiting");
+    }
+
+
+// end of file