|
1 /* |
|
2 * Copyright (c) 2006 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: Definition of the S60 Audio Stream Source custom command msg cods. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef DATABUFFERDATASOURCE_H |
|
20 #define DATABUFFERDATASOURCE_H |
|
21 |
|
22 #include <e32base.h> |
|
23 #include <DRMConfigTypes.h> |
|
24 |
|
25 // Public Media Server includes |
|
26 //#include <mmfdatasink.h> |
|
27 #include <mmfdatasource.h> |
|
28 //#include <mmfdatapath.h> |
|
29 #include <mmfdatasourcesink.hrh> |
|
30 #include <mmfaudioiointerfaceuids.hrh> |
|
31 #include <mmffourcc.h> |
|
32 #include <MultimediaDataSource.h> |
|
33 #include <DataBufferSource.h> |
|
34 #include "DataCopyEngineObserver.h" |
|
35 #include "ParentChildIntfc.h" |
|
36 |
|
37 // FORWARD DECLARATIONS |
|
38 class CSourceQueueItem; |
|
39 class CSinkQueueItem; |
|
40 class CDataCopyEngineAO; |
|
41 using multimedia::TBufferingConfig; |
|
42 class CDataBufferMultimediaSource; |
|
43 // CLASS DECLARATION |
|
44 class CDataBufferSource : public MDataSource |
|
45 { |
|
46 public: |
|
47 static CDataBufferSource* NewL( TUid aType ); |
|
48 ~CDataBufferSource(void); |
|
49 // From MDataSource begins |
|
50 TUid DataSourceType() const; |
|
51 TFourCC SourceDataTypeCode( TMediaId aMediaId ); |
|
52 TInt SetSourceDataTypeCode( TFourCC aSourceFourCC, TMediaId aMediaId ); |
|
53 void FillBufferL( CMMFBuffer* aBuffer, MDataSink* aConsumer, TMediaId aMediaId ); |
|
54 void BufferEmptiedL( CMMFBuffer* aBuffer ); |
|
55 TBool CanCreateSourceBuffer(); |
|
56 CMMFBuffer* CreateSourceBufferL( TMediaId aMediaId, TBool& aReference ); |
|
57 TInt SourceThreadLogon(MAsyncEventHandler& aEventHandler); |
|
58 void SourceThreadLogoff(); |
|
59 void SourcePrimeL(); |
|
60 void SourcePlayL(); |
|
61 void SourceStopL(); |
|
62 void SourceCustomCommand(TMMFMessage& aMessage); |
|
63 void ConstructSourceL( const TDesC8& aInitData ); |
|
64 // From MDataSource ends |
|
65 |
|
66 void SetMultimediaSource(CDataBufferMultimediaSource& aMultimediaSource); |
|
67 |
|
68 private: |
|
69 CDataBufferSource(TUid aType); |
|
70 |
|
71 void ConstructL (void); |
|
72 private: |
|
73 //Data |
|
74 CDataBufferMultimediaSource* iMultiMediaSource; |
|
75 |
|
76 }; |
|
77 |
|
78 class CDataBufferMultimediaSource : public CMultimediaDataSource, |
|
79 public MDataCopyEngineObserver, |
|
80 public CParentIntfc |
|
81 { |
|
82 public: |
|
83 IMPORT_C static CDataBufferMultimediaSource* NewL(MDataSource& aDataSource); |
|
84 |
|
85 // From CMultimediaDataSource begins |
|
86 TInt SetObserver( MMultimediaDataSourceObserver& aObserver ); |
|
87 TInt GetObserver( MMultimediaDataSourceObserver*& aObserver ); |
|
88 void Event( TUid aEvent ); |
|
89 TInt SetDataTypeCode(TFourCC aSourceFourCC ); |
|
90 TInt GetDataTypeCode(TFourCC& aSourceFourCC ); |
|
91 TInt GetSize( TUint& aSize ); |
|
92 TInt Open(); |
|
93 TInt Close(); |
|
94 TInt Prime(); |
|
95 TInt Play(); |
|
96 TInt Stop(); |
|
97 TInt FillBuffer( CMMFBuffer* aBuffer); |
|
98 TInt GetInterface( |
|
99 TUid aInterfaceId, |
|
100 TVersion& aVer, |
|
101 TAny*& aInterfaceImpl ); |
|
102 TInt EvaluateIntent( ContentAccess::TIntent aIntent ); |
|
103 TInt ExecuteIntent( ContentAccess::TIntent aIntent ); |
|
104 // From CMultimediaDataSource ends |
|
105 |
|
106 // From MCustomInterface |
|
107 TAny* CustomInterface( TUid aInterfaceUid ); |
|
108 |
|
109 |
|
110 // From MDataCopyEngineObserver begins |
|
111 // Called by iDataCopyEngineAO when item on source queue is processed |
|
112 void SourceQueueItemProcessed(); |
|
113 // Called by iDataCopyEngineAO when item on sink queue is processed |
|
114 void SinkQueueItemProcessed(); |
|
115 // From MDataCopyEngineObserver ends |
|
116 |
|
117 void SourceCustomCommand(TMMFMessage& aMessage); |
|
118 |
|
119 // A common function that implements FillBuffer requests |
|
120 TInt ServiceFillBuffer( CMMFBuffer* aBuffer, |
|
121 MMultimediaDataSourceObserver* aObserver, |
|
122 MDataSink* aConsumer ); |
|
123 |
|
124 // To be called by DRMConfig Interface begins |
|
125 TInt GetDRMType( TDRMType& aDRMType ); |
|
126 TInt GetAllowedOutputDeviceCount( TInt& aCount ); |
|
127 TInt GetAllowedOutputDevice( |
|
128 TInt aIndex, |
|
129 TDRMAllowedOutputDevice& aOutputDevice ); |
|
130 // To be called by DRMConfig Interface ends |
|
131 |
|
132 private: |
|
133 CDataBufferMultimediaSource(MDataSource& aDataSource); |
|
134 ~CDataBufferMultimediaSource(void); |
|
135 void ConstructL (void); |
|
136 // A common function that implements FillBuffer requests |
|
137 TInt AppendBufferToSinkQueue( CMMFBuffer* aBuffer, |
|
138 MMultimediaDataSourceObserver* aObserver, |
|
139 MDataSink* aConsumer ); |
|
140 // Reset queues |
|
141 TInt EmptySourceQueue(); |
|
142 TInt EmptySinkQueue(); |
|
143 |
|
144 // Calculate BufferedDataSize |
|
145 void CalculateBufferdDataSize(); |
|
146 |
|
147 // Handles SetDRMConfig custom command |
|
148 TInt HandleSetDRMConfig( TMMFMessage& aMessage ); |
|
149 // Implements SetDRMConfig custom command |
|
150 void DoSetDRMConfigL( TMMFMessage& aMessage ); |
|
151 TInt DoHandleCancel( TMMFMessage& aMessage ); |
|
152 |
|
153 private: // Data |
|
154 |
|
155 // Queue of data buffers from client |
|
156 TSglQue<CSourceQueueItem>* iSourceQueue; |
|
157 // Queue of buffers from controller |
|
158 TSglQue<CSinkQueueItem>* iSinkQueue; |
|
159 // Pointer to DataCopyEngineAO owned by this |
|
160 CDataCopyEngineAO* iDataCopyEngineAO; |
|
161 // Source item Counter |
|
162 TInt iSrcItemsCount; |
|
163 // Sink item Counter |
|
164 TInt iSnkItemsCount; |
|
165 // Number of bytes received from client so far |
|
166 TUint iSrcBytes; |
|
167 // Number of bytes copied to controller so far |
|
168 TUint iSnkBytes; |
|
169 // Size of source (Set by the application) |
|
170 TUint iSizeBytes; |
|
171 // FourCC |
|
172 TFourCC iSourceFourCC; |
|
173 // Reference to MMultimedia data source |
|
174 MMultimediaDataSourceObserver* iObserver; |
|
175 // Observer bit rate in bps |
|
176 TUint iObserverBitRate; |
|
177 // Transfer bit rate in bps |
|
178 TUint iTransferRate; |
|
179 // Buffering size in bytes |
|
180 TUint iBufferedDataSize; |
|
181 // Holds true if last buffer is received or not |
|
182 TBool iLastBufferReceived; |
|
183 |
|
184 TBufferingConfig iBufferingConfig; |
|
185 |
|
186 TMMFMessage* iMessage; |
|
187 |
|
188 /* Attributes to hold DRM Info */ |
|
189 // Holds DRM Type set by client |
|
190 TDRMType iDRMType; |
|
191 // Holds list of allowed output devices set by client |
|
192 RArray<TDRMAllowedOutputDevice> iAllowedOutputDeviceList; |
|
193 // Parent MDataSource |
|
194 MDataSource* iParentDataSource; |
|
195 |
|
196 }; |
|
197 |
|
198 #endif // DATABUFFERDATASOURCE_H |
|
199 |
|
200 // End of File |