vtprotocolplugins/VideoSource/inc/CVSMMFDataBuffer.h
changeset 0 ed9695c8bcbe
equal deleted inserted replaced
-1:000000000000 0:ed9695c8bcbe
       
     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:  Video Source subsystem.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CVSMMFDATABUFFER_H
       
    20 #define CVSMMFDATABUFFER_H
       
    21 
       
    22 //  INCLUDE FILES
       
    23 
       
    24 #include <mmfdatabuffer.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 
       
    28 class MFrameBuffer;
       
    29 class MCameraBuffer;
       
    30 
       
    31 /**
       
    32 *  API of data buffer that allows provider's buffer contents to
       
    33 *  be given to consumer without copying.
       
    34 *
       
    35 *  @lib videosource.lib
       
    36 *  @since 5.0
       
    37 */
       
    38 class MVSMMFDataBuffer
       
    39     {
       
    40 
       
    41 public:
       
    42 
       
    43     /**
       
    44     * Sets the ECAM frame buffer.
       
    45     * @param "aFrameBuffer" MFrameBuffer pointer.
       
    46     */
       
    47     virtual void SetFrameBufferL( MFrameBuffer* aFrameBuffer ) = 0;
       
    48 
       
    49 	/**
       
    50     * Sets the ECAM camera buffer.
       
    51     * @param "aFrameBuffer" MFrameBuffer pointer.
       
    52     */
       
    53     virtual void SetFrameBufferL( MCameraBuffer* aCameraBuffer ) = 0;
       
    54 
       
    55     /**
       
    56     * Calls Release() for MFrameBuffer and sets aFrameBuffer to NULL.
       
    57     */
       
    58     virtual void ReleaseL() = 0;
       
    59 
       
    60     /**
       
    61     * Sets start offset and length of internal iPtr variable (when
       
    62     * pointing to iData).
       
    63     */
       
    64     virtual void SetBufferOffset( TInt aOffset ) = 0;
       
    65 
       
    66     /**
       
    67     * Reallocates the max size in bytes.
       
    68     * @param "aMaxBufferSize" New size in bytes.
       
    69     * @exception Can leave with one of the system wide error codes.
       
    70     */
       
    71     virtual void ReAllocBufferL( TInt aMaxBufferSize ) = 0;
       
    72 
       
    73     /**
       
    74     * Checks whether buffer needs reset or not.
       
    75     * @return ETrue if buffer needs reset, EFalse otherwise.
       
    76     */
       
    77     virtual TBool NeedsReset() const = 0;
       
    78 
       
    79     /**
       
    80     * Sets needs reset state.
       
    81     * @param aNeedsReset New reset state.
       
    82     */
       
    83     virtual void SetNeedsReset( TBool aNeedsReset ) = 0;
       
    84 
       
    85     /**
       
    86     * Resets buffer (i.e. clears data).
       
    87     */
       
    88     virtual void Reset() = 0;
       
    89 
       
    90     };
       
    91 
       
    92 /**
       
    93 *  Implementation of data buffer that allows provider's buffer contents to
       
    94 *  be given to consumer without copying.
       
    95 *
       
    96 *  @lib videosource.lib
       
    97 */
       
    98 class CVSMMFDataBuffer : public CMMFDataBuffer, public MVSMMFDataBuffer
       
    99     {
       
   100     public: // new methods
       
   101 
       
   102         /**
       
   103         * Static factory function to create instance of this class.
       
   104         * @exception Can leave with one of the system wide error codes.
       
   105         * @return Pointer to new instance.
       
   106         */
       
   107         IMPORT_C static CVSMMFDataBuffer* NewL();
       
   108 
       
   109         /**
       
   110         * Static factory function to create instance of this class.
       
   111         * @param "aMaxBufferSize" Buffer size
       
   112         * @exception Can leave with one of the system wide error codes.
       
   113         * @return Pointer to new instance.
       
   114         */
       
   115         IMPORT_C static CVSMMFDataBuffer* NewL( TInt aMaxBufferSize );
       
   116 
       
   117         /**
       
   118         * Destructor.
       
   119         */
       
   120         IMPORT_C ~CVSMMFDataBuffer();
       
   121 
       
   122     public: // from CMMFDataBuffer
       
   123 
       
   124         /**
       
   125         * @see CMMFDataBuffer::Data
       
   126         */
       
   127         virtual TDes8& Data();
       
   128 
       
   129         /**
       
   130         * @see CMMFDataBuffer::Data
       
   131         */
       
   132         virtual const TDesC8& Data() const;
       
   133 
       
   134         /**
       
   135         * @see CMMFDataBuffer::SetStatus
       
   136         */
       
   137         virtual void SetStatus( TBufferStatus aStatus );
       
   138 
       
   139         /**
       
   140         * @see CMMFDataBuffer::SetRequestSizeL
       
   141         */
       
   142         virtual void SetRequestSizeL( TInt aSize );
       
   143 
       
   144         /**
       
   145         * @see CMMFDataBuffer::BufferSize
       
   146         */
       
   147         virtual TUint BufferSize() const;
       
   148 
       
   149         /**
       
   150         * @see CMMFDataBuffer::SetPosition
       
   151         */
       
   152         virtual void SetPosition( TUint aPosition );
       
   153 
       
   154     public: // from MVSMMFDataBuffer
       
   155 
       
   156         /**
       
   157         * @see MVSMMFDataBuffer::SetFrameBufferL
       
   158         */
       
   159         void SetFrameBufferL( MFrameBuffer* aFrameBuffer );
       
   160 
       
   161         /**
       
   162         * @see MVSMMFDataBuffer::SetFrameBufferL
       
   163         */
       
   164         void SetFrameBufferL( MCameraBuffer* aCameraBuffer );
       
   165 
       
   166         /**
       
   167         * @see MVSMMFDataBuffer::ReleaseL
       
   168         */
       
   169         void ReleaseL();
       
   170 
       
   171         /**
       
   172         * @see MVSMMFDataBuffer::SetBufferOffset
       
   173         */
       
   174         void SetBufferOffset( TInt aOffset );
       
   175 
       
   176         /**
       
   177         * @see MVSMMFDataBuffer::ReAllocBufferL
       
   178         */
       
   179         void ReAllocBufferL( TInt aMaxBufferSize );
       
   180 
       
   181         /**
       
   182         * @see MVSMMFDataBuffer::NeedsReset
       
   183         */
       
   184         TBool NeedsReset() const;
       
   185 
       
   186         /**
       
   187         * @see MVSMMFDataBuffer::SetNeedsReset
       
   188         */
       
   189         void SetNeedsReset( TBool aNeedsReset );
       
   190 
       
   191         /**
       
   192         * @see MVSMMFDataBuffer::Reset
       
   193         */
       
   194         void Reset();
       
   195 
       
   196 
       
   197     private:    // Constructors and destructor
       
   198 
       
   199         /**
       
   200         * Constructor.
       
   201         */
       
   202         CVSMMFDataBuffer();
       
   203 
       
   204         /**
       
   205         * 2nd phase constructor.
       
   206         * @param "aMaxBufferSize" Buffer size in bytes.
       
   207         */
       
   208         void ConstructL( TInt aMaxBufferSize );
       
   209 
       
   210     public: // Data
       
   211 
       
   212     protected:  // Data
       
   213 
       
   214     private:    // Data
       
   215 
       
   216         // Pointer to ECAM buffer
       
   217         MFrameBuffer* iFrameBuffer;
       
   218 
       
   219         // Pointer to ECAM buffer
       
   220         MCameraBuffer* iCameraBuffer;
       
   221 
       
   222         // Pointer to data buffer ( n/a for ECAM )
       
   223         TUint8* iData;
       
   224 
       
   225         // TPtr8 pointing to iData or ECAM buffer data content
       
   226         TPtr8 iPtr;
       
   227 
       
   228         // Max buffer size ( n/a for ECAM )
       
   229         TInt iMaxBufferSize;
       
   230 
       
   231         // ETrue if buffers needs reset, EFalse otherwise
       
   232         TBool iNeedsReset;
       
   233 
       
   234         // ETrue if buffer is set, EFalse otherwise
       
   235         TBool iIsBufferSet;
       
   236 
       
   237     };
       
   238 
       
   239 #endif // CVSMMFDATABUFFER_H