mmappfw_plat/qt_telephony_multimedia_service_api/inc/qtmsclientsource.h
branchRCL_3
changeset 56 63223d4fd956
parent 55 6c1dfe4da5dd
child 59 666f9a5a90a9
equal deleted inserted replaced
55:6c1dfe4da5dd 56:63223d4fd956
     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_CLIENT_SOURCE_H
       
    19 #define QTMS_CLIENT_SOURCE_H
       
    20 
       
    21 #include <QObject>
       
    22 #include <qtms.h>
       
    23 #include <qtmsbuffer.h>
       
    24 #include <qtmssource.h>
       
    25 #include "qtmswrapperexport.h"
       
    26 
       
    27 // FORWARD DECLARATIONS
       
    28 namespace TMS
       
    29 {
       
    30 class TMSSource;
       
    31 }
       
    32 
       
    33 namespace QTMS
       
    34 {
       
    35 
       
    36 /**
       
    37  * QTMSClientSource class
       
    38  *
       
    39  * This class instantiates QTMS client source interface. It serves as a data
       
    40  * source to the QTMS, through which the client submits data buffers to the
       
    41  * QTMS call server for playback on the audio and/or video output device.
       
    42  *
       
    43  * @lib QTMSapi.lib
       
    44  *
       
    45  */
       
    46 class QTMS_WRAPPER_DLL_EXPORT QTMSClientSource : public QObject,
       
    47                                                  public QTMSSource
       
    48 {
       
    49     Q_OBJECT
       
    50 public:
       
    51     /**
       
    52      * Destructor
       
    53      */
       
    54     virtual ~QTMSClientSource();
       
    55 
       
    56     /**
       
    57      * PULL MODE ONLY
       
    58      *
       
    59      * Tell the source that the buffer passed in has been filled in with data
       
    60      * by the client and it is ready to be sent do the QTMS for processing.
       
    61      *
       
    62      * This function must be called in response to the callback from the
       
    63      * source observer QTMSClientSourceObserver::FillBuffer.
       
    64      *
       
    65      * @param  buffer
       
    66      *      The buffer which has been processed by the client (filled in
       
    67      *      with data).
       
    68      *
       
    69      * @return
       
    70      *      Status of the operation.
       
    71      *
       
    72      */
       
    73     gint BufferFilled(QTMSBuffer& buffer);
       
    74 
       
    75     /**
       
    76      * In the PUSH MODE, tell the source that the supplied buffer filled in
       
    77      * with data should be queued before being sent for processing by the
       
    78      * server. All ProcessBuffer requests will be queued until client calls
       
    79      * Flush(). After all queued buffers are pushed to the server and
       
    80      * processed, the QTMS will respond by issuing
       
    81      * QTMSClientSourceObserver::BufferProcessed
       
    82      * callback event.
       
    83      *
       
    84      * @param  buffer
       
    85      *      The buffer with audio data supplied by the client for playback.
       
    86      *
       
    87      */
       
    88     gint ProcessBuffer(QTMSBuffer* buffer);
       
    89 
       
    90     /**
       
    91      * PUSH MODE ONLY
       
    92      *
       
    93      * Tell the QTMS framework to queue ProcessBuffer events. To request the
       
    94      * QTMS push mode operation, the SetEnqueueMode must be called with the
       
    95      * flag set TRUE. Buffer enqueuing continues until the client calls
       
    96      * Flush(). At this point all queued data (buffers) are sent over to the
       
    97      * QTMS for processing and the enqueuing mode is turned OFF. To turn it
       
    98      * ON again, the client has to call SetEnqueueMode with TRUE parameter.
       
    99      *
       
   100      * Has no effect in the PULL mode.
       
   101      *
       
   102      * @param  enable
       
   103      *      Toggles buffer enqueuing ON and OFF.
       
   104      *
       
   105      * @return
       
   106      *      QTMS_RESULT_SUCCESS if the operation was successful.
       
   107      *
       
   108      */
       
   109     gint SetEnqueueMode(const gboolean enable);
       
   110 
       
   111     /**
       
   112      * PUSH MODE ONLY
       
   113      *
       
   114      * Return current buffer enqueuing mode setting.
       
   115      * Has no effect in the PULL mode.
       
   116      *
       
   117      * @param  enable
       
   118      *      Current enqueuing mode.
       
   119      *
       
   120      */
       
   121     gint GetEnqueueMode(gboolean& enable);
       
   122 
       
   123     /**
       
   124      * PUSH MODE ONLY
       
   125      *
       
   126      * Push all queued buffers by ProcessBuffer to the server for processing.
       
   127      * After calling this function, the enqueuing mode is turned OFF. To set
       
   128      * it ON, the client has to call SetEnqueueMode again.
       
   129      *
       
   130      * Has no effect in the PULL mode.
       
   131      *
       
   132      * @return
       
   133      *      QTMS_RESULT_SUCCESS if the operation was successful.
       
   134      *
       
   135      */
       
   136     gint Flush();
       
   137 
       
   138     /**
       
   139      * Return the source type.
       
   140      *
       
   141      * This function can be called at any time.
       
   142      *
       
   143      * @param  QTMSSourceType&
       
   144      *      The type of the source object. The supported source types are
       
   145      *      as follows:
       
   146      *          QTMS_SOURCE_CLIENT
       
   147      *          QTMS_SOURCE_MODEM
       
   148      *          QTMS_SOURCE_MIC
       
   149      *
       
   150      * @return
       
   151      *      QTMS_RESULT_SUCCESS if the operation was successful.
       
   152      *
       
   153      */
       
   154     virtual gint GetType(QTMSSourceType& sourcetype);
       
   155 
       
   156     Q_SIGNALS:
       
   157     void FillBuffer(QTMSBuffer& buffer);
       
   158     void BufferProcessed(const QTMSBuffer* buffer, gint reason);
       
   159 
       
   160 protected:
       
   161     /**
       
   162      * Constructor
       
   163      */
       
   164     QTMSClientSource();
       
   165 
       
   166 protected:
       
   167     TMS::TMSSource* iSource;
       
   168 };
       
   169 
       
   170 } //namespace QTMS
       
   171 
       
   172 #endif //QTMS_CLIENT_SOURCE_H
       
   173 // End of file
       
   174