sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // sl@0: sl@0: #ifndef __VIDEOPLAYHWDEVICE_H__ sl@0: #define __VIDEOPLAYHWDEVICE_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: sl@0: /** sl@0: A base class for all video playback (decoder and post-processor) hardware devices. sl@0: Since both decoders and post-processors can implement post-processing functionality, sl@0: this class includes all post-processing related methods. The main difference between decoder sl@0: and post-processor devices is that decoders can input coded data and write decoded pictures sl@0: to another device, while post-processor devices can accept decoded pictures from the client sl@0: or from another device. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CMMFVideoPlayHwDevice : public CMMFVideoHwDevice sl@0: { sl@0: public: sl@0: /** sl@0: Retrieves post-processing information about this hardware device. sl@0: The device creates a CPostProcessorInfo structure, fills it with correct data, pushes it sl@0: to the cleanup stack and returns it. The client will delete the object when it is no sl@0: longer needed. sl@0: sl@0: @return "Post-processor information as a CPostProcessorInfo object. sl@0: The object is pushed to the cleanup stack, and must be deallocated by the caller." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: */ sl@0: virtual CPostProcessorInfo* PostProcessorInfoLC() = 0; sl@0: sl@0: /** sl@0: Retrieves the list of the output formats that the device supports. The list is ordered in sl@0: plug-in preference order, with the preferred formats at the beginning of the list. The list sl@0: can depend on the device source format, and therefore SetSourceFormatL() must be called before sl@0: calling this method. sl@0: sl@0: @param "aFormats" "An array for the result format list. The array must be created and destroyed by the caller." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method may only be called before the hwdevice has been initialized using Initialize()." sl@0: */ sl@0: virtual void GetOutputFormatListL(RArray& aFormats) = 0; sl@0: sl@0: /** sl@0: Sets the device output format. sl@0: sl@0: @param "aFormat" "The format to use." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method may only be called before the hwdevice has been initialized using Initialize()." sl@0: */ sl@0: virtual void SetOutputFormatL(const TUncompressedVideoFormat &aFormat) = 0; sl@0: sl@0: /** sl@0: Sets the clock source to use for video timing. If no clock source is set. video playback sl@0: will not be synchronized, but will proceed as fast as possible, depending on input data sl@0: and output buffer availability. sl@0: sl@0: @param "aClock" "The clock source to be used." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetClockSource(MMMFClockSource* aClock) = 0; sl@0: sl@0: /** sl@0: Sets the device video output destination. The destination can be the screen (using direct sl@0: screen access) or memory buffers. By default memory buffers are used. If data is written sl@0: to another device, this method is ignored, and suitable memory buffers are always used. sl@0: sl@0: @param "aScreen" "True if video output destination is the screen, false if memory buffers." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetVideoDestScreenL(TBool aScreen) = 0; sl@0: sl@0: /** sl@0: Sets the post-processing types to be used. sl@0: sl@0: @param "aPostProcCombination" "The post-processing steps to perform, a bitwise OR of values from TPostProcessType." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetPostProcessTypesL(TUint32 aPostProcCombination) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for input (pan-scan) cropping. sl@0: sl@0: @param "aRect" "The cropping rectangle to use." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetInputCropOptionsL(const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for YUV to RGB color space conversion. sl@0: Specifies the input YUV and output RGB formats to use explicitly. SetSourceFormatL(), sl@0: SetOutputFormatL(), and SetPostProcessTypesL() must be called before this method is used. sl@0: sl@0: @param "aOptions" "The conversion options to use." sl@0: @param "aYuvFormat" "Conversion source YUV format" sl@0: @param "aRgbFormat" "Conversion target RGB format" sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions, const TYuvFormat& aYuvFormat, TRgbFormat aRgbFormat) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for YUV to RGB color space conversion. sl@0: Uses the device input and output formats. For decoder devices the default YUV format used is sl@0: the format specified in the input bitstream. SetSourceFormatL(), SetOutputFormatL(), and sl@0: SetPostProcessTypesL() must be called before this method is used. sl@0: sl@0: @param "aOptions" "The conversion options to use." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetYuvToRgbOptionsL(const TYuvToRgbOptions& aOptions) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for rotation. SetPostProcessTypesL() must be called before sl@0: this method is used. sl@0: sl@0: @param "aRotationType" "The rotation to perform." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetRotateOptionsL(TRotationType aRotationType) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for scaling. SetPostProcessTypesL() must be called before sl@0: this method is used. sl@0: sl@0: @param "aTargetSize" "Scaling target size. If a fixed scale factor size is used, sl@0: the new dimensions must be set to width=floor(factor*width), sl@0: height=floor(factor*height). For example, scaling a sl@0: QCIF (176x144) picture up by a factor of 4/3 yields a size sl@0: of 234x192." sl@0: @param "aAntiAliasFiltering" "True if anti-aliasing filtering should be used. sl@0: If the post-processor does not support anti-aliased scaling, sl@0: or supports anti-aliased scaling only, this argument is ignored." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetScaleOptionsL(const TSize& aTargetSize, TBool aAntiAliasFiltering) = 0; sl@0: sl@0: /** sl@0: Sets post-processing options for output cropping. SetPostProcessTypesL() must be called before sl@0: this method is used. sl@0: sl@0: @param "aRect" "Output cropping area." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetOutputCropOptionsL(const TRect& aRect) = 0; sl@0: sl@0: /** sl@0: Sets post-processing plug-in specific options. SetPostProcessTypesL() must be called before sl@0: this method is used. sl@0: sl@0: @param "aOptions" "The options. The format is plug-in specific." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can be called either before or after the hwdevice has been initialized with Initialize(). sl@0: If called after initialization, the change must only be committed when CommitL() is called." sl@0: */ sl@0: virtual void SetPostProcSpecificOptionsL(const TDesC8& aOptions) = 0; sl@0: sl@0: /** sl@0: Initializes the device. This method is asynchronous, the device will call sl@0: MMFVideoPlayProxy::MdvppInitializeComplete() after initialization has completed. After this sl@0: method has successfully completed, further configuration changes are not possible except where sl@0: separately noted. sl@0: */ sl@0: virtual void Initialize() = 0; sl@0: sl@0: /** sl@0: Commit all changes since the last CommitL(), Revert() or Initialize() sl@0: to the hardware device. This only applies to methods which can be called both sl@0: before AND after DevVideoPlay has been initialized. sl@0: sl@0: @see SetPostProcessTypesL sl@0: @see SetInputCropOptionsL sl@0: @see SetYuvToRgbOptionsL sl@0: @see SetRotateOptionsL sl@0: @see SetScaleOptionsL sl@0: @see SetOutputCropOptionsL sl@0: @see SetPostProcSpecificOptionsL sl@0: sl@0: @leave "The method will leave if an error occurs." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void CommitL() = 0; sl@0: sl@0: /** sl@0: Revert all changes since the last CommitL(), Revert() or Initialize() sl@0: back to their previous settings. This only applies to methods which can sl@0: be called both before AND after DevVideoPlay has been initialized. sl@0: sl@0: @see SetPostProcessTypesL sl@0: @see SetInputCropOptionsL sl@0: @see SetYuvToRgbOptionsL sl@0: @see SetRotateOptionsL sl@0: @see SetScaleOptionsL sl@0: @see SetOutputCropOptionsL sl@0: @see SetPostProcSpecificOptionsL sl@0: sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Revert() = 0; sl@0: sl@0: /** sl@0: Starts writing output directly to the display frame buffer using Direct Screen Access. sl@0: sl@0: @param "aVideoRect" "The video output rectangle on screen." sl@0: @param "aScreenDevice" "The screen device to use. The screen device object must be valid in the current thread." sl@0: @param "aClipRegion" "Initial clipping region to use." sl@0: sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void StartDirectScreenAccessL(const TRect& aVideoRect, sl@0: CFbsScreenDevice& aScreenDevice, const TRegion& aClipRegion) = 0; sl@0: sl@0: /** sl@0: Sets a new clipping region for Direct Screen Access. After the method returns, no video will sl@0: be drawn outside of the region. If clipping is not supported, or the clipping region is too sl@0: complex, either playback will pause or will resume without video display, depending on the sl@0: current setting of SetPauseOnClipFail(), and the result can be verified with IsPlaying(). sl@0: Clipping can be disabled by setting a new clipping region that includes the whole video window. sl@0: sl@0: @param "aRegion" "The new clipping region. After the method returns, no video will be drawn outside the region." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetScreenClipRegion(const TRegion& aRegion) = 0; sl@0: sl@0: /** sl@0: Sets whether the system should pause playback when it gets a clipping region it cannot handle, sl@0: or Direct Screen Access is aborted completely. If not, processing will proceed normally, but no sl@0: video will be drawn. By default, playback is paused. sl@0: sl@0: @param "aPause" "True if playback should be paused when clipping fails, false if not. sl@0: If playback is not paused, it will be continued without video display." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetPauseOnClipFail(TBool aPause) = 0; sl@0: sl@0: /** sl@0: Aborts Direct Screen Access completely, to be called from MAbortDirectScreenAccess::AbortNow() sl@0: and similar methods. DSA can be resumed by calling StartDirectScreenAccessL(). sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void AbortDirectScreenAccess() = 0; sl@0: sl@0: /** sl@0: Indicates whether playback is proceeding. This method can be used to check whether playback was sl@0: paused or not in response to a new clipping region or DSA abort. sl@0: sl@0: @return "ETrue if video is still being played (even if not necessarily displayed)." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TBool IsPlaying() = 0; sl@0: sl@0: /** sl@0: Re-draws the latest video picture. Only available when DSA is being used. If DSA is aborted or a sl@0: non-supported clipping region has been set, the request may be ignored. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Redraw() = 0; sl@0: sl@0: sl@0: /** sl@0: Starts video playback, including decoding, post-processing, and rendering. Playback will proceed sl@0: until it has been stopped or paused, or the end of the bitstream is reached. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Start() = 0; sl@0: sl@0: /** sl@0: Stops video playback. No new pictures will be decoded, post-processed, or rendered. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Stop() = 0; sl@0: sl@0: /** sl@0: Pauses video playback, including decoding, post-processing, and rendering. No pictures will be sl@0: decoded, post-processed, or rendered until playback has been resumed. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Pause() = 0; sl@0: sl@0: /** sl@0: Resumes video playback after a pause. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void Resume() = 0; sl@0: sl@0: /** sl@0: Changes to a new decoding and playback position, used for randomly accessing (seeking) the sl@0: input stream. The position change flushes all input and output buffers. Pre-decoder and sl@0: post-decoder buffering are handled as if a new bitstream was being decoded. If the device still has buffered sl@0: pictures that precede the new playback position, they will be discarded. If playback is sl@0: synchronized to a clock source, the client is responsible for setting the clock source to the sl@0: new position. sl@0: sl@0: @param "aPlaybackPosition" "The new playback position in the video stream." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetPosition(const TTimeIntervalMicroSeconds& aPlaybackPosition) = 0; sl@0: sl@0: /** sl@0: Freezes a picture on the screen. After the picture has been frozen, no new pictures are sl@0: displayed until the freeze is released with ReleaseFreeze(). If the device output is being sl@0: written to memory buffers or to another plug-in, instead of the screen, no decoded pictures sl@0: will be delivered while the freeze is active, and they are simply discarded. sl@0: sl@0: @param "aTimestamp" "The presentation timestamp of the picture to freeze. The frozen picture sl@0: will be the first picture with a timestamp greater than or equal to this sl@0: parameter." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void FreezePicture(const TTimeIntervalMicroSeconds& aTimestamp) = 0; sl@0: sl@0: /** sl@0: Releases a picture frozen with FreezePicture(). sl@0: sl@0: @param "aTimestamp" "The presentation timestamp of the picture to release. The first picture sl@0: displayed after the release will be the first picture with a timestamp sl@0: greater than or equal to this parameter. To release the freeze immediately, sl@0: set the timestamp to zero." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void ReleaseFreeze(const TTimeIntervalMicroSeconds& aTimestamp) = 0; sl@0: sl@0: sl@0: /** sl@0: Returns the current playback position, i.e. the timestamp for the most recently displayed or sl@0: virtually displayed picture. If the device output is written to another device, the most recent sl@0: output picture is used. sl@0: sl@0: @return "Current playback position." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds PlaybackPosition() = 0; sl@0: sl@0: /** sl@0: Returns the total amount of memory allocated for uncompressed pictures. This figure only sl@0: includes the pictures actually allocated by the plug-in itself, so that the total number of sl@0: bytes allocated in the system can be calculated by taking the sum of the values from all plug-ins. sl@0: sl@0: @return "Total number of bytes of memory allocated for uncompressed pictures." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TUint PictureBufferBytes() = 0; sl@0: sl@0: /** sl@0: Reads various counters related to decoded pictures. The counters are reset when Initialize() sl@0: or this method is called, and thus they only include pictures processed since the last call. sl@0: sl@0: Post-processor devices return the number of input pictures in iPicturesDecoded and sl@0: iTotalPictures. If the decoded pictures are written to another plug-in, they are considered sl@0: to be "virtually displayed". sl@0: sl@0: @param "aCounters" "The counter structure to fill." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetPictureCounters(CMMFDevVideoPlay::TPictureCounters& aCounters) = 0; sl@0: sl@0: sl@0: /** sl@0: Sets the computational complexity level to use. If separate complexity levels are not available, sl@0: the method call is ignored. If the level specified is not available, the results are undefined. sl@0: Typically the device will either ignore the request or use the nearest suitable level. sl@0: sl@0: The complexity level can be changed at any point during playback. sl@0: sl@0: @param "aLevel" "The computational complexity level to use. Level zero (0) is the most complex sl@0: one, with the highest quality. Higher level numbers require less processing sl@0: and may have lower quality." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetComplexityLevel(TUint aLevel) = 0; sl@0: sl@0: /** sl@0: Gets the number of complexity levels available. sl@0: sl@0: @return "The number of complexity control levels available, or zero if the information is not sl@0: available yet. The information may not be available if the number of levels depends on sl@0: the input data, and enough input data has not been read yet. In that case, using level sl@0: zero is safe." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TUint NumComplexityLevels() = 0; sl@0: sl@0: /** sl@0: Gets information about a computational complexity level. This method can be called after sl@0: NumComplexityLevels() has returned a non-zero value - at that point the information is guaranteed sl@0: to be available. Some hardware device implementations may not be able to provide all values, sl@0: in that case the values will be approximated. sl@0: sl@0: @param "aLevel" "The computational complexity level to query. The level numbers range from zero sl@0: (the most complex) to NumComplexityLevels()-1." sl@0: @param "aInfo" "The information structure to fill." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetComplexityLevelInfo(TUint aLevel, CMMFDevVideoPlay::TComplexityLevelInfo& aInfo) = 0; sl@0: sl@0: /** sl@0: Returns a picture back to the device. This method is called by CMMFDevVideoPlay to return pictures sl@0: from the client (after they have been written with NewPicture()), or by the output device when sl@0: it has finished using a picture. sl@0: sl@0: @param "aPicture" "The picture to return. The device can re-use the memory for the picture." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void ReturnPicture(TVideoPicture* aPicture) = 0; sl@0: sl@0: /** sl@0: Gets a copy of the latest picture sent to output. sl@0: sl@0: @param "aPictureData" "Target picture. The memory for the picture must be allocated by the sl@0: caller, and initialized properly. The data formats must match the snapshot sl@0: format requested." sl@0: @param "aFormat" "The picture format to use for the snapshot." sl@0: sl@0: @return "ETrue if the snapshot was taken, EFalse if a picture is not available. The picture may not sl@0: be available if decoding has not progressed far enough yet." sl@0: sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The requested data format or picture size is not supported, or the sl@0: plug-in does not support snapshots." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TBool GetSnapshotL(TPictureData& aPictureData, const TUncompressedVideoFormat& aFormat) = 0; sl@0: sl@0: /** sl@0: When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete() sl@0: callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot sl@0: request can be active at a time. sl@0: sl@0: @param "aPictureData" "Target picture. The memory for the picture must be allocated by sl@0: the caller, and initialized properly. The data formats must match sl@0: the snapshot format requested. The picture must remain valid until sl@0: the snapshot has been taken or until the request has been cancelled sl@0: with CancelTimedSnapshot()." sl@0: @param "aFormat" "The picture format to use for the snapshot." sl@0: @param "aPresentationTimestamp" "Presentation timestamp for the picture to copy." sl@0: sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The requested data format or picture size is not supported or sl@0: the plug-in does not support timed snapshots." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, sl@0: const TTimeIntervalMicroSeconds& aPresentationTimestamp) = 0; sl@0: sl@0: /** sl@0: When the snapshot is available, it will be returned to the client using the TimedSnapshotComplete() sl@0: callback. To cancel a timed snapshot request, use CancelTimedSnapshot(). Only one timed snapshot sl@0: request can be active at a time. sl@0: sl@0: @param "aPictureData" "Target picture. The memory for the picture must be allocated by sl@0: the caller, and initialized properly. The data formats must match sl@0: the snapshot format requested. The picture must remain valid until sl@0: the snapshot has been taken or until the request has been cancelled sl@0: with CancelTimedSnapshot()." sl@0: @param "aFormat" "The picture format to use for the snapshot." sl@0: @param "aPictureId" "Picture identifier for the picture to copy." sl@0: sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The requested data format or picture size is not supported or sl@0: the plug-in does not support timed snapshots." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetTimedSnapshotL(TPictureData* aPictureData, const TUncompressedVideoFormat& aFormat, sl@0: const TPictureId& aPictureId) = 0; sl@0: sl@0: /** sl@0: Cancels a timed snapshot request. sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void CancelTimedSnapshot() = 0; sl@0: sl@0: /** sl@0: Gets a list of the supported snapshot picture formats. sl@0: sl@0: @param "aFormats" "An array for the result format list. The array must be created and destroyed by sl@0: the caller." sl@0: sl@0: @leave "This method may leave with one of the standard error codes." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetSupportedSnapshotFormatsL(RArray& aFormats) = 0; sl@0: sl@0: sl@0: /** sl@0: sl@0: Notifies the hardware device that the end of input data has been reached and no more input data sl@0: will be written. The hardware device can use this signal to ensure that the remaining data gets sl@0: processed, without waiting for new data. For example when the data type is not EDuCodedPicture, sl@0: calling this method is necessary otherwise a hardware device implementation might be looking for sl@0: the start code for the next picture to ensure it has a complete picture before starting to decode sl@0: the previous one. sl@0: sl@0: sl@0: After the remaining data has been processed (and displayed, if applicable), the hardware sl@0: device must notify the proxy with the MdvppStreamEnd() callback. sl@0: sl@0: DevVideo clients are encouraged to call this method, but its use is not mandatory for synchronized sl@0: processing. For synchronized playback, all video pictures are processed or discarded according to sl@0: their timestamps, and so the client can easily infer when processing is complete. However, it sl@0: should be noted that the last picture might not be displayed if this method is not called and the sl@0: input data type is not EDuCodedPicture. sl@0: sl@0: For non-synchronized playback (e.g. file conversion), a client must call this method otherwise it sl@0: will never find out when the hardware device has finished processing the data. sl@0: sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void InputEnd() = 0; sl@0: }; sl@0: sl@0: sl@0: sl@0: sl@0: /** sl@0: CMMFVideoDecodeHwDevice is the MSL video decoder hardware device interface. sl@0: All video decoders must implement this interface. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CMMFVideoDecodeHwDevice : public CMMFVideoPlayHwDevice sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new video decoder hardware device object, based on the implementation UID. sl@0: sl@0: @param "aUid" "Decoder implementation UID." sl@0: @param "aProxy" "The proxy implementation to use." sl@0: @return "A new CMMFVideoDecodeHwDevice object." sl@0: @leave "This method may leave with one of the system-wide error codes. sl@0: */ sl@0: IMPORT_C static CMMFVideoDecodeHwDevice* NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy); sl@0: sl@0: /** sl@0: Creates a new video decoder hardware device adapter object, based on the Implementation Information of a Processing Unit. sl@0: sl@0: @param "aImplInfo" "The registration data relating to the Interface Implementation of the Processing Unit." sl@0: @param "aProxy" "The proxy implementation to use." sl@0: @return "A new CMMFVideoDecodeHwDevice object." sl@0: @leave "This method will leave if an error occurs." sl@0: */ sl@0: IMPORT_C static CMMFVideoDecodeHwDevice* NewPuAdapterL(const CImplementationInformation& aImplInfo, MMMFDevVideoPlayProxy& aProxy); sl@0: sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C virtual ~CMMFVideoDecodeHwDevice(); sl@0: sl@0: sl@0: /** sl@0: Retrieves decoder information about this hardware device. The device creates a CVideoDecoderInfo sl@0: structure, fills it with correct data, pushes it to the cleanup stack and returns it. The client sl@0: will delete the object when it is no longer needed. sl@0: sl@0: @return "Decoder information as a CVideoDecoderInfo object. The object is pushed to the cleanup sl@0: stack, and must be deallocated by the caller." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: sl@0: @see CVideoDecoderInfo sl@0: */ sl@0: virtual CVideoDecoderInfo* VideoDecoderInfoLC() = 0; sl@0: sl@0: /** sl@0: Reads header information from a coded data unit. sl@0: @param "aDataUnitType" "The type of the coded data unit that is contained in aDataUnit. If the data is a sl@0: simple piece of bitstream, use EDuArbitraryStreamSection." sl@0: @param "aEncapsulation" "The encapsulation type used for the coded data. If the data is a sl@0: simple piece of bitstream, use EDuElementaryStream." sl@0: @param "aDataUnit" "The coded data unit, contained in a TVideoInputBuffer." sl@0: @return "Header information for the data unit, or NULL if the coded data unit did not contain sl@0: enough data to parse the header. The header data must be returned to the device using sl@0: ReturnHeader() before Initialize() is called or the decoder is destroyed. The data remains sl@0: valid until it is returned." sl@0: @leave "The method will leave if an error occurs. Running out of data is not considered an error, sl@0: as described above. Typical error codes used: sl@0: * KErrNotSupported - The data is not in a supported format. sl@0: * KErrCorrupt - The data appears to be in a supported format, but is corrupted." sl@0: */ sl@0: virtual TVideoPictureHeader* GetHeaderInformationL(TVideoDataUnitType aDataUnitType, sl@0: TVideoDataUnitEncapsulation aEncapsulation, TVideoInputBuffer* aDataUnit) = 0; sl@0: sl@0: sl@0: /** sl@0: Returns a header from GetHeaderInformationL() back to the decoder so that the memory can be freed. sl@0: sl@0: @param "aHeader" "The header to return." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void ReturnHeader(TVideoPictureHeader* aHeader) = 0; sl@0: sl@0: /** sl@0: Sets the device input format to a compressed video format. sl@0: sl@0: @param "aFormat" "The input format to use." sl@0: @param "aDataUnitType" "The data unit type for input data." sl@0: @param "aEncapsulation" "The encapsulation type used for the coded data." sl@0: @param "aDataInOrder" "ETrue if the input data is written in correct decoding order, sl@0: EFalse if will be written in arbitrary order." sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The source format is not supported." sl@0: sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetInputFormatL(const CCompressedVideoFormat& aFormat, sl@0: TVideoDataUnitType aDataUnitType, TVideoDataUnitEncapsulation aEncapsulation, sl@0: TBool aDataInOrder) = 0; sl@0: sl@0: /** sl@0: Sets whether decoding should be synchronized to the current clock source, if any, or if pictures sl@0: should instead be decoded as soon as possible. If decoding is synchronized, decoding timestamps sl@0: are used if available, presentation timestamps are used if not. When decoding is not synchronized, sl@0: pictures are decoded as soon as source data is available for them, and the decoder has a free sl@0: output buffer. If a clock source is not available, decoding will not be synchronized. sl@0: sl@0: @param "aSynchronize" "True if decoding should be synchronized to a clock source." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SynchronizeDecoding(TBool aSynchronize) = 0; sl@0: sl@0: /** sl@0: Sets decoder buffering options. See [3] for a description of the options available. sl@0: sl@0: @param "aOptions" "Buffering options." sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The specified buffering options are not supported. sl@0: If the client receives this error code, it can call GetBufferOptions() sl@0: to determine the options the decoder is able to support." sl@0: sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetBufferOptionsL(const CMMFDevVideoPlay::TBufferOptions& aOptions) = 0; sl@0: sl@0: /** sl@0: Gets the video decoder buffer options actually in use. This can be used before calling sl@0: SetBufferOptions() to determine the default options, or afterwards to check the values sl@0: actually in use (if some default values were used). sl@0: sl@0: @param "aOptions" "Buffering options structure to fill." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetBufferOptions(CMMFDevVideoPlay::TBufferOptions& aOptions) = 0; sl@0: sl@0: /** sl@0: Indicates which HRD/VBV specification is fulfilled in the input stream and any related parameters. sl@0: sl@0: @param "aHrdVbvSpec" "The HRD/VBV specification fulfilled." sl@0: @param "aHrdVbvParams" "HRD/VBV parameters. The data format depends on the parameters chosen. sl@0: For 3GPP TS 26.234 parameters (aHrdVbvSpec=EHrdVbv3GPP), the data in the sl@0: descriptor is a package of type TPckC sl@0: (see T3gppHrdVbvParams). If no HRD/VBV parameters are used, the descriptor sl@0: is zero length." sl@0: @see THrdVbvSpecification sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetHrdVbvSpec(THrdVbvSpecification aHrdVbvSpec, const TDesC8& aHrdVbvParams) = 0; sl@0: sl@0: /** sl@0: Sets the output post-processor device to use. If an output device is set, all decoded pictures sl@0: are delivered to that device, and not drawn on screen or returned to the client. Pictures are sl@0: written using CMMDVideoPostProcDevice::WritePictureL() or a custom interface after they have been sl@0: decoded. The post-processor must then synchronize rendering to the clock source if necessary. sl@0: sl@0: @param "aDevice" "The output post-processor device to use." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetOutputDevice(CMMFVideoPostProcHwDevice* aDevice) = 0; sl@0: sl@0: /** sl@0: Returns the current decoding position, i.e. the timestamp for the most recently decoded picture. sl@0: sl@0: @return "Current decoding position." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds DecodingPosition() = 0; sl@0: sl@0: /** sl@0: Returns the current pre-decoder buffer size. sl@0: sl@0: @return "The number of bytes of data in the pre-decoder buffer." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TUint PreDecoderBufferBytes() = 0; sl@0: sl@0: /** sl@0: Reads various counters related to the received input bitstream and coded data units. The counters sl@0: are reset when Initialize() or this method is called, and thus they only include data processed sl@0: since the last call. sl@0: sl@0: @param "aCounters" "The counter structure to fill." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void GetBitstreamCounters(CMMFDevVideoPlay::TBitstreamCounters& aCounters) = 0; sl@0: sl@0: /** sl@0: Retrieves the number of free input buffers the decoder has available. sl@0: sl@0: @return "Number of free input buffers the decoder has available." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual TUint NumFreeBuffers() = 0; sl@0: sl@0: /** sl@0: Retrieves an empty video input buffer from the decoder. After input data has been written to the sl@0: buffer, it can be written to the decoder using WriteCodedDataL(). The number of buffers the decoder sl@0: must be able to provide before expecting any back, and the maximum size for each buffer, are sl@0: specified in the buffer options. sl@0: sl@0: The decoder maintains ownership of the buffers even while they have been retrieved by the client, sl@0: and will take care of deallocating them. sl@0: sl@0: @param "aBufferSize" "Required buffer size, in bytes. The resulting buffer can be larger than sl@0: this, but not smaller." sl@0: @return "A new input data buffer. The buffer is at least as large as requested, but it may be sl@0: larger. If no free buffers are available, the return value is NULL." sl@0: @leave "The method will leave if an error occurs. Lack of free buffers is not considered an error." sl@0: */ sl@0: virtual TVideoInputBuffer* GetBufferL(TUint aBufferSize) = 0; sl@0: sl@0: /** sl@0: Writes a piece of coded video data to the decoder. The data buffer must be retrieved from the sl@0: decoder with GetBufferL(). sl@0: sl@0: @param "aBuffer" "The coded data unit to write." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void WriteCodedDataL(TVideoInputBuffer* aBuffer) = 0; sl@0: sl@0: /** sl@0: Configures the Decoder using header information known by the client. sl@0: @param "aVideoPictureHeader" "Header information to configure the decoder with" sl@0: @leave "The method will leave if an error occurs. Running out of data is not considered an error, sl@0: as described above. sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void ConfigureDecoderL(const TVideoPictureHeader& aVideoPictureHeader); sl@0: sl@0: sl@0: sl@0: protected: sl@0: /** sl@0: Constructor. sl@0: */ sl@0: IMPORT_C CMMFVideoDecodeHwDevice(); sl@0: sl@0: /** sl@0: Set the proxy implementation to be used. Called just after the object is constructed. sl@0: @param "aProxy" "The proxy to use." sl@0: */ sl@0: virtual void SetProxy(MMMFDevVideoPlayProxy& aProxy) = 0; sl@0: private: sl@0: TUid iDtor_ID_Key; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: CMMFVideoPostProcHwDevice is the MSL video post-processor plug-in interface. All MSL video sl@0: post-processors must implement this interface. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CMMFVideoPostProcHwDevice : public CMMFVideoPlayHwDevice sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new video post-processor hardware device object, based on the implementation UID. sl@0: sl@0: @param "aUid" "Post-processor implementation UID." sl@0: @param "aProxy" "The proxy implementation to use." sl@0: @return "A new CMMFVideoPostProcHwDevice object." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: */ sl@0: IMPORT_C static CMMFVideoPostProcHwDevice* NewL(TUid aUid, MMMFDevVideoPlayProxy& aProxy); sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C virtual ~CMMFVideoPostProcHwDevice(); sl@0: sl@0: /** sl@0: Sets the device input format to an uncompressed video format. sl@0: sl@0: @param "aFormat" "The input format to use." sl@0: @leave "The method will leave if an error occurs. Typical error codes used: sl@0: * KErrNotSupported - The input format is not supported." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetInputFormatL(const TUncompressedVideoFormat& aFormat) = 0; sl@0: sl@0: /** sl@0: Sets the decoder device that will write data to this post-processor. Decoded pictures will be sl@0: written with WritePictureL() or through a custom interface. After pictures have been processed, sl@0: they must be returned to the decoder using ReturnPicture(). sl@0: sl@0: @param "aDevice" "The decoder source plug-in to use." sl@0: @pre "This method can only be called before the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void SetInputDevice(CMMFVideoDecodeHwDevice* aDevice) = 0; sl@0: sl@0: /** sl@0: Writes an uncompressed video picture to the post-processor. The picture must be returned to the sl@0: client or source plug-in after it has been used. sl@0: sl@0: @param "aPicture" "The picture to write." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void WritePictureL(TVideoPicture* aPicture) = 0; sl@0: protected: sl@0: /** sl@0: Constructor. sl@0: */ sl@0: IMPORT_C CMMFVideoPostProcHwDevice(); sl@0: sl@0: /** sl@0: Set the proxy implementation to be used. Called just after the object is constructed. sl@0: @param "aProxy" "The proxy to use." sl@0: */ sl@0: virtual void SetProxy(MMMFDevVideoPlayProxy& aProxy) = 0; sl@0: private: sl@0: TUid iDtor_ID_Key; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: A custom interface extending the functionality of CMMFVideoPlayHwDevice, adding support for the decoder to handle the sl@0: copying of the bitstream data into the buffers, combining this with a scan of the data and support for the passing of sl@0: information from the client to the decoder describing what part of a frame the data contains. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class MMMFVideoPlayHwDeviceExtensionScanCopy sl@0: { sl@0: public: sl@0: /** sl@0: Writes a piece of coded video data to the decoder. The data buffer must be retrieved from the sl@0: decoder with GetBufferL(). sl@0: sl@0: @param "aBuffer" "The coded data unit to write." sl@0: @param "aPortion" "The portion of the frame that the data contains. Defaults to EFramePortionUnknown." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void WriteCodedDataL(TVideoInputBuffer* aBuffer, TFramePortion aPortion = EFramePortionUnknown) = 0; sl@0: /** sl@0: Passes a pointer to a piece of coded video data to the decoder. The data buffer, which is left empty by the client, sl@0: must be retrieved from the decoder with GetBufferL(). sl@0: sl@0: @param "aCodedData" "A pointer to the coded data unit to scan and copy." sl@0: @param "aBuffer" "The empty data buffer." sl@0: @param "aPortion" "The portion of the frame that the data contains. Defaults to EFramePortionUnknown." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: @pre "This method can only be called after the hwdevice has been initialized with Initialize()." sl@0: */ sl@0: virtual void ScanAndCopyCodedDataL(TPtr8 aCodedData, TVideoInputBuffer* aBuffer, TInt& aConsumed, TFramePortion aPortion = EFramePortionUnknown) = 0; sl@0: }; sl@0: sl@0: inline void CMMFVideoDecodeHwDevice::ConfigureDecoderL(const TVideoPictureHeader& /*aVideoPictureHeader*/) sl@0: { sl@0: User::Leave(KErrNotSupported); sl@0: } sl@0: sl@0: sl@0: sl@0: #endif