mmapitest/devvideohaitest/inc/t_cmmfdevvideoplaydata.h
branchRCL_3
changeset 23 545d349d14da
equal deleted inserted replaced
20:67584cc761d1 23:545d349d14da
       
     1 /*
       
     2 * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef T_CMMFDEVVIDEODATA_H
       
    21 #define T_CMMFDEVVIDEODATA_H
       
    22 
       
    23 //Epoc includes
       
    24 #include <e32base.h>
       
    25 #include <e32std.h>
       
    26 #include <f32file.h>
       
    27 #include <videoplayhwdevice.h>
       
    28 #include <devvideoplay.h>
       
    29 #include <devvideobase.h> 
       
    30 #include <bitdev.h>   // for display device 
       
    31 #include <fbs.h>  
       
    32 //User Includes
       
    33 #include "datawrapperbase.h"
       
    34 #include "t_devvideoconstants.h"
       
    35 #include "H264DecTestEngine.h"
       
    36 
       
    37 enum TVideoDecoderOutput 
       
    38 	{
       
    39 	EDecodedFile = 0,
       
    40 	EScreenOutput
       
    41 	};
       
    42 
       
    43 //Forward declarations
       
    44 class CT_CMMFDevVideoPlay;
       
    45 
       
    46 //Engine observer handle Async request completeion and release waitclass of Test scriptor
       
    47 
       
    48 class CEngineObserver:  public CBase, public MVDecEngineObserver
       
    49 {
       
    50 public:
       
    51     void MvdeStreamEndReached();
       
    52     void MvdeSetError(TInt aError);
       
    53     ~CEngineObserver() {}
       
    54     CEngineObserver(CT_CMMFDevVideoPlay& aTestClass);
       
    55       
       
    56 private:
       
    57     CT_CMMFDevVideoPlay& iTestClass;
       
    58     
       
    59 };
       
    60 /**
       
    61  * Test Active Notification class
       
    62  *
       
    63  */
       
    64 class CT_CMMFDevVideoPlay : public CDataWrapperBase, MMMFDevVideoPlayObserver 
       
    65 	{
       
    66 public:
       
    67 	
       
    68 	~CT_CMMFDevVideoPlay();
       
    69 	virtual TAny*	GetObject();
       
    70 	virtual TBool	DoCommandL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex);
       
    71 	static	CT_CMMFDevVideoPlay*	NewL();		
       
    72 	void DestroyData();
       
    73 	TInt ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer, TInt aSize);
       
    74 	TInt ReadOneCodedPicture(TVideoInputBuffer* aCodedInBuffer);
       
    75 	TInt ReadRawPicture();
       
    76 	void OpenFileL(TFileName& aInFileName);
       
    77 	void OpenFileL(TFileName& aOutFileName, TFileName& aInFileName);
       
    78 	void CloseFile();
       
    79 	void ListFrameSizeL(TVideoCodec aCodec);
       
    80 	void AbortDirectScreenAccess();
       
    81     void StartDirectScreenAccessL();
       
    82     void HandleRuntimeError(TInt aError);
       
    83     void SaveAndReturnPicture();
       
    84     void GetReturnedPicture();
       
    85     void FillAndSendBufferL();
       
    86     void GetInputBuffer();
       
    87     void HandleNewBufferL();  
       
    88     void SetWindowRect(TInt aX, TInt aY, TSize aSize);
       
    89     void CreateFiles(const TTEFSectionName& aSection);
       
    90     void InitializeParamsL(const TTEFSectionName& aSection);    
       
    91 	void MdvpoNewBuffers();
       
    92     void MdvpoReturnPicture(TVideoPicture* aPicture);
       
    93     void MdvpoSupplementalInformation(const TDesC8& aData, const TTimeIntervalMicroSeconds& aTimestamp, const TPictureId& aPictureId);
       
    94     void MdvpoPictureLoss();
       
    95     void MdvpoPictureLoss(const TArray<TPictureId>& aPictures);
       
    96     void MdvpoSliceLoss(TUint aFirstMacroblock, TUint aNumMacroblocks, const TPictureId& aPicture);
       
    97     void MdvpoReferencePictureSelection(const TDesC8& aSelectionData);
       
    98     void MdvpoTimedSnapshotComplete(TInt aError, TPictureData* aPictureData, const TTimeIntervalMicroSeconds& aPresentationTimestamp, const TPictureId& aPictureId);
       
    99     void MdvpoNewPictures();
       
   100     void MdvpoFatalError(TInt aError);
       
   101     void MdvpoInitComplete(TInt aError);    
       
   102     void MdvpoStreamEnd();   
       
   103 protected:
       
   104 	CT_CMMFDevVideoPlay();
       
   105 	void ConstructL();
       
   106 private:
       
   107 	void DoCmdInitialize(const TInt aAsyncErrorIndex);
       
   108 	void DoCmdStart(const TInt aAsyncErrorIndex);
       
   109 	void DoCmdStop();
       
   110 	void DoCmdPause();
       
   111 	void DoCmdResume();
       
   112 	void DoCmdSetRotateOptionsL(const TTEFSectionName& aSection);
       
   113 	void DoCmdSetScaleOptionsL(const TTEFSectionName& aSection);
       
   114 	void DoCmdSetPosition(const TTEFSectionName& aSection);
       
   115 	void DoCmdSetClockSource(const TTEFSectionName& aSection);
       
   116 	void DoCmdNewL(const TTEFSectionName& aSection);
       
   117 	void DoCmdSelectDecoderL(const TTEFSectionName& aSection);
       
   118 	void DoCmdSetInputFormatL(const TTEFSectionName& aSection);
       
   119 	void DoCmdSelectPostProcessorL(const TTEFSectionName& aSection);
       
   120 	void DoCmdGetOutputFormatListL(const TTEFSectionName& aSection);
       
   121 	void DoCmdPostProcessorInfoLC();
       
   122 	void DoCmdFindCommonFormat();
       
   123 	void DoCmdSetOutputFormatL(const TTEFSectionName& aSection);
       
   124 	void DoCmdGetHeaderInformationL(const TTEFSectionName& aSection);
       
   125 	void DoCmdSetVideoDestScreenL();
       
   126 	void DoCmdGetBufferOptions();
       
   127 	void DoCmdSetBufferOptionsL();
       
   128 	void DoCmdSetPostProcessTypesL(const TTEFSectionName& aSection);
       
   129 	void DoCmdReturnHeader();
       
   130 	void DoCmdDestructor();
       
   131 	void DoCmdAbortDirectScreenAccess();
       
   132 	void DoCmdStartDirectScreenAccessL(const TTEFSectionName& aSection);
       
   133 	void DoCmdUtilityGetEnvironmentL();
       
   134 
       
   135 	void DoCmdH264CreateDecTest(const TTEFSectionName& aSection);
       
   136 	void DoCmdH264SelectPostProcessor(const TTEFSectionName& aSection);
       
   137 	void DoCmdH264SetPostProcessTypes(const TTEFSectionName& aSection);
       
   138 	void DoCmdH264SetInputFormatCompr(const TTEFSectionName& aSection);
       
   139 	void DoCmdH264SetOutputFormat(const TTEFSectionName& aSection);
       
   140 	void DoCmdH264SetBufferOptions(const TTEFSectionName& aSection);
       
   141 	void DoCmdH264ListFrameSize();
       
   142 	void DoCmdH264SetVideoDestScreen(const TTEFSectionName& aSection);
       
   143 	void DoCmdH264SetWindowRect(const TTEFSectionName& aSection);
       
   144 	void DoCmdH264Initialize();
       
   145 	void DoCmdH264Start(const TTEFSectionName& aSection);
       
   146 	void DoCmdH264Stop();
       
   147 	void DoCmdH264Pause();
       
   148 	void DoCmdH264Resume();
       
   149 	void DoCmdH264IOFrameNumMatch();
       
   150 	void DoCmdH264FindCommonFormats();
       
   151 	void DoCmdH264GetHeaderInformation(const TTEFSectionName& aSection);
       
   152 	void DoCmdH264EnableSynchronization(const TTEFSectionName& aSection);
       
   153 	void DoCmdH264SetScaleOptions(const TTEFSectionName& aSection);
       
   154 	void DoCmdH264SetRotateOptions(const TTEFSectionName& aSection);
       
   155 	void DoCmdH264SynchronizeDecoding(const TTEFSectionName& aSection);
       
   156 	void DoCmdH264Delete();
       
   157 	void DoCmdH264SetPosition(const TTEFSectionName& aSection);
       
   158 	void DoCmdH264AbortDirectScreenAccess();
       
   159 private:
       
   160 	/**
       
   161 	 * Wrapped object
       
   162 	 */
       
   163 	CMMFDevVideoPlay* iDevvp; 
       
   164 	/**
       
   165 	 * For selected decoder
       
   166 	 */
       
   167     THwDeviceId iDecHWDevId; 
       
   168     /**
       
   169 	 * For selected Post processor
       
   170 	 */
       
   171     THwDeviceId iPostProcId;
       
   172     /**
       
   173 	 * Size of video buffer
       
   174 	 */
       
   175     TInt	iInBuffSize; 
       
   176     /**
       
   177 	 * Control the number of inputs
       
   178 	 */
       
   179     TBool	iInputEnd;
       
   180     /**
       
   181 	 * Direct Screen Access
       
   182 	 */
       
   183     TBool	iDsaStarted;
       
   184     /**
       
   185 	 * For synchronize the clock(fps)
       
   186 	 */
       
   187     TBool	iSynchronized;
       
   188     /**
       
   189 	 * Listed frames
       
   190 	 */
       
   191     TBool	iFrameListed;
       
   192     /**
       
   193 	 * The size of the picture
       
   194 	 */
       
   195     TSize	iPictureSize;
       
   196     /**
       
   197 	 * Async error
       
   198 	 */
       
   199     TInt	iAsyncErrorIndex;
       
   200     /**
       
   201 	 * Width and height of the video
       
   202 	 */
       
   203     TRect	iDispRect;
       
   204     /**
       
   205 	 * For management the Open files
       
   206 	 */
       
   207 	TBool	iFileOpen;
       
   208 	/**
       
   209 	 * for get the coded buffer
       
   210 	 */
       
   211 	TVideoInputBuffer* iCodedInBuffer;
       
   212 	/**
       
   213 	 * Output buffer
       
   214 	 */
       
   215     TVideoPicture* iOutBuffer;
       
   216     /**
       
   217 	 * 
       
   218 	 */
       
   219     TVideoPicture* iRawInBuffer;
       
   220     /**
       
   221 	 * For synch the time
       
   222 	 */
       
   223     TInt64	iTimeStamp;
       
   224     /**
       
   225 	 * Time interval in each frame
       
   226 	 */
       
   227     TInt64	iFrameTimeInterval;
       
   228     /**
       
   229 	 * Buffer control
       
   230 	 */
       
   231     TInt	iSentBuffCount;
       
   232     /**
       
   233 	 * Buffer control
       
   234 	 */
       
   235     TInt	iReturnedBuffCount;
       
   236     /**
       
   237 	 * Loss Pictures
       
   238 	 */
       
   239     TInt	iPictureLoss;
       
   240     /**
       
   241 	 * The end of the stream
       
   242 	 */
       
   243     TBool	iStreamEnd;
       
   244     /**
       
   245 	 * Type of codec
       
   246 	 */
       
   247     TVideoCodec iCodecType;
       
   248     /**
       
   249 	 * Management of the time between frames
       
   250 	 */
       
   251     CSystemClockSource* iClock;
       
   252     /**
       
   253 	 * Direct Access at the Screen
       
   254 	 */
       
   255     TBool	iDirectScreenAccess;
       
   256     /**
       
   257 	 * for handle the buffer
       
   258 	 */
       
   259     TBool	iCIBuffMgmtOn;
       
   260     /**
       
   261 	 * For measurement of the frame
       
   262 	 */
       
   263     TBool	iFrameMeasurement;
       
   264     /**
       
   265 	 * for H264
       
   266 	 */
       
   267     RArray<TInt> iFrameSizeList;
       
   268     /**
       
   269 	 * frame rate(fps)
       
   270 	 */
       
   271     TInt iFramerate;
       
   272     /**
       
   273 	 *  File Server
       
   274 	 */
       
   275     RFs   iFs;  
       
   276     /**
       
   277 	 * Input file
       
   278 	 */
       
   279     RFile iInFile;
       
   280     /**
       
   281 	 * Ouput file
       
   282 	 */
       
   283     RFile iOutFile;	
       
   284     /**
       
   285 	 *  Fbs
       
   286 	 */
       
   287     CFbsScreenDevice* iScreenDevice;  
       
   288     /**
       
   289 	 * Common format between Post processor and decoder
       
   290 	 */
       
   291     TUncompressedVideoFormat iCommonFormat;
       
   292     /**
       
   293 	 * Decoder read from the ini file
       
   294 	 */
       
   295     TUid iSelectDecoder;
       
   296     /**
       
   297 	 * Post processor read from the ini file
       
   298 	 */
       
   299     TUid iSelectPostProcessor;
       
   300     /**
       
   301 	 * Formats Decoder
       
   302 	 */
       
   303     RArray<TUncompressedVideoFormat> iDecFormats;
       
   304     /**
       
   305 	 * Post processor formats
       
   306 	 */
       
   307     RArray<TUncompressedVideoFormat> iPPFormats;
       
   308     /**
       
   309 	 * Information about the post processor
       
   310 	 */
       
   311     CPostProcessorInfo* iInfo; 
       
   312     /**
       
   313 	 * if exist information for header info
       
   314 	 */
       
   315     TVideoPictureHeader* iHeaderInfo;
       
   316     /**
       
   317 	 * Buffer options
       
   318 	 */
       
   319     CMMFDevVideoPlay::TBufferOptions iBufferOptions;
       
   320     /**
       
   321 	 * The common format
       
   322 	 */
       
   323     TBool iCommonFormatFound;  
       
   324     /**
       
   325      * To Control the errors in GetInputBuffer
       
   326      */
       
   327     TBool iErrorInputBuffer;
       
   328     /**
       
   329 	 * Enum for codecs
       
   330 	 */   
       
   331     static const TEnumEntryTable iCodecs[];
       
   332     /**
       
   333 	 * Enum for Display mode
       
   334 	 */
       
   335     static const TEnumEntryTable iDisplayModes[];
       
   336     /**
       
   337 	 * Enum for rotations
       
   338 	 */
       
   339     static const TEnumEntryTable iRotations[];
       
   340     /**
       
   341 	 * Enum for Video Data Unit Types
       
   342 	 */
       
   343     static const TEnumEntryTable iTVideoDataUnitType[];
       
   344     /**
       
   345 	 * Enum for Video Data Unit Encapsulation
       
   346 	 */
       
   347     static const TEnumEntryTable iTVideoDataUnitEncapsulation[];
       
   348     
       
   349     /**
       
   350      * H264
       
   351      */
       
   352     CVDecTestEngine* iEngine;
       
   353     CEngineObserver* iObserver;
       
   354     TBool iUse264;
       
   355     TInt iFrameRate;
       
   356 	};
       
   357 	
       
   358 	
       
   359 #endif // T_CMMFDEVVIDEODATA_H
       
   360