|
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 #include "mdfvideoencodehwdeviceadapter.h" |
|
17 #include <mmf/server/mmfdatabuffer.h> |
|
18 #include <mmf/devvideo/devvideobase.h> |
|
19 #include <mmf/devvideo/devvideopuconfig.h> |
|
20 #include <mmf/server/mmfdatabuffer.h> |
|
21 |
|
22 // Literal descriptor for the encoder's info |
|
23 _LIT8(KEncoderInfoCSInfo, "Coded by Symbian"); |
|
24 // Literal descriptor for the encoder's implementation info |
|
25 _LIT8(KEncoderInfoISInfo, "Implemented by Symbian"); |
|
26 // Literal descriptor for the video encoder panic |
|
27 _LIT(KDevVideoEncoderPanicCategory, "DevVideoEncoder"); |
|
28 |
|
29 // Processing unit's input port index |
|
30 const TInt KEncoderPUInputPortIndex = 0; |
|
31 // Processing unit's output port index |
|
32 const TInt KEncoderPUOutputPortIndex = 0; |
|
33 // Processing unit's major version number |
|
34 const TInt KEncoderPUInfoVersionMaj = 0; |
|
35 // Processing unit's minor version number |
|
36 const TInt KEncoderPUInfoVersionMin = 1; |
|
37 // Processing unit's build version number |
|
38 const TInt KEncoderPUInfoVersionBuild = 1; |
|
39 // Bytes per pixel |
|
40 const TInt KBytesPerPixel = 3; |
|
41 |
|
42 void DevVideoEncoderPanic(TInt aReason) |
|
43 { |
|
44 User::Panic(KDevVideoEncoderPanicCategory, aReason); |
|
45 } |
|
46 |
|
47 |
|
48 /** |
|
49 Constructs a new instance of CMdfVideoEncodeHwDeviceAdapter. |
|
50 @return "CMdfVideoEncodeHwDeviceAdapter*" |
|
51 A pointer to the newly constructed HwDevice |
|
52 */ |
|
53 CMdfVideoEncodeHwDeviceAdapter* CMdfVideoEncodeHwDeviceAdapter::NewL() |
|
54 { |
|
55 CMdfVideoEncodeHwDeviceAdapter* self = new(ELeave) CMdfVideoEncodeHwDeviceAdapter; |
|
56 CleanupStack::PushL(self); |
|
57 self->ConstructL(); |
|
58 CleanupStack::Pop(self); |
|
59 return self; |
|
60 } |
|
61 |
|
62 /** |
|
63 Default constructor |
|
64 */ |
|
65 CMdfVideoEncodeHwDeviceAdapter::CMdfVideoEncodeHwDeviceAdapter() |
|
66 { |
|
67 } |
|
68 |
|
69 /** |
|
70 Safe contructor for CMdfVideoEncodeHwDeviceAdapter. |
|
71 */ |
|
72 void CMdfVideoEncodeHwDeviceAdapter::ConstructL() |
|
73 { |
|
74 // Load the PU Loader plugin |
|
75 iPuLoader = static_cast<CMdfPuLoader*> |
|
76 (REComSession::CreateImplementationL(TUid::Uid(KUidPuLoaderImplementation), iPuLoaderDtorKey)); |
|
77 } |
|
78 |
|
79 /** |
|
80 Default destructor |
|
81 */ |
|
82 CMdfVideoEncodeHwDeviceAdapter::~CMdfVideoEncodeHwDeviceAdapter() |
|
83 { |
|
84 if(iEncoderPU) |
|
85 { |
|
86 iPuLoader->UnloadProcessingUnit(iEncoderPU); |
|
87 } |
|
88 |
|
89 delete iPuLoader; |
|
90 delete iPuData; |
|
91 delete iManufacturer; |
|
92 REComSession::DestroyedImplementation(iPuLoaderDtorKey); |
|
93 |
|
94 for (TInt i = 0; i < iOutputVideoFormats.Count(); i++) |
|
95 { |
|
96 delete iOutputVideoFormats[i]; |
|
97 } |
|
98 |
|
99 iEncoderPUOutputPortsArray.Reset(); |
|
100 iEncoderPUOutputPortsArray.Close(); |
|
101 |
|
102 iEncoderPUInputPortsArray.Reset(); |
|
103 iEncoderPUInputPortsArray.Close(); |
|
104 |
|
105 iPictureRates.Reset(); |
|
106 iPictureRates.Close(); |
|
107 |
|
108 iInputVideoFormats.Reset(); |
|
109 iInputVideoFormats.Close(); |
|
110 |
|
111 iOutputVideoFormats.Reset(); |
|
112 iOutputVideoFormats.Close(); |
|
113 |
|
114 for (TInt i = 0; i < iDataBuffers.Count(); i++) |
|
115 { |
|
116 User::Free((TAny*)iDataBuffers[i].iData.Ptr()); |
|
117 } |
|
118 iDataBuffers.Reset(); |
|
119 iDataBuffers.Close(); |
|
120 |
|
121 delete iInputBuffer; |
|
122 delete iOutputBuffer; |
|
123 } |
|
124 |
|
125 void CMdfVideoEncodeHwDeviceAdapter::LoadProcessingUnitL(const CImplementationInformation& aImplInfo) |
|
126 { |
|
127 iPuUid = aImplInfo.ImplementationUid(); |
|
128 |
|
129 iEncoderPU = iPuLoader->LoadProcessingUnitL(*this,iPuUid); |
|
130 // store the opaque data associated with this PU so we can extract information about |
|
131 // the PU later |
|
132 iPuData = CCodecApiVideoOpaqueData::NewL(aImplInfo.OpaqueData()); |
|
133 iManufacturer = HBufC::NewL(iPuData->Manufacturer().Length()); |
|
134 iManufacturer->Des().Copy(iPuData->Manufacturer()); |
|
135 } |
|
136 |
|
137 // private method : body of Initialize() |
|
138 void CMdfVideoEncodeHwDeviceAdapter::InitializeL() |
|
139 { |
|
140 if (!iEncoderPU) |
|
141 { |
|
142 iProxy->MdvrpInitializeComplete(this, KErrNotFound); |
|
143 return; |
|
144 } |
|
145 |
|
146 // we have to pre-check that the image format is set correctly, |
|
147 // else an attempt to set it into the config will panic. |
|
148 switch(iFormat.iDataFormat) |
|
149 { |
|
150 case 0: |
|
151 User::Leave(KErrNotReady); |
|
152 break; |
|
153 case ERgbRawData: |
|
154 case ERgbFbsBitmap: |
|
155 case EYuvRawData: |
|
156 break; |
|
157 default: |
|
158 User::Leave(KErrNotSupported); |
|
159 break; |
|
160 } |
|
161 |
|
162 // get the encoder input ports |
|
163 User::LeaveIfError(iEncoderPU->GetInputPorts(iEncoderPUInputPortsArray)); |
|
164 |
|
165 // set the observer for the encoder input ports |
|
166 for(TInt i = 0; i < iEncoderPUInputPortsArray.Count(); i++) |
|
167 { |
|
168 iEncoderPUInputPortsArray[i]->MipSetObserver(*this); |
|
169 } |
|
170 |
|
171 // get the encoder output ports |
|
172 User::LeaveIfError(iEncoderPU->GetOutputPorts(iEncoderPUOutputPortsArray)); |
|
173 |
|
174 // set the observer for the encoder input ports |
|
175 for(TInt i = 0; i < iEncoderPUOutputPortsArray.Count(); i++) |
|
176 { |
|
177 iEncoderPUOutputPortsArray[i]->MopSetObserver(*this); |
|
178 } |
|
179 |
|
180 TInt bufSize = iPictureSize.iHeight * iPictureSize.iWidth * KBytesPerPixel; |
|
181 iDataBuffers.Reset(); |
|
182 |
|
183 // create the buffer. zero out all fields |
|
184 TVideoOutputBuffer buf; |
|
185 memset(&buf, 0, sizeof(buf)); |
|
186 |
|
187 TUint8* bufData = (TUint8*)User::AllocL(bufSize); |
|
188 CleanupStack::PushL(bufData); |
|
189 |
|
190 buf.iData.Set(bufData, bufSize); |
|
191 iDataBuffers.AppendL(buf); |
|
192 |
|
193 CleanupStack::Pop(bufData); // don't destroy - owned by iDataBuffers |
|
194 |
|
195 TDevVideoRecordPuConfig config; |
|
196 config.iFrameSize = iPictureSize; |
|
197 config.iImageFormat = iFormat; |
|
198 config.iFrameRate = iFrameRate; |
|
199 |
|
200 TPuConfigDevVideoRecord puConfig(config); |
|
201 |
|
202 // initialize with config info. |
|
203 iEncoderPU->Configure(puConfig); |
|
204 |
|
205 // create input buffer |
|
206 iInputBuffer = CMMFDescriptorBuffer::NewL(bufSize); |
|
207 iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipUseBuffer(*iInputBuffer); |
|
208 |
|
209 // create output buffer |
|
210 TUint32 outputPortBufferSize = |
|
211 iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopBufferSize(); |
|
212 iOutputBuffer = CMMFDescriptorBuffer::NewL(outputPortBufferSize); |
|
213 iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopUseBuffer(*iOutputBuffer); |
|
214 |
|
215 // initialize the encoder PU |
|
216 iEncoderPU->Initialize(); |
|
217 |
|
218 } |
|
219 |
|
220 /** |
|
221 @see CMMFVideoHwDevice |
|
222 */ |
|
223 TAny* CMdfVideoEncodeHwDeviceAdapter::CustomInterface(TUid aInterface) |
|
224 { |
|
225 if (aInterface.iUid == KUidDevVideoHwDeviceAdapterSetup) |
|
226 { |
|
227 return static_cast<MDevVideoHwDeviceAdapterSetup*>(this); |
|
228 } |
|
229 return NULL; |
|
230 } |
|
231 |
|
232 /** |
|
233 @see CMMFVideoRecordHwDevice |
|
234 */ |
|
235 CPreProcessorInfo* CMdfVideoEncodeHwDeviceAdapter::PreProcessorInfoLC() |
|
236 { |
|
237 // we have no preprocessor info |
|
238 return NULL; |
|
239 } |
|
240 |
|
241 /** |
|
242 @see CMMFVideoRecordHwDevice |
|
243 */ |
|
244 void CMdfVideoEncodeHwDeviceAdapter::SetInputFormatL(const TUncompressedVideoFormat& aFormat, const TSize& aPictureSize) |
|
245 { |
|
246 iFormat = aFormat; |
|
247 iPictureSize = aPictureSize; |
|
248 } |
|
249 |
|
250 /** |
|
251 @see CMMFVideoRecordHwDevice |
|
252 */ |
|
253 void CMdfVideoEncodeHwDeviceAdapter::SetSourceCameraL(TInt /* aCameraHandle */, TReal /* aPictureRate */) |
|
254 { |
|
255 User::Leave(KErrNotSupported); |
|
256 } |
|
257 |
|
258 /** |
|
259 @see CMMFVideoRecordHwDevice |
|
260 */ |
|
261 void CMdfVideoEncodeHwDeviceAdapter::SetSourceMemoryL(TReal aMaxPictureRate, TBool /* aConstantPictureRate */, TBool /* aProcessRealtime */) |
|
262 { |
|
263 iFrameRate = (TInt)aMaxPictureRate; |
|
264 } |
|
265 |
|
266 /** |
|
267 @see CMMFVideoRecordHwDevice |
|
268 */ |
|
269 void CMdfVideoEncodeHwDeviceAdapter::Initialize() |
|
270 { |
|
271 TRAPD(err, InitializeL()); |
|
272 if(err != KErrNone) |
|
273 { |
|
274 iProxy->MdvrpInitializeComplete(this, err); |
|
275 } |
|
276 } |
|
277 |
|
278 /** |
|
279 @see CMMFVideoRecordHwDevice |
|
280 */ |
|
281 void CMdfVideoEncodeHwDeviceAdapter::WritePictureL(TVideoPicture* aPicture) |
|
282 { |
|
283 __ASSERT_ALWAYS(iEncoderPU, DevVideoEncoderPanic(0)); |
|
284 |
|
285 if(!aPicture) |
|
286 { |
|
287 User::Leave(KErrArgument); |
|
288 } |
|
289 |
|
290 // the picture size MUST be the same as the size the encoder has |
|
291 // been initialized with. |
|
292 if(aPicture->iData.iDataSize != iPictureSize) |
|
293 { |
|
294 User::Leave(KErrArgument); |
|
295 } |
|
296 |
|
297 // Picture received : increment picture count |
|
298 iPictureCounters.iInputPictures++; |
|
299 iCurrentPicture = aPicture; |
|
300 TDes8& data = iInputBuffer->Data(); |
|
301 data.SetLength((*aPicture->iData.iRawData).Length()); |
|
302 data.Copy(*aPicture->iData.iRawData); |
|
303 iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipWriteData(*iInputBuffer); |
|
304 iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]->MopReadData(*iOutputBuffer); |
|
305 |
|
306 // Picture encoded : increment picture count |
|
307 iPictureCounters.iPicturesProcessed++; |
|
308 } |
|
309 |
|
310 /** |
|
311 @see CMMFVideoRecordHwDevice |
|
312 */ |
|
313 void CMdfVideoEncodeHwDeviceAdapter::InputEnd() |
|
314 { |
|
315 // The client has notified us it has reached the end of the input stream |
|
316 iInputStreamEnd = ETrue; |
|
317 iProxy->MdvrpStreamEnd(); |
|
318 } |
|
319 |
|
320 /** |
|
321 @see CMMFVideoRecordHwDevice |
|
322 */ |
|
323 void CMdfVideoEncodeHwDeviceAdapter::Start() |
|
324 { |
|
325 __ASSERT_ALWAYS(iEncoderPU, DevVideoEncoderPanic(0)); |
|
326 iEncoderPU->Execute(); |
|
327 } |
|
328 |
|
329 /** |
|
330 @see CMMFVideoRecordHwDevice |
|
331 */ |
|
332 void CMdfVideoEncodeHwDeviceAdapter::Stop() |
|
333 { |
|
334 iProxy->MdvrpFatalError(this, KErrNotSupported); |
|
335 } |
|
336 |
|
337 /** |
|
338 @see CMMFVideoRecordHwDevice |
|
339 */ |
|
340 void CMdfVideoEncodeHwDeviceAdapter::Pause() |
|
341 { |
|
342 iProxy->MdvrpFatalError(this, KErrNotSupported); |
|
343 } |
|
344 |
|
345 /** |
|
346 @see CMMFVideoRecordHwDevice |
|
347 */ |
|
348 void CMdfVideoEncodeHwDeviceAdapter::Resume() |
|
349 { |
|
350 iProxy->MdvrpFatalError(this, KErrNotSupported); |
|
351 } |
|
352 |
|
353 /** |
|
354 @see CMMFVideoRecordHwDevice |
|
355 */ |
|
356 void CMdfVideoEncodeHwDeviceAdapter::Freeze() |
|
357 { |
|
358 iProxy->MdvrpFatalError(this, KErrNotSupported); |
|
359 } |
|
360 |
|
361 /** |
|
362 @see CMMFVideoRecordHwDevice |
|
363 */ |
|
364 void CMdfVideoEncodeHwDeviceAdapter::ReleaseFreeze() |
|
365 { |
|
366 iProxy->MdvrpFatalError(this, KErrNotSupported); |
|
367 } |
|
368 |
|
369 /** |
|
370 @see CMMFVideoRecordHwDevice |
|
371 */ |
|
372 TTimeIntervalMicroSeconds CMdfVideoEncodeHwDeviceAdapter::RecordingPosition() |
|
373 { |
|
374 // return picture count times frame rate |
|
375 return iPictureCounters.iPicturesProcessed * (1000000 / iFrameRate); |
|
376 } |
|
377 |
|
378 /** |
|
379 @see CMMFVideoRecordHwDevice |
|
380 */ |
|
381 void CMdfVideoEncodeHwDeviceAdapter::GetPictureCounters(CMMFDevVideoRecord::TPictureCounters& aCounters) |
|
382 { |
|
383 aCounters = iPictureCounters; |
|
384 } |
|
385 |
|
386 /** |
|
387 @see CMMFVideoRecordHwDevice |
|
388 */ |
|
389 void CMdfVideoEncodeHwDeviceAdapter::GetFrameStabilisationOutput(TRect& aRect) |
|
390 { |
|
391 aRect = TRect(iPictureSize); |
|
392 } |
|
393 |
|
394 /** |
|
395 @see CMMFVideoRecordHwDevice |
|
396 */ |
|
397 TUint CMdfVideoEncodeHwDeviceAdapter::NumComplexityLevels() |
|
398 { |
|
399 // separate complexity levels are not available; return 1 |
|
400 return 1; |
|
401 } |
|
402 |
|
403 /** |
|
404 @see CMMFVideoRecordHwDevice |
|
405 */ |
|
406 void CMdfVideoEncodeHwDeviceAdapter::SetComplexityLevel(TUint /* aLevel */) |
|
407 { |
|
408 } |
|
409 |
|
410 /** |
|
411 @see CMMFVideoEncodeHwDevice |
|
412 */ |
|
413 CVideoEncoderInfo* CMdfVideoEncodeHwDeviceAdapter::VideoEncoderInfoLC() |
|
414 { |
|
415 //if PU is not loaded panic |
|
416 if(iPuData == NULL) |
|
417 { |
|
418 DevVideoEncoderPanic(KErrNotReady); |
|
419 } |
|
420 // output formats array |
|
421 iOutputVideoFormats.Reset(); |
|
422 CCompressedVideoFormat* videoCV = NULL; |
|
423 videoCV = CCompressedVideoFormat::NewL(iPuData->OutputDataType() , KNullDesC8); |
|
424 CleanupStack::PushL(videoCV); |
|
425 iOutputVideoFormats.AppendL(videoCV); |
|
426 // Note; CCompressedVideo object is destroyed in destructor |
|
427 CleanupStack::Pop(videoCV); |
|
428 |
|
429 // input formats array |
|
430 iInputVideoFormats.Reset(); |
|
431 TUncompressedVideoFormat inputFormats[3]; |
|
432 inputFormats[0].iDataFormat = ERgbRawData; |
|
433 inputFormats[0].iRgbFormat = ERgb16bit565; |
|
434 iInputVideoFormats.AppendL(inputFormats[0]); |
|
435 inputFormats[1].iDataFormat = ERgbFbsBitmap; |
|
436 inputFormats[1].iRgbFormat = EFbsBitmapColor16M; |
|
437 iInputVideoFormats.AppendL(inputFormats[1]); |
|
438 inputFormats[2].iDataFormat = EYuvRawData; |
|
439 memset(&inputFormats[2].iYuvFormat, 0, sizeof(TYuvFormat)); |
|
440 iInputVideoFormats.AppendL(inputFormats[2]); |
|
441 |
|
442 // construct the video Encoder info object |
|
443 CVideoEncoderInfo* vInfo = CVideoEncoderInfo::NewL( |
|
444 iPuUid, |
|
445 *iManufacturer, |
|
446 KNullDesC, |
|
447 TVersion(KEncoderPUInfoVersionMaj, KEncoderPUInfoVersionMin, KEncoderPUInfoVersionBuild), |
|
448 EFalse, // not accelerated |
|
449 EFalse, // does not support direct capture |
|
450 iInputVideoFormats.Array(), |
|
451 iOutputVideoFormats.Array(), |
|
452 iPuData->MaxPictureSize(), |
|
453 EDuCodedPicture, // data unit type(s) |
|
454 EDuElementaryStream, // data encapsulation type |
|
455 1, // num bitrate layers |
|
456 EFalse, // does not support supplemental enhancement info |
|
457 1, // unequal error protection levels not supported |
|
458 KMaxTUint32, // max bitrate supported |
|
459 iPuData->MaxPictureRates().Array(), |
|
460 1, // in-layer scalability not supported |
|
461 0, // no supported picture options |
|
462 EFalse, // picture loss not supported, |
|
463 EFalse, // slice loss not supported, |
|
464 KEncoderInfoCSInfo, |
|
465 KEncoderInfoISInfo); |
|
466 |
|
467 CleanupStack::PushL(vInfo); |
|
468 return vInfo; |
|
469 } |
|
470 |
|
471 /** |
|
472 @see CMMFVideoEncodeHwDevice |
|
473 */ |
|
474 void CMdfVideoEncodeHwDeviceAdapter::SetOutputFormatL(const CCompressedVideoFormat& /* aFormat */, |
|
475 TVideoDataUnitType /* aDataUnitType */, |
|
476 TVideoDataUnitEncapsulation /* aDataEncapsulation */, |
|
477 TBool /* aSegmentationAllowed */) |
|
478 { |
|
479 User::Leave(KErrNotSupported); |
|
480 } |
|
481 |
|
482 /** |
|
483 @see CMMFVideoEncodeHwDevice |
|
484 */ |
|
485 void CMdfVideoEncodeHwDeviceAdapter::SetOutputRectL(const TRect& /* aRect */) |
|
486 { |
|
487 User::Leave(KErrNotSupported); |
|
488 } |
|
489 |
|
490 /** |
|
491 @see CMMFVideoEncodeHwDevice |
|
492 */ |
|
493 void CMdfVideoEncodeHwDeviceAdapter::SetInputDevice(CMMFVideoPreProcHwDevice* /*aDevice*/) |
|
494 { |
|
495 // Function is not supported. |
|
496 } |
|
497 |
|
498 /** |
|
499 @see CMMFVideoEncodeHwDevice |
|
500 */ |
|
501 void CMdfVideoEncodeHwDeviceAdapter::SetErrorsExpected(TBool /* aBitErrors */, TBool /* aPacketLosses */) |
|
502 { |
|
503 // Function is not supported. |
|
504 } |
|
505 |
|
506 /** |
|
507 @see CMMFVideoEncodeHwDevice |
|
508 */ |
|
509 void CMdfVideoEncodeHwDeviceAdapter::SetMinRandomAccessRate(TReal /* aRate */) |
|
510 { |
|
511 // Function is not supported. |
|
512 } |
|
513 |
|
514 /** |
|
515 @see CMMFVideoEncodeHwDevice |
|
516 */ |
|
517 void CMdfVideoEncodeHwDeviceAdapter::SetNumBitrateLayersL(TUint /* aNumLayers */) |
|
518 { |
|
519 User::Leave(KErrNotSupported); |
|
520 } |
|
521 |
|
522 /** |
|
523 @see CMMFVideoEncodeHwDevice |
|
524 */ |
|
525 void CMdfVideoEncodeHwDeviceAdapter::SetScalabilityLayerTypeL(TUint /* aLayer */, TScalabilityType /* aScalabilityType */) |
|
526 { |
|
527 User::Leave(KErrNotSupported); |
|
528 } |
|
529 |
|
530 /** |
|
531 @see CMMFVideoEncodeHwDevice |
|
532 */ |
|
533 void CMdfVideoEncodeHwDeviceAdapter::SetGlobalReferenceOptions(TUint /* aMaxReferencePictures */, TUint /* aMaxPictureOrderDelay */) |
|
534 { |
|
535 // Function is not supported. |
|
536 } |
|
537 |
|
538 /** |
|
539 @see CMMFVideoEncodeHwDevice |
|
540 */ |
|
541 void CMdfVideoEncodeHwDeviceAdapter::SetLayerReferenceOptions(TUint /* aLayer */, TUint /* aMaxReferencePictures */, TUint /* aMaxPictureOrderDelay */) |
|
542 { |
|
543 // Function is not supported. |
|
544 } |
|
545 |
|
546 /** |
|
547 @see CMMFVideoEncodeHwDevice |
|
548 */ |
|
549 void CMdfVideoEncodeHwDeviceAdapter::SetBufferOptionsL(const TEncoderBufferOptions& /* aOptions */) |
|
550 { |
|
551 User::Leave(KErrNotSupported); |
|
552 } |
|
553 |
|
554 /** |
|
555 @see CMMFVideoEncodeHwDevice |
|
556 */ |
|
557 void CMdfVideoEncodeHwDeviceAdapter::SetCodingStandardSpecificOptionsL(const TDesC8& /* aOptions */) |
|
558 { |
|
559 User::Leave(KErrNotSupported); |
|
560 } |
|
561 |
|
562 /** |
|
563 @see CMMFVideoEncodeHwDevice |
|
564 */ |
|
565 void CMdfVideoEncodeHwDeviceAdapter::SetImplementationSpecificEncoderOptionsL(const TDesC8& /* aOptions */) |
|
566 { |
|
567 User::Leave(KErrNotSupported); |
|
568 } |
|
569 |
|
570 /** |
|
571 @see CMMFVideoEncodeHwDevice |
|
572 */ |
|
573 HBufC8* CMdfVideoEncodeHwDeviceAdapter::CodingStandardSpecificInitOutputLC() |
|
574 { |
|
575 User::Leave(KErrNotSupported); |
|
576 return NULL; |
|
577 } |
|
578 |
|
579 /** |
|
580 @see CMMFVideoEncodeHwDevice |
|
581 */ |
|
582 HBufC8* CMdfVideoEncodeHwDeviceAdapter::ImplementationSpecificInitOutputLC() |
|
583 { |
|
584 User::Leave(KErrNotSupported); |
|
585 return NULL; |
|
586 } |
|
587 |
|
588 /** |
|
589 @see CMMFVideoEncodeHwDevice |
|
590 */ |
|
591 void CMdfVideoEncodeHwDeviceAdapter::SetErrorProtectionLevelsL(TUint /* aNumLevels */, TBool /* aSeparateBuffers */) |
|
592 { |
|
593 User::Leave(KErrNotSupported); |
|
594 } |
|
595 |
|
596 /** |
|
597 @see CMMFVideoEncodeHwDevice |
|
598 */ |
|
599 void CMdfVideoEncodeHwDeviceAdapter::SetErrorProtectionLevelL(TUint /* aLevel */, TUint /* aBitrate */, TUint /* aStrength */) |
|
600 { |
|
601 User::Leave(KErrNotSupported); |
|
602 } |
|
603 |
|
604 /** |
|
605 @see CMMFVideoEncodeHwDevice |
|
606 */ |
|
607 void CMdfVideoEncodeHwDeviceAdapter::SetChannelPacketLossRate(TUint /* aLevel */, |
|
608 TReal /* aLossRate */, |
|
609 TTimeIntervalMicroSeconds32 /* aLossBurstLength */) |
|
610 { |
|
611 // Function is not supported. |
|
612 } |
|
613 |
|
614 /** |
|
615 @see CMMFVideoEncodeHwDevice |
|
616 */ |
|
617 void CMdfVideoEncodeHwDeviceAdapter::SetChannelBitErrorRate(TUint /* aLevel */, TReal /* aErrorRate */, TReal /* aStdDeviation */) |
|
618 { |
|
619 // Function is not supported. |
|
620 } |
|
621 |
|
622 /** |
|
623 @see CMMFVideoEncodeHwDevice |
|
624 */ |
|
625 void CMdfVideoEncodeHwDeviceAdapter::SetSegmentTargetSize(TUint /* aLayer */, TUint /* aSizeBytes */, TUint /* aSizeMacroblocks */) |
|
626 { |
|
627 // Function is not supported. |
|
628 } |
|
629 |
|
630 /** |
|
631 @see CMMFVideoEncodeHwDevice |
|
632 */ |
|
633 void CMdfVideoEncodeHwDeviceAdapter::SetRateControlOptions(TUint /* aLayer */, const TRateControlOptions& /* aOptions */) |
|
634 { |
|
635 // Function is not supported. |
|
636 } |
|
637 |
|
638 /** |
|
639 @see CMMFVideoEncodeHwDevice |
|
640 */ |
|
641 void CMdfVideoEncodeHwDeviceAdapter::SetInLayerScalabilityL(TUint /* aLayer */, TUint /* aNumSteps */, |
|
642 TInLayerScalabilityType /* aScalabilityType */, |
|
643 const TArray<TUint>& /* aBitrateShare */, |
|
644 const TArray<TUint>& /* aPictureShare */) |
|
645 { |
|
646 User::Leave(KErrNotSupported); |
|
647 } |
|
648 |
|
649 /** |
|
650 @see CMMFVideoEncodeHwDevice |
|
651 */ |
|
652 void CMdfVideoEncodeHwDeviceAdapter::SetLayerPromotionPointPeriod(TUint /* aLayer */, TUint /* aPeriod */) |
|
653 { |
|
654 // Function is not supported. |
|
655 } |
|
656 |
|
657 /** |
|
658 @see CMMFVideoEncodeHwDevice |
|
659 */ |
|
660 HBufC8* CMdfVideoEncodeHwDeviceAdapter::CodingStandardSpecificSettingsOutputLC() |
|
661 { |
|
662 User::Leave(KErrNotSupported); |
|
663 return NULL; |
|
664 } |
|
665 |
|
666 /** |
|
667 @see CMMFVideoEncodeHwDevice |
|
668 */ |
|
669 HBufC8* CMdfVideoEncodeHwDeviceAdapter::ImplementationSpecificSettingsOutputLC() |
|
670 { |
|
671 User::Leave(KErrNotSupported); |
|
672 return NULL; |
|
673 } |
|
674 |
|
675 /** |
|
676 @see CMMFVideoEncodeHwDevice |
|
677 */ |
|
678 void CMdfVideoEncodeHwDeviceAdapter::SendSupplementalInfoL(const TDesC8& /* aData */) |
|
679 { |
|
680 User::Leave(KErrNotSupported); |
|
681 } |
|
682 |
|
683 /** |
|
684 @see CMMFVideoEncodeHwDevice |
|
685 */ |
|
686 void CMdfVideoEncodeHwDeviceAdapter::SendSupplementalInfoL(const TDesC8& /* aData */, const TTimeIntervalMicroSeconds& /* aTimestamp */) |
|
687 { |
|
688 User::Leave(KErrNotSupported); |
|
689 } |
|
690 |
|
691 /** |
|
692 @see CMMFVideoEncodeHwDevice |
|
693 */ |
|
694 void CMdfVideoEncodeHwDeviceAdapter::CancelSupplementalInfo() |
|
695 { |
|
696 // Function is not supported. |
|
697 } |
|
698 |
|
699 /** |
|
700 @see CMMFVideoEncodeHwDevice |
|
701 */ |
|
702 void CMdfVideoEncodeHwDeviceAdapter::GetOutputBufferStatus(TUint& aNumFreeBuffers, TUint& aTotalFreeBytes) |
|
703 { |
|
704 // We have one output buffer, which has a max size of one raw frame. |
|
705 aNumFreeBuffers = 1; |
|
706 aTotalFreeBytes = iDataBuffers[0].iData.Size(); |
|
707 } |
|
708 |
|
709 /** |
|
710 @see CMMFVideoEncodeHwDevice |
|
711 */ |
|
712 void CMdfVideoEncodeHwDeviceAdapter::ReturnBuffer(TVideoOutputBuffer* /*aBuffer*/) |
|
713 { |
|
714 // Receive a used output buffer (from DevVideoRecord) |
|
715 // We do nothing - we have one buffer, which is going to be re-used. |
|
716 } |
|
717 |
|
718 /** |
|
719 @see CMMFVideoEncodeHwDevice |
|
720 */ |
|
721 void CMdfVideoEncodeHwDeviceAdapter::PictureLoss() |
|
722 { |
|
723 // Function is not supported. |
|
724 } |
|
725 |
|
726 /** |
|
727 @see CMMFVideoEncodeHwDevice |
|
728 */ |
|
729 void CMdfVideoEncodeHwDeviceAdapter::PictureLoss(const TArray<TPictureId>& /* aPictures */) |
|
730 { |
|
731 // Function is not supported. |
|
732 } |
|
733 |
|
734 /** |
|
735 @see CMMFVideoEncodeHwDevice |
|
736 */ |
|
737 void CMdfVideoEncodeHwDeviceAdapter::SliceLoss(TUint /* aFirstMacroblock */, TUint /* aNumMacroblocks */, const TPictureId& /* aPicture */) |
|
738 { |
|
739 // Function is not supported. |
|
740 } |
|
741 |
|
742 /** |
|
743 @see CMMFVideoEncodeHwDevice |
|
744 */ |
|
745 void CMdfVideoEncodeHwDeviceAdapter::ReferencePictureSelection(const TDesC8& /* aSelectionData */) |
|
746 { |
|
747 // Function is not supported. |
|
748 } |
|
749 |
|
750 /** |
|
751 @see CMMFVideoRecordHwDevice |
|
752 */ |
|
753 void CMdfVideoEncodeHwDeviceAdapter::CommitL() |
|
754 { |
|
755 User::Leave(KErrNotSupported); |
|
756 } |
|
757 |
|
758 /** |
|
759 @see CMMFVideoRecordHwDevice |
|
760 */ |
|
761 void CMdfVideoEncodeHwDeviceAdapter::Revert() |
|
762 { |
|
763 // Function is not supported. |
|
764 } |
|
765 |
|
766 /** |
|
767 @see CMMFVideoEncodeHwDevice |
|
768 */ |
|
769 void CMdfVideoEncodeHwDeviceAdapter::SetProxy(MMMFDevVideoRecordProxy& aProxy) |
|
770 { |
|
771 ASSERT(!iProxy); |
|
772 iProxy = &aProxy; |
|
773 } |
|
774 |
|
775 void CMdfVideoEncodeHwDeviceAdapter::MipoWriteDataComplete(const MMdfInputPort* aInputPort, CMMFBuffer* aBuffer, TInt aErrorCode) |
|
776 { |
|
777 if (aErrorCode != KErrNone) |
|
778 { |
|
779 iProxy->MdvrpFatalError(this, aErrorCode); |
|
780 return; |
|
781 } |
|
782 |
|
783 if (aInputPort == iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]) |
|
784 { |
|
785 if (aBuffer->LastBuffer()) |
|
786 { |
|
787 iEncoderPU->Stop(); |
|
788 } |
|
789 else |
|
790 { |
|
791 iProxy->MdvrpReturnPicture(iCurrentPicture); |
|
792 iCurrentPicture = NULL; |
|
793 } |
|
794 } |
|
795 } |
|
796 |
|
797 |
|
798 void CMdfVideoEncodeHwDeviceAdapter::MipoDisconnectTunnelComplete(const MMdfInputPort* /*aInputPort*/, TInt aErrorCode) |
|
799 { |
|
800 if (aErrorCode != KErrNone) |
|
801 { |
|
802 iProxy->MdvrpFatalError(this, aErrorCode); |
|
803 } |
|
804 } |
|
805 |
|
806 void CMdfVideoEncodeHwDeviceAdapter::MopoDisconnectTunnelComplete(const MMdfOutputPort* /*aOutputPort*/, TInt aErrorCode) |
|
807 { |
|
808 if (aErrorCode != KErrNone) |
|
809 { |
|
810 iProxy->MdvrpFatalError(this, aErrorCode); |
|
811 } |
|
812 } |
|
813 |
|
814 |
|
815 void CMdfVideoEncodeHwDeviceAdapter::MopoReadDataComplete(const MMdfOutputPort* aOutputPort, CMMFBuffer* aBuffer, TInt aErrorCode) |
|
816 { |
|
817 if (aErrorCode != KErrNone) |
|
818 { |
|
819 iProxy->MdvrpFatalError(this, aErrorCode); |
|
820 return; |
|
821 } |
|
822 if (aOutputPort == iEncoderPUOutputPortsArray[KEncoderPUOutputPortIndex]) |
|
823 { |
|
824 TVideoOutputBuffer buf; |
|
825 CMMFDataBuffer* dataBuffer = static_cast<CMMFDataBuffer*>(aBuffer); |
|
826 TUint bufSize = dataBuffer->BufferSize(); |
|
827 buf.iData.Set(const_cast<TUint8*>((dataBuffer->Data()).Ptr()), dataBuffer->BufferSize()); |
|
828 |
|
829 if (aBuffer->LastBuffer()) |
|
830 { |
|
831 iEncoderPU->Stop(); |
|
832 iProxy->MdvrpStreamEnd(); |
|
833 } |
|
834 else |
|
835 { |
|
836 |
|
837 if (!iInputStreamEnd) |
|
838 { |
|
839 // still expecting more buffers, so let client know |
|
840 iProxy->MdvrpNewBuffer(&buf); |
|
841 } |
|
842 else |
|
843 { |
|
844 dataBuffer->Data().SetLength(0); |
|
845 dataBuffer->SetLastBuffer(ETrue); |
|
846 // Write a zero sized input buffer to the port, with the last buffer flag set |
|
847 iEncoderPUInputPortsArray[KEncoderPUInputPortIndex]->MipWriteData(*iInputBuffer); |
|
848 } |
|
849 } |
|
850 } |
|
851 } |
|
852 |
|
853 |
|
854 void CMdfVideoEncodeHwDeviceAdapter::InitializeComplete(const CMdfProcessingUnit* /*aPu*/, TInt aErrorCode) |
|
855 { |
|
856 // KB: We have an error code, so use it not fatal error in this case |
|
857 iProxy->MdvrpInitializeComplete(this, aErrorCode); |
|
858 } |
|
859 |
|
860 void CMdfVideoEncodeHwDeviceAdapter::ExecuteComplete(const CMdfProcessingUnit* /*aPu*/, TInt aErrorCode) |
|
861 { |
|
862 if (aErrorCode != KErrNone) |
|
863 { |
|
864 iProxy->MdvrpFatalError(this, aErrorCode); |
|
865 return; |
|
866 } |
|
867 } |
|
868 |
|
869 void CMdfVideoEncodeHwDeviceAdapter::MipoRestartTunnelComplete(const MMdfInputPort* /*aInputPort*/, TInt /*aErrorCode*/) |
|
870 { |
|
871 // Function is not supported. |
|
872 } |
|
873 |
|
874 void CMdfVideoEncodeHwDeviceAdapter::MopoRestartTunnelComplete(const MMdfOutputPort* /*aOutputPort*/, TInt /*aErrorCode*/) |
|
875 { |
|
876 // Function is not supported. |
|
877 } |
|
878 |
|
879 /** |
|
880 @see CMMFVideoRecordHwDevice |
|
881 */ |
|
882 void CMdfVideoEncodeHwDeviceAdapter::SetClockSource(MMMFClockSource* /* aClock */) |
|
883 { |
|
884 // Function is not supported. |
|
885 } |
|
886 |
|
887 /** |
|
888 @see CMMFVideoRecordHwDevice |
|
889 */ |
|
890 void CMdfVideoEncodeHwDeviceAdapter::SetPreProcessTypesL(TUint32 /* aPreProcessTypes */) |
|
891 { |
|
892 User::Leave(KErrNotSupported); |
|
893 } |
|
894 |
|
895 /** |
|
896 @see CMMFVideoRecordHwDevice |
|
897 */ |
|
898 void CMdfVideoEncodeHwDeviceAdapter::SetRgbToYuvOptionsL(TRgbRange /* aRange */, const TYuvFormat& /* aOutputFormat */) |
|
899 { |
|
900 User::Leave(KErrNotSupported); |
|
901 } |
|
902 |
|
903 /** |
|
904 @see CMMFVideoRecordHwDevice |
|
905 */ |
|
906 void CMdfVideoEncodeHwDeviceAdapter::SetYuvToYuvOptionsL(const TYuvFormat& /* aInputFormat */, const TYuvFormat& /* aOutputFormat */) |
|
907 { |
|
908 User::Leave(KErrNotSupported); |
|
909 } |
|
910 |
|
911 /** |
|
912 @see CMMFVideoRecordHwDevice |
|
913 */ |
|
914 void CMdfVideoEncodeHwDeviceAdapter::SetRotateOptionsL(TRotationType /* aRotationType */) |
|
915 { |
|
916 User::Leave(KErrNotSupported); |
|
917 } |
|
918 |
|
919 /** |
|
920 @see CMMFVideoRecordHwDevice |
|
921 */ |
|
922 void CMdfVideoEncodeHwDeviceAdapter::SetScaleOptionsL(const TSize& /* aTargetSize */, TBool /* aAntiAliasFiltering */) |
|
923 { |
|
924 User::Leave(KErrNotSupported); |
|
925 } |
|
926 |
|
927 /** |
|
928 @see CMMFVideoRecordHwDevice |
|
929 */ |
|
930 void CMdfVideoEncodeHwDeviceAdapter::SetInputCropOptionsL(const TRect& /* aRect */) |
|
931 { |
|
932 User::Leave(KErrNotSupported); |
|
933 } |
|
934 |
|
935 /** |
|
936 @see CMMFVideoRecordHwDevice |
|
937 */ |
|
938 void CMdfVideoEncodeHwDeviceAdapter::SetOutputCropOptionsL(const TRect& /* aRect */) |
|
939 { |
|
940 User::Leave(KErrNotSupported); |
|
941 } |
|
942 |
|
943 /** |
|
944 @see CMMFVideoRecordHwDevice |
|
945 */ |
|
946 void CMdfVideoEncodeHwDeviceAdapter::SetOutputPadOptionsL(const TSize& /* aOutputSize */, const TPoint& /* aPicturePos */) |
|
947 { |
|
948 User::Leave(KErrNotSupported); |
|
949 } |
|
950 |
|
951 /** |
|
952 @see CMMFVideoRecordHwDevice |
|
953 */ |
|
954 void CMdfVideoEncodeHwDeviceAdapter::SetColorEnhancementOptionsL(const TColorEnhancementOptions& /* aOptions */) |
|
955 { |
|
956 User::Leave(KErrNotSupported); |
|
957 } |
|
958 |
|
959 /** |
|
960 @see CMMFVideoRecordHwDevice |
|
961 */ |
|
962 void CMdfVideoEncodeHwDeviceAdapter::SetFrameStabilisationOptionsL(const TSize& /* aOutputSize */, TBool /* aFrameStabilisation */) |
|
963 { |
|
964 User::Leave(KErrNotSupported); |
|
965 } |
|
966 |
|
967 /** |
|
968 @see CMMFVideoRecordHwDevice |
|
969 */ |
|
970 void CMdfVideoEncodeHwDeviceAdapter::SetCustomPreProcessOptionsL(const TDesC8& /* aOptions */) |
|
971 { |
|
972 User::Leave(KErrNotSupported); |
|
973 } |
|
974 |
|
975 |