Update contrib.
2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <datawrapper.h>
20 #include <devvideoplay.h>
21 #include <devvideobase.h>
23 #include <devvideoconstants.h>
24 #include "t_cmmfdevvideoplaydata.h"
25 #include "t_devvideoconstants.h"
28 //LIT's to get params from ini files
29 _LIT(KPostPro, "postprocessor");
30 _LIT(KCodec, "codec");
31 _LIT(KCombination, "combination");
32 _LIT(KScreenout, "screen");
33 _LIT(KFramerate, "framerate");
34 _LIT(KInputfile, "inputfile");
35 _LIT(KOutputfile, "outputfile");
36 _LIT(KSynch, "synch");
37 _LIT(KDecoder, "dec");
38 _LIT(KRotation, "rotation");
39 _LIT(KWidth, "width");
40 _LIT(KHeight, "height");
44 _LIT(KAntiAliasFiltering, "antiAliasFiltering");
45 _LIT(KMimeType, "mimeType");
46 _LIT(KUseDecoder, "useDecoder");
47 _LIT(KInputPath, "inputPath");
48 _LIT(KOutputPath, "outputPath");
49 _LIT(KDisplayMode, "displayMode");
51 _LIT(KDataInOrder, "dataInOrder");
52 _LIT(KTVideoDataUnitType, "TVideoDataUnitType");
53 _LIT(KTVideoDataUnitEncapsulation, "TVideoDataUnitEncapsulation");
56 _LIT(KBuffMgmt, "buffMgmt");
57 _LIT(KOutput, "output");
58 _LIT(KHwdev, "hwdev");
59 _LIT(KDataUnitTypeInt, "dataUnitTypeInt");
60 _LIT(KEncapsulation, "encapsulation");
61 _LIT(KFormat, "format");
62 _LIT(KDataFormat, "dataFormat");
63 _LIT(KDataLayout, "dataLayout");
64 _LIT(KPattern, "pattern");
65 _LIT(KAspectRatioNum, "aspectRatioNum");
66 _LIT(KAspectRatioDenom, "aspectRatioDenom");
67 _LIT(KCoefficients, "coefficients");
68 _LIT(KPreDecodeBufferSize, "preDecodeBufferSize");
69 _LIT(KMaxPostDecodeBufferSize, "maxPostDecodeBufferSize");
70 _LIT(KPreDecoderBufferPeriodInt, "preDecoderBufferPeriodInt");
71 _LIT(KPostDecoderBufferPeriodInt, "postDecoderBufferPeriodInt");
72 _LIT(KMaxInputBufferSize, "maxInputBufferSize");
73 _LIT(KMinNumInputBuffers, "minNumInputBuffers");
74 _LIT(KInputEnd, "inputEnd");
82 //LIT's to identify commands
83 _LIT(KCmdNewL, "NewL");
84 _LIT(KCmdDestructor, "~");
85 _LIT(KCmdInitialize, "Initialize");
86 _LIT(KCmdStart, "Start");
87 _LIT(KCmdStop, "Stop");
88 _LIT(KCmdPause, "Pause");
89 _LIT(KCmdResume, "Resume");
90 _LIT(KCmdSetRotateOptionsL, "SetRotateOptionsL");
91 _LIT(KCmdSetScaleOptionsL, "SetScaleOptionsL");
92 _LIT(KCmdSetPosition, "SetPosition");
93 _LIT(KCmdSetClockSource, "SetClockSource");
94 _LIT(KCmdSelectDecoderL, "SelectDecoderL");
95 _LIT(KCmdSetInputFormat, "SetInputFormat");
96 _LIT(KCmdSelectPostProcessorL, "SelectPostProcessorL");
97 _LIT(KCmdPostProcessorInfoLC, "PostProcessorInfoLC");
98 _LIT(KCmdFindCommonFormat, "FindCommonFormat");
99 _LIT(KCmdSetOutputFormatL, "SetOutputFormatL");
100 _LIT(KCmdGetHeaderInformationL, "GetHeaderInformationL");
101 _LIT(KCmdReturnHeader, "ReturnHeader");
102 _LIT(KCmdSetVideoDestScreenL, "SetVideoDestScreenL");
103 _LIT(KCmdGetBufferOptions, "GetBufferOptions");
104 _LIT(KCmdSetBufferOptionsL, "SetBufferOptionsL");
105 _LIT(KCmdSetPostProcessTypesL, "SetPostProcessTypesL");
106 _LIT(KCmdGetOutputFormatListL, "GetOutputFormatListL");
107 _LIT(KCmdAbortDirectScreenAccess, "AbortDirectScreenAccess");
108 _LIT(KCmdStartDirectScreenAccess, "StartDirectScreenAccess");
109 _LIT(KCmdUtilityGetEnvironment, "UtilityGetEnvironment");
111 _LIT(KCmdH264CreateDecTest, "H264CreateDecTest");
112 _LIT(KCmdH264SelectPostProcessor, "H264SelectPostProcessor");
113 _LIT(KCmdH264SetPostProcessTypes, "H264SetPostProcessTypes");
114 _LIT(KCmdH264SetInputFormatCompr, "H264SetInputFormatCompr");
115 _LIT(KCmdH264SetOutputFormat, "H264SetOutputFormat");
116 _LIT(KCmdH264SetBufferOptions, "H264SetBufferOptions");
117 _LIT(KCmdH264ListFrameSize, "H264ListFrameSize");
118 _LIT(KCmdH264SetVideoDestScreen, "H264SetVideoDestScreen");
119 _LIT(KCmdH264SetWindowRect, "H264SetWindowRect");
120 _LIT(KCmdH264Initialize, "H264Initialize");
121 _LIT(KCmdH264Start, "H264Start");
122 _LIT(KCmdH264Stop, "H264Stop");
123 _LIT(KCmdH264Pause, "H264Pause");
124 _LIT(KCmdH264Resume, "H264Resume");
125 _LIT(KCmdH264IOFrameMatch, "H264IOFrameMatch");
126 _LIT(KCmdH264FindCommonFormats, "H264FindCommonFormats");
127 _LIT(KCmdH264GetHeaderInformation, "H264GetHeaderInformation");
128 _LIT(KCmdH264EnableSynchronization, "H264EnableSynchronization");
129 _LIT(KCmdH264SetScaleOptions, "H264SetScaleOptions");
130 _LIT(KCmdH264SetRotateOptions, "H264SetRotateOptions");
131 _LIT(KCmdH264SynchronizeDecoding, "H264SynchronizeDecoding");
132 _LIT(KCmdH264Delete, "H264Delete");
133 _LIT(KCmdH264SetPosition, "H264SetPosition");
134 _LIT(KCmdH264AbortDirectScreenAccess, "H264AbortDirectScreenAccess");
137 _LIT(KNoCodec, "ENoCodec");
138 _LIT(KH263, "EH263");
139 _LIT(KMPEG4, "EMPEG4");
140 _LIT(KH264, "EH264");
144 const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iCodecs[] =
154 //LIT's for display mode
155 _LIT(KNone, "ENone");
156 _LIT(KGray2, "EGray2");
157 _LIT(KGray4, "EGray4");
158 _LIT(KGray16, "EGray16");
159 _LIT(KGray256, "EGray256");
160 _LIT(KColor16, "EColor16");
161 _LIT(KColor256, "EColor256");
162 _LIT(KColor64K, "EColor64K");
163 _LIT(KColor16M, "EColor16M");
165 _LIT(KColor4K, "EColor4K");
166 _LIT(KColor16MU, "EColor16MU");
167 _LIT(KColor16MA, "EColor16MA");
168 _LIT(KColorLast, "EColorLast");
171 const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iDisplayModes[] =
179 KColor256, EColor256,
180 KColor64K, EColor64K,
181 KColor16M, EColor16M,
184 KColor16MU, EColor16MU,
185 KColor16MA, EColor16MA,
186 KColorLast, EColorLast,
187 KColor64K, EColor64K,
192 _LIT(KRotateNone, "ERotateNone");
193 _LIT(KRotate90Clockwise, "ERotate90Clockwise");
194 _LIT(KRotate90Anticlockwise, "ERotate90Anticlockwise");
195 _LIT(KRotate180, "ERotate180");
197 const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iRotations[] =
199 KRotateNone, ERotateNone,
200 KRotate90Clockwise, ERotate90Clockwise,
201 KRotate90Anticlockwise, ERotate90Anticlockwise,
202 KRotate180, ERotate180
206 //LIT's for Video Data Unit Type
207 _LIT(KEDuCodedPicture, "EDuCodedPicture");
208 _LIT(KEDuVideoSegment, "EDuVideoSegment");
209 _LIT(KEDuSeveralSegments, "EDuSeveralSegments");
210 _LIT(KEDuArbitraryStreamSection, "EDuArbitraryStreamSection");
213 const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iTVideoDataUnitType[] =
215 KEDuCodedPicture, EDuCodedPicture,
216 KEDuVideoSegment, EDuVideoSegment,
217 KEDuSeveralSegments, EDuSeveralSegments,
218 KEDuArbitraryStreamSection, EDuArbitraryStreamSection
222 //LIT's for video data unit encapsulation
223 _LIT(KEDuElementaryStream, "EDuElementaryStream");
224 _LIT(KEDuGenericPayload, "EDuGenericPayload");
225 _LIT(KEDuRtpPayload, "EDuRtpPayload");
227 const CDataWrapperBase::TEnumEntryTable CT_CMMFDevVideoPlay::iTVideoDataUnitEncapsulation[] =
229 KEDuElementaryStream, EDuElementaryStream,
230 KEDuGenericPayload, EDuGenericPayload,
231 KEDuRtpPayload, EDuRtpPayload
235 // -----------------------------------------------------------------------------
236 // class CEngineObserver
237 // -----------------------------------------------------------------------------
239 CEngineObserver::CEngineObserver(CT_CMMFDevVideoPlay& aTestClass) :
240 iTestClass(aTestClass)
244 void CEngineObserver::MvdeStreamEndReached()
246 iTestClass.DecOutstanding();
248 void CEngineObserver::MvdeSetError(TInt aError)
250 iTestClass.SetError(aError);
256 CT_CMMFDevVideoPlay::~CT_CMMFDevVideoPlay()
258 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor In"));
263 iDevvp->AbortDirectScreenAccess();
264 iDsaStarted = EFalse;
270 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay Destructor Out"));
274 * Return a pointer to the object that the data wraps
275 * @return pointer to the object that the data wraps
277 TAny* CT_CMMFDevVideoPlay::GetObject()
283 * Command that destroy the wrapped object and helper objects
285 void CT_CMMFDevVideoPlay::DoCmdDestructor()
295 iDevvp->AbortDirectScreenAccess();
296 iDsaStarted = EFalse;
298 //Postproc input buffer
299 if ( !iCIBuffMgmtOn && iRawInBuffer)
301 delete (TUint8*)iRawInBuffer->iData.iRawData->Ptr();
302 delete iRawInBuffer->iData.iRawData;
308 delete iScreenDevice;
309 iScreenDevice = NULL;
310 RFbsSession::Disconnect();
317 iFrameSizeList.Close();
319 REComSession::FinalClose();
327 INFO_PRINTF1(_L("DoCmdDestructor DecOutstanding()"));
333 * Helper method tha destroy the wrapped object
335 void CT_CMMFDevVideoPlay::DestroyData()
337 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DestroyData"));
338 // Delete Devvideo play
341 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DestroyData"));
345 * Two phase constructor
347 * @leave system wide error
349 CT_CMMFDevVideoPlay* CT_CMMFDevVideoPlay::NewL()
351 CT_CMMFDevVideoPlay* ret=new (ELeave) CT_CMMFDevVideoPlay();
352 CleanupStack::PushL(ret);
354 CleanupStack::Pop(ret);
359 * Protected constructor. First phase construction
361 CT_CMMFDevVideoPlay::CT_CMMFDevVideoPlay()
369 iSynchronized(EFalse),
370 iFrameListed(EFalse),
374 iCodedInBuffer(NULL),
378 iFrameTimeInterval(0),
380 iReturnedBuffCount(0),
385 iDirectScreenAccess(EFalse),
386 iCIBuffMgmtOn(EFalse),
387 iFrameMeasurement(EFalse),
388 iCommonFormatFound(EFalse),
389 iErrorInputBuffer(EFalse),
398 * Second phase construction
402 * @post None * @leave system wide error
404 void CT_CMMFDevVideoPlay::ConstructL()
406 iClock = CSystemClockSource::NewL();
410 * Process a command read from the ini file
411 * @param aCommand The command to process
412 * @param aSection The section in the ini containing data for the command
413 * @param aAsyncErrorIndex Command index for async calls to return errors to
414 * @return ETrue if the command is processed *
415 * @leave System wide error
417 TBool CT_CMMFDevVideoPlay::DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection,
418 const TInt aAsyncErrorIndex)
422 if ( aCommand==KCmdDestructor )
426 else if ( aCommand==KCmdNewL )
430 else if ( aCommand==KCmdInitialize )
432 DoCmdInitialize(aAsyncErrorIndex);
434 else if ( aCommand==KCmdStart )
436 DoCmdStart(aAsyncErrorIndex);
438 else if ( aCommand==KCmdStop )
442 else if ( aCommand==KCmdSetPosition )
444 DoCmdSetPosition(aSection);
446 else if ( aCommand==KCmdPause )
450 else if ( aCommand==KCmdResume )
454 else if ( aCommand==KCmdSetRotateOptionsL )
456 DoCmdSetRotateOptionsL(aSection);
458 else if ( aCommand==KCmdSetScaleOptionsL )
460 DoCmdSetScaleOptionsL(aSection);
462 else if ( aCommand==KCmdSetClockSource )
464 DoCmdSetClockSource(aSection);
466 else if ( aCommand==KCmdSelectDecoderL )
468 DoCmdSelectDecoderL(aSection);
470 else if ( aCommand==KCmdSelectPostProcessorL )
472 DoCmdSelectPostProcessorL(aSection);
474 else if ( aCommand==KCmdPostProcessorInfoLC )
476 DoCmdPostProcessorInfoLC();
478 else if ( aCommand==KCmdGetOutputFormatListL )
480 DoCmdGetOutputFormatListL(aSection);
482 else if ( aCommand==KCmdFindCommonFormat )
484 DoCmdFindCommonFormat();
486 else if ( aCommand==KCmdSetOutputFormatL )
488 DoCmdSetOutputFormatL(aSection);
490 else if ( aCommand==KCmdGetHeaderInformationL )
492 DoCmdGetHeaderInformationL(aSection);
494 else if ( aCommand==KCmdReturnHeader )
498 else if ( aCommand==KCmdSetVideoDestScreenL )
500 DoCmdSetVideoDestScreenL();
502 else if ( aCommand==KCmdGetBufferOptions )
504 DoCmdGetBufferOptions();
506 else if ( aCommand==KCmdSetBufferOptionsL )
508 DoCmdSetBufferOptionsL();
510 else if ( aCommand==KCmdSetPostProcessTypesL )
512 DoCmdSetPostProcessTypesL(aSection);
514 else if ( aCommand==KCmdSetInputFormat )
516 DoCmdSetInputFormatL(aSection);
518 else if ( aCommand==KCmdStartDirectScreenAccess )
520 DoCmdStartDirectScreenAccessL(aSection);
522 else if ( aCommand==KCmdAbortDirectScreenAccess )
524 DoCmdAbortDirectScreenAccess();
526 else if ( aCommand==KCmdUtilityGetEnvironment )
528 DoCmdUtilityGetEnvironmentL();
530 else if ( aCommand==KCmdH264CreateDecTest)
532 DoCmdH264CreateDecTest(aSection);
534 else if (aCommand==KCmdH264SelectPostProcessor)
536 DoCmdH264SelectPostProcessor(aSection);
538 else if (aCommand==KCmdH264SetPostProcessTypes)
540 DoCmdH264SetPostProcessTypes(aSection);
542 else if (aCommand==KCmdH264SetInputFormatCompr)
544 DoCmdH264SetInputFormatCompr(aSection);
546 else if (aCommand==KCmdH264SetOutputFormat)
548 DoCmdH264SetOutputFormat(aSection);
550 else if (aCommand==KCmdH264SetBufferOptions)
552 DoCmdH264SetBufferOptions(aSection);
554 else if (aCommand==KCmdH264ListFrameSize)
556 DoCmdH264ListFrameSize();
558 else if (aCommand==KCmdH264SetVideoDestScreen)
560 DoCmdH264SetVideoDestScreen(aSection);
562 else if (aCommand==KCmdH264SetWindowRect)
564 DoCmdH264SetWindowRect(aSection);
566 else if (aCommand==KCmdH264Initialize)
568 DoCmdH264Initialize();
570 else if (aCommand==KCmdH264Start)
572 DoCmdH264Start(aSection);
574 else if (aCommand==KCmdH264IOFrameMatch)
576 DoCmdH264IOFrameNumMatch();
578 else if (aCommand==KCmdH264Stop)
582 else if (aCommand==KCmdH264GetHeaderInformation)
584 DoCmdH264GetHeaderInformation(aSection);
586 else if (aCommand==KCmdH264FindCommonFormats)
588 DoCmdH264FindCommonFormats();
590 else if (aCommand==KCmdH264EnableSynchronization)
592 DoCmdH264EnableSynchronization(aSection);
594 else if (aCommand==KCmdH264SetScaleOptions)
596 DoCmdH264SetScaleOptions(aSection);
598 else if (aCommand==KCmdH264SetRotateOptions)
600 DoCmdH264SetRotateOptions(aSection);
602 else if (aCommand==KCmdH264SynchronizeDecoding)
604 DoCmdH264SynchronizeDecoding(aSection);
606 else if (aCommand==KCmdH264Delete)
610 else if (aCommand==KCmdH264Pause)
614 else if (aCommand==KCmdH264Resume)
618 else if (aCommand==KCmdH264SetPosition)
620 DoCmdH264SetPosition(aSection);
622 else if (aCommand==KCmdH264AbortDirectScreenAccess)
624 DoCmdH264AbortDirectScreenAccess();
628 ERR_PRINTF1(_L("Unknown command"));
635 * Constructs CMMFDevVideoPlay instance and initialize params.
636 * @param aSection - The section to read from the ini file
639 void CT_CMMFDevVideoPlay::DoCmdNewL(const TTEFSectionName& aSection)
641 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdNewL"));
642 TBool dataOk = ETrue;
644 TRAPD(err, iDevvp = CMMFDevVideoPlay::NewL(*this));
647 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
653 TRAP(err, InitializeParamsL(aSection));
656 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed in InitializeParamsL. Error: %d"), err);
659 CreateFiles(aSection);
661 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdNewL"));
667 void CT_CMMFDevVideoPlay::CreateFiles(const TTEFSectionName& aSection)
673 TBool screenout = EFalse;
674 TInt error = KErrNone;
675 TBool dataOk = ETrue;
676 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CreateFiles"));
678 if ( !(GetBoolFromConfig(aSection, KScreenout(), screenout)))
680 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
681 SetBlockResult(EFail);
684 if ( !(GetStringFromConfig(aSection, KInputfile(),inputfile)))
686 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
687 SetBlockResult(EFail);
692 if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
694 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
695 SetBlockResult(EFail);
699 if ( !(GetStringFromConfig(aSection, KInputPath(),inputPath)))
701 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
702 SetBlockResult(EFail);
707 error = iFs.Connect ();
708 if ( error!=KErrNone)
710 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), error);
715 TFileName inFileName(inputPath);
716 inFileName.Append (inputfile);
720 TRAPD(err, OpenFileL(inFileName));
721 if ( err != KErrNone)
723 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdNewL failed with error %d"), err);
727 INFO_PRINTF1(_L("File Opened!"));
731 if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputPath)))
733 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
734 SetBlockResult(EFail);
736 TFileName outFileName(outputPath);
737 outFileName.Append (outputfile);
738 TRAPD(err, OpenFileL(outFileName, inFileName));
739 if ( err != KErrNone)
741 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::OpenFileL failed with error %d"), err);
748 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CreateFiles"));
752 * Initilize Engine parameters
753 * @param aSection - The section to read from the ini file
756 void CT_CMMFDevVideoPlay::InitializeParamsL(const TTEFSectionName& aSection)
759 TBool dataOk = ETrue;
760 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::InitializeParamsL"));
761 if ( !(GetEnumFromConfig(aSection, KCodec(), iCodecs, codec)))
763 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
764 SetBlockResult(EFail);
767 if ( !(GetBoolFromConfig(aSection, KScreenout(), iDirectScreenAccess)))
769 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KScreenout());
770 SetBlockResult(EFail);
776 iCodecType=(TVideoCodec)codec;
777 if (iDirectScreenAccess)
779 User::LeaveIfError(FbsStartup());
782 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::InitializeParamsL"));
786 * Sets the clock source in case the sync parameter is true
787 * @param aSection - The section to read from the ini file
790 void CT_CMMFDevVideoPlay::DoCmdSetClockSource(const TTEFSectionName& aSection)
794 TBool dataOk = ETrue;
795 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));
796 if ( !( GetIntFromConfig(aSection, KFramerate(), framerate)) )
798 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
799 SetBlockResult(EFail);
802 if ( !( GetIntFromConfig(aSection,KSynch(), synch)) )
804 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSynch());
805 SetBlockResult(EFail);
810 if (synch) //Set Clock and frame rate for syncronization
812 TRAPD(err, ListFrameSizeL(iCodecType));
813 if ( err != KErrNone)
815 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::ListFrameSizeL failed with error %d"), err);
820 INFO_PRINTF1(_L("List Frame done!"));
821 iDevvp->SetClockSource(iClock);
822 iSynchronized = ETrue;
823 iFrameTimeInterval = (TInt64)(1000000/framerate);
824 iFramerate = framerate;
828 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetClockSource"));
832 * Gets the decoders list and Select a Decoder
833 * @param aSection - Section to read from the ini file
836 void CT_CMMFDevVideoPlay::DoCmdSelectDecoderL(const TTEFSectionName& aSection)
839 TBool dataOk = ETrue;
840 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
841 if ( !(GetHexFromConfig(aSection, KDecoder(), decoder)))
843 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
844 SetBlockResult(EFail);
849 iSelectDecoder=TUid::Uid(decoder);
850 TRAPD(err, iDecHWDevId = iDevvp->SelectDecoderL(iSelectDecoder));
853 ERR_PRINTF2(_L("SelectDecoderL left with error: %d"), err);
857 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectDecoder"));
861 * Gets the postprocessores list and Select a PostProcessor
862 * @param aSection - Section to read from the ini file
865 void CT_CMMFDevVideoPlay::DoCmdSelectPostProcessorL(const TTEFSectionName& aSection)
868 TBool dataOk = ETrue;
869 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
870 if ( !(GetHexFromConfig(aSection, KPostPro(), postPro)))
872 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDecoder());
873 SetBlockResult(EFail);
878 iSelectPostProcessor=TUid::Uid(postPro);
879 TRAPD(err, iPostProcId = iDevvp->SelectPostProcessorL(iSelectPostProcessor));
882 ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), err);
886 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSelectPostProcessor"));
890 * Sets the input format for the decoder and the postprocessor
891 * @param aSection - Section to read from the ini file
894 void CT_CMMFDevVideoPlay::DoCmdSetInputFormatL(const TTEFSectionName& aSection)
897 TBool useDecoder = ETrue;
898 TInt tVideoDataUnitType = EDuCodedPicture;
899 TInt tVideoDataUnitEncapsulation = EDuElementaryStream;
900 TBool dataInOrder=ETrue;
902 TBool dataOk = ETrue;
903 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
904 if(!GetStringFromConfig(aSection, KMimeType(), mimeType))
906 ERR_PRINTF1(_L("Mime type not retrieved, command will not be executed"));
907 SetBlockResult(EFail);
910 if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
912 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
913 SetBlockResult(EFail);
917 if( !(GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder)))
919 ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KDataInOrder());
921 if(! (GetEnumFromConfig(aSection, KTVideoDataUnitType(), iTVideoDataUnitType,tVideoDataUnitType)))
923 ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitType());
925 if( !(GetEnumFromConfig(aSection, KTVideoDataUnitEncapsulation(), iTVideoDataUnitEncapsulation,tVideoDataUnitEncapsulation)))
927 ERR_PRINTF2(_L("Error in getting parameter %S from INI file, using default value"),&KTVideoDataUnitEncapsulation());
931 mimetype.Append(mimeType);
932 if ( useDecoder) //Decoder
934 CCompressedVideoFormat* compressedFormat=NULL;
935 TRAPD(error, compressedFormat = CCompressedVideoFormat::NewL (mimetype));
936 if (error != KErrNone)
938 ERR_PRINTF2(_L("Error in CCompressedVideoFormat::NewL: %d"), error);
943 CleanupStack::PushL (compressedFormat);
945 iDevvp->SetInputFormatL(iDecHWDevId, *compressedFormat,
946 (TVideoDataUnitType)tVideoDataUnitType,
947 (TVideoDataUnitEncapsulation)tVideoDataUnitEncapsulation,
949 CleanupStack::PopAndDestroy (compressedFormat);
950 if ( error != KErrNone)
952 ERR_PRINTF2(_L("Error in SetInputFormatL for decoder: %d"), error);
957 INFO_PRINTF1(_L("SetInputFormatL done!"));
962 else // PostProcessor
964 TRAPD(err, iDevvp->SetInputFormatL(iPostProcId, iCommonFormat));
965 if ( err != KErrNone)
967 ERR_PRINTF2(_L("Error in SetInputFormatL for PostProcessor: %d"), err);
972 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetInputFormat"));
976 * Gets the output format list from the decoder and the postprocessor
977 * @param aSection - The section to read from the ini file
980 void CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL(const TTEFSectionName& aSection)
982 TBool useDecoder = ETrue; //ETrue - Decoder , EFalse - PostProcessor
983 TBool dataOk = ETrue;
984 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
985 if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
987 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
988 SetBlockResult(EFail);
993 if ( useDecoder) //Decoder
995 TRAPD(err, iDevvp->GetOutputFormatListL(iDecHWDevId, iDecFormats));
996 if ( err != KErrNone)
998 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL failed with error %d"), err);
1002 else //PostProcessor
1004 TRAPD(err1, iDevvp->GetOutputFormatListL(iPostProcId, iPPFormats));
1005 if ( err1 != KErrNone)
1007 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL left with error %d"), err1);
1012 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetOutputFormatListL"));
1016 * Gets the postprocessor info.
1018 void CT_CMMFDevVideoPlay::DoCmdPostProcessorInfoLC()
1020 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
1023 TRAPD(err, {iInfo = iDevvp->PostProcessorInfoLC(iSelectPostProcessor); CleanupStack::Pop(iInfo);} );
1024 if ( err!=KErrNone )
1026 ERR_PRINTF2(_L("PostProcessorInfoLC failed with error %i"),err);
1030 iPPFormats = iInfo->SupportedFormats();
1032 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPostProcessorInfo"));
1036 * Find common format for dec output and postproc input.
1037 * Precondition: The command GetOutputList has to be called before, for the Decoder and the postprocessor,
1038 * because in this method we use both list to find the common format.
1040 void CT_CMMFDevVideoPlay::DoCmdFindCommonFormat()
1042 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
1043 if ( iDevvp->FindCommonFormat (iDecFormats.Array (), iPPFormats.Array (), iCommonFormat) )
1045 INFO_PRINTF1(_L("DoCmdFindCommonFormat found common Format!"));
1049 iCommonFormat = iDecFormats[0];
1050 ERR_PRINTF1(_L("Error in CT_CMMFDevVideoPlay::DoCmdFindCommonFormat: Common Format not found."));
1051 SetBlockResult(EFail);
1053 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdFindCommonFormat"));
1057 * Sets the output format for both the decoder and the postprocessor.
1058 * @param aSection - The section to read from the ini file
1061 void CT_CMMFDevVideoPlay::DoCmdSetOutputFormatL(const TTEFSectionName& aSection)
1063 TBool useDecoder = ETrue;
1064 TBool dataOk = ETrue;
1065 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
1066 if ( !(GetBoolFromConfig(aSection, KUseDecoder(), useDecoder)))
1068 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUseDecoder());
1069 SetBlockResult(EFail);
1076 TRAPD(error, iDevvp->SetOutputFormatL (iDecHWDevId, iCommonFormat));
1077 if(error != KErrNone)
1079 ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
1085 if ( iDirectScreenAccess)
1088 TUncompressedVideoFormat outFormat;
1089 outFormat.iDataFormat = ERgbRawData;
1090 outFormat.iRgbFormat = ERgb32bit888; //RGB format for display
1091 TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, outFormat));
1092 if(error != KErrNone)
1094 ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
1099 else // Memory buffer output
1101 TRAPD(error, iDevvp->SetOutputFormatL (iPostProcId, iCommonFormat));
1102 if(error != KErrNone)
1104 ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), error);
1110 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetOutputFormat"));
1115 * Gets the header information.
1116 * @param aSection - The section to read from the ini file
1119 void CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL(const TTEFSectionName& aSection)
1122 TBool dataOk = ETrue;
1123 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
1124 if ( !(GetIntFromConfig(aSection, KBuf(), bufSize)))
1126 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuf());
1127 SetBlockResult(EFail);
1132 INFO_PRINTF1(_L("GetHeaderInformationL init..!"));
1133 TInt err = KErrNone;
1135 HBufC8* tempBuff= NULL;
1136 //Read Picture header : Size is not known
1137 TVideoInputBuffer* codedBuffer = new(ELeave) TVideoInputBuffer;
1138 CleanupStack::PushL ( codedBuffer);
1139 if ( iFrameListed) //frame size known
1141 tempBuff = HBufC8::NewLC(iInBuffSize);
1142 codedBuffer->iData.Set (tempBuff->Des ());
1143 if(iFrameSizeList.Count() > 0)
1145 err = ReadOneCodedPicture (codedBuffer, iFrameSizeList[0]);
1153 if ( iInFile.Seek (ESeekStart, pos))
1159 CleanupStack::PopAndDestroy (tempBuff);
1162 else //frame size not known
1164 iInBuffSize = KH263MaxCodedSizeQCIF;
1166 while ( (err == KErrOverflow) && (iInBuffSize <= KMP4MaxCodedSizeVGA))
1168 tempBuff = HBufC8::NewLC(iInBuffSize);
1169 codedBuffer->iData.Set (tempBuff->Des ());
1170 err = ReadOneCodedPicture (codedBuffer);
1172 if ( iInFile.Seek (ESeekStart, pos))
1182 CleanupStack::PopAndDestroy (tempBuff);
1183 iInBuffSize = 4*iInBuffSize;
1187 // Reitrieve header information from bitstream
1190 CleanupStack::PopAndDestroy (codedBuffer);
1194 TRAPD(error, iHeaderInfo = iDevvp->GetHeaderInformationL(EDuCodedPicture, EDuElementaryStream,codedBuffer));
1195 CleanupStack::PopAndDestroy (tempBuff);
1196 CleanupStack::PopAndDestroy (codedBuffer);
1197 if ( error != KErrNone)
1199 ERR_PRINTF2(_L("Error in DoCmdGetHeaderInformationL: %d"), error);
1208 iPictureSize = iHeaderInfo->iDisplayedRect.Size ();
1210 TSize dispsize = iHeaderInfo->iDisplayedRect.Size ();
1211 iDispRect.SetSize (dispsize);
1212 INFO_PRINTF3(_L("Size from Header, Height: %d Width: %d"),dispsize.iHeight,
1214 INFO_PRINTF3(_L("Size from iPictureSize, Height: %d Width: %d"),iPictureSize.iHeight,
1215 iPictureSize.iWidth);
1217 // Set size of decoder input buffer
1220 iInBuffSize = bufSize;
1225 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetHeaderInformationL"));
1229 * Returns the HeaderInformation of the video
1231 void CT_CMMFDevVideoPlay::DoCmdReturnHeader()
1233 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
1236 iDevvp->ReturnHeader(iHeaderInfo);
1240 ERR_PRINTF1(_L("Error in DoCmdReturnHeader!"));
1241 SetBlockResult(EFail);
1243 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdReturnHeader"));
1247 * Sets output on screen or memory buffer
1249 void CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL()
1251 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
1252 TRAPD(err, iDevvp->SetVideoDestScreenL(iDirectScreenAccess));
1253 if (err != KErrNone)
1255 ERR_PRINTF2(_L("Error in DoCmdSetVideoDestScreenL: %d"), err);
1258 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetVideoDestScreenL"));
1262 * Gets the buffer options.
1264 void CT_CMMFDevVideoPlay::DoCmdGetBufferOptions()
1266 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
1267 iDevvp->GetBufferOptions(iBufferOptions);
1268 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdGetBufferOptions"));
1272 * Sets the buffer options for the DevVideoPlay
1274 void CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL()
1276 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
1277 iBufferOptions.iMaxInputBufferSize = iInBuffSize;
1278 //iBufferOptions.iMaxPostDecodeBufferSize = 0;
1279 iBufferOptions.iPreDecodeBufferSize = 0;
1280 iBufferOptions.iMinNumInputBuffers = KNumOfInputBuffers;
1281 TRAPD(err, iDevvp->SetBufferOptionsL(iBufferOptions));
1282 if ( err != KErrNone)
1284 ERR_PRINTF2(_L("Error in DoCmdSetBufferOptionsL: %d"), err);
1287 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetBufferOptionsL"));
1291 * Sets the options for the postprocessor
1293 void CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL(const TTEFSectionName& aSection)
1295 TInt combination = 0;
1296 TBool dataOk = ETrue;
1297 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
1298 if ( ! (GetHexFromConfig(aSection, KCombination(), combination)) )
1300 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
1301 SetBlockResult(EFail);
1306 TRAPD(err,iDevvp->SetPostProcessTypesL(iPostProcId, combination));
1309 ERR_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL left with error %d"), err);
1313 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPostProcessTypesL"));
1317 * Initialize the decoder with the specified parameters.
1318 * @return - KErrNone if no error
1320 void CT_CMMFDevVideoPlay::DoCmdInitialize(const TInt aAsyncErrorIndex)
1322 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdInitialize"));
1323 iAsyncErrorIndex = aAsyncErrorIndex;
1324 iDevvp->Initialize();
1326 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdInitialize"));
1330 * Starts video decoding directly to the display frame buffer using Direct Screen Access. Playback to the display can start immediately.
1334 void CT_CMMFDevVideoPlay::DoCmdStart(const TInt aAsyncErrorIndex)
1336 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStart"));
1337 iAsyncErrorIndex = aAsyncErrorIndex;
1338 // Start DevVideoPlay
1339 INFO_PRINTF1(_L("Start Decoding Engine.."));
1341 //Reset Clock at Stream Start
1342 if ( iSynchronized )
1344 TTimeIntervalMicroSeconds offset(KStartOffset);
1345 iClock->Reset(offset);
1347 INFO_PRINTF1(_L("Start Data transfer."));
1348 TRAPD(err, HandleNewBufferL());
1349 if (err != KErrNone)
1351 ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
1356 if(!iErrorInputBuffer)
1359 INFO_PRINTF1(_L("Start..done!"));
1360 INFO_PRINTF2(_L("iFrameSizeList.Count %d"),iFrameSizeList.Count());
1363 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStart"));
1367 * Stops the playback
1368 * @param aSection - The section to read from the ini file
1371 void CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL(const TTEFSectionName& aSection)
1373 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));
1374 if ( !iScreenDevice)
1376 delete iScreenDevice;
1377 iScreenDevice = NULL;
1378 RFbsSession::Disconnect();
1379 TDisplayMode displayMode; //0 - Decoder , 1 - PostProcessor
1381 if ( !(GetEnumFromConfig(aSection, KDisplayMode(), iDisplayModes, value)))
1383 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDisplayMode());
1384 SetBlockResult(EFail);
1386 displayMode = (TDisplayMode)value;
1387 User::LeaveIfError (RFbsSession::Connect());
1389 TRAPD(error, iScreenDevice = CFbsScreenDevice::NewL (KScreenNumber, displayMode));
1390 if(error != KErrNone)
1392 ERR_PRINTF2(_L("Error creating screen device"),error);
1397 if ( iDispRect.iBr.iY > KQVGAHeight)
1399 iDispRect.iTl.iY = 0;
1400 iDispRect.SetHeight (KQVGAHeight);
1402 if ( iDispRect.iBr.iX > KQVGAWidth)
1404 iDispRect.iTl.iX = 0;
1405 iDispRect.SetWidth (KQVGAWidth);
1408 TRegionFix<1> region(iDispRect);
1411 INFO_PRINTF2(_L("Size window Y: %d"),iDispRect.Height());
1412 INFO_PRINTF2(_L("Size window X: %d"),iDispRect.Width());
1414 TRAPD(error,iDevvp->StartDirectScreenAccessL(iDispRect, *iScreenDevice, region));
1415 if ( error != KErrNone)
1417 ERR_PRINTF2(_L("StartDirectScreenAccessL error: %d"),error);
1422 iDsaStarted = ETrue;
1425 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStartDirectScreenAccessL"));
1431 void CT_CMMFDevVideoPlay::DoCmdStop()
1433 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdStop"));
1435 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdStop"));
1439 * Aborts Direct Screen Access completely
1442 void CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess()
1444 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
1445 if ( iDirectScreenAccess && iDsaStarted)
1447 iDevvp->AbortDirectScreenAccess ();
1448 INFO_PRINTF1(_L("Abort Direct Screen Access Done"));
1449 iDsaStarted = EFalse;
1451 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdAbortDirectScreenAccess"));
1455 * Pause the decoding process
1457 void CT_CMMFDevVideoPlay::DoCmdPause()
1459 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdPause"));
1462 iClock->Suspend (); //Stop Clock source
1465 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdPause"));
1469 * Resume the decodind process
1471 void CT_CMMFDevVideoPlay::DoCmdResume()
1473 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdResume"));
1476 iClock->Resume (); //Restart Clock source
1481 if ( iDevvp->NumFreeBuffers () > 0 )
1483 INFO_PRINTF1(_L("Restart data transfer."));
1484 TRAPD(err1, HandleNewBufferL());
1485 if (err1 != KErrNone)
1487 ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
1494 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdResume"));
1498 * Rotating the display
1499 * @param aSection - The section to read from the ini file
1502 void CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL(const TTEFSectionName& aSection)
1504 TRotationType rotation;
1506 TBool dataOk = ETrue;
1507 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
1508 if ( !( GetEnumFromConfig(aSection, KRotation(), iRotations, rotItem)))
1510 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
1511 SetBlockResult(EFail);
1516 rotation = (TRotationType)rotItem;
1517 TRAPD(error,iDevvp->SetRotateOptionsL(iPostProcId, rotation));
1518 if ( error != KErrNone)
1520 ERR_PRINTF2(_L("DoCmdSetRotateOptionsL! Error = %d"),error);
1524 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetRotateOptionsL"));
1528 * Setting the screen options
1529 * @param aSection - The section to read from the ini file
1532 void CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL(const TTEFSectionName& aSection)
1537 TBool antiAliasFiltering = ETrue;
1538 TBool dataOk = ETrue;
1539 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
1540 if ( !(GetIntFromConfig(aSection, Kx(), x)) )
1542 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Kx());
1543 SetBlockResult(EFail);
1546 if ( !(GetIntFromConfig(aSection, Ky(), y)) )
1548 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &Ky());
1549 SetBlockResult(EFail);
1552 if ( !(GetIntFromConfig(aSection, KWidth(), width)) )
1554 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
1555 SetBlockResult(EFail);
1558 if ( !(GetIntFromConfig(aSection, KHeight(), height)) )
1560 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
1561 SetBlockResult(EFail);
1564 GetBoolFromConfig(aSection, KAntiAliasFiltering(),antiAliasFiltering);
1567 TSize size(width, height);
1568 TRAPD(error, SetWindowRect(x, y,size));
1569 if ( error != KErrNone)
1571 ERR_PRINTF2(_L("SetWindowRect! left with Error = %d"),error);
1572 SetBlockResult (EFail);
1575 TRAP(error, iDevvp->SetScaleOptionsL(iPostProcId, size, antiAliasFiltering));
1576 if ( error != KErrNone)
1578 ERR_PRINTF2(_L("SetScaleOptionsL! left with Error = %d"),error);
1582 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetScaleOptionsL"));
1586 * Sets the new position for playback and decoding. It is use for forward and backward
1588 void CT_CMMFDevVideoPlay::DoCmdSetPosition(const TTEFSectionName& aSection)
1592 TBool dataOk = ETrue;
1593 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
1594 if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
1596 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
1597 SetBlockResult(EFail);
1602 pos = pos*iFramerate;
1603 INFO_PRINTF2(_L("pos %i"),pos);
1604 if((pos > iFrameSizeList.Count()) || ((pos+iSentBuffCount) < 0))
1606 ERR_PRINTF2(_L("Invalid value, check %S from INI file"), &KPos());
1607 //SetBlockResult(EFail);
1611 iSentBuffCount +=pos;
1612 TTimeIntervalMicroSeconds timeStamp;
1613 if ( iSynchronized )
1615 timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount*iFrameTimeInterval);
1616 time = timeStamp.Int64();
1617 iClock->Reset(timeStamp);
1622 timeStamp = (TTimeIntervalMicroSeconds)(iSentBuffCount);
1625 iDevvp->SetPosition(timeStamp);
1628 for(TInt i=0; i < iSentBuffCount; i++)
1630 temp += iFrameSizeList[i];
1632 TInt error = KErrNone;
1633 error = iInFile.Seek(ESeekStart,temp);
1634 if (error != KErrNone)
1636 ERR_PRINTF2(_L("Error Seeking in file, check ini for parameter POS: %d"),error);
1637 SetBlockResult(EFail);
1641 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdSetPosition"));
1645 * Utility command to get the initial parameters
1647 void CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL()
1649 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
1651 CPostProcessorInfo *infoPost = NULL;
1652 RArray< TUid > postProcessors;
1653 iDevvp->GetPostProcessorListL(postProcessors);
1654 for(TInt i = 0; i< postProcessors.Count(); i++)
1656 INFO_PRINTF3(_L("PostProcessors %d = 0x%x"),i,postProcessors[i]);
1657 TRAPD(err,infoPost = iDevvp->PostProcessorInfoLC(postProcessors[i]);CleanupStack::Pop(infoPost));
1660 ERR_PRINTF1(_L("Error in getting Devvp->PostProcessorInfoLC(postProcessors[i])"));
1664 TBool supported = infoPost->SupportsDirectDisplay();
1667 INFO_PRINTF1(_L("Direct Display Supported"));
1671 INFO_PRINTF1(_L("Direct Display Not Supported"));
1673 const RArray<TUint32> combinations = infoPost->SupportedCombinations();
1674 for (i = 0; i < combinations.Count(); i++)
1676 INFO_PRINTF2(_L("Supported Combination : %d"),combinations[i]);
1678 TUint32 test = 0x3040;
1679 if (infoPost->SupportsCombination(test))
1681 INFO_PRINTF2(_L("Combination %x is Supported"),test);
1685 INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
1688 if (infoPost->SupportsCombination(test))
1690 INFO_PRINTF2(_L("Combination %x is Supported"),test);
1694 INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
1696 test = 0x44;//rotation
1697 if (infoPost->SupportsCombination(test))
1699 INFO_PRINTF2(_L("Combination %x is Supported"),test);
1703 INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
1706 if (infoPost->SupportsCombination(test))
1708 INFO_PRINTF2(_L("Combination %x is Supported"),test);
1712 INFO_PRINTF2(_L("Combination %x is NOT Supported"),test);
1714 TUint32 rotations = infoPost->SupportedRotations();
1717 INFO_PRINTF1(_L("Rotation is Not Supported"));
1721 INFO_PRINTF2(_L("Supported rotation : %d"),rotations);
1723 supported = infoPost->SupportsArbitraryScaling();
1726 INFO_PRINTF1(_L("Arbitrary Scaling is Supported"));
1730 RArray<TScaleFactor> scaleFactors = infoPost->SupportedScaleFactors();
1731 TScaleFactor factor;
1732 for (i = 0; i < scaleFactors.Count(); i++)
1734 factor = scaleFactors[i];
1735 INFO_PRINTF3(_L("Scale factor: scale num - %d scale denom - %d"),factor.iScaleNum,factor.iScaleDenom);
1743 RArray<TUid> decoders;
1744 iDevvp->GetDecoderListL(decoders);
1745 CVideoDecoderInfo *infDec =NULL;
1746 INFO_PRINTF1(_L("INFORMATION ABOUT DECODERS:"));
1747 for(TInt i = 0; i< decoders.Count(); i++)
1749 TRAPD(err, infDec = iDevvp->VideoDecoderInfoLC(decoders[i]);CleanupStack::Pop(infDec));
1750 if(err != KErrNone )
1752 ERR_PRINTF1(_L("Error in iDevvp->VideoDecoderInfoLC(decoders[i])"));
1756 INFO_PRINTF6(_L("\nDecoder =0x%x\n Identifier = %S\n Accelerated = %i\n Supports Direct Display: %i\n Manufacturer%S"),
1758 &infDec->Identifier(),
1759 infDec->Accelerated(),
1760 infDec->SupportsDirectDisplay(),
1761 &infDec->Manufacturer());
1762 INFO_PRINTF1(_L("SUPPORTED FORMATS:"));
1764 const RPointerArray<CCompressedVideoFormat>& outputFormats =infDec->SupportedFormats();
1765 for (TInt j = 0; j < outputFormats.Count(); j++)
1767 mime.Copy(outputFormats[j]->MimeType());
1768 INFO_PRINTF3(_L("Supported type %d MIMETYPE: %S"),j,&mime);
1770 INFO_PRINTF1(_L("\n\n"));
1775 HAL::Get(HALData::EDisplayColors, colors);
1776 INFO_PRINTF2(_L("Display colors : %d"),colors);
1777 INFO_PRINTF1(_L("Display mode!"));
1781 INFO_PRINTF1(_L("None"));
1784 INFO_PRINTF1(_L("EColor16MU"));
1787 INFO_PRINTF1(_L("EColor64K"));
1790 INFO_PRINTF1(_L("EColor4K"));
1793 INFO_PRINTF1(_L("Default mode EColor4K"));
1795 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::DoCmdUtilityGetEnvironmentL"));
1799 * Sets the original window for display
1801 void CT_CMMFDevVideoPlay::SetWindowRect(TInt aX, TInt aY, TSize aSize)
1803 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
1804 iDispRect.SetRect(TPoint(aX,aY),aSize);
1805 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SetWindowRect"));
1809 * Read one coded picture into decoder input buffer
1811 * @param aCodedInBuffer
1815 TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer)
1817 TInt buffLength = iInBuffSize;
1818 TBool found = EFalse;
1820 TUint8* testData= NULL;
1821 TInt err = KErrNone;
1822 if ( aCodedInBuffer->iData.MaxLength ()< buffLength)
1827 aCodedInBuffer->iData.SetLength (0);
1828 //Read data from Input File
1829 err = iInFile.Read (aCodedInBuffer->iData, buffLength);
1830 if ( err != KErrNone)
1834 //Buffer is not full, reset size of buffer
1835 if ( aCodedInBuffer->iData.Length ()< buffLength)
1837 buffLength = aCodedInBuffer->iData.Length ();
1839 testData = const_cast<TUint8*>(aCodedInBuffer->iData.Ptr());
1840 //Check the length of one coded picture
1841 if ( (iCodecType == EH263) || ((testData[0] == 0x00) && (testData[1] == 0x00) & ((testData[2] & 0xFC) == 0x80)))
1843 if ( (aCodedInBuffer->iData.Length() > 0))
1845 pos = KScLength; //skip first 3 byte (PSC)
1847 while ( pos < (buffLength - KScLength) && !found)
1849 if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00) & ((testData[pos+3] & 0xFC) == 0x80))
1863 if ( iCodecType == EMPEG4)
1865 if ( (aCodedInBuffer->iData.Length() > 0))
1867 // Check if start code of Visual Object Sequence
1869 while ( pos < (buffLength - KScLength) && !found)
1870 { // Find 1st VOP start code in the buffer
1871 if ( (testData[pos] == 0x00) && (testData[pos+1] == 0x00)&& (testData[pos+2] == 0x01) && (testData[pos+3] == 0xB6))
1873 while (pos < (buffLength - KScLength-1) && !found)
1876 // Find 2nd start code in the buffer >> End of a Picture
1877 if ( (testData[pos+1] == 0x00) && (testData[pos+2] == 0x00)&& (testData[pos+3] == 0x01) && (testData[pos+4] != 0xB1))
1894 err = KErrNotSupported;
1896 // Start and End of a picure are found
1899 //Set Size to length of the header + one picure, and reset position to be read next time
1900 aCodedInBuffer->iData.SetLength (pos);
1901 TInt tempLength = pos - buffLength;
1902 err = iInFile.Seek (ESeekCurrent, tempLength);
1904 // All data in Buffer are checked and end of data not found
1907 if ( pos >= (iInBuffSize-3))
1912 if ( err == KErrNone)
1920 * Read one coded picture into decoder input buffer, frame size is known
1922 * @param aCodedInBuffer
1923 * @param aSize - frame size
1924 * @return err - The error
1926 TInt CT_CMMFDevVideoPlay::ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer, TInt aSize)
1928 TInt err = KErrNone;
1929 if(aCodedInBuffer !=NULL)
1931 err = iInFile.Read(aCodedInBuffer->iData, aSize);
1935 INFO_PRINTF1(_L("aCodedInBuffer is NULL"));
1947 * Notifies the client that one or more new empty input buffers are available
1950 void CT_CMMFDevVideoPlay::MdvpoNewBuffers()
1952 TRAPD(err, HandleNewBufferL());
1953 if (err != KErrNone)
1955 ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err);
1956 SetBlockResult(EFail);
1961 * Returns a used input video picture back to the caller. The picture memory can be re-used or freed.
1963 * @param aPicture the picture to return
1965 void CT_CMMFDevVideoPlay::MdvpoReturnPicture(TVideoPicture* aPicture)
1967 if ( iRawInBuffer == aPicture )
1969 TRAPD(err1, HandleNewBufferL());
1970 if (err1 != KErrNone)
1972 ERR_PRINTF2(_L("HandleNewBufferL()left with error %d"),err1);
1973 SetBlockResult(EFail);
1979 * Delivers supplemental information from a coded data unit.
1981 * @param aData The supplemental data. The reference is only valid until the method returns, and thus the data must be processed or copied immediately
1982 * @param aTimestamp The presentation timestamp for the picture that the supplemental data is part of
1983 * @param aPictureId Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
1987 void CT_CMMFDevVideoPlay::MdvpoSupplementalInformation(const TDesC8& /*aData*/, const TTimeIntervalMicroSeconds& /*aTimestamp*/, const TPictureId& /*aPictureId*/)
1992 * Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
1996 void CT_CMMFDevVideoPlay::MdvpoPictureLoss()
2002 * Back channel information from the decoder, indicating a picture loss without specifying the lost picture.
2004 * @param aPictures Picture identifiers for the lost pictures.
2008 void CT_CMMFDevVideoPlay::MdvpoPictureLoss(const TArray<TPictureId>& aPictures)
2010 iPictureLoss += aPictures.Count();
2014 * Back channel information from the decoder, indicating the loss of consecutive macroblocks in raster scan order.
2016 * @param aFirstMacroblock The first lost macroblock
2017 * @param aNumMacroblocks The number of lost macroblocks that are consecutive in raster-scan order
2018 * @param aPicture The picture identifier for the picture where the macroblocks were lost
2022 void CT_CMMFDevVideoPlay::MdvpoSliceLoss(TUint /*aFirstMacroblock*/, TUint /*aNumMacroblocks*/, const TPictureId& /*aPicture*/)
2027 * Back channel information from the decoder, indicating a reference picture selection request.
2029 * @param aSelectionData The reference picture selection request message.
2033 void CT_CMMFDevVideoPlay::MdvpoReferencePictureSelection(const TDesC8& /*aSelectionData*/)
2038 * Called when a timed snapshot request has been completed. When this method is called, the snapshot has been taken, and the memory reserved for the picture can be re-used or freed.
2040 * @param aError An error code, KErrNone if no errors occurred.
2041 * @param aPictureData The snapshot picture data
2042 * @param aPresentationTimestamp The presentation timestamp for the snapshot picture
2043 * @param aPictureId Picture identifier for the picture. If a picture ID is not available, aPictureId.iIdType is set to ENone
2047 void CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete(TInt aError, TPictureData* /*aPictureData*/,
2048 const TTimeIntervalMicroSeconds& /*aPresentationTimestamp*/,
2049 const TPictureId& /*aPictureId*/)
2051 if(aError!= KErrNone)
2053 INFO_PRINTF2(_L("An error has ocurred: %i in CT_CMMFDevVideoPlay::MdvpoTimedSnapshotComplete"),aError);
2058 * Notifies the client that one or more new output pictures are available.
2062 void CT_CMMFDevVideoPlay::MdvpoNewPictures()
2064 GetReturnedPicture();
2068 * Reports a fatal decoding or playback error to the client.
2070 * @param aError The error code
2074 void CT_CMMFDevVideoPlay::MdvpoFatalError(TInt aError)
2076 INFO_PRINTF1(_L("MdvpoFatalError DecOutstanding"));
2078 ERR_PRINTF2(_L("A Fatal error has ocurred: %i"),aError);
2079 HandleRuntimeError(aError);
2083 * Reports that DevVideoPlay initialization has completed. The interface can now be used for video playback.
2085 * @param aError Initialization error code, KErrNone if no error occurred
2089 void CT_CMMFDevVideoPlay::MdvpoInitComplete(TInt aError)
2092 if ( aError == KErrNone)
2094 INFO_PRINTF1(_L("MdvpoInitComplete OK"));
2095 //Initilize parameters for Decoding/Playback
2096 iCodedInBuffer = NULL;
2099 iReturnedBuffCount = 0;
2102 iStreamEnd = EFalse;
2107 ERR_PRINTF2(_L("MdvpoInitComplete Error %d"), aError);
2108 SetAsyncError (iAsyncErrorIndex, aError);
2110 INFO_PRINTF1(_L("MdvpoInitComplete DecOutstanding"));
2115 * Reports that the input video stream end has been reached and all pictures have been processed.
2116 * This method is only called after the client has called InputEnd(). No more output pictures will be available.
2120 void CT_CMMFDevVideoPlay::MdvpoStreamEnd()
2123 INFO_PRINTF1(_L("Stream End!"));
2124 INFO_PRINTF2(_L("iSentBuffCount: %d"),iSentBuffCount);
2125 INFO_PRINTF2(_L("iReturnedBuffCount: %d"),iReturnedBuffCount);
2126 INFO_PRINTF2(_L("iPictureLoss: %d"),iPictureLoss);
2127 INFO_PRINTF1(_L("MdvpoStreamEnd DecOutStanding"));
2133 * Get Next input data
2137 void CT_CMMFDevVideoPlay::HandleNewBufferL()
2141 if ( iDecHWDevId || iCIBuffMgmtOn ) //Retrieve buffer from Hwdevice
2147 FillAndSendBufferL(); // Postproc input
2153 * Retrieve decoder input buffer
2157 void CT_CMMFDevVideoPlay::GetInputBuffer()
2159 //TBool buffer = EFalse;
2162 TRAPD(error, iCodedInBuffer = iDevvp->GetBufferL(iInBuffSize));
2163 if (error != KErrNone)
2165 ERR_PRINTF2(_L("Error GetInputBufferL!. Error %d"),error);
2166 iErrorInputBuffer = ETrue;
2171 if ( iCodedInBuffer )
2173 TRAPD(error, FillAndSendBufferL());
2174 if (error != KErrNone)
2176 ERR_PRINTF2(_L("Error GetInputBufferL->FillAndSendBufferL!. Error %d"),error);
2177 SetBlockResult(EFail);
2187 * Fill data into input buffer and send to devvideoplay
2191 void CT_CMMFDevVideoPlay::FillAndSendBufferL()
2193 TInt err = KErrNone;
2199 if((iSentBuffCount>=0) && (iSentBuffCount < iFrameSizeList.Count()))
2201 size = iFrameSizeList[iSentBuffCount];
2205 ERR_PRINTF2(_L("error %i"),iSentBuffCount);
2208 err = ReadOneCodedPicture (iCodedInBuffer, size); // Read compressed data of one picture from file
2212 err = ReadOneCodedPicture (iCodedInBuffer); // Read compressed data of one picture from file
2215 else // Postproc input case
2217 err = ReadRawPicture (); // Read raw data for one picture
2221 iDevvp->InputEnd (); // All input Data sent
2228 iCodedInBuffer->iOptions = TVideoInputBuffer::EDecodingTimestamp;
2231 iCodedInBuffer->iOptions |= TVideoInputBuffer::EPresentationTimestamp;
2235 iCodedInBuffer->iDecodingTimestamp = iTimeStamp;
2238 iCodedInBuffer->iPresentationTimestamp = iTimeStamp;
2240 iTimeStamp += iFrameTimeInterval;
2242 else // Clock source is not set
2244 iCodedInBuffer->iDecodingTimestamp = iSentBuffCount;
2247 iCodedInBuffer->iPresentationTimestamp = iSentBuffCount;
2250 if ( iFrameMeasurement)
2252 iClock->Reset (); // Reset Timer
2254 TRAPD(error,iDevvp->WriteCodedDataL(iCodedInBuffer)); // Input Data Sent to Decoder
2255 if ( error != KErrNone)
2257 ERR_PRINTF2(_L("Error Writing data!. Error %d"),error);
2264 iRawInBuffer->iData.iDataSize.SetSize (iPictureSize.iWidth,
2265 iPictureSize.iHeight);
2266 iRawInBuffer->iOptions |= (TVideoPicture::ETimestamp);
2269 iRawInBuffer->iTimestamp = iTimeStamp;
2270 iTimeStamp += iFrameTimeInterval;
2274 iRawInBuffer->iTimestamp = iSentBuffCount;
2276 TRAPD(error, iDevvp->WritePictureL (iRawInBuffer)); // Input Data Sent to PostProcessor
2277 if (error != KErrNone)
2279 ERR_PRINTF2(_L("Error Writing Picture!. Error %d"),error);
2289 iDevvp->InputEnd ();
2296 * Retrieve output picture
2300 void CT_CMMFDevVideoPlay::GetReturnedPicture()
2302 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::GetReturnedPicture"));
2303 TRAPD(err, iOutBuffer = iDevvp->NextPictureL());
2304 if ( err != KErrNone)
2306 HandleRuntimeError(err);
2307 ERR_PRINTF1(_L("Error en GetReturnedPicture!!"));
2311 iReturnedBuffCount++;
2312 SaveAndReturnPicture();
2314 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::GetReturnedPicture"));
2318 * This function finishes the async call depending on the error occured while handling the picture
2320 * @param aError Error Value passed
2323 void CT_CMMFDevVideoPlay::HandleRuntimeError(TInt aError)
2325 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::HandleRuntimeError"));
2326 ERR_PRINTF2(_L("HandleRuntimeError! Error = %d"),aError);
2328 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::HandleRuntimeError"));
2332 * Store output data into a file
2336 void CT_CMMFDevVideoPlay::SaveAndReturnPicture()
2338 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
2339 TInt err = iOutFile.Write (*(iOutBuffer->iData.iRawData), iOutBuffer->iData.iRawData->Size ());
2340 iDevvp->ReturnPicture (iOutBuffer);
2342 if ( err != KErrNone)
2344 HandleRuntimeError (err);
2346 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::SaveAndReturnPicture"));
2350 * List size of each frame of coded bitstream
2352 * @param aCodec picture
2355 void CT_CMMFDevVideoPlay::ListFrameSizeL(TVideoCodec aCodec)
2359 TInt buffsize = KH263MaxCodedSizeQCIF; //buffer size for listing frame size
2360 iCodecType = aCodec; // this is for ReadOneCodedPicture
2361 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ListFrameSizeL"));
2362 //Initial buffer size
2364 TVideoInputBuffer* videoBuffer = new(ELeave) TVideoInputBuffer;
2365 CleanupStack::PushL (videoBuffer);
2366 HBufC8* tempBuff = HBufC8::NewLC( buffsize);
2367 videoBuffer->iData.Set (tempBuff->Des ());
2370 iInBuffSize = buffsize;
2371 videoBuffer->iData.SetLength (0);
2372 framesize = ReadOneCodedPicture (videoBuffer);//
2373 if ( framesize >= 0) // Frame size is added to list
2375 iFrameSizeList.AppendL (framesize);
2376 readpos += framesize;
2378 else // resize buffer to bigger one
2380 if ( buffsize < KMP4MaxCodedSizeVGA)
2382 CleanupStack::PopAndDestroy(tempBuff);
2383 buffsize = buffsize + KH263MaxCodedSizeQCIF;
2384 tempBuff = HBufC8::NewLC( buffsize);
2385 videoBuffer->iData.Set (tempBuff->Des ());
2386 iInFile.Seek (ESeekStart, readpos);
2390 framesize = KErrNotFound;
2395 //Reset file postion to start
2397 iInFile.Seek (ESeekStart, pos);
2400 CleanupStack::PopAndDestroy(2, videoBuffer);
2404 User::Leave (framesize);
2406 //Set frame size listed
2407 iFrameListed = ETrue;
2408 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ListFrameSizeL"));
2412 * Closes the opened files
2414 void CT_CMMFDevVideoPlay::CloseFile()
2416 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::CloseFile"));
2418 if ( !iDirectScreenAccess)
2422 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::CloseFile"));
2426 * Opens the input and output file
2427 * @param aInFileName - The name of input file
2428 * @param aOutFileName - The name of output file
2431 void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aOutFileName, TFileName& aInFileName)
2433 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
2434 TInt err = iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly);
2435 User::LeaveIfError (err);
2436 err = iOutFile.Replace (iFs, aOutFileName,
2437 EFileShareExclusive|EFileWrite);
2438 if ( err!= KErrNone)
2443 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
2447 * Opens the input File
2448 * @param aInFileName -The name of input file
2451 void CT_CMMFDevVideoPlay::OpenFileL(TFileName& aInFileName)
2453 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::OpenFileL"));
2454 User::LeaveIfError(iInFile.Open (iFs, aInFileName, EFileRead | EFileShareReadersOnly));
2455 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::OpenFileL"));
2459 * Read one raw picture into postprocessor input buffer
2461 TInt CT_CMMFDevVideoPlay::ReadRawPicture()
2463 INFO_PRINTF1(_L("*START*CT_CMMFDevVideoPlay::ReadRawPicture"));
2464 iRawInBuffer->iData.iRawData->Set ((TUint8*)iRawInBuffer->iData.iRawData->Ptr(), 0, iInBuffSize);
2465 TInt err = iInFile.Read (*(iRawInBuffer->iData.iRawData), iInBuffSize);
2468 if ( (iRawInBuffer->iData.iRawData->Length()) == 0)
2473 INFO_PRINTF1(_L("*END*CT_CMMFDevVideoPlay::ReadRawPicture"));
2477 void CT_CMMFDevVideoPlay::DoCmdH264CreateDecTest(const TTEFSectionName& aSection)
2479 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::CreateDecTest, In"));
2488 TPtrC inputDirectory;
2490 iObserver = new (ELeave) CEngineObserver(*this);
2491 //Create Decoder test engine
2492 iEngine = CVDecTestEngine::NewL(*iObserver);
2494 //Read from test case file
2495 if(!GetHexFromConfig(aSection, KUid(), uidInt))
2497 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
2498 SetBlockResult(EFail);
2500 if(!GetIntFromConfig(aSection, KBuffMgmt(), buffMgmt))
2502 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KBuffMgmt());
2503 SetBlockResult(EFail);
2505 if(!GetIntFromConfig(aSection, KOutput(), output))
2507 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutput());
2508 SetBlockResult(EFail);
2510 if(!GetIntFromConfig(aSection, KWidth(), width))
2512 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
2513 SetBlockResult(EFail);
2515 if(!GetIntFromConfig(aSection, KHeight(), height))
2517 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
2518 SetBlockResult(EFail);
2520 if(!GetIntFromConfig(aSection, KCodec(), codec))
2522 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCodec());
2523 SetBlockResult(EFail);
2525 if(!GetStringFromConfig(aSection, KInputPath(), inputDirectory))
2527 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputPath());
2528 SetBlockResult(EFail);
2530 if(!GetStringFromConfig(aSection, KInputfile(), inputfile))
2532 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputfile());
2533 SetBlockResult(EFail);
2537 TFileName inFileName(inputDirectory);
2538 inFileName.Append(inputfile);
2541 decoderUid.iUid = uidInt;
2542 INFO_PRINTF2(_L("Decoder uid is [%x]"), decoderUid.iUid);
2545 size.SetSize(width, height);
2547 if (output == EDecodedFile)
2550 TPtrC outputDirectory;
2551 if ( ! (GetStringFromConfig(aSection, KOutputPath(),outputDirectory)))
2553 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputPath());
2554 SetBlockResult(EFail);
2556 if ( !(GetStringFromConfig(aSection, KOutputfile(),outputfile)))
2558 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KOutputfile());
2559 SetBlockResult(EFail);
2563 iEngine->SetUpL(size, EFalse, buffMgmt);
2564 TFileName outFileName(outputDirectory);
2565 outFileName.Append(outputfile);
2566 iEngine->OpenFileL(outFileName, inFileName);
2568 else if (output == EScreenOutput)
2570 iEngine->SetUpL(size, ETrue, buffMgmt);
2571 iEngine->OpenFileL(inFileName);
2574 TRAPD(result, iEngine->SelectDecoderL(decoderUid));
2575 if(result != KErrNone)
2577 ERR_PRINTF2(_L("SelectDecoderL left with error %d"), result);
2581 TVideoCodec videoCodec;
2586 else if (codec == 2)
2588 videoCodec = EMPEG4;
2590 else if (codec == 3)
2594 else if (codec == 4)
2598 else if (codec == 5)
2602 else if (codec == 6)
2608 videoCodec = EMPEG4;
2610 iEngine->SetCodecType(videoCodec);
2614 INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::CreateDecTest, Out"));
2617 void CT_CMMFDevVideoPlay::DoCmdH264SetInputFormatCompr(const TTEFSectionName& aSection)
2619 INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, In"));
2622 TInt dataUnitTypeInt = 0;
2623 TInt encapsulation = 0;
2624 TInt dataInOrder = 0;
2626 if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
2628 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
2629 SetBlockResult(EFail);
2631 if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
2633 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataUnitTypeInt());
2634 SetBlockResult(EFail);
2636 if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
2638 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KEncapsulation());
2639 SetBlockResult(EFail);
2641 if(!GetBoolFromConfig(aSection, KDataInOrder(), dataInOrder))
2643 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataInOrder());
2644 SetBlockResult(EFail);
2646 if(!GetStringFromConfig(aSection, KFormat(), format))
2648 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFormat());
2649 SetBlockResult(EFail);
2652 TVideoDataUnitType dataUnitType;
2653 switch (dataUnitTypeInt)
2655 case 1: dataUnitType = EDuCodedPicture;
2657 case 2: dataUnitType = EDuVideoSegment;
2659 case 3: dataUnitType = EDuSeveralSegments;
2661 case 4: dataUnitType = EDuArbitraryStreamSection;
2663 default:dataUnitType = EDuCodedPicture;
2666 TVideoDataUnitEncapsulation dataEncapsulation;
2668 switch (encapsulation)
2670 case 1: dataEncapsulation = EDuElementaryStream;
2672 case 2: dataEncapsulation = EDuGenericPayload;
2674 case 3: dataEncapsulation = EDuRtpPayload;
2676 default:dataEncapsulation = EDuElementaryStream;
2681 CCompressedVideoFormat* compressedFormat = CCompressedVideoFormat::NewL(buf);
2683 TRAPD(result, iEngine->SetInputFormatL(hwdev,*compressedFormat, dataUnitType, dataEncapsulation, dataInOrder));
2684 if(result != KErrNone)
2686 ERR_PRINTF2(_L("SetInputFormatL left with error %d"), result);
2689 delete compressedFormat;
2691 INFO_PRINTF1(_L("CT_MMFDevVideoPlayData::SetInputFormatCompr, Out"));
2694 void CT_CMMFDevVideoPlay::DoCmdH264SetOutputFormat(const TTEFSectionName& aSection)
2697 TInt dataFormat = 0;
2698 TInt dataLayout = 0;
2700 TInt aspectRatioNum = 1;
2701 TInt aspectRatioDenom = 1;
2702 TInt coefficients = 0;
2704 //Read from test case file
2705 if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
2707 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
2708 SetBlockResult(EFail);
2710 if ( !(GetIntFromConfig(aSection, KDataFormat(), dataFormat)))
2712 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataFormat());
2713 SetBlockResult(EFail);
2716 if ( !(GetIntFromConfig(aSection, KDataLayout(), dataLayout)))
2718 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDataLayout());
2719 SetBlockResult(EFail);
2722 TUncompressedVideoFormat unCompressedFormat;
2727 unCompressedFormat.iDataFormat = ERgbRawData;
2728 unCompressedFormat.iRgbFormat = ERgb32bit888;
2730 case 2: unCompressedFormat.iDataFormat = ERgbFbsBitmap;
2733 case 1: unCompressedFormat.iRgbFormat = ERgb16bit444;
2735 case 2: unCompressedFormat.iRgbFormat = ERgb16bit565;
2737 case 3: unCompressedFormat.iRgbFormat = ERgb32bit888;
2739 case 4: unCompressedFormat.iRgbFormat = EFbsBitmapColor4K;
2741 case 5: unCompressedFormat.iRgbFormat = EFbsBitmapColor16M;
2743 case 6: unCompressedFormat.iRgbFormat = EFbsBitmapColor16MU;
2745 default: unCompressedFormat.iRgbFormat = ERgb16bit444;
2748 case 3: unCompressedFormat.iDataFormat = EYuvRawData;
2749 if ( !(GetIntFromConfig(aSection, KPattern(), pattern)))
2751 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPattern());
2752 SetBlockResult(EFail);
2754 if ( !(GetIntFromConfig(aSection, KAspectRatioNum(), aspectRatioNum)))
2756 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioNum());
2757 SetBlockResult(EFail);
2759 if ( !(GetIntFromConfig(aSection, KAspectRatioDenom(), aspectRatioDenom)))
2761 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KAspectRatioDenom());
2762 SetBlockResult(EFail);
2764 if(!GetHexFromConfig(aSection, KCoefficients(), coefficients))
2766 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCoefficients());
2767 SetBlockResult(EFail);
2771 case 1: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
2773 case 2: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedLE;
2775 case 3: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataInterleavedBE;
2777 case 4: unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataSemiPlanar;
2779 default:unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
2783 case 1: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
2785 case 2: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
2787 case 3: unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma3;
2789 case 4: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma1;
2791 case 5: unCompressedFormat.iYuvFormat.iPattern = EYuv422Chroma2;
2793 default:unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma2;
2795 switch (coefficients)
2797 case 1: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange0;
2799 case 2: unCompressedFormat.iYuvFormat.iCoefficients = EYuvRange1;
2801 case 3: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709;
2803 case 4: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
2805 case 5: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range1;
2807 case 6: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601;
2809 case 7: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range0;
2811 case 8: unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
2813 case 9: unCompressedFormat.iYuvFormat.iCoefficients = ECustomYuvMatrix;
2815 default:unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt709Range0;
2817 unCompressedFormat.iYuvFormat.iAspectRatioNum = aspectRatioNum;
2818 unCompressedFormat.iYuvFormat.iAspectRatioDenom = aspectRatioDenom;
2819 // We don't use conversion
2820 unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
2821 unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
2824 default: unCompressedFormat.iDataFormat = EYuvRawData;
2825 unCompressedFormat.iYuvFormat.iDataLayout = EYuvDataPlanar;
2826 unCompressedFormat.iYuvFormat.iPattern = EYuv420Chroma1;
2827 unCompressedFormat.iYuvFormat.iAspectRatioNum = 1;
2828 unCompressedFormat.iYuvFormat.iAspectRatioDenom = 1;
2829 unCompressedFormat.iYuvFormat.iCoefficients = EYuvBt601Range1;
2831 // We don't use conversion
2832 unCompressedFormat.iYuvFormat.iYuv2RgbMatrix = NULL;
2833 unCompressedFormat.iYuvFormat.iRgb2YuvMatrix = NULL;
2836 TRAPD(result, iEngine->SetOutputFormatL(hwdev, unCompressedFormat));
2837 if(result != KErrNone)
2839 ERR_PRINTF2(_L("SetOutputFormatL left with error %d"), result);
2844 void CT_CMMFDevVideoPlay::DoCmdH264SetBufferOptions(const TTEFSectionName& aSection)
2846 TInt preDecodeBufferSize = 0;
2847 TInt maxPostDecodeBufferSize = 0;
2848 TInt preDecoderBufferPeriodInt = 0;
2849 TInt postDecoderBufferPeriodInt = 0;
2850 TInt maxInputBufferSize = 0;
2851 TInt minNumInputBuffers = 0;
2853 if ( !(GetIntFromConfig(aSection, KPreDecodeBufferSize(), preDecodeBufferSize)))
2855 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecodeBufferSize());
2856 SetBlockResult(EFail);
2858 if ( !(GetIntFromConfig(aSection, KMaxPostDecodeBufferSize(), maxPostDecodeBufferSize)))
2860 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxPostDecodeBufferSize());
2861 SetBlockResult(EFail);
2863 if ( !(GetIntFromConfig(aSection, KPreDecoderBufferPeriodInt(), preDecoderBufferPeriodInt)))
2865 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPreDecoderBufferPeriodInt());
2866 SetBlockResult(EFail);
2868 if ( !(GetIntFromConfig(aSection, KPostDecoderBufferPeriodInt(), postDecoderBufferPeriodInt)))
2870 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPostDecoderBufferPeriodInt());
2871 SetBlockResult(EFail);
2873 if ( !(GetIntFromConfig(aSection, KMaxInputBufferSize(), maxInputBufferSize)))
2875 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMaxInputBufferSize());
2876 SetBlockResult(EFail);
2878 if ( !(GetIntFromConfig(aSection, KMinNumInputBuffers(), minNumInputBuffers)))
2880 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KMinNumInputBuffers());
2881 SetBlockResult(EFail);
2884 CMMFDevVideoPlay::TBufferOptions bufferOptions;
2885 bufferOptions.iPreDecodeBufferSize = preDecodeBufferSize;
2886 bufferOptions.iMaxPostDecodeBufferSize = maxPostDecodeBufferSize;
2887 bufferOptions.iPreDecoderBufferPeriod = preDecoderBufferPeriodInt;
2888 bufferOptions.iPostDecoderBufferPeriod = postDecoderBufferPeriodInt;
2889 bufferOptions.iMaxInputBufferSize = maxInputBufferSize;
2890 bufferOptions.iMinNumInputBuffers = minNumInputBuffers;
2892 TRAPD(result, iEngine->SetBufferOptionsL(bufferOptions));
2893 if(result != KErrNone)
2895 ERR_PRINTF2(_L("SetBufferOptionsL left with error %d"), result);
2900 void CT_CMMFDevVideoPlay::DoCmdH264Initialize()
2902 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, In"));
2903 iEngine->Initialize();
2905 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Initialize, Out"));
2908 void CT_CMMFDevVideoPlay::DoCmdH264Start(const TTEFSectionName& aSection)
2910 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, In"));
2912 if ( !(GetIntFromConfig(aSection, KInputEnd(), inputEnd)))
2914 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KInputEnd());
2915 SetBlockResult(EFail);
2919 iEngine->Start(ETrue);
2923 iEngine->Start(EFalse);
2926 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Start, Out"));
2929 void CT_CMMFDevVideoPlay::DoCmdH264Stop()
2931 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, In"));
2932 TRAPD(result, iEngine->Stop());
2933 if(result != KErrNone)
2935 ERR_PRINTF2(_L("Stop left with error %d"), result);
2938 INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Stop, Out result=%d"),result);
2941 void CT_CMMFDevVideoPlay::DoCmdH264Pause()
2943 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, In"));
2944 TInt result = KErrNone;
2945 result = iEngine->Pause();
2946 INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Pause, Out result=%d"),result);
2949 void CT_CMMFDevVideoPlay::DoCmdH264Resume()
2951 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, In"));
2952 TInt result = KErrNone;
2953 result = iEngine->Resume();
2954 INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264Resume, Out result=%d"),result);
2957 void CT_CMMFDevVideoPlay::DoCmdH264IOFrameNumMatch()
2959 iEngine->SetFrameMatch( ETrue );
2962 void CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize()
2964 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, In"));
2965 RArray<TInt> framesizes;
2966 TRAPD(result, iEngine->ListFrameSizeL(framesizes));
2967 if(result != KErrNone)
2969 ERR_PRINTF2(_L("ListFrameSizeL left with error %d"), result);
2972 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264ListFrameSize, Out"));
2975 void CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen(const TTEFSectionName& aSection)
2977 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::SetVideoDestScreen, In"));
2980 if(!GetBoolFromConfig(aSection, KDest(), dest))
2982 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KDest());
2983 SetBlockResult(EFail);
2986 TRAPD(result, iEngine->SetVideoDestScreenL(dest));
2987 if(result != KErrNone)
2989 ERR_PRINTF2(_L("SetVideoDestScreenL left with error %d"), result);
2992 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetVideoDestScreen, Out"));
2995 void CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect(const TTEFSectionName& aSection)
2997 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, In"));
3004 if ( !(GetIntFromConfig(aSection, KX(), x)))
3006 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KX());
3007 SetBlockResult(EFail);
3009 if ( !(GetIntFromConfig(aSection, KY(), y)))
3011 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
3012 SetBlockResult(EFail);
3014 if ( !(GetIntFromConfig(aSection, KWidth(), width)))
3016 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
3017 SetBlockResult(EFail);
3019 if ( !(GetIntFromConfig(aSection, KHeight(), height)))
3021 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
3022 SetBlockResult(EFail);
3025 TSize size(width, height);
3027 iEngine->SetWindowRect(x, y, size);
3029 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetWindowRect, Out"));
3032 void CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor(const TTEFSectionName& aSection)
3034 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, In"));
3037 if(!GetHexFromConfig(aSection, KUid(), uidInt))
3039 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KUid());
3040 SetBlockResult(EFail);
3044 postproUid.iUid = uidInt;
3045 INFO_PRINTF2(_L("PostProcessor uid is [%x]"), postproUid.iUid);
3047 TRAPD(result, iEngine->SelectPostProcessorL(postproUid));
3048 if(result != KErrNone)
3050 ERR_PRINTF2(_L("SelectPostProcessorL left with error %d"), result);
3053 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SelectPostProcessor, Out"));
3056 void CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes(const TTEFSectionName& aSection)
3058 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
3060 TInt combination = 0;
3063 if(!GetIntFromConfig(aSection, KHwdev(), hwdev))
3065 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
3066 SetBlockResult(EFail);
3068 if(!GetHexFromConfig(aSection, KCombination(), combination))
3070 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KCombination());
3071 SetBlockResult(EFail);
3074 TRAPD(result, iEngine->SetPostProcessTypesL(hwdev, combination));
3075 if(result != KErrNone)
3077 ERR_PRINTF2(_L("SetPostProcessTypesL left with error %d"), result);
3080 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPostProcessTypes, In"));
3083 void CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats()
3085 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, In") );
3087 TRAPD(result, iEngine->FindCommonFormatsL());
3088 if(result != KErrNone)
3090 ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
3093 INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::DoCmdH264FindCommonFormats, Out [%d]"), result);
3097 void CT_CMMFDevVideoPlay::DoCmdH264GetHeaderInformation(const TTEFSectionName& aSection)
3099 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, In") );
3100 TInt result = KErrNone;
3101 TInt dataUnitTypeInt = 0;
3102 TBool getDataUnitTypeInt = ETrue;
3103 if(!GetIntFromConfig(aSection, KDataUnitTypeInt(), dataUnitTypeInt))
3105 getDataUnitTypeInt = EFalse;
3107 TInt encapsulation = 0;
3108 TBool getEncapsulation = ETrue;
3109 if(!GetIntFromConfig(aSection, KEncapsulation(), encapsulation))
3111 getEncapsulation = EFalse;
3113 if(getDataUnitTypeInt && getEncapsulation)
3115 TVideoDataUnitType dataUnitType;
3116 switch (dataUnitTypeInt)
3118 case 1: dataUnitType = EDuCodedPicture;
3120 case 2: dataUnitType = EDuVideoSegment;
3122 case 3: dataUnitType = EDuSeveralSegments;
3124 case 4: dataUnitType = EDuArbitraryStreamSection;
3126 default:dataUnitType = EDuCodedPicture;
3129 TVideoDataUnitEncapsulation dataEncapsulation;
3130 switch (encapsulation)
3132 case 1: dataEncapsulation = EDuElementaryStream;
3134 case 2: dataEncapsulation = EDuGenericPayload;
3136 case 3: dataEncapsulation = EDuRtpPayload;
3138 default:dataEncapsulation = EDuElementaryStream;
3141 TRAP(result, iEngine->GetHeaderInformationL(dataUnitType, dataEncapsulation));
3145 TRAP(result, iEngine->GetHeaderInformationL());
3147 if(result != KErrNone)
3149 ERR_PRINTF2(_L("GetHeaderInformationL left with error %d"), result);
3152 INFO_PRINTF2(_L("CT_CMMFDevVideoPlay::GetHeaderInformation, Out [%d]"), result);
3155 void CT_CMMFDevVideoPlay::DoCmdH264EnableSynchronization(const TTEFSectionName& aSection)
3157 if(!GetIntFromConfig(aSection, KFramerate(), iFrameRate))
3159 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KFramerate());
3160 SetBlockResult(EFail);
3163 iEngine->EnableSynchronization(iFrameRate);
3166 void CT_CMMFDevVideoPlay::DoCmdH264SetScaleOptions(const TTEFSectionName& aSection)
3170 TInt antiAliasing = 0;
3173 if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
3175 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
3176 SetBlockResult(EFail);
3178 if ( !(GetIntFromConfig(aSection, KWidth(), width)))
3180 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KWidth());
3181 SetBlockResult(EFail);
3183 if ( !(GetIntFromConfig(aSection, KHeight(), height)))
3185 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHeight());
3186 SetBlockResult(EFail);
3188 if ( !(GetIntFromConfig(aSection, KY(), antiAliasing)))
3190 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KY());
3191 SetBlockResult(EFail);
3194 TSize size(width, height);
3196 TRAPD(result, iEngine->SetScaleOptionsL(hwdev, size, antiAliasing));
3197 if(result != KErrNone)
3199 ERR_PRINTF2(_L("FindCommonFormatsL left with error %d"), result);
3204 void CT_CMMFDevVideoPlay::DoCmdH264SetRotateOptions(const TTEFSectionName& aSection)
3208 if ( !(GetIntFromConfig(aSection, KHwdev(), hwdev)))
3210 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KHwdev());
3211 SetBlockResult(EFail);
3213 if ( !(GetIntFromConfig(aSection, KRotation(), rotItem)))
3215 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KRotation());
3216 SetBlockResult(EFail);
3218 TRotationType rotation;
3222 rotation = ERotateNone;
3225 rotation = ERotate90Clockwise;
3228 rotation = ERotate180;
3231 rotation = ERotate90Anticlockwise;
3234 rotation = ERotateNone;
3236 TRAPD(result, iEngine->SetRotateOptionsL(hwdev, rotation));
3237 if(result != KErrNone)
3239 ERR_PRINTF2(_L("SetRotateOptionsL left with error %d"), result);
3244 void CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding(const TTEFSectionName& aSection)
3246 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, In"));
3248 if(!GetBoolFromConfig(aSection, KSync(), sync))
3250 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KSync());
3251 SetBlockResult(EFail);
3253 iEngine->SynchronizeDecoding(sync);
3254 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SynchronizeDecoding, Out"));
3257 void CT_CMMFDevVideoPlay::DoCmdH264Delete()
3259 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, In"));
3260 if (iFileOpen && iUse264)
3262 iEngine->CloseFile();
3264 iEngine->TearDown();
3280 while(Outstanding())
3282 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete DecOutstanding()"));
3285 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264Delete, Out"));
3288 void CT_CMMFDevVideoPlay::DoCmdH264SetPosition(const TTEFSectionName& aSection)
3290 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, In"));
3292 TBool dataOk = ETrue;
3293 if ( !(GetIntFromConfig(aSection, KPos(), pos)) ) //This parameter indicates seconds to move forward/backward from the current position
3295 ERR_PRINTF2(_L("Error in getting parameter %S from INI file"), &KPos());
3296 SetBlockResult(EFail);
3301 TInt frameTimeInterval = (TInt64)(1000000/iFrameRate);
3302 TInt newPosition = (iEngine->PlaybackPosition()).Int64()/frameTimeInterval + pos;
3303 INFO_PRINTF2(_L("set to position %d"),newPosition);
3304 TInt maxPosition = iEngine->GetFrameSizeCount();
3305 INFO_PRINTF2(_L("total framesize count %d"),maxPosition);
3306 if(newPosition >= maxPosition)
3308 INFO_PRINTF3(_L("Invalid forward position %d, auto set to maximum framesize count %d"),newPosition,maxPosition-1);
3309 newPosition = maxPosition - 1;
3311 if(newPosition <= 0)
3313 INFO_PRINTF2(_L("Invalid backward position %d, auto set to starting position."),newPosition);
3316 TTimeIntervalMicroSeconds timestamp = newPosition*frameTimeInterval;
3317 iEngine->SetPosition(timestamp);
3319 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264SetPosition, Out"));
3322 void CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess()
3324 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess In"));
3325 iEngine->AbortDirectScreenAccess();
3326 INFO_PRINTF1(_L("CT_CMMFDevVideoPlay::DoCmdH264AbortDirectScreenAccess, Out"));