devsound/a3facf/inc/mbuffersink.h
changeset 0 40261b775718
equal deleted inserted replaced
-1:000000000000 0:40261b775718
       
     1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 //
       
    15 
       
    16 
       
    17 
       
    18 /**
       
    19  @file
       
    20  @publishedPartner
       
    21  @released
       
    22 */
       
    23 
       
    24 #ifndef MBUFFERSINK_H
       
    25 #define MBUFFERSINK_H
       
    26 
       
    27 #include <a3f/a3fbase.h>
       
    28 #include <a3f/maudiodataconsumer.h>
       
    29 
       
    30 class CMMFBuffer;
       
    31 class MMMFAudioDataConsumer;
       
    32 
       
    33 /**
       
    34  * Buffer sink is used for receiving the audio data in buffers outside the audio process.
       
    35  *
       
    36  * The type of the actual 'physical' sink can be for example a file or a socket or the
       
    37  * data could also be simple analysed and then discarded. Nevertheless, the client
       
    38  * (the MAudioDataConsumer) is responsible for writing the data to its final sink
       
    39  * while reading it from the buffers received as a parameter with the callbacks in
       
    40  * the MAudioDataConsumer interface.
       
    41  */
       
    42 class MMMFBufferSink
       
    43 	{
       
    44 public:
       
    45 	/**
       
    46 	 * Initializes the sink for using aConsumer as a data consumer.
       
    47 	 * 
       
    48 	 * The sink must be initialized before it is attahced to a stream.
       
    49 	 *
       
    50 	 * @param aConsumer a reference to the data consumer which will be responsible
       
    51 	 * for reading the audio data from the buffers provided by this sink.
       
    52 	 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes.
       
    53 	 */
       
    54 	virtual TInt SetDataConsumer(MMMFAudioDataConsumer& aConsumer)=0;
       
    55 
       
    56 	/**
       
    57 	 * Indicates that the audio data has been read from a buffer received from this buffer sink.
       
    58 	 *
       
    59 	 * @param aBuffer the buffer that has been consumed.
       
    60 	 * @return an error code. KErrNone if successful, otherwise one of the system wide error codes.
       
    61 	 */
       
    62 	virtual TInt BufferEmptied(CMMFBuffer* aBuffer)=0;
       
    63 
       
    64 	/** 
       
    65 	 * Called by the client to acknowledgement the processing of DiscardBuffers() to indicate that 
       
    66 	 * control of any buffer previously passed to the client.
       
    67 	 * (by BufferToBeEmptied()) returns to the framework proper.
       
    68 	 * 
       
    69 	 * @return an error code. KErrNone on success, otherwise one of the system wide error codes.
       
    70 	 */
       
    71 	virtual TInt BuffersDiscarded()=0;
       
    72 	};
       
    73 
       
    74 #endif // MBUFFERSINK_H