multimediacommscontroller/mmccvideosourcesink/inc/mccvideosourcekeyretriever.h
changeset 0 1bce908db942
equal deleted inserted replaced
-1:000000000000 0:1bce908db942
       
     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:    
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef MCCVIDEOSOURCEKEYRETRIEVER_H
       
    21 #define MCCVIDEOSOURCEKEYRETRIEVER_H
       
    22 
       
    23 // INCLUDES
       
    24 #include <e32base.h>
       
    25 #include <mmf/server/mmfdatasink.h>
       
    26 #include "mmccevents.h"
       
    27 #include "mcccamerahandler.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 class CMccVideoSourceImpl;
       
    31 class CMccPeriodicRunner;
       
    32 
       
    33 // CONSTANTS
       
    34 const TInt KMccKeyRetrieveGuardTimeoutMicrosecs = 10000000; // 10 secs
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * Class used to fecth encoder configuration information.
       
    40 * It wraps long taking asynchronous calls behind one sync function call.
       
    41 * Operation has guard timer if fetching takes too long.
       
    42 *
       
    43 */
       
    44 class CMccVideoSourceConfigKeyRetriever : 
       
    45     public CBase, public MDataSink, public MAsyncEventHandler
       
    46     {
       
    47 public:
       
    48 
       
    49     static CMccVideoSourceConfigKeyRetriever* NewLC( MMccCameraHandler& aCameraHandler );
       
    50     
       
    51     ~CMccVideoSourceConfigKeyRetriever();
       
    52     
       
    53     /**
       
    54     * Fetch config info. If operation takes too long, it is interrupted
       
    55     * and key retrieval fails
       
    56     */
       
    57     void RetrieveL( const TMccCodecInfo& aVideoCodec, TDes8& aConfigKey );
       
    58 
       
    59 public: // From MDataSink
       
    60 
       
    61     TFourCC SinkDataTypeCode( TMediaId aMediaId );   
       
    62      
       
    63     void EmptyBufferL( CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId aMediaId );
       
    64     
       
    65     void BufferFilledL( CMMFBuffer* aBuffer );
       
    66     
       
    67     TBool CanCreateSinkBuffer(); 
       
    68     
       
    69     CMMFBuffer* CreateSinkBufferL( TMediaId aMediaId, TBool &aReference );
       
    70     
       
    71     void ConstructSinkL( const TDesC8& aInitData );
       
    72         
       
    73 public: // From MAsyncEventHandler
       
    74 
       
    75     TInt SendEventToClient( const TMMFEvent& aEvent );
       
    76 
       
    77 private:
       
    78 
       
    79     void ConstructL();
       
    80 
       
    81     CMccVideoSourceConfigKeyRetriever( MMccCameraHandler& aCameraHandler );
       
    82     
       
    83     void HandleEventL( TMccEvent& aEvent );
       
    84     
       
    85     void HandleError();
       
    86     
       
    87     void StopWaiting();
       
    88     
       
    89     void StartGuardTimer();
       
    90     
       
    91     void StopGuardTimer();
       
    92     
       
    93     static TInt GuardTimerExpired( TAny* aObject );
       
    94     
       
    95 private:
       
    96 
       
    97     MMccCameraHandler& iCameraHandler;   
       
    98     
       
    99     CActiveSchedulerWait* iWait;   
       
   100     
       
   101     CMccVideoSourceImpl* iSource;
       
   102     
       
   103     CMMFDataBuffer* iBuffer;
       
   104     
       
   105     TBool iFailed;
       
   106     
       
   107     CMccPeriodicRunner* iGuardTimer;
       
   108     
       
   109     TInt iGuardTimerTimeout;
       
   110 
       
   111     #ifdef TEST_EUNIT
       
   112 		friend class UT_CMccVideoSourceImpl;
       
   113 		friend class UT_CMccVideoSourceKeyRetriever;	
       
   114     #endif
       
   115    		      
       
   116     };
       
   117     
       
   118 
       
   119 #endif 
       
   120 
       
   121 
       
   122 // End of file
       
   123