mmserv/voipaudioservices/VoIPIntfc/inc/VoIPUplinkStreamImpl.h
changeset 0 71ca22bcf22a
child 53 eabc8c503852
equal deleted inserted replaced
-1:000000000000 0:71ca22bcf22a
       
     1 /*
       
     2 * Copyright (c) 2007-2008 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:  VOIP Audio Services
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __VOIPUPLINKSTREAMIMPL_H
       
    20 #define __VOIPUPLINKSTREAMIMPL_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <voipformatintfc.h>
       
    24 #include <voipuplinkstream.h>
       
    25 #include "VoIPAudioSession.h"
       
    26 #include "VoIPQueueHandler.h"
       
    27 
       
    28 
       
    29 /**
       
    30  *  CVoIPAudioUplinkStreamImpl class
       
    31  *
       
    32  *  ?more_complete_description
       
    33  *
       
    34  *  @lib VoIPAudioIntfc.dll
       
    35  *  @since S60 v5.0
       
    36  */
       
    37 NONSHARABLE_CLASS(CVoIPAudioUplinkStreamImpl) : public CBase,
       
    38                                                 public CVoIPAudioUplinkStream,
       
    39                                                 public MQueueHandlerObserver,
       
    40                                                 public MVoIPFormatObserver
       
    41     {
       
    42     enum TQueueType
       
    43         {
       
    44         EMsgBufQueue,
       
    45         EMsgComQueue
       
    46         };
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * 2-phased constructor
       
    52      *
       
    53      * @since S60 v5.0
       
    54      * @param none
       
    55      * @return CVoIPAudioUplinkStreamImpl*
       
    56      */
       
    57     static CVoIPAudioUplinkStreamImpl* NewL(
       
    58                 const TMMFPrioritySettings aPriority);
       
    59 
       
    60     /**
       
    61      * Destructor
       
    62      *
       
    63      * @since S60 v5.0
       
    64      * @param none
       
    65      * @return none
       
    66      */
       
    67     virtual ~CVoIPAudioUplinkStreamImpl();
       
    68 
       
    69     /**
       
    70      * ?description
       
    71      *
       
    72      * @since S60 v5.0
       
    73      * @param MVoIPUplinkObserver&
       
    74      * @return TInt
       
    75      */
       
    76     TInt Open(MVoIPUplinkObserver& aObserver);
       
    77 
       
    78     /**
       
    79      * ?description
       
    80      *
       
    81      * @since S60 v5.0
       
    82      * @param TVersion&
       
    83      * @return TInt
       
    84      */
       
    85     TInt GetVersion(TVersion& aVersion);
       
    86 
       
    87     /**
       
    88      * ?description
       
    89      *
       
    90      * @since S60 v5.0
       
    91      * @param TInt&
       
    92      * @return TInt
       
    93      */
       
    94     TInt GetMaxGain(TInt& aGain);
       
    95 
       
    96     /**
       
    97      * ?description
       
    98      *
       
    99      * @since S60 v5.0
       
   100      * @param TInt
       
   101      * @return TInt
       
   102      */
       
   103     TInt SetGain(TInt aGain);
       
   104 
       
   105     /**
       
   106      * ?description
       
   107      *
       
   108      * @since S60 v5.0
       
   109      * @param TInt&
       
   110      * @return TInt
       
   111      */
       
   112     TInt GetGain(TInt& aGain);
       
   113 
       
   114     /**
       
   115      * ?description
       
   116      *
       
   117      * @since S60 v5.0
       
   118      * @param const TMMFPrioritySettings
       
   119      * @param RArray<TVoIPCodecFormat>&
       
   120      * @return void
       
   121      */
       
   122     void GetSupportedFormatsL(const TMMFPrioritySettings aPriority,
       
   123                               RArray<TVoIPCodecFormat>& aFormats);
       
   124 
       
   125     /**
       
   126      * ?description
       
   127      *
       
   128      * @since S60 v5.0
       
   129      * @param TVoIPCodecFormat
       
   130      * @param CVoIPFormatIntfc&
       
   131      * @return void
       
   132      */
       
   133     void SetFormatL(TVoIPCodecFormat aFormat, CVoIPFormatIntfc*& aIntfc);
       
   134 
       
   135     /**
       
   136      * ?description
       
   137      *
       
   138      * @since S60 v5.0
       
   139      * @param none
       
   140      * @return TVoIPCodecFormat
       
   141      */
       
   142     TVoIPCodecFormat GetFormat();
       
   143 
       
   144     /**
       
   145      * ?description
       
   146      *
       
   147      * @since S60 v5.0
       
   148      * @param none
       
   149      * @return TInt
       
   150      */
       
   151     TInt Start();
       
   152 
       
   153     /**
       
   154      * ?description
       
   155      *
       
   156      * @since S60 v5.0
       
   157      * @param none
       
   158      * @return TInt
       
   159      */
       
   160     TInt Stop();
       
   161 
       
   162     /**
       
   163      * ?description
       
   164      *
       
   165      * @since S60 v5.0
       
   166      * @param none
       
   167      * @return void
       
   168      */
       
   169     void Close();
       
   170 
       
   171     /**
       
   172      * ?description
       
   173      *
       
   174      * @since S60 v5.0
       
   175      * @param CVoIPDataBuffer*
       
   176      * @return TInt
       
   177      */
       
   178     TInt BufferEmptied(CVoIPDataBuffer* aBuffer);
       
   179 
       
   180     /**
       
   181      * ?description
       
   182      *
       
   183      * @since S60 v5.0
       
   184      * @param none
       
   185      * @return RVoIPAudioSession*
       
   186      */
       
   187     RVoIPAudioSession* GetSession();
       
   188 
       
   189 
       
   190 // From MQueueHandlerObserver
       
   191 
       
   192     /**
       
   193      * ?description
       
   194      *
       
   195      * @since S60 v5.0
       
   196      * @param CVoIPDataBuffer*
       
   197      * @return void
       
   198      */
       
   199     virtual void FillBuffer(CVoIPDataBuffer* /*aBuffer*/) {};
       
   200 
       
   201     /**
       
   202      * ?description
       
   203      *
       
   204      * @since S60 v5.0
       
   205      * @param CVoIPDataBuffer*
       
   206      * @return void
       
   207      */
       
   208     virtual void EmptyBuffer(CVoIPDataBuffer* aBuffer);
       
   209 
       
   210     /**
       
   211      * ?description
       
   212      *
       
   213      * @since S60 v5.0
       
   214      * @param aEventType
       
   215      * @param TInt
       
   216      * @return void
       
   217      */
       
   218     virtual void Event(TInt aEventType, TInt aError);
       
   219 
       
   220 // From MVoIPFormatObserver
       
   221 
       
   222     /**
       
   223      * ?description
       
   224      *
       
   225      * @since S60 v5.0
       
   226      * @param CVoIPFormatIntfc&
       
   227      * @param TInt
       
   228      * @return void
       
   229      */
       
   230     virtual void Event(const CVoIPFormatIntfc& aSrc, TInt aEventType);
       
   231 
       
   232 private:
       
   233 
       
   234     /**
       
   235      * Constructor
       
   236      *
       
   237      * @since S60 v5.0
       
   238      * @param none
       
   239      * @return none
       
   240      */
       
   241     CVoIPAudioUplinkStreamImpl();
       
   242 
       
   243     /**
       
   244      * Symbian constructor
       
   245      *
       
   246      * @since S60 v5.0
       
   247      * @param none
       
   248      * @return void
       
   249      */
       
   250     void ConstructL(const TMMFPrioritySettings aPriority);
       
   251 
       
   252     /**
       
   253      * ?description
       
   254      *
       
   255      * @since S60 v5.0
       
   256      * @param TDesC&
       
   257      * @param TInt
       
   258      * @param TQueueType
       
   259      * @return TInt
       
   260      */
       
   261     TInt CreateQueue(const TDesC& aQueueName,
       
   262                      const TInt aNumSlots,
       
   263                      const TQueueType aQueueType);
       
   264 
       
   265     /**
       
   266      * ?description
       
   267      *
       
   268      * @since S60 v5.0
       
   269      * @param none
       
   270      * @return void
       
   271      */
       
   272     void ReceiveMsgQHandlerEventsL();
       
   273 
       
   274     /**
       
   275      * ?description
       
   276      *
       
   277      * @since S60 v5.0
       
   278      * @param none
       
   279      * @return void
       
   280      */
       
   281     void ReceiveMsgQComHandlerEventsL();
       
   282 
       
   283     /**
       
   284      * ?description
       
   285      *
       
   286      * @since S60 v5.0
       
   287      * @param TVoIPCodecFormat
       
   288      * @return TFourCC
       
   289      */
       
   290     TUint32 CodecFourCC(TVoIPCodecFormat aFormat);
       
   291 
       
   292     /**
       
   293      * ?description
       
   294      *
       
   295      * @since S60 v5.0
       
   296      * @param TUint32
       
   297      * @return TVoIPCodecFormat
       
   298      */
       
   299     TVoIPCodecFormat ConvertFourCC(TUint32 aCodec);
       
   300 
       
   301     /**
       
   302      * ?description
       
   303      *
       
   304      * @since S60 v5.0
       
   305      * @param TVoIPCodecFormat
       
   306      * @return TBool
       
   307      */
       
   308     TBool IsCodecSupportedL(TVoIPCodecFormat aFormat);
       
   309 
       
   310     /**
       
   311      * ?description
       
   312      *
       
   313      * @since S60 v5.0
       
   314      * @param TVoIPCodecFormat
       
   315      * @return TBool
       
   316      */
       
   317     TBool FindFormat(TVoIPCodecFormat aFormat);
       
   318 
       
   319 private:
       
   320 
       
   321 // Client side VoIP server session
       
   322     RVoIPAudioSession         iVoIPAudioSession;
       
   323 
       
   324     MVoIPUplinkObserver*      iObserver;
       
   325 
       
   326 // Message queues
       
   327     RMsgQueue<TVoIPMsgBuf>    iMsgQueue;
       
   328     RMsgQueue<TVoIPMsgBuf>    iMsgComQueue;
       
   329 
       
   330 // Message queue handlers
       
   331     CQueueHandler*            iMsgQHandler;
       
   332     CQueueHandler*            iMsgQComHandler;
       
   333 
       
   334     TMMFPrioritySettings      iPriority;
       
   335     TPtr8                     iBufferPtr;
       
   336     TInt                      iBufferLen;
       
   337     TInt                      iG711FrameSize;
       
   338     TBool                     iIsClosing;
       
   339 
       
   340     TVoIPCodecFormat          iFormat;
       
   341     RArray<TVoIPCodecFormat>* iCodecFormats;
       
   342 
       
   343     };
       
   344 
       
   345 #endif //__VOIPUPLINKSTREAMIMPL_H
       
   346 
       
   347 // End of file