mmfenh/enhancedmediaclient/Client/src/Components/StreamControl/ClientStreamControl.h
changeset 0 71ca22bcf22a
child 6 e35735ece90c
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     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:  Definition of the ClientStreamControl class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 // ClientStreamControl.h
       
    20 
       
    21 #ifndef CSTREAMCONTROL_H
       
    22 #define CSTREAMCONTROL_H
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <StreamControl.h>
       
    26 #include <mcustominterface.h>
       
    27 #include <mmf/common/mmfcontroller.h>
       
    28 #include "ClientUtility.h"
       
    29 #include <Events.h>
       
    30 #include <StreamControlCustomCommands.h>
       
    31 #include <StreamControlObserver.h>
       
    32 #include "EffectControlBase.h"
       
    33 
       
    34 //class CMMFFindAndOpenController;
       
    35 //class CMMFControllerEventMonitor;
       
    36 
       
    37 namespace multimedia
       
    38     {
       
    39     class MSinkControl;
       
    40     class CEventNotifier;
       
    41     class CEventBase;
       
    42     class CMCustomCommand;
       
    43     
       
    44     class CStreamControl : public CBase,
       
    45         public MStreamControl,
       
    46         public MMMFControllerEventMonitorObserver,
       
    47         public MMMFFindAndOpenControllerObserver
       
    48         {
       
    49         public:
       
    50             CStreamControl();
       
    51             ~CStreamControl();
       
    52             TInt PostConstructor();
       
    53             // From MControl begins
       
    54             TInt AddObserver( MControlObserver& aObserver );
       
    55             TInt RemoveObserver( MControlObserver& aObserver );
       
    56             TUid Type();
       
    57             TControlType ControlType();
       
    58             
       
    59             // From MControl ends
       
    60             
       
    61             
       
    62             // From MStreamControl begins
       
    63             // Config msgs
       
    64             TInt AddSource( MSourceControl& aSource );
       
    65             TInt RemoveSource( MSourceControl& aSource );
       
    66             TInt AddSink( MSinkControl& aSink );
       
    67             TInt RemoveSink( MSinkControl& aSink );
       
    68             TInt AddEffect( MEffectControl& aEffect );
       
    69             TInt RemoveEffect( MEffectControl& aEffect );
       
    70             TInt SetPosition( TInt64& aPos );
       
    71             TInt SetPriority( TInt aPriority, TInt aPreference );
       
    72             
       
    73             // Query msgs
       
    74             TInt GetDuration( TInt64& aDuration );
       
    75             TInt GetPosition( TInt64& aPos);
       
    76             TInt GetSeekingSupport( TBool& aFlag );
       
    77             TInt GetRandomSeekingSupport( TBool& aFlag );
       
    78             TStreamState GetState();
       
    79             TAny* CustomInterface( TUid aCIUid );
       
    80 
       
    81             // Control msg
       
    82             TInt Open();
       
    83             TInt Prime();
       
    84             TInt Start();
       
    85             TInt Pause();
       
    86             TInt Stop();
       
    87             TInt Close();
       
    88             // From MStreamControl ends
       
    89             
       
    90             // From MMMFControllerEventMonitorObserver
       
    91             void HandleEvent( const TMMFEvent& aEvent );
       
    92             
       
    93             // From MMMFFindAndOpenControllerObserver
       
    94             void MfaocComplete( TInt& aError,
       
    95                 RMMFController* aController,
       
    96                 TUid aControllerUid,
       
    97                 TMMFMessageDestination* aSourceHandle,
       
    98                 TMMFMessageDestination* aSinkHandle);
       
    99             
       
   100             
       
   101         private:
       
   102             enum TStreamControlState
       
   103                 {
       
   104                     EStreamClosed,
       
   105                     EStreamOpened,
       
   106                     EStreamOpening,
       
   107                     EStreamPrimed,
       
   108                     EStreamPriming,
       
   109                     EStreamPlaying,
       
   110                     EStreamStartingPlaying,
       
   111                     EStreamBuffering,
       
   112                     EStreamPaused,
       
   113                     EStreamPausing
       
   114                 };
       
   115             
       
   116         private:
       
   117             void ConfigureControllerLoader(
       
   118                 TUid aMediaType,
       
   119                 CMMFFindAndOpenController::TControllerMode aMode);
       
   120             
       
   121             TInt LaunchController();
       
   122             
       
   123             void SetStreamState( TStreamControlState aState, TInt aReason );
       
   124             
       
   125             void SendEventToClient( TUint aEvent, CEventBase* aEventObject );
       
   126         	void SendEventToEffectControls(  TUint aEvent, CEventBase* aEventObject );
       
   127             
       
   128         private:
       
   129             CEventNotifier* iEventNotifier;
       
   130             TStreamControlState iStreamState;
       
   131             MSourceControl* iSourceControl;
       
   132             MSinkControl* iSinkControl;
       
   133             RMMFController iController;
       
   134             TBool iControllerLoaded;
       
   135             TUid iControllerUid;
       
   136             CMMFFindAndOpenController* iFindAndOpenController;
       
   137             CMMFControllerEventMonitor* iControllerEventMonitor;
       
   138             TMMFPrioritySettings iPrioritySettings;
       
   139             TTimeIntervalMicroSeconds iPosition;
       
   140             CMCustomCommand* iCMCustomCommand;
       
   141             RStreamControlCustomCommands iStreamControlCustomCommands;
       
   142             TStreamState iState;
       
   143             TBool iPrimeController;
       
   144         	CEventNotifier* iEventNotifierForEffects;
       
   145         	RPointerArray<CEffectControlBase> iAssociatedEffects;
       
   146         	TInt iError;
       
   147         };
       
   148     } // namespace multimedia
       
   149     
       
   150 #endif // CSTREAMCONTROL_H
       
   151     
       
   152     // End of file