mmfenh/enhancedmediaclient/Client/src/Components/ClientDataBufferSource/ClientDataBufferSource.h
changeset 0 71ca22bcf22a
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 ClientDataBufferSource class.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CCLIENTDATABUFFERSOURCE_H
       
    20 #define C_CCLIENTDATABUFFERSOURCE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <DataBufferSource.h>
       
    24 #include <DRMConfigTypes.h>
       
    25 #include <mmfcontrollerframework.h>
       
    26 
       
    27 #include "SourceBase.h"
       
    28 #include "DataBufferQueueItem.h"
       
    29 #include "BufTypeSupEventAO.h"
       
    30 #include "ParentChildIntfc.h"
       
    31 
       
    32 class MCustomCommand;
       
    33 
       
    34 namespace multimedia
       
    35     {
       
    36     
       
    37     class CEventNotifier;
       
    38     class MDataBuffer;
       
    39 
       
    40     /**
       
    41     *  Implements the ClientSide Source for the DBS.
       
    42     *  Provides functionality to the Clients to query attributes
       
    43     *  from the ServerSide source
       
    44     *  @lib EnhancedMediaClient.lib
       
    45     *  @since S60 v3.2
       
    46     */    
       
    47     class CClientDataBufferSource : public CSourceBase,
       
    48                                         public MDataBufferSource,
       
    49                                         public MBufferObserver,
       
    50                                         public MBufferingTypesSupportedObserver,
       
    51                                         public CParentIntfc
       
    52         {
       
    53         public:
       
    54             /**
       
    55             * Function to Create the Object.
       
    56             * @param aObserver Observer to callback the Event.
       
    57             */
       
    58             CClientDataBufferSource();
       
    59             
       
    60             /**
       
    61             * Destructor.
       
    62             */
       
    63             ~CClientDataBufferSource();
       
    64             
       
    65             /**
       
    66             * Post Contructor. This is to Support the new type of Construction
       
    67             * of the Object. Notice there is no Two phased Constructor in this class
       
    68             */
       
    69             TInt PostConstructor();
       
    70             
       
    71             // From MControl begins
       
    72             /**
       
    73             * From MControl.
       
    74             * Adds the Observer to this Object
       
    75             * @since S60 v3.2
       
    76             * @param aObserver Client which set the Observer.             
       
    77             */            
       
    78             TInt AddObserver( MControlObserver& aObserver );
       
    79             /**
       
    80             * From MControl.
       
    81             * Removes the Observer to this Object
       
    82             * @since S60 v3.2
       
    83             * @param aObserver Client which set the Observer.             
       
    84             */            
       
    85             TInt RemoveObserver( MControlObserver& aObserver );
       
    86             /**
       
    87             * From MControl.
       
    88             * Returns the Type of this Object.
       
    89             * request and that it is now outstanding 
       
    90             * @since S60 v3.2
       
    91             */            
       
    92             TUid Type();
       
    93             /**
       
    94             * From MControl.
       
    95             * Returns the Control Type of this Object.
       
    96             *
       
    97             * @since S60 v3.2
       
    98             */            
       
    99             TControlType ControlType();
       
   100             // From MControl ends
       
   101             
       
   102             // From MSourceControl begins
       
   103             /**
       
   104             * From MSourceControl.
       
   105             * Returns the Size in Bytes of the Source.
       
   106             * Since this is DBS, the size represents the Total 
       
   107             * data size  which will be passed by the Client to
       
   108             * the Source
       
   109             * @since S60 v3.2
       
   110             * @param aSize Size returned by the Source.             
       
   111             */            
       
   112             TInt GetSize( TUint& aSize );
       
   113             /**
       
   114             * From MSourceControl.
       
   115             * Returns the Mime Type of the Data for which
       
   116             * the Source is initialized.
       
   117             * @since S60 v3.2
       
   118             * @param aMimeType MimeType returned by the Source.             
       
   119             */            
       
   120             TInt GetMimeType( TDes8& aMimeType );
       
   121             /**
       
   122             * From MSourceControl.
       
   123             * Closes the Source.
       
   124             *
       
   125             * @since S60 v3.2
       
   126             */            
       
   127             TInt Close();
       
   128             // From MSourceControl ends
       
   129             
       
   130             // From MDataBufferSource begins
       
   131             /**
       
   132             * From MDataBufferSource.
       
   133             * Opens the Source with the mimetype and HeaderData
       
   134             *
       
   135             * @since S60 v3.2
       
   136             * @param aMimeType     MimeType used to Configure the Source.
       
   137             * @param aHeaderData   HeaderData to Configure the Source.
       
   138             */            
       
   139             TInt Open( TDesC8& aMimeType , MDataBuffer& aHeaderData );
       
   140             /**
       
   141             * From MDataBufferSource.
       
   142             * Returns the minimum buffersize the Source needs.
       
   143             *
       
   144             * @since S60 v3.2
       
   145             * @param aBufferSize   Returns the Minimum BufferSize the Source needs.             
       
   146             */            
       
   147             TInt GetMinimumBufferSize( TUint& aBufferSize );
       
   148             /**
       
   149             * From MDataBufferSource.
       
   150             * Sets the Size of the Data which the Client intends to send
       
   151             *
       
   152             * @since S60 v3.2
       
   153             * @param aBufferSize   Sets the Size of the Data which the Client 
       
   154                                 intends to Send to the Source             
       
   155             */            
       
   156             TInt SetSize( TUint aSize );
       
   157             /**
       
   158             * From MDataBufferSource.
       
   159             * Writes the Buffer to the ServerSide Source
       
   160             *
       
   161             * @since S60 v3.2
       
   162             * @param aBuffer   Buffer that needs to be passed to the ServerSide Source                          
       
   163             */            
       
   164             TInt WriteData( MDataBuffer& aBuffer );
       
   165             /**
       
   166             * From MDataBufferSource.
       
   167             * Tries to Empty the Buffers on the ServerSide Source
       
   168             *
       
   169             * @since S60 v3.2
       
   170             */            
       
   171             TInt EmptyBuffers();
       
   172             /**
       
   173             * From MDataBufferSource.
       
   174             * Returns the Buffering Configuration of the ServerSide Source
       
   175             *
       
   176             * @since S60 v3.2
       
   177             * @param aConfig   Returns the Buffering Configuration of the Source.
       
   178             */            
       
   179             TInt GetBufferingConfig(TBufferingConfig& aConfig);
       
   180             /**
       
   181             * From MDataBufferSource.
       
   182             * Sets the Buffering Configuration of the ServerSide Source
       
   183             *
       
   184             * @since S60 v3.2
       
   185             * @param aConfig   Sets the Buffering Configuration of the Source.
       
   186             */            
       
   187             TInt SetBufferingConfig(TBufferingConfig aConfig);
       
   188             /**
       
   189             * From MDataBufferSource.
       
   190             * Returns the BitRate of the Source
       
   191             * the Source is initialized.
       
   192             *
       
   193             * @since S60 v3.2
       
   194             * @param aRate   Returns the BitRate of the Source.             
       
   195             */            
       
   196             TInt GetBitRate(TUint& aRate);
       
   197             /**
       
   198             * From MDataBufferSource.
       
   199             * Returns the Mime Type of the Data for which
       
   200             * the Source is initialized.
       
   201             *
       
   202             * @since S60 v3.2
       
   203             * @param aArray   Returns an Array of Buffering Types Supported
       
   204                             by the Source
       
   205             */            
       
   206             TInt GetBufferingTypesSupported(TArray<TBufferingConfig::TBufferingType>& aArray);
       
   207             /**
       
   208             * From MDataBufferSource.
       
   209             * Returns the Interface for querying Output Restrictions
       
   210             *
       
   211             * @since S60 v3.2
       
   212             * @param aInterfaceId   Interfacae ID of the interface requested.             
       
   213             * @param aVer   Version of the Interface Requested.             
       
   214             * @param aInterfaceImpl   Implementation returned.             
       
   215             */            
       
   216             TInt GetInterface(
       
   217                     TUid aInterfaceId,
       
   218                     TVersion& aVer,
       
   219                     TAny*& aInterfaceImpl );
       
   220             // From MDataBufferSource ends
       
   221             
       
   222             // From CSourceBase begins
       
   223             /**
       
   224             * From CSourceBase.
       
   225             * Callback from the StreamControl when the Source is Created
       
   226             *
       
   227             * @since S60 v3.2
       
   228             * @param aCustomCommand    Custom Command handle to send message to the Source             
       
   229             * @param aSourceHandle     Handle Identifying the Source             
       
   230             */            
       
   231             void ServerSourceCreated( MCustomCommand& aCustomCommand,
       
   232                                     TMMFMessageDestination& aSourceHandle );
       
   233             /**
       
   234             * From CSourceBase.
       
   235             * Callback from the StreamControl when the ServerSource is Deleted
       
   236             *
       
   237             * @since S60 v3.2
       
   238             */            
       
   239             void ServerSourceDeleted();
       
   240             /**
       
   241             * From CSourceBase.
       
   242             * Returns the Content Protection information to the Stream Control
       
   243             * Currently returns KErrNotSupported 
       
   244             * @since S60 v3.2
       
   245             */            
       
   246             TBool IsEncrypted();
       
   247             /**
       
   248             * From CSourceBase.
       
   249             * Returns the SourceUID
       
   250             *
       
   251             * @since S60 v3.2
       
   252             */            
       
   253             TUid GetSourceUid();
       
   254             /**
       
   255             * From CSourceBase.
       
   256             * Returns the Header Data passed when the Client calls Open
       
   257             *  Currently return KErrNotSupported
       
   258             * @since S60 v3.2
       
   259             */            
       
   260             TInt GetHeaderData(TPtr& aPtr);
       
   261             // From CSourceBase ends
       
   262             
       
   263             // From MBufferObserver begins
       
   264             /**
       
   265             * From MBufferObserver.
       
   266             * Callback from the Source when the Buffer sent to the ServerSide
       
   267             * is processed
       
   268             * @since S60 v3.2
       
   269             * @param aItem item sent to the Server.             
       
   270             */            
       
   271             void BufferProcessed( CDataBufferQueueItem* aItem );
       
   272             void HandleCancel( CDataBufferQueueItem& aItem );
       
   273             // From MBufferObserver ends
       
   274             
       
   275             // From MBufferingTypesSupportedObserver begins
       
   276             /**
       
   277             * From MBufferingTypesSupportedObserver.
       
   278             * Callback from the Source when the Buffering Types Support changes
       
   279             * @since S60 v3.2
       
   280             * @param aItem item sent to the Server.             
       
   281             */            
       
   282             void BufferingTypesSupportedChanged();
       
   283             
       
   284             
       
   285             // DRM information
       
   286             /**
       
   287             * Sets the DRM Type of Data which will be sent
       
   288             * @since S60 v3.2
       
   289             * @param aDRMType DRM Type data sent.             
       
   290             */            
       
   291             TInt SetDRMType( TDRMType aDRMType );
       
   292             /**
       
   293             * Gets the DRM Type set by the Client before
       
   294             * @since S60 v3.2
       
   295             * @param aDRMType DRM Type set by the Client before.             
       
   296             */            
       
   297             TInt GetDRMType( TDRMType& aDRMType );
       
   298             /**
       
   299             * Appends the Output Device to the List
       
   300             * @since S60 v3.2
       
   301             * @param aOutputDevice Output Device to be added to the List             
       
   302             */            
       
   303             TInt AppendAllowedOutputDevice( TDRMAllowedOutputDevice aOutputDevice );
       
   304             /**
       
   305             * Removes the Output Device from the List
       
   306             * @since S60 v3.2
       
   307             * @param aOutputDevice Device to be removed from the List.             
       
   308             */            
       
   309             TInt RemoveAllowedOutputDevice( TDRMAllowedOutputDevice aOutputDevice );
       
   310             /**
       
   311             * Gets the Allowed Output Device Count
       
   312             * @since S60 v3.2
       
   313             * @param aCount OutputDevice Count             
       
   314             */            
       
   315             TInt GetAllowedOutputDeviceCount( TInt& aCount );
       
   316             /**
       
   317             * Gets the Output Device in the List from the Index
       
   318             * @since S60 v3.2
       
   319             * @param aIndex Index in the List             
       
   320             * @param aOutputDevice Returned OutputDevice             
       
   321             */            
       
   322             TInt GetAllowedOutputDevice( TInt aIndex, TDRMAllowedOutputDevice& aOutputDevice );
       
   323             /**
       
   324             * Reset the DRM Config and empty the List
       
   325             * @since S60 v3.2
       
   326             */            
       
   327             TInt ResetDRMConfig();
       
   328             /**
       
   329             * Commit the Allowed Output Device List to the Server Side Source
       
   330             * @since S60 v3.2
       
   331             */            
       
   332             TInt CommitDRMConfig();
       
   333             
       
   334         private:
       
   335             void EmptyQueue();
       
   336             void DoCommitDRMConfigL();
       
   337             
       
   338         private:
       
   339             // Variable to determine if the ServerSource exists
       
   340             TBool iServerSourceExists;
       
   341             // Variable to Hold the Mime Type sent by the Client
       
   342             HBufC8* iMimeType;
       
   343             // Queue of data buffers from client
       
   344             TSglQue<CDataBufferQueueItem>* iAudioBufferQueue;
       
   345             // Variable to Stote the Source Size set by the Client
       
   346             TUint iSourceSize;
       
   347             // Handle to send messages to the Server Side Source
       
   348             MCustomCommand* iCustomCommand;
       
   349             // Handle Identifying the Server Side Source
       
   350             TMMFMessageDestination iSourceHandle;
       
   351             // Package of the Source Handle
       
   352             TMMFMessageDestinationPckg iSourceHandlePckg;
       
   353             
       
   354             // Event Notifier that notifies the Client
       
   355             CEventNotifier* iEventNotifier;
       
   356             // Active Object that monitors the Support changed.
       
   357             CBufTypeSupEventAO* iBufTypeSupportEvent;
       
   358             // if Fixed Duration Support is valid
       
   359             TBool iFixedDurationSupport;
       
   360             /* Attributes to hold DRM Info */
       
   361             // Holds DRM Type set by client
       
   362             TDRMType iDRMType;
       
   363             // Holds list of allowed output devices set by client
       
   364             RArray<TDRMAllowedOutputDevice> iAllowedOutputDeviceList;
       
   365             // Holds the next buffer sequence number starting from 0
       
   366             TUint iBufferSeqNum;
       
   367         };
       
   368     } // namespace multimedia
       
   369 
       
   370 #endif // C_CCLIENTDATABUFFERSOURCE_H
       
   371 
       
   372 // End of file