qtms/inc/qtmsmembuffer.h
changeset 27 cbb1bfb7ebfb
child 32 edd273b3192a
equal deleted inserted replaced
25:d881023c13eb 27:cbb1bfb7ebfb
       
     1 /*
       
     2  * Copyright (c) 2010 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: QT Bindings for TMS
       
    15  *
       
    16  */
       
    17 
       
    18 #ifndef QTMS_MEM_BUFFER_H
       
    19 #define QTMS_MEM_BUFFER_H
       
    20 
       
    21 #include <qtmsbuffer.h>
       
    22 
       
    23 namespace QTMS {
       
    24 
       
    25 // QTMSMemBuffer class
       
    26 class QTMSMemBuffer : public QTMSBuffer
       
    27     {
       
    28 public:
       
    29     virtual ~QTMSMemBuffer();
       
    30 
       
    31     /**
       
    32      * Creates Memory Buffer object of the given size.
       
    33      * The memory is allocated on the heap.
       
    34      *
       
    35      * @param  size
       
    36      *      Size of the buffer to be created.
       
    37      *
       
    38      * @param  buffer
       
    39      *      Created buffer object.
       
    40      *
       
    41      * @return
       
    42      *      TMS_RESULT_SUCCESS if buffer is created successfully.
       
    43      *      TMS_RESULT_INSUFFICIENT_MEMORY if buffer creation failed due to
       
    44      *      insufficient memory.
       
    45      *      TMS_RESULT_BUFFER_TYPE_NOT_SUPPORTED if the buffer type is not
       
    46      *      supported.
       
    47      *
       
    48      */
       
    49     static gint Create(guint size, QTMSBuffer*& buffer);
       
    50 
       
    51     /**
       
    52      * Return buffer type.
       
    53      *
       
    54      * @param  buftype
       
    55      *      Type of the buffer object (QTMS_BUFFER_MEMORY).
       
    56      *
       
    57      * @return
       
    58      *      QTMS_RESULT_SUCCESS if the operation was successful.
       
    59      *
       
    60      */
       
    61     virtual gint GetType(QTMSBufferType& buftype);
       
    62 
       
    63     /**
       
    64      Gets the timestamp on the Buffer so that the framework can
       
    65      determine the time at which this buffer has to be rendered
       
    66      by the output device sink.
       
    67 
       
    68      @param ts
       
    69      timestamp in microseconds
       
    70      */
       
    71     virtual gint GetTimeStamp(guint64& ts);
       
    72 
       
    73     /**
       
    74      Sets the timestamp on the Buffer so that the framework can
       
    75      determine the time at which this buffer has to be rendered
       
    76      by the output device sink.
       
    77 
       
    78      @param ts
       
    79      timestamp in milliseconds
       
    80      */
       
    81     virtual gint SetTimeStamp(const guint64 ts);
       
    82 
       
    83     /**
       
    84      Gets the size of data in the buffer specified by the client.
       
    85 
       
    86      @param size
       
    87      size of data in bytes
       
    88      */
       
    89     virtual gint GetDataSize(guint& size);
       
    90 
       
    91     /**
       
    92      Sets the size of data in the buffer after the client
       
    93      fill it.
       
    94 
       
    95      @param size
       
    96      size of data in bytes
       
    97      */
       
    98     virtual gint SetDataSize(const guint size);
       
    99 
       
   100     /**
       
   101      Gets the pointer to the memory location associated with this
       
   102      buffer where the data is stored.
       
   103 
       
   104      @param bufptr
       
   105      ptr to the data stored in the buffer.
       
   106      */
       
   107     virtual gint GetDataPtr(guint8*& bufptr);
       
   108 
       
   109 private:
       
   110     QTMSMemBuffer();
       
   111     gint PostConstruct(guint size);
       
   112 
       
   113 private:
       
   114     guint iBufferSize;
       
   115     guint iTimeStamp;
       
   116     guint8* iDataPtr;
       
   117     gboolean iOwnsBuffer;
       
   118     };
       
   119 
       
   120 } //namespace QTMS
       
   121 
       
   122 #endif //QTMS_MEM_BUFFER_H