mmappfw_plat/mpx_common_api/inc/mpxdrmmediautility.h
changeset 0 a2952bb97e68
equal deleted inserted replaced
-1:000000000000 0:a2952bb97e68
       
     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:  Encapsulates DRM Media
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef CMPXDRMMEDIAUTILITY_H
       
    21 #define CMPXDRMMEDIAUTILITY_H
       
    22 
       
    23 #include <e32def.h>
       
    24 #include <e32std.h>
       
    25 #include <f32file.h>
       
    26 #include <caf/content.h>
       
    27 using namespace ContentAccess;
       
    28 
       
    29 // CONSTANTS
       
    30 _LIT( KMPXWDRMCafAgentName, "PV WMA CAF Agent" );
       
    31 _LIT( KMPXOMACafAgentName, "OMA DRM Agent" );
       
    32 _LIT( KMPXS60WMDRMCafAgent, "WM DRM Agent");
       
    33 
       
    34 enum TDrmConsumeType
       
    35     {
       
    36     EMPXDrmConsumeNone,
       
    37     EMPXDrmConsumeStart,
       
    38     EMPXDrmConsumePause,
       
    39     EMPXDrmConsumeContinue,
       
    40     EMPXDrmConsumeFinish,
       
    41     EMPXDrmConsumeStartOrContinue
       
    42     };
       
    43 
       
    44 // FORWARD DECLARATION
       
    45 class CMPXMedia;
       
    46 class CMPXDrmMediaAgent;
       
    47 
       
    48 
       
    49 /**
       
    50 * CMPXDrmMediaUtility class declaration.
       
    51 * 
       
    52 * @lib mpxcommon.lib
       
    53 */
       
    54 NONSHARABLE_CLASS(CMPXDrmMediaUtility) : public CBase
       
    55     {
       
    56 private:
       
    57     enum TMPXDrmMediaAgents
       
    58         {
       
    59         EOmaDrmAgent,
       
    60         EWmaDrmAgent
       
    61         };
       
    62 
       
    63 public:     // Constructors and Destructors
       
    64     /**
       
    65     *  Two-phase constructor.
       
    66     *
       
    67     *  @since S60 3.2.3
       
    68     *  @return object created
       
    69     */
       
    70     IMPORT_C static CMPXDrmMediaUtility* NewL();
       
    71 
       
    72     /**
       
    73     *  Two-phase constructor.
       
    74     *
       
    75     *  @since S60 3.2.3
       
    76     *  @return object created
       
    77     */
       
    78     IMPORT_C static CMPXDrmMediaUtility* NewLC();
       
    79 
       
    80     /**
       
    81     *  Destructor.
       
    82     *
       
    83     *  @since S60 3.2.3
       
    84     */
       
    85     IMPORT_C virtual ~CMPXDrmMediaUtility();
       
    86     
       
    87 public:     // New Functions
       
    88     /**
       
    89     *  Initialize utility using a filename.
       
    90     *
       
    91     *  @since S60 3.2.3
       
    92     *  @param aFileName file name
       
    93     */
       
    94     IMPORT_C void InitL(const TDesC& aFileName);
       
    95 
       
    96     /**
       
    97     *  Initialize utility using a file handle.
       
    98     *
       
    99     *  @since S60 3.2.3
       
   100     *  @param aFile file handle
       
   101     */
       
   102     IMPORT_C void InitL(RFile& aFile);
       
   103     
       
   104     /**
       
   105     *  Gets media object with the given attributes.
       
   106     *
       
   107     *  @since S60 3.2.3
       
   108     *  @param aAttributes attributes to retreive
       
   109     *  @return CMPXMedia object with the specified attributes
       
   110     *          NULL if the utility has not been initialized with a DRM file
       
   111     */
       
   112     IMPORT_C const CMPXMedia* GetMediaL(TUint aAttributes);
       
   113     
       
   114     /**
       
   115     *  Consumes the rights for the current media according
       
   116     *  to the specified consume type.
       
   117     *
       
   118     *  @since S60 3.2.3
       
   119     *  @param aType Type of consumption to execute
       
   120     */
       
   121     IMPORT_C void ConsumeL(TDrmConsumeType aType);
       
   122     
       
   123     /**
       
   124     * Closes and unitializes the utility.
       
   125     *
       
   126     * @since S60 3.2.3
       
   127     * @return void
       
   128     */
       
   129     IMPORT_C void Close();
       
   130     
       
   131 private:    // Constructors
       
   132     /**
       
   133     *  C++ default constructor.
       
   134     *
       
   135     *  @since S60 3.2.3
       
   136     */
       
   137     CMPXDrmMediaUtility();
       
   138     
       
   139     /**
       
   140     * 2nd phase contructor.
       
   141     *
       
   142     * @since S60 3.2.3
       
   143     */
       
   144     void ConstructL();
       
   145     
       
   146 private:    // New Functions
       
   147     /**
       
   148     * Finds an agent to handle the content.
       
   149     * 
       
   150     * @since S60 3.2.3
       
   151     * @param aContent content to find agent for
       
   152     */
       
   153     void FindAgent( CContent& aContent );
       
   154 
       
   155 private:  // New Functions
       
   156 
       
   157 private:  // Data
       
   158     // Array of drm agents to use
       
   159     RPointerArray<CMPXDrmMediaAgent> iAgents;
       
   160     CMPXDrmMediaAgent* iCurrentAgent;
       
   161     TBool iConsumeStarted;
       
   162     CMPXMedia* iDefaultMedia;
       
   163     RFs iFs;
       
   164     };
       
   165 
       
   166 #endif // CMPXDRMMEDIAUTILITY_H