os/mm/devsound/devsoundrefplugin/src/swcodecwrapper/mmfSwCodecConvertDataPath.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
//
sl@0
    15
sl@0
    16
#ifndef __MMFSWCODECCONVERTDATAPATH_H__
sl@0
    17
#define __MMFSWCODECCONVERTDATAPATH_H__
sl@0
    18
sl@0
    19
#include <e32base.h>
sl@0
    20
sl@0
    21
#include "mmfSwCodecDataPath.h"
sl@0
    22
sl@0
    23
/**
sl@0
    24
 *  Derived class for convert datapath internal to the Sw codec wrapper
sl@0
    25
 *  @internalComponent
sl@0
    26
 */
sl@0
    27
class CMMFSwCodecConvertDataPath : public CMMFSwCodecDataPathX
sl@0
    28
	{ 
sl@0
    29
public:	
sl@0
    30
	static CMMFSwCodecConvertDataPath* NewL();
sl@0
    31
	virtual ~CMMFSwCodecConvertDataPath(); 
sl@0
    32
	virtual TInt SetObserver(MMMFHwDeviceObserver &aHwObserver);
sl@0
    33
	virtual TInt AddCodec(CMMFSwCodec& aCodec);
sl@0
    34
	virtual TInt Start();
sl@0
    35
	virtual void Stop();
sl@0
    36
	virtual void Pause();
sl@0
    37
	virtual void BufferFilledL(CMMFDataBuffer& aBuffer);
sl@0
    38
	virtual void BufferEmptiedL(const CMMFDataBuffer& aBuffer);	
sl@0
    39
	virtual void SoundDeviceException(TInt aError);
sl@0
    40
	virtual RMdaDevSound& Device();
sl@0
    41
	void FillSourceBufferL();
sl@0
    42
	void FillSinkBufferL();
sl@0
    43
	void EmptySinkBufferL();
sl@0
    44
private:	
sl@0
    45
	CMMFSwCodecConvertDataPath() {};
sl@0
    46
	void ConstructL();	
sl@0
    47
private: 
sl@0
    48
	/**
sl@0
    49
     * Private class for the convert datapath that is an active object
sl@0
    50
	 * used to drive the conversion.  This class performs the main data transfer
sl@0
    51
	 * between the source and the sink.
sl@0
    52
     * This is done in a separate class as opposed to CMMFSwCodecConvertDataPath
sl@0
    53
     * because the class needs to be an active object to avoid recursive call stacks
sl@0
    54
     * in cases where the source and sink are not active objects - which is
sl@0
    55
     * the case with descriptors.  Making CMMFSwCodecConvertDataPath derive
sl@0
    56
     * from CActive is less desirable as it would involve multiple inheretence
sl@0
    57
     * @internalComponent
sl@0
    58
     */
sl@0
    59
	class CDataPathConverter : public CActive
sl@0
    60
	{
sl@0
    61
	public:
sl@0
    62
		enum TConvertState
sl@0
    63
		{
sl@0
    64
		EIdle,
sl@0
    65
		EFillingSourceBuffer,
sl@0
    66
		EFillingSinkBuffer,
sl@0
    67
		EEmptyingSinkBuffer
sl@0
    68
		};
sl@0
    69
	public:
sl@0
    70
		CDataPathConverter(CMMFSwCodecConvertDataPath& aParent, TInt aPriority);
sl@0
    71
		~CDataPathConverter();
sl@0
    72
		void Start();
sl@0
    73
		void BufferFilledL(CMMFDataBuffer& aBuffer);
sl@0
    74
		void BufferEmptiedL(CMMFDataBuffer& aBuffer);
sl@0
    75
		void ChangeConvertState(TConvertState aNewConvertState);
sl@0
    76
		//CActive
sl@0
    77
		virtual void RunL();
sl@0
    78
		virtual TInt RunError(TInt aError);
sl@0
    79
		virtual void DoCancel();
sl@0
    80
	private:	
sl@0
    81
		void FillSourceBufferL();
sl@0
    82
		void FillSinkBufferL();
sl@0
    83
		void EmptySinkBufferL();
sl@0
    84
	private:
sl@0
    85
		TConvertState iConvertState;
sl@0
    86
		CMMFSwCodecConvertDataPath& iParent;
sl@0
    87
		CMMFDataBuffer* iSourceBuffer;
sl@0
    88
	};
sl@0
    89
private: 
sl@0
    90
	CDataPathConverter* iDataPathConverter;
sl@0
    91
	CMMFDataBuffer* iSourceBuffer;
sl@0
    92
	CMMFDataBuffer* iSinkBuffer;
sl@0
    93
	TBool iNoMoreSourceData;
sl@0
    94
	TUint iSinkBufferSize;
sl@0
    95
	TUint iSourceBufferSize;
sl@0
    96
	RMdaDevSound iDummyDevSound;//don't need a devsound for convert
sl@0
    97
	};
sl@0
    98
sl@0
    99
#endif
sl@0
   100