bt_plat/bluetooth_audio_adaptation_api/inc/btaudiostreaminputbase.h
changeset 0 29b1cd4cb562
child 17 32ba20339036
equal deleted inserted replaced
-1:000000000000 0:29b1cd4cb562
       
     1 /*
       
     2 * Copyright (c) 2005 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:  ?Description
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __BTAUDIOSTREAMINPUTBASE_H__
       
    20 #define __BTAUDIOSTREAMINPUTBASE_H__
       
    21 
       
    22 #include <e32base.h>
       
    23 #include <e32std.h>
       
    24 #include <mmf/common/MmfUtilities.h> 
       
    25 
       
    26 /**
       
    27  *  Observer interface for receiving the audio data buffers. 
       
    28  *
       
    29  *  This class defines an observer interface to be implemented by the 
       
    30  *  class that is going to receive the audio data. 
       
    31  *
       
    32  *  @lib btaudioadaptation.lib 
       
    33  *  @since S60 v3.1
       
    34  */
       
    35 class MBTAudioStreamObserver 
       
    36 {
       
    37 public: 
       
    38     /**
       
    39      * Method for receiving audio data and an associated timestamp. 
       
    40      *
       
    41      * @since S60 v3.1 
       
    42      * @param aBuffer the audio data frames from the encoder. 
       
    43      * @param aTimestamp the timestamp of the first audio frame in the aBuffer 
       
    44      * @return a Symbian OS wide error code. 
       
    45      */
       
    46 	virtual TInt Receive(const TDesC8& aBuffer, TTimeIntervalMicroSeconds aTimestamp) = 0;
       
    47 
       
    48     /**
       
    49      * Method for receiving audio data. 
       
    50      *
       
    51      * @since S60 v3.1 
       
    52      * @param aBuffer the audio data frames from the encoder. 
       
    53      * @return a Symbian OS wide error code. 
       
    54      */
       
    55 	virtual TInt Receive(const TDesC8& aBuffer) = 0;
       
    56 }; 
       
    57 
       
    58 /**
       
    59  *  Observer interface for receiving the audio adaptation errors. 
       
    60  *
       
    61  *  This class defines an observer interface to be implemented by the 
       
    62  *  class that is going to receive the errors that have occurred in 
       
    63  *  BT Audio Adaptation or in the audio subsystem. 
       
    64  *
       
    65  *  To be implemented by a class who uses this adaptation class. 
       
    66  *  @lib btaudioadaptation.lib 
       
    67  *  @since S60 v3.1
       
    68  */
       
    69 class MBTAudioErrorObserver 
       
    70 {
       
    71 public: 
       
    72     /**
       
    73  		 *  Method for receiving the errors. 
       
    74      *
       
    75      * @since S60 v3.1 
       
    76      * @param aError a Symbian OS wide error code. 
       
    77      * @return a Symbian OS wide error code. 
       
    78      */
       
    79 	virtual TInt Error(const TInt aError) = 0;
       
    80 }; 
       
    81 
       
    82 /**
       
    83  *  This class specifies the interface for receiving audio data from audio subsystem. 
       
    84  *
       
    85  *  This class contains the interface definition. It can't be instantiated directly, 
       
    86  *  but instead the implementation is done in the class inherited from this class. 
       
    87  *  
       
    88  *  Also, the factory method for the base class must be implemented by the 
       
    89  *  implementator of this interface. 
       
    90  *
       
    91  *  @lib btaudioadaptation.lib
       
    92  *  @since S60 v3.1 
       
    93  */
       
    94 class CBTAudioStreamInputBase : public CBase
       
    95 {
       
    96 public: 
       
    97     IMPORT_C static CBTAudioStreamInputBase* NewL( MBTAudioStreamObserver &aStreamObserver, MBTAudioErrorObserver &aErrorObserver );
       
    98 
       
    99     /**
       
   100      * This method is for connecting to the audio subsystem. 
       
   101      *
       
   102      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   103      * for detailed explanation. 
       
   104      *
       
   105      * @since S60 v3.1
       
   106      * @param void. 
       
   107      * @return a Symbian OS wide error code. 
       
   108      */
       
   109     virtual TInt Connect() = 0;
       
   110 
       
   111     /**
       
   112      * This method is for disconnecting from the audio subsystem. 
       
   113      *
       
   114      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   115      * for detailed explanation. 
       
   116      *
       
   117      * @since S60 v3.1
       
   118      * @param void. 
       
   119      * @return void
       
   120      */
       
   121     virtual void Disconnect() = 0;
       
   122 
       
   123     /**
       
   124      * This method is for passing the custom interfaces that are 
       
   125      * needed sometimes for configuring the hardware encoder. 
       
   126      *
       
   127      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   128      * for detailed explanation. 
       
   129      *
       
   130      * @since S60 v3.1
       
   131      * @param aInterfaceId specifies the id of custom interface that the client 
       
   132      *        wants to get. 
       
   133      * @return  A pointer to the requested interface. Client must cast it into a correct class. 
       
   134      */
       
   135     virtual TAny *EncoderInterface(TUid aInterfaceId) = 0;
       
   136 
       
   137     /**
       
   138      * This method is for choosing the encoder for the audio data. 
       
   139      *
       
   140      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   141      * for detailed explanation. 
       
   142      *
       
   143      * @since S60 v3.1
       
   144      * @param aDesiredFourCC specifies the encoder that the client wants to use. 
       
   145      * @return a Symbian OS wide error code. 
       
   146      */
       
   147     virtual TInt SetFormat(TFourCC aDesiredFourCC) = 0; 
       
   148 
       
   149     /**
       
   150      * This method is for starting the recording from the audio subsystem. 
       
   151      *
       
   152      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   153      * for detailed explanation. 
       
   154      *
       
   155      * @since S60 v3.1
       
   156      * @param void. 
       
   157      * @return a Symbian OS wide error code. 
       
   158      */
       
   159     virtual TInt Start() = 0;
       
   160 
       
   161     /**
       
   162      * This method is for stopping the recording from the audio subsystem. 
       
   163      *
       
   164      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   165      * for detailed explanation. 
       
   166      *
       
   167      * @since S60 v3.1
       
   168      * @param void. 
       
   169      * @return a Symbian OS wide error code. 
       
   170      */
       
   171     virtual void Stop() = 0;
       
   172 
       
   173     /**
       
   174 	 * This method is called when the client has processed the buffer it got 
       
   175 	 * from the Receive method. 
       
   176 	 * 
       
   177      * See BT Audio Adaptation API and BT Audio Adaptation Design specifications 
       
   178      * for detailed explanation. 
       
   179      *
       
   180      * @since S60 v3.1
       
   181      * @param aBuffer refers to the buffer that was received earlier in the Receive method. 
       
   182      * @return  void
       
   183      */
       
   184     virtual void BufferEmptied( const TDesC8 &aBuffer ) = 0;
       
   185 }; 
       
   186 
       
   187 #endif