epoc32/include/mmf/devvideo/videoplayhwdevice.h
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:27:01 +0100
branchSymbian2
changeset 3 e1b950c65cb4
child 4 837f303aceeb
permissions -rw-r--r--
Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
     1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
     7 //
     8 // Initial Contributors:
     9 // Nokia Corporation - initial contribution.
    10 //
    11 // Contributors:
    12 //
    13 // Description:
    14 //
    15 
    16 #ifndef __VIDEOPLAYHWDEVICE_H__
    17 #define __VIDEOPLAYHWDEVICE_H__
    18 
    19 #include <mmf/devvideo/devvideobase.h>
    20 #include <mmf/devvideo/devvideoplay.h>
    21 
    22 /**
    23 A base class for all video playback (decoder and post-processor) hardware devices. 
    24 Since both decoders and post-processors can implement post-processing functionality, 
    25 this class includes all post-processing related methods. The main difference between decoder 
    26 and post-processor devices is that decoders can input coded data and write decoded pictures 
    27 to another device, while post-processor devices can accept decoded pictures from the client 
    28 or from another device.
    29 @publishedAll
    30 @released
    31 */
    32 class CMMFVideoPlayHwDevice : public CMMFVideoHwDevice
    33 	{
    34 public:
    35 	/**
    36 	Retrieves post-processing information about this hardware device. 
    37 	The device creates a CPostProcessorInfo structure, fills it with correct data, pushes it 
    38 	to the cleanup stack and returns it. The client will delete the object when it is no 
    39 	longer needed.
    40 
    41 	@return "Post-processor information as a CPostProcessorInfo object. 
    42 			The object is pushed to the cleanup stack, and must be deallocated by the caller."
    43 	@leave  "This method may leave with one of the system-wide error codes.
    44 	*/
    45 	virtual CPostProcessorInfo* PostProcessorInfoLC() = 0;
    46 
    47 	/**
    48 	Retrieves the list of the output formats that the device supports. The list is ordered in 
    49 	plug-in preference order, with the preferred formats at the beginning of the list. The list 
    50 	can depend on the device source format, and therefore SetSourceFormatL() must be called before 
    51 	calling this method.
    52 
    53 	@param "aFormats" "An array for the result format list. The array must be created and destroyed by the caller."
    54 	@leave  "This method may leave with one of the system-wide error codes.
    55 	@pre	"This method may only be called before the hwdevice has been initialized using Initialize()."
    56 	*/
    57 	virtual void GetOutputFormatListL(RArray<TUncompressedVideoFormat>& aFormats) = 0;
    58 
    59 	/**
    60 	Sets the device output format.
    61 
    62 	@param  "aFormat" "The format to use."
    63 	@leave  "This method may leave with one of the system-wide error codes.
    64 	@pre	"This method may only be called before the hwdevice has been initialized using Initialize()."
    65 	*/
    66 	virtual void SetOutputFormatL(const TUncompressedVideoFormat &aFormat) = 0;
    67 
    68 	/**
    69 	Sets the clock source to use for video timing. If no clock source is set. video playback 
    70 	will not be synchronized, but will proceed as fast as possible, depending on input data 
    71 	and output buffer availability.	
    72 
    73 	@param  "aClock" "The clock source to be used."
    74 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
    75 	*/
    76 	virtual void SetClockSource(MMMFClockSource* aClock) = 0;
    77 
    78 	/**
    79 	Sets the device video output destination. The destination can be the screen (using direct 
    80 	screen access) or memory buffers. By default memory buffers are used. If data is written 
    81 	to another device, this method is ignored, and suitable memory buffers are always used.
    82 	
    83 	@param  "aScreen" "True if video output destination is the screen, false if memory buffers."
    84 	@leave  "This method may leave with one of the system-wide error codes.
    85 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
    86 	*/
    87 	virtual void SetVideoDestScreenL(TBool aScreen) = 0;
    88 
    89 	/**
    90 	Sets the post-processing types to be used.
    91 
    92 	@param  "aPostProcCombination" "The post-processing steps to perform, a bitwise OR of values from TPostProcessType."
    93 	@leave  "This method may leave with one of the system-wide error codes.
    94 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
    95 			If called after initialization, the change must only be committed when CommitL() is called."
    96 	*/
    97 	virtual void SetPostProcessTypesL(TUint32 aPostProcCombination) = 0;
    98 
    99 	/**
   100 	Sets post-processing options for input (pan-scan) cropping.
   101 
   102 	@param  "aRect" "The cropping rectangle to use."
   103 	@leave  "This method may leave with one of the system-wide error codes.
   104 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   105 			If called after initialization, the change must only be committed when CommitL() is called."
   106 	*/
   107 	virtual void SetInputCropOptionsL(const TRect& aRect) = 0;
   108 
   109 	/**
   110 	Sets post-processing options for YUV to RGB color space conversion. 
   111 	Specifies the input YUV and output RGB formats to use explicitly. SetSourceFormatL(), 
   112 	SetOutputFormatL(), and SetPostProcessTypesL() must be called before this method is used.
   113 
   114 	@param  "aOptions"		"The conversion options to use."
   115 	@param  "aYuvFormat"	"Conversion source YUV format"
   116 	@param  "aRgbFormat"	"Conversion target RGB format"
   117 	@leave  "This method may leave with one of the system-wide error codes.
   118 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   119 			If called after initialization, the change must only be committed when CommitL() is called."
   120 	*/
   121 	virtual void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat) = 0;
   122 
   123 	/**
   124 	Sets post-processing options for YUV to RGB color space conversion.
   125 	Uses the device input and output formats. For decoder devices the default YUV format used is 
   126 	the format specified in the input bitstream. SetSourceFormatL(), SetOutputFormatL(), and 
   127 	SetPostProcessTypesL() must be called before this method is used.
   128 
   129 	@param  "aOptions"		"The conversion options to use."
   130 	@leave  "This method may leave with one of the system-wide error codes.
   131 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   132 			If called after initialization, the change must only be committed when CommitL() is called."
   133 	*/
   134 	virtual void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions) = 0;
   135 
   136 	/**
   137 	Sets post-processing options for rotation. SetPostProcessTypesL() must be called before 
   138 	this method is used.
   139 
   140 	@param  "aRotationType" "The rotation to perform."	
   141 	@leave  "This method may leave with one of the system-wide error codes.
   142 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   143 			If called after initialization, the change must only be committed when CommitL() is called."
   144 	*/
   145 	virtual void SetRotateOptionsL(TRotationType aRotationType) = 0;
   146 
   147 	/**
   148 	Sets post-processing options for scaling. SetPostProcessTypesL() must be called before 
   149 	this method is used.
   150 	
   151 	@param  "aTargetSize"			"Scaling target size. If a fixed scale factor size is used, 
   152 									the new dimensions must be set to width=floor(factor*width), 
   153 									height=floor(factor*height). For example, scaling a 
   154 									QCIF (176x144) picture up by a factor of 4/3 yields a size 
   155 									of 234x192."
   156 	@param  "aAntiAliasFiltering"	"True if anti-aliasing filtering should be used. 
   157 									If the post-processor does not support anti-aliased scaling, 
   158 									or supports anti-aliased scaling only, this argument is ignored."
   159 	@leave  "This method may leave with one of the system-wide error codes.
   160 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   161 			If called after initialization, the change must only be committed when CommitL() is called."
   162 	*/
   163 	virtual void SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering) = 0;
   164 
   165 	/**
   166 	Sets post-processing options for output cropping. SetPostProcessTypesL() must be called before 
   167 	this method is used.
   168 	
   169 	@param  "aRect" "Output cropping area."
   170 	@leave  "This method may leave with one of the system-wide error codes.
   171 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   172 			If called after initialization, the change must only be committed when CommitL() is called."
   173 	*/
   174 	virtual void SetOutputCropOptionsL(const TRect& aRect) = 0;
   175 
   176 	/**
   177 	Sets post-processing plug-in specific options. SetPostProcessTypesL() must be called before 
   178 	this method is used.
   179 
   180 	@param  "aOptions" "The options. The format is plug-in specific."
   181 	@leave  "This method may leave with one of the system-wide error codes.
   182 	@pre	"This method can be called either before or after the hwdevice has been initialized with Initialize().
   183 			If called after initialization, the change must only be committed when CommitL() is called."
   184 	*/
   185 	virtual void SetPostProcSpecificOptionsL(const TDesC8& aOptions) = 0;
   186 
   187 	/**
   188 	Initializes the device. This method is asynchronous, the device will call 
   189 	MMFVideoPlayProxy::MdvppInitializeComplete() after initialization has completed. After this 
   190 	method has successfully completed, further configuration changes are not possible except where 
   191 	separately noted.
   192 	*/
   193 	virtual void Initialize() = 0;
   194 
   195 	/**
   196 	Commit all changes since the last CommitL(), Revert() or Initialize()
   197 	to the hardware device.  This only applies to methods which can be called both
   198 	before AND after DevVideoPlay has been initialized.
   199 
   200 	@see	SetPostProcessTypesL
   201 	@see	SetInputCropOptionsL
   202 	@see	SetYuvToRgbOptionsL
   203 	@see	SetRotateOptionsL
   204 	@see	SetScaleOptionsL
   205 	@see	SetOutputCropOptionsL
   206 	@see	SetPostProcSpecificOptionsL
   207 
   208 	@leave  "The method will leave if an error occurs."
   209 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   210 	*/
   211 	virtual void CommitL() = 0;
   212 
   213 	/**
   214 	Revert all changes since the last CommitL(), Revert() or Initialize()
   215 	back to their previous settings.  This only applies to methods which can 
   216 	be called both before AND after DevVideoPlay has been initialized.
   217 
   218 	@see	SetPostProcessTypesL
   219 	@see	SetInputCropOptionsL
   220 	@see	SetYuvToRgbOptionsL
   221 	@see	SetRotateOptionsL
   222 	@see	SetScaleOptionsL
   223 	@see	SetOutputCropOptionsL
   224 	@see	SetPostProcSpecificOptionsL
   225 
   226 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   227 	*/
   228 	virtual void Revert() = 0;
   229 
   230 	/**
   231 	Starts writing output directly to the display frame buffer using Direct Screen Access.
   232 
   233 	@param  "aVideoRect"	"The video output rectangle on screen."
   234 	@param  "aScreenDevice"	"The screen device to use. The screen device object must be valid in the current thread."
   235 	@param  "aClipRegion"	"Initial clipping region to use."
   236 	
   237 	@leave  "This method may leave with one of the system-wide error codes.
   238 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   239 	*/
   240 	virtual void StartDirectScreenAccessL(const TRect& aVideoRect, 
   241 		CFbsScreenDevice& aScreenDevice, const TRegion& aClipRegion) = 0;
   242 
   243 	/**
   244 	Sets a new clipping region for Direct Screen Access. After the method returns, no video will 
   245 	be drawn outside of the region. If clipping is not supported, or the clipping region is too 
   246 	complex, either playback will pause or will resume without video display, depending on the 
   247 	current setting of SetPauseOnClipFail(), and the result can be verified with IsPlaying(). 
   248 	Clipping can be disabled by setting a new clipping region that includes the whole video window.
   249 
   250 	@param  "aRegion" "The new clipping region. After the method returns, no video will be drawn outside the region."
   251 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   252 	*/
   253 	virtual void SetScreenClipRegion(const TRegion& aRegion) = 0;
   254 
   255 	/**
   256 	Sets whether the system should pause playback when it gets a clipping region it cannot handle, 
   257 	or Direct Screen Access is aborted completely. If not, processing will proceed normally, but no 
   258 	video will be drawn. By default, playback is paused.
   259 
   260 	@param "aPause" "True if playback should be paused when clipping fails, false if not. 
   261 					If playback is not paused, it will be continued without video display."
   262 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   263 	*/
   264 	virtual void SetPauseOnClipFail(TBool aPause) = 0;
   265 
   266 	/**
   267 	Aborts Direct Screen Access completely, to be called from MAbortDirectScreenAccess::AbortNow() 
   268 	and similar methods. DSA can be resumed by calling StartDirectScreenAccessL().
   269 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   270 	*/
   271 	virtual void AbortDirectScreenAccess() = 0;
   272 
   273 	/**
   274 	Indicates whether playback is proceeding. This method can be used to check whether playback was 
   275 	paused or not in response to a new clipping region or DSA abort.
   276 
   277 	@return "ETrue if video is still being played (even if not necessarily displayed)."
   278 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   279 	*/
   280 	virtual TBool IsPlaying() = 0;
   281 
   282 	/**
   283 	Re-draws the latest video picture. Only available when DSA is being used. If DSA is aborted or a 
   284 	non-supported clipping region has been set, the request may be ignored.
   285 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   286 	*/
   287 	virtual void Redraw() = 0;
   288 
   289 
   290 	/**
   291 	Starts video playback, including decoding, post-processing, and rendering. Playback will proceed 
   292 	until it has been stopped or paused, or the end of the bitstream is reached.
   293 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   294 	*/
   295 	virtual void Start() = 0;
   296 
   297 	/**
   298 	Stops video playback. No new pictures will be decoded, post-processed, or rendered.
   299 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   300 	*/
   301 	virtual void Stop() = 0;
   302 
   303 	/**
   304 	Pauses video playback, including decoding, post-processing, and rendering. No pictures will be 
   305 	decoded, post-processed, or rendered until playback has been resumed.
   306 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   307 	*/
   308 	virtual void Pause() = 0;
   309 
   310 	/**
   311 	Resumes video playback after a pause.
   312 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   313 	*/
   314 	virtual void Resume() = 0;
   315 
   316 	/**
   317 	Changes to a new decoding and playback position, used for randomly accessing (seeking) the 
   318 	input stream. The position change flushes all input and output buffers. Pre-decoder and 
   319 	post-decoder buffering are handled as if a new bitstream was being decoded. If the device still has buffered 
   320 	pictures that precede the new playback position, they will be discarded. If playback is 
   321 	synchronized to a clock source, the client is responsible for setting the clock source to the 
   322 	new position.
   323 	
   324 	@param "aPlaybackPosition" "The new playback position in the video stream."
   325 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   326 	*/
   327 	virtual void SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition) = 0;
   328 
   329 	/**
   330 	Freezes a picture on the screen. After the picture has been frozen, no new pictures are 
   331 	displayed until the freeze is released with ReleaseFreeze(). If the device output is being 
   332 	written to memory buffers or to another plug-in, instead of the screen, no decoded pictures 
   333 	will be delivered while the freeze is active, and they are simply discarded.
   334 
   335 	@param "aTimestamp" "The presentation timestamp of the picture to freeze. The frozen picture 
   336 						will be the first picture with a timestamp greater than or equal to this 
   337 						parameter."
   338 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   339 	*/
   340 	virtual void FreezePicture(const TTimeIntervalMicroSeconds& aTimestamp) = 0;
   341 
   342 	/**
   343 	Releases a picture frozen with FreezePicture().
   344 
   345 	@param "aTimestamp" "The presentation timestamp of the picture to release. The first picture 
   346 						displayed after the release will be the first picture with a timestamp 
   347 						greater than or equal to this parameter. To release the freeze immediately, 
   348 						set the timestamp to zero."
   349 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   350 	*/
   351 	virtual void ReleaseFreeze(const TTimeIntervalMicroSeconds& aTimestamp) = 0;
   352 
   353 
   354 	/**
   355 	Returns the current playback position, i.e. the timestamp for the most recently displayed or 
   356 	virtually displayed picture. If the device output is written to another device, the most recent 
   357 	output picture is used.
   358 
   359 	@return "Current playback position."
   360 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   361 	*/
   362 	virtual TTimeIntervalMicroSeconds PlaybackPosition() = 0;
   363 
   364 	/**
   365 	Returns the total amount of memory allocated for uncompressed pictures. This figure only 
   366 	includes the pictures actually allocated by the plug-in itself, so that the total number of 
   367 	bytes allocated in the system can be calculated by taking the sum of the values from all plug-ins.
   368 
   369 	@return "Total number of bytes of memory allocated for uncompressed pictures."
   370 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   371 	*/
   372 	virtual TUint PictureBufferBytes() = 0;
   373 
   374 	/**
   375 	Reads various counters related to decoded pictures. The counters are reset when Initialize() 
   376 	or this method is called, and thus they only include pictures processed since the last call.
   377 
   378 	Post-processor devices return the number of input pictures in iPicturesDecoded and 
   379 	iTotalPictures. If the decoded pictures are written to another plug-in, they are considered 
   380 	to be "virtually displayed".
   381 
   382 	@param "aCounters" "The counter structure to fill."
   383 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   384 	*/
   385 	virtual void GetPictureCounters(CMMFDevVideoPlay::TPictureCounters& aCounters) = 0;
   386 
   387 
   388 	/**
   389 	Sets the computational complexity level to use. If separate complexity levels are not available, 
   390 	the method call is ignored. If the level specified is not available, the results are undefined. 
   391 	Typically the device will either ignore the request or use the nearest suitable level.
   392 
   393 	The complexity level can be changed at any point during playback.
   394 
   395 	@param "aLevel" "The computational complexity level to use. Level zero (0) is the most complex 
   396 					one, with the highest quality. Higher level numbers require less processing 
   397 					and may have lower quality."
   398 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   399 	*/
   400 	virtual void SetComplexityLevel(TUint aLevel) = 0;
   401 
   402 	/**
   403 	Gets the number of complexity levels available.
   404 	
   405 	@return "The number of complexity control levels available, or zero if the information is not 
   406 			available yet. The information may not be available if the number of levels depends on 
   407 			the input data, and enough input data has not been read yet. In that case, using level 
   408 			zero is safe."
   409 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   410 	*/
   411 	virtual TUint NumComplexityLevels() = 0;
   412 
   413 	/**
   414 	Gets information about a computational complexity level. This method can be called after 
   415 	NumComplexityLevels() has returned a non-zero value - at that point the information is guaranteed 
   416 	to be available. Some hardware device implementations may not be able to provide all values, 
   417 	in that case the values will be approximated.
   418 
   419 	@param "aLevel"	"The computational complexity level to query. The level numbers range from zero 
   420 					(the most complex) to NumComplexityLevels()-1."
   421 	@param "aInfo"	"The information structure to fill."
   422 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   423 	*/
   424 	virtual void GetComplexityLevelInfo(TUint aLevel, CMMFDevVideoPlay::TComplexityLevelInfo& aInfo) = 0;
   425 
   426 	/**
   427 	Returns a picture back to the device. This method is called by CMMFDevVideoPlay to return pictures 
   428 	from the client (after they have been written with NewPicture()), or by the output device when 
   429 	it has finished using a picture.
   430 
   431 	@param "aPicture" "The picture to return. The device can re-use the memory for the picture."
   432 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   433 	*/
   434 	virtual void ReturnPicture(TVideoPicture* aPicture) = 0;
   435 
   436 	/**
   437 	Gets a copy of the latest picture sent to output.
   438 
   439 	@param "aPictureData"	"Target picture. The memory for the picture must be allocated by the 
   440 							caller, and initialized properly. The data formats must match the snapshot 
   441 							format requested."
   442 	@param "aFormat"		"The picture format to use for the snapshot."
   443 
   444 	@return "ETrue if the snapshot was taken, EFalse if a picture is not available. The picture may not 
   445 			be available if decoding has not progressed far enough yet."
   446 
   447 	@leave	"The method will leave if an error occurs. Typical error codes used:
   448 			* KErrNotSupported - The requested data format or picture size is not supported, or the 
   449 			plug-in does not support snapshots."
   450 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   451 	*/
   452 	virtual TBool GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& aFormat) = 0;
   453 
   454 	/**
   455 	When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete()
   456 	callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot 
   457 	request can be active at a time.
   458 
   459 	@param "aPictureData"			"Target picture. The memory for the picture must be allocated by 
   460 									the caller, and initialized properly. The data formats must match 
   461 									the snapshot format requested. The picture must remain valid until 
   462 									the snapshot has been taken or until the request has been cancelled 
   463 									with CancelTimedSnapshot()."
   464 	@param "aFormat"				"The picture format to use for the snapshot."
   465 	@param "aPresentationTimestamp"	"Presentation timestamp for the picture to copy."
   466 
   467 	@leave	"The method will leave if an error occurs. Typical error codes used:
   468 			* KErrNotSupported - The requested data format or picture size is not supported or 
   469 			the plug-in does not support timed snapshots."
   470 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   471 	*/
   472 	virtual void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, 
   473 		const TTimeIntervalMicroSeconds& aPresentationTimestamp) = 0;
   474 
   475 	/**
   476 	When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete()
   477 	callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot 
   478 	request can be active at a time.
   479 
   480 	@param "aPictureData"			"Target picture. The memory for the picture must be allocated by 
   481 									the caller, and initialized properly. The data formats must match 
   482 									the snapshot format requested. The picture must remain valid until 
   483 									the snapshot has been taken or until the request has been cancelled 
   484 									with CancelTimedSnapshot()."
   485 	@param "aFormat"				"The picture format to use for the snapshot."
   486 	@param "aPictureId"				"Picture identifier for the picture to copy."
   487 
   488 	@leave	"The method will leave if an error occurs. Typical error codes used:
   489 			* KErrNotSupported - The requested data format or picture size is not supported or 
   490 			the plug-in does not support timed snapshots."
   491 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   492 	*/
   493 	virtual void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, 
   494 		const TPictureId& aPictureId) = 0;
   495 
   496 	/**
   497 	Cancels a timed snapshot request.
   498 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   499 	*/
   500 	virtual void CancelTimedSnapshot() = 0;
   501 
   502 	/**
   503 	Gets a list of the supported snapshot picture formats.
   504 
   505 	@param "aFormats" "An array for the result format list. The array must be created and destroyed by 
   506 	the caller."
   507 
   508 	@leave "This method may leave with one of the standard error codes."
   509 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   510 	*/
   511 	virtual void GetSupportedSnapshotFormatsL(RArray<TUncompressedVideoFormat>& aFormats) = 0;
   512 
   513 
   514 	/**
   515 
   516 	Notifies the hardware device that the end of input data has been reached and no more input data 
   517 	will be written. The hardware device can use this signal to ensure that the remaining data gets 
   518 	processed, without waiting for new data. For example when the data type is not EDuCodedPicture,
   519 	calling this method is necessary otherwise a hardware device implementation might be looking for 
   520 	the start code for the next picture to ensure it has a complete picture before starting to decode
   521 	the previous one. 
   522 	
   523 	  
   524 	After the remaining data has been processed (and displayed, if applicable), the hardware 
   525 	device must notify the proxy with the MdvppStreamEnd() callback.
   526 
   527 	DevVideo clients are encouraged to call this method, but its use is not mandatory for synchronized
   528 	processing.  For synchronized playback, all video pictures are processed or discarded according to 
   529 	their timestamps, and so the client can easily infer when processing is complete.  However, it 
   530 	should be noted that the last picture might not be displayed if this method is not called and the 
   531 	input data type is not EDuCodedPicture.
   532 
   533 	For non-synchronized playback (e.g. file conversion), a client must call this method otherwise it
   534 	will never find out when the hardware device has finished processing the data.
   535 	
   536 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   537 	*/
   538 	virtual void InputEnd() = 0;
   539 	};
   540 
   541 
   542 
   543 
   544 /**
   545 CMMFVideoDecodeHwDevice is the MSL video decoder hardware device interface. 
   546 All video decoders must implement this interface.
   547 @publishedAll
   548 @released
   549 */
   550 class CMMFVideoDecodeHwDevice : public CMMFVideoPlayHwDevice
   551 	{
   552 public:
   553 	/**
   554 	Creates a new video decoder hardware device object, based on the implementation UID.
   555 
   556 	@param	"aUid"		"Decoder implementation UID."
   557 	@param	"aProxy"	"The proxy implementation to use."
   558 	@return	"A new CMMFVideoDecodeHwDevice object."
   559 	@leave	"This method may leave with one of the system-wide error codes.
   560 	*/
   561 	IMPORT_C static CMMFVideoDecodeHwDevice* NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy);
   562 	
   563 	/**
   564 	Creates a new video decoder hardware device adapter object, based on the Implementation Information of a Processing Unit.
   565 
   566 	@param	"aImplInfo"	"The registration data relating to the Interface Implementation of the Processing Unit."
   567 	@param	"aProxy"	"The proxy implementation to use."
   568 	@return	"A new CMMFVideoDecodeHwDevice object."
   569 	@leave	"This method will leave if an error occurs."
   570 	*/
   571 	IMPORT_C static CMMFVideoDecodeHwDevice* NewPuAdapterL(const CImplementationInformation& aImplInfo, MMMFDevVideoPlayProxy& aProxy);
   572 
   573 
   574 	/**
   575 	Destructor.
   576 	*/
   577 	IMPORT_C virtual ~CMMFVideoDecodeHwDevice();
   578 
   579 
   580 	/**
   581 	Retrieves decoder information about this hardware device. The device creates a CVideoDecoderInfo 
   582 	structure, fills it with correct data, pushes it to the cleanup stack and returns it. The client 
   583 	will delete the object when it is no longer needed.
   584 	
   585 	@return	"Decoder information as a CVideoDecoderInfo object. The object is pushed to the cleanup 
   586 			stack, and must be deallocated by the caller."
   587 	@leave	"This method may leave with one of the system-wide error codes."
   588 
   589 	@see CVideoDecoderInfo
   590 	*/
   591 	virtual CVideoDecoderInfo* VideoDecoderInfoLC() = 0;
   592 
   593 	/**
   594 	Reads header information from a coded data unit.
   595 	@param	"aDataUnitType"		"The type of the coded data unit that is contained in aDataUnit. If the data is a 
   596 								simple piece of bitstream, use EDuArbitraryStreamSection."
   597 	@param	"aEncapsulation"	"The encapsulation type used for the coded data. If the data is a 
   598 								simple piece of bitstream, use EDuElementaryStream."
   599 	@param	"aDataUnit"			"The coded data unit, contained in a TVideoInputBuffer."
   600 	@return "Header information for the data unit, or NULL if the coded data unit did not contain 
   601 			enough data to parse the header. The header data must be returned to the device using 
   602 			ReturnHeader() before Initialize() is called or the decoder is destroyed. The data remains 
   603 			valid until it is returned."
   604 	@leave	"The method will leave if an error occurs. Running out of data is not considered an error, 
   605 			as described above. Typical error codes used:
   606 				* KErrNotSupported - The data is not in a supported format.
   607 				* KErrCorrupt - The data appears to be in a supported format, but is corrupted."
   608 	*/
   609 	virtual TVideoPictureHeader* GetHeaderInformationL(TVideoDataUnitType aDataUnitType, 
   610 		TVideoDataUnitEncapsulation aEncapsulation, TVideoInputBuffer* aDataUnit) = 0;
   611 
   612 
   613 	/**
   614 	Returns a header from GetHeaderInformationL() back to the decoder so that the memory can be freed.
   615 
   616 	@param  "aHeader" "The header to return."
   617 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   618 	*/
   619 	virtual void ReturnHeader(TVideoPictureHeader* aHeader) = 0;
   620 
   621 	/**
   622 	Sets the device input format to a compressed video format.
   623 
   624 	@param	"aFormat"			"The input format to use."
   625 	@param	"aDataUnitType"		"The data unit type for input data."
   626 	@param	"aEncapsulation"	"The encapsulation type used for the coded data."
   627 	@param	"aDataInOrder"		"ETrue if the input data is written in correct decoding order, 
   628 								 EFalse if will be written in arbitrary order."
   629 	@leave	"The method will leave if an error occurs. Typical error codes used:
   630 				* KErrNotSupported - The source format is not supported."
   631 
   632 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   633 	*/
   634 	virtual void SetInputFormatL(const CCompressedVideoFormat& aFormat, 
   635 		TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, 
   636 		TBool aDataInOrder) = 0;
   637 
   638 	/**
   639 	Sets whether decoding should be synchronized to the current clock source, if any, or if pictures 
   640 	should instead be decoded as soon as possible. If decoding is synchronized, decoding timestamps 
   641 	are used if available, presentation timestamps are used if not. When decoding is not synchronized, 
   642 	pictures are decoded as soon as source data is available for them, and the decoder has a free 
   643 	output buffer. If a clock source is not available, decoding will not be synchronized.
   644 
   645 	@param "aSynchronize" "True if decoding should be synchronized to a clock source."
   646 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   647 	*/
   648 	virtual void SynchronizeDecoding(TBool aSynchronize) = 0;
   649 
   650 	/**
   651 	Sets decoder buffering options. See [3] for a description of the options available.
   652 	
   653 	@param "aOptions" "Buffering options."
   654 	@leave "The method will leave if an error occurs. Typical error codes used:
   655 			* KErrNotSupported - The specified buffering options are not supported. 
   656 			  If the client receives this error code, it can call GetBufferOptions() 
   657 			  to determine the options the decoder is able to support."
   658 
   659 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   660 	*/
   661 	virtual void SetBufferOptionsL(const CMMFDevVideoPlay::TBufferOptions& aOptions) = 0;
   662 
   663 	/**
   664 	Gets the video decoder buffer options actually in use. This can be used before calling 
   665 	SetBufferOptions() to determine the default options, or afterwards to check the values 
   666 	actually in use (if some default values were used).
   667 
   668 	@param "aOptions" "Buffering options structure to fill."
   669 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   670 	*/
   671 	virtual void GetBufferOptions(CMMFDevVideoPlay::TBufferOptions& aOptions) = 0;
   672 
   673 	/**
   674 	Indicates which HRD/VBV specification is fulfilled in the input stream and any related parameters.
   675 
   676 	@param "aHrdVbvSpec"	"The HRD/VBV specification fulfilled."
   677 	@param "aHrdVbvParams"	"HRD/VBV parameters. The data format depends on the parameters chosen. 
   678 							For 3GPP TS 26.234 parameters (aHrdVbvSpec=EHrdVbv3GPP), the data in the 
   679 							descriptor is a package of type TPckC<T3gppHrdVbvParams> 
   680 							(see T3gppHrdVbvParams). If no HRD/VBV parameters are used, the descriptor 
   681 							is zero length."
   682 	@see THrdVbvSpecification
   683 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   684 	*/
   685 	virtual void SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams) = 0;
   686 
   687 	/**
   688 	Sets the output post-processor device to use. If an output device is set, all decoded pictures 
   689 	are delivered to that device, and not drawn on screen or returned to the client. Pictures are 
   690 	written using CMMDVideoPostProcDevice::WritePictureL() or a custom interface after they have been 
   691 	decoded. The post-processor must then synchronize rendering to the clock source if necessary.
   692 
   693 	@param "aDevice" "The output post-processor device to use."
   694 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   695 	*/
   696 	virtual void SetOutputDevice(CMMFVideoPostProcHwDevice* aDevice) = 0;
   697 
   698 	/**
   699 	Returns the current decoding position, i.e. the timestamp for the most recently decoded picture.
   700 
   701 	@return "Current decoding position."
   702 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   703 	*/
   704 	virtual TTimeIntervalMicroSeconds DecodingPosition() = 0;
   705 
   706 	/**
   707 	Returns the current pre-decoder buffer size.
   708 
   709 	@return "The number of bytes of data in the pre-decoder buffer."
   710 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   711 	*/
   712 	virtual TUint PreDecoderBufferBytes() = 0;
   713 
   714 	/**
   715 	Reads various counters related to the received input bitstream and coded data units. The counters 
   716 	are reset when Initialize() or this method is called, and thus they only include data processed 
   717 	since the last call.
   718 
   719 	@param "aCounters" "The counter structure to fill."
   720 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   721 	*/
   722 	virtual void GetBitstreamCounters(CMMFDevVideoPlay::TBitstreamCounters& aCounters) = 0;
   723 
   724 	/**
   725 	Retrieves the number of free input buffers the decoder has available.
   726 
   727 	@return "Number of free input buffers the decoder has available."
   728 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   729 	*/
   730 	virtual TUint NumFreeBuffers() = 0;
   731 
   732 	/**
   733 	Retrieves an empty video input buffer from the decoder. After input data has been written to the 
   734 	buffer, it can be written to the decoder using WriteCodedDataL(). The number of buffers the decoder
   735 	must be able to provide before expecting any back, and the maximum size for each buffer, are 
   736 	specified in the buffer options.
   737 
   738 	The decoder maintains ownership of the buffers even while they have been retrieved by the client, 
   739 	and will take care of deallocating them.
   740 
   741 	@param	"aBufferSize"	"Required buffer size, in bytes. The resulting buffer can be larger than 
   742 							this, but not smaller."
   743 	@return "A new input data buffer. The buffer is at least as large as requested, but it may be 
   744 			larger. If no free buffers are available, the return value is NULL."
   745 	@leave  "The method will leave if an error occurs. Lack of free buffers is not considered an error."
   746 	*/
   747 	virtual TVideoInputBuffer* GetBufferL(TUint aBufferSize) = 0;
   748 
   749 	/**
   750 	Writes a piece of coded video data to the decoder. The data buffer must be retrieved from the 
   751 	decoder with GetBufferL().
   752 
   753 	@param "aBuffer" "The coded data unit to write."
   754 	@leave "This method may leave with one of the system-wide error codes."
   755 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   756 	*/
   757 	virtual void WriteCodedDataL(TVideoInputBuffer* aBuffer) = 0;
   758 	
   759 	/**
   760 	Configures the Decoder using header information known by the client.
   761 	@param	"aVideoPictureHeader"	"Header information to configure the decoder with"
   762 	@leave	"The method will leave if an error occurs. Running out of data is not considered an error, 
   763 			as described above.
   764 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   765 	*/
   766 	virtual void ConfigureDecoderL(const TVideoPictureHeader& aVideoPictureHeader);
   767 		
   768 
   769 
   770 protected:
   771 	/**
   772 	Constructor.
   773 	*/
   774 	IMPORT_C CMMFVideoDecodeHwDevice();
   775 
   776 	/**
   777 	Set the proxy implementation to be used. Called just after the object is constructed.
   778 	@param	"aProxy"	"The proxy to use."
   779 	*/
   780 	virtual void SetProxy(MMMFDevVideoPlayProxy& aProxy) = 0;
   781 private:
   782 	TUid iDtor_ID_Key;
   783 	};
   784 
   785 
   786 /**
   787 CMMFVideoPostProcHwDevice is the MSL video post-processor plug-in interface. All MSL video 
   788 post-processors must implement this interface.
   789 @publishedAll
   790 @released
   791 */
   792 class CMMFVideoPostProcHwDevice : public CMMFVideoPlayHwDevice
   793 	{
   794 public:
   795 	/**
   796 	Creates a new video post-processor hardware device object, based on the implementation UID.
   797 
   798 	@param	"aUid"		"Post-processor implementation UID."
   799 	@param	"aProxy"	"The proxy implementation to use."
   800 	@return	"A new CMMFVideoPostProcHwDevice object."
   801 	@leave	"This method may leave with one of the system-wide error codes."
   802 	*/
   803 	IMPORT_C static CMMFVideoPostProcHwDevice* NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy);
   804 
   805 	/**
   806 	Destructor.
   807 	*/
   808 	IMPORT_C virtual ~CMMFVideoPostProcHwDevice();
   809 
   810 	/**
   811 	Sets the device input format to an uncompressed video format.
   812 
   813 	@param	"aFormat"	"The input format to use."
   814 	@leave	"The method will leave if an error occurs. Typical error codes used:
   815 			* KErrNotSupported - The input format is not supported."	
   816 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   817 	*/
   818 	virtual void SetInputFormatL(const TUncompressedVideoFormat& aFormat) = 0;
   819 
   820 	/**
   821 	Sets the decoder device that will write data to this post-processor. Decoded pictures will be 
   822 	written with WritePictureL() or through a custom interface. After pictures have been processed, 
   823 	they must be returned to the decoder using ReturnPicture().
   824 
   825 	@param	"aDevice"	"The decoder source plug-in to use."
   826 	@pre	"This method can only be called before the hwdevice has been initialized with Initialize()."
   827 	*/
   828 	virtual void SetInputDevice(CMMFVideoDecodeHwDevice* aDevice) = 0;
   829 
   830 	/**
   831 	Writes an uncompressed video picture to the post-processor. The picture must be returned to the 
   832 	client or source plug-in after it has been used.
   833 
   834 	@param	"aPicture"	"The picture to write."
   835 	@leave	"This method may leave with one of the system-wide error codes."
   836 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   837 	*/
   838 	virtual void WritePictureL(TVideoPicture* aPicture) = 0;
   839 protected:
   840 	/**
   841 	Constructor.
   842 	*/
   843 	IMPORT_C CMMFVideoPostProcHwDevice();
   844 
   845 	/**
   846 	Set the proxy implementation to be used. Called just after the object is constructed.
   847 	@param	"aProxy"	"The proxy to use."
   848 	*/
   849 	virtual void SetProxy(MMMFDevVideoPlayProxy& aProxy) = 0;
   850 private:
   851 	TUid iDtor_ID_Key;
   852 	};
   853 
   854 
   855 
   856 /**
   857 A custom interface extending the functionality of CMMFVideoPlayHwDevice, adding support for the decoder to handle the 
   858 copying of the bitstream data into the buffers, combining this with a scan of the data and support for the passing of 
   859 information from the client to the decoder describing what part of a frame the data contains.
   860 @publishedAll
   861 @released
   862 */
   863 class MMMFVideoPlayHwDeviceExtensionScanCopy
   864 	{
   865 public:
   866 	/**
   867 	Writes a piece of coded video data to the decoder. The data buffer must be retrieved from the
   868 	decoder with GetBufferL().
   869 
   870 	@param	"aBuffer"	"The coded data unit to write."
   871 	@param	"aPortion"	"The portion of the frame that the data contains. Defaults to EFramePortionUnknown."
   872 	@leave	"This method may leave with one of the system-wide error codes."
   873 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   874 	*/
   875 	virtual void WriteCodedDataL(TVideoInputBuffer* aBuffer, TFramePortion aPortion = EFramePortionUnknown) = 0;
   876 	/**
   877 	Passes a pointer to a piece of coded video data to the decoder. The data buffer, which is left empty by the client,
   878 	must be retrieved from the decoder with GetBufferL().
   879 
   880 	@param	"aCodedData"	"A pointer to the coded data unit to scan and copy."
   881 	@param	"aBuffer"		"The empty data buffer."
   882 	@param	"aPortion"		"The portion of the frame that the data contains. Defaults to EFramePortionUnknown."
   883 	@leave	"This method may leave with one of the system-wide error codes."
   884 	@pre	"This method can only be called after the hwdevice has been initialized with Initialize()."
   885 	*/
   886 	virtual void ScanAndCopyCodedDataL(TPtr8 aCodedData, TVideoInputBuffer* aBuffer, TInt& aConsumed, TFramePortion aPortion = EFramePortionUnknown) = 0;
   887 	};
   888 	
   889 
   890 inline void CMMFVideoDecodeHwDevice::ConfigureDecoderL(const TVideoPictureHeader& /*aVideoPictureHeader*/) 
   891 	{
   892 	User::Leave(KErrNotSupported);
   893 	}
   894 		
   895 
   896 
   897 #endif