vtprotocols/inc/cdatasinkproxy.h
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     1 /*
       
     2 * Copyright (c) 2004-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 #ifndef CDATASINKPROXY_H
       
    20 #define CDATASINKPROXY_H
       
    21 NONSHARABLE_CLASS( CPVDisplaySinkNodeProxy ) : public CBase,
       
    22                                                public MVTVideoSource
       
    23     {
       
    24     public: //New
       
    25         /**
       
    26          * Constructor .
       
    27          */
       
    28         CPVDisplaySinkNodeProxy();
       
    29         /**
       
    30          * Set new supplier.
       
    31          * @param aSupplier
       
    32          */
       
    33         void SetSupplier(MPVDataSourceBase* aSupplier);
       
    34     public: //From MVTVideoSource
       
    35         /**
       
    36          * Method called by a data sink to pass back an emptied buffer to the source
       
    37          *
       
    38          * This is a pure virtual function that each derived class must implement.
       
    39          * This method is used as the callback when the data source actively requests a consumer ie a data sink
       
    40          * to empty a buffer by calling the data sinks EmptyBufferL.
       
    41          * When the data source gets this callback it knows that the buffer has been emptied and can be reused
       
    42          * 
       
    43          * @param   "aBuffer"
       
    44          *          The buffer that has been emptied by a data sink and is now available for reuse
       
    45          */
       
    46         virtual void BufferEmptiedL(CMMFBuffer* aBuffer);
       
    47     private:
       
    48         MPVDataSourceBase* iSupplier;
       
    49     };
       
    50 
       
    51 NONSHARABLE_CLASS( CDisplaySinkProxy ) : public CBase,
       
    52                                          public MPVDataSink,
       
    53                                          public MPVVideoOutput
       
    54     {
       
    55     public: //From MPVPluginBase
       
    56         /**
       
    57          * This API returns multimedias type supported by the data source/sink - 
       
    58          * Audio, Video, Data etc.  Each supported type is indicated by a MIME type structure.
       
    59          * @return Multimedia types supported by the data source/sink.  The reference 
       
    60          * is valid until the MPVPluginBase derived object is destroyed.
       
    61          **/
       
    62         virtual const RArray<TPVMIMEType *>& GetMultimediaTypesL() const;
       
    63         /**
       
    64          * This API is to allow for extensibility of the plugin interface.
       
    65          * It allows a caller to ask for all UUIDs associated with a particular MIME type.
       
    66          * If interfaces of the requested MIME type are found within the plugin, they are added 
       
    67          * to the UUIDs array.  
       
    68          * 
       
    69          * Also added to the UUIDs array will be all interfaces which have the requested MIME 
       
    70          * type as a base MIME type.  This functionality can be turned off.
       
    71          * 
       
    72          * @param aMimeType The MIME type of the desired interfaces
       
    73          * @param aUuids An array to hold the discovered UUIDs
       
    74          * @param aExactUuidsOnly Turns on/off the retrival of UUIDs with aMimeType as a base type
       
    75          **/
       
    76         virtual void QueryUUID( const TPVMIMEType& aMimeType, RArray<TPVUuid>& aUuids, bool aExactUuidsOnly = false );
       
    77         /**
       
    78          * This API is to allow for extensibility of the plugin interface.
       
    79          * It allows a caller to ask for an instance of a particular interface object to be returned.
       
    80          * The mechanism is analogous to the COM IUnknown method.  The interfaces are identified with
       
    81          * an interface ID that is a UUID as in DCE and a pointer to the interface object is
       
    82          * returned if it is supported.  Otherwise the returned pointer is NULL.
       
    83          * @param aUuid The UUID of the desired interface
       
    84          * @param aInterfacePtr The output pointer to the desired interface
       
    85          **/
       
    86         virtual void QueryInterface( const TPVUuid& aUuid, TPVInterfacePtr& aInterfacePtr );
       
    87         /**
       
    88          *  This API is used to provide a timebase for plugins that deal with synchronized media data
       
    89          **/
       
    90         virtual void SetTimebaseL(MPVSymbianTimebaseInterface* aTimebase);
       
    91     public: //From MPVDataSinkBase
       
    92         /**
       
    93          * Method called by a MDataSource to request the data sink to empty aBuffer of data.
       
    94          *
       
    95          * This is a pure virtual function that each derived class must implement.
       
    96          * This method is used when a data sink is passively waiting for requests from a supplier ie a data source
       
    97          * to empty a buffer.  The data sink must call the BufferEmptiedL member on aSupplier when it has emptied
       
    98          * the buffer of it's data - the data sink can either make this callback synchronously or asynchronously.
       
    99          * 
       
   100          * @param   "aBuffer"
       
   101          *          The full buffer that needs emptying of it's data
       
   102          *
       
   103          * @param   "aSupplier" 
       
   104          *          The data source that supplied the data. The data sink needs this to make the BufferEmptiedL
       
   105          *          callback on aSupplier to indicate to the data source that the data sink has finished with the buffer.
       
   106          *
       
   107          * @param   "aMediaId"
       
   108          *          This identifies the type of media eg audio or video and the stream id.
       
   109          *          This parameter is required in cases where the source can supply data
       
   110          *          of more than one media type and/or multiple strams of data
       
   111          */
       
   112         virtual void EmptyBufferL(CMMFBuffer* aBuffer, MPVDataSourceBase* aSupplier, TMediaId aMediaId);
       
   113         /**
       
   114          * Method called by a data source to pass back an filled buffer to the sink
       
   115          *
       
   116          * This is a pure virtual function that each derived class must implement.
       
   117          * This method is used as the callback when the data sink actively requests a supplier ie a data source
       
   118          * to fill a buffer by calling the data sources FillBufferL.
       
   119          * When the data sink gets this callback it knows that the buffer has been filled and is ready to be emptied
       
   120          * 
       
   121          * @param   "aBuffer"
       
   122          *          The buffer that has been filled by a data source and is now available for processing
       
   123          */
       
   124         virtual void BufferFilledL(CMMFBuffer* aBuffer);
       
   125         /**
       
   126          * Method to indicate whether the data sink can create a buffer.
       
   127          *
       
   128          * This is a pure virtual function that each derived class must implement.
       
   129          * 
       
   130          * @return  ETrue if the data sink can create a buffer else EFalse
       
   131          */
       
   132         virtual TBool CanCreateSinkBuffer();
       
   133         /**
       
   134          * Returns a buffer created by the data sink
       
   135          *
       
   136          * This is a pure virtual function that each derived class must implement.
       
   137          *
       
   138          * @param   "aMediaId"
       
   139          *          This identifies the type of media eg audio or video and the stream id.
       
   140          *          This parameter is required in cases where the source can supply data
       
   141          *          of more than one media type and/or multiple strams of data.
       
   142          *
       
   143          * @param   "aReference"
       
   144          *          This must be written to by the method to indicate whether the created buffer is
       
   145          *          a 'reference' buffer.  A 'reference' buffer is a buffer that is owned by the sink
       
   146          *          and should be used in preference to the source buffer provided the source buffer
       
   147          *          is also not a reference buffer.
       
   148          * .  
       
   149          * @return  The created buffer
       
   150          */
       
   151         virtual CMMFBuffer* CreateSinkBufferL(TMediaId aMediaId, TBool &aReference );
       
   152         /**
       
   153          * Method to 'logon' the data sink to the same thread that sink will be consuming data in.
       
   154          *
       
   155          * This method may be required as the thread that the data sink was created in is not always
       
   156          * the same thread that the data transfer will take place in.  Therefore any thread specific
       
   157          * initialisation needs to be performed in the SinkThreadLogon rather than in the creation 
       
   158          * of the data sink.
       
   159          *
       
   160          * This is a virtual function that a derrived data sink can implement if any thread specific
       
   161          * initialisation is required and/or the data sink can create any asynchronous events.
       
   162          * 
       
   163          * 
       
   164          * @param   "aEventHandler"
       
   165          *          This is an MAsyncEventHandler to handle asynchronous events that occur during the
       
   166          *          transfer of multimedia data.  The event handler must be in the same thread as the data transfer
       
   167          *          thread - hence the reason it is passed in the SinkThreadLogon as opposed to say the constructor.
       
   168          *
       
   169          *
       
   170          * @return  KErrNone if successful, otherwise a system wide error code.
       
   171          */
       
   172         virtual TInt SinkThreadLogon( MAsyncEventHandler& aEventHandler );
       
   173         /**
       
   174          * Method to 'logoff' the data sink from the same thread that sink consumes data in.
       
   175          *
       
   176          * This method may be required as the thread that the data sink is deleted in may not be
       
   177          * the same thread that the data transfer took place in.  Therefore any thread specific
       
   178          * releasing of resources needs to be performed in the SinkThreadLogoff rather than in the destructor
       
   179          *
       
   180          * This is a virtual function that a derrived data sink can implement if any thread specific
       
   181          * releasing of resources is required.
       
   182          */
       
   183         virtual void SinkThreadLogoff();
       
   184         /**
       
   185          * Method to 'prime' the data sink
       
   186          *
       
   187          * This is a virtual function that a derrived data sink can implement if 
       
   188          * any data sink specific 'priming' is required
       
   189          */
       
   190         virtual TInt SinkPrimeL();
       
   191         /**
       
   192          * Method to 'play' the data sink
       
   193          *
       
   194          * This is a virtual function that a derrived data sink can implement if 
       
   195          * any data sink specific action is required prior to 'playing'ie the start of data transfer
       
   196          */
       
   197         virtual TInt SinkPlayL();
       
   198         /**
       
   199          * Method to 'pause' the data sink
       
   200          *
       
   201          * This is a virtual function that a derrived data sink can implement if 
       
   202          * any data sink specific action is required to 'pause'
       
   203          */
       
   204         virtual TInt SinkPauseL();
       
   205 
       
   206         /**
       
   207          * Method to 'stop' the data sink
       
   208          *
       
   209          * This is a virtual function that a derrived data sink can implement if 
       
   210          * any data sink specific action is required to 'stop'
       
   211          */
       
   212         virtual TInt SinkStopL();
       
   213     public: //From MPVVideoOutput
       
   214 
       
   215         /**
       
   216          * Set the video frame format.  This must be from the list of supported formats.
       
   217          * @param "aFormat" A mime string describing the video frame format.
       
   218          * @exception Can leave with one of the system wide error codes
       
   219          **/
       
   220         virtual void SetFormatL(const TDesC8& aFormat);
       
   221 
       
   222         /**
       
   223          * Set the video frame size
       
   224          * @param "aSize" The video frame size, in pixels
       
   225          * @exception Can leave with one of the system wide error codes
       
   226          **/
       
   227         virtual void SetVideoFrameSizeL(const TSize& aSize);
       
   228 
       
   229         /**
       
   230          * Get the video frame size
       
   231          * @param "aSize" The video frame size, in pixels
       
   232          * @exception Can leave with one of the system wide error codes
       
   233          **/
       
   234         virtual void GetVideoFrameSizeL(TSize& aSize) const;
       
   235     public:
       
   236         /**
       
   237          * Constructor.
       
   238          */
       
   239         CDisplaySinkProxy(MVTVideoSink* aDisplaySink);
       
   240         
       
   241         /**
       
   242          * ConstructL
       
   243          */
       
   244         void ConstructL();
       
   245 
       
   246         /**
       
   247          * NewL
       
   248          */
       
   249         static CDisplaySinkProxy* NewL(MVTVideoSink* aDisplaySink);
       
   250         /**
       
   251          * Get pointer object of data sink.
       
   252          * @return member variant:iDisplaySink
       
   253          */
       
   254         MVTVideoSink* DisplaySink() { return iDisplaySink; }
       
   255     private:
       
   256         MVTVideoSink* iDisplaySink;
       
   257         CPVDisplaySinkNodeProxy* iDSNodeProxy;
       
   258         
       
   259     };
       
   260 
       
   261 NONSHARABLE_CLASS( CAudioSinkProxy ) : public CBase,
       
   262                                        public MVTAudioSink
       
   263     {
       
   264     public:
       
   265         MPVDataSink* iAudioSink;
       
   266     };
       
   267     
       
   268 #endif
       
   269 //  End of File 
       
   270