mmappfw_plat/mpx_playback_utility_api/tsrc/testvideoplaybackplugin/inc/testvideoplaybackplugin.h
branchRCL_3
changeset 63 91d5ad76f5c6
equal deleted inserted replaced
59:666f9a5a90a9 63:91d5ad76f5c6
       
     1 /*
       
     2 * Copyright (c) 2002 - 2007 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 testvideoplaybackplugin interface
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef _CTESTVIDEOPLAYBACKPLUGIN_H_
       
    19 #define _CTESTVIDEOPLAYBACKPLUGIN_H_
       
    20 
       
    21 //
       
    22 //  INCLUDES
       
    23 //
       
    24 #include <e32base.h>
       
    25 
       
    26 #include <mpxplaybackplugin.h>
       
    27 #include <mpxplaybackpluginversion2.h>
       
    28 #include <mpxplaybackengineobserver.h>
       
    29 #include <mpxvideoplaybackdefs.h>
       
    30 
       
    31 #include "mpxplaybackutilitytest.h"
       
    32 
       
    33 
       
    34 
       
    35 
       
    36 #include <e32svr.h>
       
    37 #include <stifparser.h>
       
    38 #include <stiftestinterface.h>
       
    39 
       
    40 #include <mpxmediageneraldefs.h>
       
    41 #include <mpxcommandgeneraldefs.h>
       
    42 #include <mmf/common/mmferrors.h>
       
    43 #include <mpxplaybackpluginversion2.h>
       
    44 #include <mpxmessagegeneraldefs.h>
       
    45 
       
    46 #include <accpolnamevaluerecord.h>
       
    47 #include <accconfigfileparser.h>
       
    48 #include <acccongenericid.h>
       
    49 #include <accpolnamevaluerecord.h>
       
    50 
       
    51 #include <mpxvideoplaybackdefs.h>
       
    52 #include "mpxmediavideodefs.h"
       
    53 
       
    54 typedef struct
       
    55 {
       
    56     TInt               iEvent;
       
    57     TInt               iData;
       
    58     TInt               iError;
       
    59 } TTestVideoPlaybackCallbackEvent;
       
    60 
       
    61 typedef CArrayPtrFlat<TTestVideoPlaybackCallbackEvent> CCallbackArray;
       
    62 
       
    63 //
       
    64 //  CLASS DECLARATION
       
    65 //
       
    66 
       
    67 /*
       
    68  *  CTestVideoPlaybackPlugin class
       
    69  *
       
    70  */
       
    71 
       
    72 NONSHARABLE_CLASS( CTestVideoPlaybackPlugin ) : public CMPXPlaybackPluginVersion2
       
    73                                                 
       
    74 {
       
    75     public:
       
    76         //
       
    77         //  Constructors and destructor
       
    78         //
       
    79 
       
    80         /*
       
    81          *  Two-phased constructor.
       
    82          *  @param aInitParams, initialization parameter
       
    83          *  @return a pointer to the created instance
       
    84          */
       
    85         static CTestVideoPlaybackPlugin* NewL(TAny* aInitParams);
       
    86 
       
    87         /*
       
    88          *  Destructor
       
    89          *  Destroy the object and release all memory objects
       
    90          */
       
    91         ~CTestVideoPlaybackPlugin();
       
    92         
       
    93         /*
       
    94          *  Returns the current file handle iFile
       
    95          */        
       
    96         RFile GetFileHandle();
       
    97 
       
    98         /**
       
    99         * Initializes a file for playback.
       
   100         *
       
   101         * @since S60 9.2
       
   102         * @param aUri URI of the item
       
   103         * @param aType the mime type of the item
       
   104         * @param aAccessPoint the access point
       
   105         */
       
   106         void InitStreamingL(const TDesC& aUri, const TDesC8& aType, TInt aAccessPoint, TInt aPosition);
       
   107 
       
   108         /**
       
   109         * Initializes a file handle for playback.
       
   110         *
       
   111         * @since S60 9.2
       
   112         * @param aFile file handle of a file
       
   113         * @param aAccessPoint the access point
       
   114         */
       
   115         void InitStreamingL(RFile& aFile, TInt aAccessPoint, TInt aPosition);
       
   116                   
       
   117 #ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   118     /**
       
   119     * Initializes a file handle for playback.
       
   120     *
       
   121     * @since S60 9.2
       
   122     * @param aFile 64 bit file handle of a file
       
   123     * @param aAccessPoint the access point
       
   124     */
       
   125     void InitStreaming64L(RFile64& aFile, TInt aAccessPoint, TInt aPosition);
       
   126 
       
   127     /**
       
   128     * Initializes a song for playback.
       
   129     *
       
   130     * @since S60 9.2
       
   131     * @param aFile 64 bit file handle of a song
       
   132     */
       
   133     void Initialise64L(RFile64& aFile, TInt aPosition);
       
   134 #endif // SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
       
   135 
       
   136     /**
       
   137     * Initializes a song for playback.
       
   138     *
       
   139     * @since S60 9.2
       
   140     * @param aSong the song path
       
   141     * @param aPosition the starting position
       
   142     */
       
   143     virtual void InitialiseWithPositionL(const TDesC& aSong, TInt aPosition = 0 );
       
   144     
       
   145     /**
       
   146     * Initializes a song for playback.
       
   147     *
       
   148     * @since S60 9.2
       
   149     * @param aFile file handle of a song
       
   150     * @param aPosition the starting position
       
   151     */
       
   152     virtual void InitialiseWithPositionL(RFile& aSong, TInt aPosition = 0);
       
   153     
       
   154     //runl for active object
       
   155     void RunL();
       
   156     
       
   157     void DoCancel();
       
   158     
       
   159     private:
       
   160         //
       
   161         //  CMPXPlaybackPlugin Implementation
       
   162         //
       
   163 
       
   164         /*
       
   165          *  Set observer
       
   166          *
       
   167          *  @param aObs observer
       
   168          */
       
   169         void SetObserver( MMPXPlaybackPluginObserver& aObs );
       
   170 
       
   171         /*
       
   172          *  Initializes a clip for playback
       
   173          *  @param aSong the song path
       
   174          */
       
   175         void InitialiseL( const TDesC& aSong );
       
   176 
       
   177         /*
       
   178          *  Initializes a song for playback
       
   179          *  @param aFile file handle of a song
       
   180          */
       
   181         void InitialiseL( RFile& aFile );
       
   182 
       
   183         /*
       
   184          *  Executes a command on the selected song
       
   185          * @param aCmd a command
       
   186          * @param aData, data
       
   187          */
       
   188         void CommandL( CMPXCommand& aCmd );  
       
   189         
       
   190         // Supposedly being deprecated
       
   191         // We're forced to implement this as its declared as a 
       
   192         // pure virtual function by the MPX framework        
       
   193         void CommandL(TMPXPlaybackCommand aCmd, TInt aData=0);
       
   194         
       
   195         /*
       
   196          *  Sets a property of the plugin
       
   197          *  @param aProperty a property
       
   198          *  @param aValue the value of the setting
       
   199          */
       
   200         void SetL( TMPXPlaybackProperty aProperty , TInt aValue );
       
   201 
       
   202         /*
       
   203          *  Gets a property of the plugin (async)
       
   204          *  @param aProperty a property
       
   205          */
       
   206         void PropertyL( TMPXPlaybackProperty aProperty ) const;
       
   207 
       
   208         /*
       
   209          *  Gets a list of sub players
       
   210          *  @return a list of names of sub players
       
   211          */
       
   212         void SubPlayerNamesL();
       
   213 
       
   214         /*
       
   215          *  Select a sub player
       
   216          *  @param aIndex index to the sub player
       
   217          */
       
   218         void SelectSubPlayerL( TInt aIndex );
       
   219 
       
   220         /*
       
   221          *  Returns current sub player name
       
   222          *  @return friendly name of the current the sub player
       
   223          */
       
   224         const TDesC& SubPlayerName();
       
   225 
       
   226         /*
       
   227          *  Current sub player index
       
   228          *  @return index to the sub player
       
   229          */
       
   230         TInt SubPlayerIndex() const;
       
   231 
       
   232         /*
       
   233          *  Media properties of the current file (async)
       
   234          *  @param aAttrs attributes requested
       
   235          */
       
   236         void MediaL( const TArray<TMPXAttribute>& aAttrs );
       
   237 
       
   238         /*
       
   239          * Cancel async request
       
   240          */
       
   241         void CancelRequest();                          
       
   242 
       
   243     private:
       
   244         /*
       
   245          *  C++ default constructor
       
   246          */
       
   247         CTestVideoPlaybackPlugin();
       
   248 
       
   249         /*
       
   250          *  the second phase constructor ConstructL to safely construct things
       
   251          *  that can leave
       
   252          */
       
   253         void ConstructL();
       
   254         
       
   255         void AddCallbackEvent( TTestVideoPlaybackCallbackEvent* event );
       
   256         static TInt SendEvent( TAny* aPtr );        
       
   257         void DoSendEvent();
       
   258 
       
   259     private:
       
   260 
       
   261         HBufC*                        iClipName;
       
   262         RFs                           iFs;
       
   263         RFile                         iFile; 
       
   264         CIdle*                        iCallback; //active object
       
   265         CCallbackArray*               iEventArray;
       
   266 };
       
   267 
       
   268 #endif