os/mm/mmlibs/mmfw/tsrc/mmfunittest/VCLNT/TS_VideoOutput/MmfVideoOutput.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) 2002-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 __MMF_VIDEOOUTPUT_H__
sl@0
    17
#define __MMF_VIDEOOUTPUT_H__
sl@0
    18
sl@0
    19
// Standard EPOC32 includes required by this header file
sl@0
    20
#include <e32base.h>
sl@0
    21
#include <e32std.h>
sl@0
    22
sl@0
    23
#include <e32hal.h>
sl@0
    24
#include <e32svr.h>
sl@0
    25
sl@0
    26
// Public Media Server includes
sl@0
    27
#include <mmf/server/mmfdatasink.h>
sl@0
    28
#include <mmf/server/mmfdatasource.h>
sl@0
    29
#include <mmf/server/mmfdatapath.h>
sl@0
    30
#include <mmf/server/mmfdatasourcesink.hrh>
sl@0
    31
sl@0
    32
#include <mmf/server/mmfcodec.h>
sl@0
    33
#include <mmf/server/mmfdatabuffer.h>
sl@0
    34
#include <mmf/common/mmfpaniccodes.h>
sl@0
    35
sl@0
    36
#include "mmfVideoOutputInterfaceUIDs.hrh"
sl@0
    37
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
sl@0
    38
#include <mmf/common/mmfhelper.h>
sl@0
    39
#endif
sl@0
    40
sl@0
    41
const TUint KVideoOutputDefaultFrameSize = 0x1000;
sl@0
    42
const TUid KUidMmfVideoOutput	= {KMmfUidVideoOutputInterface};
sl@0
    43
sl@0
    44
sl@0
    45
void Panic(TInt aPanicCode);
sl@0
    46
sl@0
    47
class MMMFVideoOutput : public MDataSink
sl@0
    48
/*
sl@0
    49
Interface class to allow dynamic linkage to CMMFVideoOutput.
sl@0
    50
*/
sl@0
    51
	{
sl@0
    52
public:
sl@0
    53
	//factory function
sl@0
    54
	inline static MMMFVideoOutput* NewVideoOutputL(TUid aImplementationUid, const TDesC8& aInitData);
sl@0
    55
	//interface
sl@0
    56
protected:
sl@0
    57
	//constructor
sl@0
    58
	MMMFVideoOutput() : MDataSink(KUidMmfVideoOutput) {}
sl@0
    59
	};
sl@0
    60
sl@0
    61
inline MMMFVideoOutput* MMMFVideoOutput::NewVideoOutputL( TUid aImplementationUid,  const TDesC8& aInitData )
sl@0
    62
	{
sl@0
    63
	//make sure the cast will be ok by checking the uid is what we expect
sl@0
    64
//	__ASSERT_ALWAYS(aImplementationUid==KUidMmfVideoOutput, Panic(EMMFVideoOutputPanicBadUID));
sl@0
    65
	MMMFVideoOutput* retPtr = STATIC_CAST(MMMFVideoOutput*, MDataSink::NewSinkL(aImplementationUid, aInitData));
sl@0
    66
	return retPtr;
sl@0
    67
	}
sl@0
    68
sl@0
    69
class CHardwareCodec;
sl@0
    70
sl@0
    71
class CMMFVideoOutput : public CBase, public MMMFVideoOutput
sl@0
    72
/**
sl@0
    73
The interface into DevSound
sl@0
    74
**/
sl@0
    75
	{
sl@0
    76
public:
sl@0
    77
	static MDataSink* NewSinkL() ;
sl@0
    78
	virtual ~CMMFVideoOutput();
sl@0
    79
sl@0
    80
	//MDataSink mixin implementations
sl@0
    81
	virtual TFourCC SinkDataTypeCode(TMediaId /*aMediaId*/); //used by data path MDataSource/Sink for codec matching
sl@0
    82
	virtual void EmptyBufferL(CMMFBuffer* aBuffer, MDataSource* aSupplier, TMediaId /*aMediaId*/);//called by a MDataSource to empty a buffer
sl@0
    83
	virtual void BufferFilledL(CMMFBuffer* aBuffer); //called by MDataSource to pass back full buffer to the sink
sl@0
    84
	virtual TBool CanCreateSinkBuffer();
sl@0
    85
	virtual CMMFBuffer* CreateSinkBufferL(TMediaId /*aMediaId*/, TBool &aReference);
sl@0
    86
	virtual TInt SinkThreadLogon(MAsyncEventHandler& aEventHandler);
sl@0
    87
	virtual void SinkThreadLogoff();
sl@0
    88
	virtual void SinkPrimeL();
sl@0
    89
	virtual void SinkPauseL();
sl@0
    90
	virtual void SinkPlayL();
sl@0
    91
	virtual void SinkStopL();
sl@0
    92
	virtual void SetSinkPrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
sl@0
    93
	TInt State();
sl@0
    94
	virtual void NegotiateL(MDataSource& aSource);
sl@0
    95
sl@0
    96
sl@0
    97
protected:
sl@0
    98
	virtual void ConstructSinkL( const TDesC8& aInitData ) ;
sl@0
    99
sl@0
   100
private:
sl@0
   101
	inline CMMFVideoOutput() {}
sl@0
   102
sl@0
   103
private:
sl@0
   104
sl@0
   105
	MAsyncEventHandler* iEventHandler;
sl@0
   106
sl@0
   107
	CMMFDataBuffer* iLastVideoBuffer;
sl@0
   108
	CMMFDataBuffer* iVideoBufferCopy;
sl@0
   109
sl@0
   110
	enum TCodec
sl@0
   111
		{
sl@0
   112
		EUseARMCodec=0,
sl@0
   113
		EUseHWCodec
sl@0
   114
		};
sl@0
   115
sl@0
   116
	enum TState
sl@0
   117
		{
sl@0
   118
		EIdle=0,
sl@0
   119
		EDevSoundReady,
sl@0
   120
		EMMFDevSoundFirstBufferSent,
sl@0
   121
		EPlaying,
sl@0
   122
		EPaused,
sl@0
   123
		EBufferEmpty
sl@0
   124
		};
sl@0
   125
sl@0
   126
	enum TError
sl@0
   127
		{
sl@0
   128
		ECantCreateBuffer,
sl@0
   129
		EEmptyBuffer,
sl@0
   130
		EDevSoundNotLoaded,
sl@0
   131
		ERecordNotSupported,
sl@0
   132
		EDevSoundError,
sl@0
   133
		EUnknown
sl@0
   134
		};
sl@0
   135
sl@0
   136
	MDataSource* iSupplier;
sl@0
   137
	TState iState;
sl@0
   138
	CHardwareCodec* iHWCodec;
sl@0
   139
sl@0
   140
	TBool iFirstBufferSent;
sl@0
   141
	TBool iDevSoundLoaded;
sl@0
   142
sl@0
   143
	TError iError;
sl@0
   144
sl@0
   145
	TCodec iCodecSelect;
sl@0
   146
	TMMFPrioritySettings iPrioritySettings;
sl@0
   147
sl@0
   148
	TUint iSourceSampleRate;
sl@0
   149
	TUint iSourceChannels;
sl@0
   150
	TFourCC iSourceFourCC;
sl@0
   151
	TBool iNeedsSWConversion;
sl@0
   152
	CMMFChannelAndSampleRateConverterFactory* iChannelAndSampleRateConverterFactory;
sl@0
   153
	CMMFChannelAndSampleRateConverter* iChannelAndSampleRateConverter;
sl@0
   154
	CMMFDataBuffer* iConvertBuffer;
sl@0
   155
	CMMFBuffer* iBufferToEmpty;
sl@0
   156
	CMMFDataBuffer* iDevSoundBuffer;
sl@0
   157
	TUint iDestinationSampleRate;
sl@0
   158
	TUint iDestinationChannels;
sl@0
   159
	};
sl@0
   160
sl@0
   161
#endif