mpx/commonframework/common/src/mpxdrmmediaagent.cpp
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 17 Dec 2009 08:55:47 +0200
changeset 0 a2952bb97e68
permissions -rw-r--r--
Revision: 200949 Kit: 200951

/*
* 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