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_VIDEOINPUT_H__
|
sl@0
|
17 |
#define __MMF_VIDEOINPUT_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 "mmfVideoInputInterfaceUIDs.hrh"
|
sl@0
|
37 |
#ifdef SYMBIAN_ENABLE_SPLIT_HEADERS
|
sl@0
|
38 |
#include <mmf/common/mmfhelper.h>
|
sl@0
|
39 |
#endif
|
sl@0
|
40 |
// DevSound
|
sl@0
|
41 |
|
sl@0
|
42 |
const TUint KVideoInputDefaultFrameSize = 0x1000;
|
sl@0
|
43 |
//#define KVideoInputCanResample //uncomment this to allow Video Input to sample rate convert
|
sl@0
|
44 |
const TUid KUidMmfVideoInput = {KMmfUidVideoInputInterface};
|
sl@0
|
45 |
|
sl@0
|
46 |
class CHardwareCodec;
|
sl@0
|
47 |
|
sl@0
|
48 |
void Panic(TInt aPanicCode);
|
sl@0
|
49 |
|
sl@0
|
50 |
class MMMFVideoInput : public MDataSource
|
sl@0
|
51 |
/*
|
sl@0
|
52 |
Interface class to allow dynamic linkage to CMMFVideoInput.
|
sl@0
|
53 |
*/
|
sl@0
|
54 |
{
|
sl@0
|
55 |
public:
|
sl@0
|
56 |
//factory function
|
sl@0
|
57 |
inline static MMMFVideoInput* NewVideoInputL(TUid aImplementationUid, const TDesC8& aInitData);
|
sl@0
|
58 |
//interface
|
sl@0
|
59 |
virtual void HWFillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer) = 0;
|
sl@0
|
60 |
protected:
|
sl@0
|
61 |
//constructor
|
sl@0
|
62 |
inline MMMFVideoInput() : MDataSource(KUidMmfVideoInput) {};
|
sl@0
|
63 |
};
|
sl@0
|
64 |
|
sl@0
|
65 |
inline MMMFVideoInput* MMMFVideoInput::NewVideoInputL( TUid aImplementationUid, const TDesC8& aInitData )
|
sl@0
|
66 |
{
|
sl@0
|
67 |
//make sure the cast will be ok by checking the uid is what we expect
|
sl@0
|
68 |
// __ASSERT_ALWAYS(aImplementationUid==KUidMmfVideoInput, Panic(EMMFVideoInputPanicBadUID));
|
sl@0
|
69 |
MMMFVideoInput* retPtr = STATIC_CAST(MMMFVideoInput*, MDataSource::NewSourceL(aImplementationUid, aInitData));
|
sl@0
|
70 |
return retPtr;
|
sl@0
|
71 |
}
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
class CMMFVideoInput : public CBase, public MMMFVideoInput
|
sl@0
|
75 |
/**
|
sl@0
|
76 |
The interface into DevSound
|
sl@0
|
77 |
**/
|
sl@0
|
78 |
{
|
sl@0
|
79 |
public:
|
sl@0
|
80 |
|
sl@0
|
81 |
static MDataSource* NewSourceL();
|
sl@0
|
82 |
virtual ~CMMFVideoInput();
|
sl@0
|
83 |
|
sl@0
|
84 |
//MDataSource mixin implementations
|
sl@0
|
85 |
virtual TFourCC SourceDataTypeCode(TMediaId /*aMediaId*/);
|
sl@0
|
86 |
virtual void FillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer,TMediaId /*aMediaId*/);//called by a MDataSink to request buffer fill
|
sl@0
|
87 |
virtual void BufferEmptiedL(CMMFBuffer* aBuffer); //called by MDataSink to pass back emptied buffer to the source
|
sl@0
|
88 |
virtual TBool CanCreateSourceBuffer();
|
sl@0
|
89 |
virtual CMMFBuffer* CreateSourceBufferL(TMediaId /*aMediaId*/);
|
sl@0
|
90 |
//XXX optimal source buffer size creation may depend on the sink buffer & vice versa
|
sl@0
|
91 |
virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer& /*aSinkBuffer*/)
|
sl@0
|
92 |
{return CreateSourceBufferL(aMediaId);};
|
sl@0
|
93 |
virtual CMMFBuffer* CreateSourceBufferL(TMediaId /*aMediaId*/, TBool &aReference);
|
sl@0
|
94 |
//XXX optimal source buffer size creation may depend on the sink buffer & vice versa
|
sl@0
|
95 |
virtual CMMFBuffer* CreateSourceBufferL(TMediaId aMediaId, CMMFBuffer& /*aSinkBuffer*/, TBool &aReference)
|
sl@0
|
96 |
{return CreateSourceBufferL(aMediaId, aReference);};
|
sl@0
|
97 |
virtual TInt SourceThreadLogon(MAsyncEventHandler& aEventHandler);
|
sl@0
|
98 |
virtual void SourceThreadLogoff();
|
sl@0
|
99 |
virtual void SourcePrimeL();
|
sl@0
|
100 |
virtual void SourceStopL();
|
sl@0
|
101 |
virtual void SourcePlayL();
|
sl@0
|
102 |
virtual void SetSourcePrioritySettings(const TMMFPrioritySettings& aPrioritySettings);
|
sl@0
|
103 |
|
sl@0
|
104 |
virtual void NegotiateL(MDataSink& aSink);
|
sl@0
|
105 |
|
sl@0
|
106 |
// MMMFVideoInput mixin implementations
|
sl@0
|
107 |
TInt BytesPlayed();
|
sl@0
|
108 |
void HWFillBufferL(CMMFBuffer* aBuffer, MDataSink* aConsumer); //called by a FillBufferL if using HW codec
|
sl@0
|
109 |
|
sl@0
|
110 |
TRequestStatus iBufferStatus;
|
sl@0
|
111 |
|
sl@0
|
112 |
protected:
|
sl@0
|
113 |
virtual void ConstructSourceL( const TDesC8& aInitData ) ;
|
sl@0
|
114 |
|
sl@0
|
115 |
private:
|
sl@0
|
116 |
inline CMMFVideoInput() {}
|
sl@0
|
117 |
|
sl@0
|
118 |
MAsyncEventHandler* iEventHandler;
|
sl@0
|
119 |
|
sl@0
|
120 |
|
sl@0
|
121 |
|
sl@0
|
122 |
private:
|
sl@0
|
123 |
|
sl@0
|
124 |
enum TCodec
|
sl@0
|
125 |
{
|
sl@0
|
126 |
EUseARMCodec=0,
|
sl@0
|
127 |
EUseHWCodec
|
sl@0
|
128 |
};
|
sl@0
|
129 |
|
sl@0
|
130 |
enum TState
|
sl@0
|
131 |
{
|
sl@0
|
132 |
EIdle=0,
|
sl@0
|
133 |
EDevSoundReady,
|
sl@0
|
134 |
EBufferEmpty
|
sl@0
|
135 |
};
|
sl@0
|
136 |
|
sl@0
|
137 |
enum TError
|
sl@0
|
138 |
{
|
sl@0
|
139 |
ECantCreateBuffer,
|
sl@0
|
140 |
EEmptyBuffer,
|
sl@0
|
141 |
EDevSoundNotLoaded,
|
sl@0
|
142 |
EUnknown
|
sl@0
|
143 |
};
|
sl@0
|
144 |
|
sl@0
|
145 |
|
sl@0
|
146 |
MDataSink* iConsumer;
|
sl@0
|
147 |
TState iState;
|
sl@0
|
148 |
CHardwareCodec* iHWCodec;
|
sl@0
|
149 |
CMMFBuffer* iBuffer;
|
sl@0
|
150 |
|
sl@0
|
151 |
TBool iFirstBufferRead;
|
sl@0
|
152 |
|
sl@0
|
153 |
TBool iDevSoundLoaded;
|
sl@0
|
154 |
TBool iStopped;
|
sl@0
|
155 |
|
sl@0
|
156 |
TError iError;
|
sl@0
|
157 |
TInt iMMFDevsoundError;
|
sl@0
|
158 |
TCodec iCodecSelect;
|
sl@0
|
159 |
TMMFPrioritySettings iPrioritySettings;
|
sl@0
|
160 |
|
sl@0
|
161 |
TUint iSinkSampleRate;
|
sl@0
|
162 |
TUint iSinkChannels;
|
sl@0
|
163 |
TFourCC iSinkFourCC;
|
sl@0
|
164 |
TBool iNeedsSWConversion;
|
sl@0
|
165 |
CMMFChannelAndSampleRateConverterFactory* iChannelAndSampleRateConverterFactory;
|
sl@0
|
166 |
CMMFChannelAndSampleRateConverter* iChannelAndSampleRateConverter;
|
sl@0
|
167 |
CMMFDataBuffer* iConvertBuffer;
|
sl@0
|
168 |
CMMFBuffer* iBufferToEmpty;
|
sl@0
|
169 |
CMMFBuffer* iDevSoundBuf;
|
sl@0
|
170 |
};
|
sl@0
|
171 |
|
sl@0
|
172 |
#endif
|