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 __DEVVIDEOBASE_H__ sl@0: #define __DEVVIDEOBASE_H__ sl@0: sl@0: #include sl@0: #include sl@0: #include sl@0: #include sl@0: #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS sl@0: #include sl@0: #endif sl@0: sl@0: sl@0: /** sl@0: Panic utility function sl@0: @publishedAll sl@0: */ sl@0: LOCAL_C void DevVideoPanic(TInt aReason) sl@0: { sl@0: User::Panic(KDevVideoPanicCategory, aReason); sl@0: } sl@0: sl@0: sl@0: /** sl@0: A hardware device ID that identifies an instantiated video hardware device. sl@0: Used in the playback and recording APIs to identify the component being controlled. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: typedef TInt THwDeviceId; sl@0: sl@0: sl@0: /** sl@0: Defines a supported scale factor for a scaling pre-processor or post-processor. sl@0: sl@0: The scale factor is defined as iScaleNum/iScaleDenom, sl@0: where the values are positive integers and relatively prime. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TScaleFactor sl@0: { sl@0: public: sl@0: /**Scale factor numerator. Non-zero.*/ sl@0: TUint iScaleNum; sl@0: /**Scale factor denominator. Non-zero.*/ sl@0: TUint iScaleDenom; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: A custom YUV/RGB conversion matrix. The same matrix structure is used for both conversion directions. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TYuvConversionMatrix sl@0: { sl@0: public: sl@0: /** sl@0: Post-multiplication offset, a three-item vector. sl@0: */ sl@0: TReal iPostOffset[3]; sl@0: sl@0: /** sl@0: Multiplication matrix, a 3x3 matrix. iMatrix[3*i+j] contains the j:th item on the i:th row of the matrix. sl@0: */ sl@0: TReal iMatrix[9]; sl@0: sl@0: /** sl@0: Pre-multiplication offset, a three-item vector. sl@0: */ sl@0: TReal iPreOffset[3]; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: YUV (YCbCr) uncompressed image data format. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TYuvFormat sl@0: { sl@0: public: sl@0: /** sl@0: The YUV/RGB conversion coefficients to use sl@0: */ sl@0: TYuvCoefficients iCoefficients; sl@0: sl@0: /** sl@0: Luminance/chrominance sampling pattern. sl@0: */ sl@0: TYuvSamplingPattern iPattern; sl@0: sl@0: /** sl@0: Data layout, specifies whether the data is stored in a planar or interleaved mode. sl@0: */ sl@0: TYuvDataLayout iDataLayout; sl@0: sl@0: /** sl@0: Custom YUV to RGB conversion matrix to use. sl@0: Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix). sl@0: */ sl@0: TYuvConversionMatrix* iYuv2RgbMatrix; sl@0: sl@0: /** sl@0: Custom RGB to YUV conversion matrix to use. sl@0: Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix). sl@0: */ sl@0: TYuvConversionMatrix* iRgb2YuvMatrix; sl@0: sl@0: /** sl@0: Pixel aspect ratio numerator. sl@0: */ sl@0: TUint iAspectRatioNum; sl@0: sl@0: /** sl@0: Pixel aspect ratio denominator. sl@0: The aspect ratio is defined as iAspectRatioNum/iAspectRatioDenom, sl@0: where the values are positive integers and relatively prime. sl@0: */ sl@0: TUint iAspectRatioDenom; sl@0: sl@0: /** sl@0: Tests whether this TYuvFormat object is the same as aOther. sl@0: @param "aOther" "The object to compare." sl@0: @return "ETrue if they are the same, EFalse if not." sl@0: */ sl@0: inline TBool operator==(const TYuvFormat& aOther) const; sl@0: }; sl@0: sl@0: /** sl@0: Defines an uncompressed video format. sl@0: This structure is mainly just a combination of YUV and RGB formats, defined to simplify the rest of the API. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TUncompressedVideoFormat sl@0: { sl@0: public: sl@0: /** sl@0: The image data format. The validity of the rest of the fields depends on the data format used. sl@0: */ sl@0: TImageDataFormat iDataFormat; sl@0: union sl@0: { sl@0: /** sl@0: YUV picture format details, valid if iDataFormat is EYuvRawData. sl@0: */ sl@0: TYuvFormat iYuvFormat; sl@0: sl@0: /** sl@0: RGB picture format details, valid if iDataFormat is ERgbRawData or ERgbFbsBitmap. sl@0: */ sl@0: TRgbFormat iRgbFormat; sl@0: }; sl@0: sl@0: /** sl@0: Tests whether this TUncompressedVideoFormat object is the same as aOther. sl@0: @param "aOther" "The object to compare." sl@0: @return "ETrue if they are the same, EFalse if not." sl@0: */ sl@0: inline TBool operator==(const TUncompressedVideoFormat& aOther) const; sl@0: sl@0: /** sl@0: Sets this object equal to aOther. sl@0: @param "aOther" "The object to clone." sl@0: */ sl@0: inline void operator=(const TUncompressedVideoFormat& aOther); sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Uncompressed picture data for one video picture. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TPictureData sl@0: { sl@0: public: sl@0: /** sl@0: The image data format. The validity of the rest of the fields depends on the data format used. sl@0: */ sl@0: TImageDataFormat iDataFormat; sl@0: sl@0: /** sl@0: Image data size in pixels. In decoder output pictures the actual active picture area may be smaller, sl@0: this is indicated using TVideoPicture.iCropRect. sl@0: */ sl@0: TSize iDataSize; sl@0: sl@0: union sl@0: { sl@0: /** sl@0: Pointer to raw image data. Valid if iDataFormat is ERgbRawData or iYuvRawData. sl@0: The data layout depends on the format used. sl@0: */ sl@0: TPtr8* iRawData; sl@0: sl@0: /** sl@0: Pointer to an RGB bitmap. Valid if iDataFormat is ERgbFbsBitmap. sl@0: */ sl@0: CFbsBitmap* iRgbBitmap; sl@0: sl@0: /** sl@0: Buffer number of current buffer for composition that is used when submitting a surface update. Valid if iDataFormat is set to ESurfaceBuffer sl@0: */ sl@0: TInt iSurfaceBufNum; sl@0: }; sl@0: }; sl@0: sl@0: /** sl@0: Header information for one decoded picture. sl@0: The header information is returned alongside with decoded pictures, sl@0: or it can be read separately when DevVideoPlay is being initialized. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TVideoPictureHeader sl@0: { sl@0: public: sl@0: /** sl@0: */ sl@0: enum THeaderOptions sl@0: { sl@0: /** Decoding timestamp is valid sl@0: */ sl@0: EDecodingTimestamp = 0x00000001, sl@0: /** Presentation timestamp is valid sl@0: */ sl@0: EPresentationTimestamp = 0x00000002, sl@0: /** Pre-decoder buffersize is valid sl@0: */ sl@0: EPreDecoderBufferSize = 0x00000004, sl@0: /** Post-decoder buffersize is valid sl@0: */ sl@0: EPostDecoderBufferSize = 0x00000008, sl@0: /** Picture number field is valid sl@0: */ sl@0: EPictureNumber = 0x00000010, sl@0: /** Layered coding is used and the layer number field is valid sl@0: */ sl@0: ELayeredCoding = 0x00000020, sl@0: /** Supplemental data is available sl@0: */ sl@0: ESupplementalData = 0x00000040, sl@0: /** Random access buffering period is valid sl@0: */ sl@0: ERandomAccessBufferingPeriod = 0x00000080, sl@0: /** Random access buffer occupancy is valid sl@0: */ sl@0: ERandomAccessBufferOccupancy = 0x00000100 sl@0: }; sl@0: sl@0: /** sl@0: Header options. The value is a bitfield combined from values from THeaderOptions. sl@0: */ sl@0: TUint32 iOptions; sl@0: sl@0: /** sl@0: Video codec profile used. Use -1 if not applicable or not defined. sl@0: */ sl@0: TInt iProfile; sl@0: sl@0: /** sl@0: Video codec level. Use -1 if not applicable or not defined. sl@0: */ sl@0: TInt iLevel; sl@0: sl@0: /** sl@0: Video codec version. Use -1 if not applicable or not defined. sl@0: */ sl@0: TInt iVersion; sl@0: sl@0: /** sl@0: Pointer to a descriptor that contains optional codec-specific features. Set to NULL if not used. sl@0: The format of the data is codec-specific. The pointer and descriptor data are valid as long as sl@0: the header information structure is valid. sl@0: */ sl@0: const TDesC8* iOptional; sl@0: sl@0: /** sl@0: Image size in memory, in pixels. May be larger than the displayed picture. sl@0: */ sl@0: TSize iSizeInMemory; sl@0: sl@0: /** sl@0: The portion of the full image to display. sl@0: */ sl@0: TRect iDisplayedRect; sl@0: sl@0: /** sl@0: Picture presentation timestamp. Valid only if EPresentationTimestamp is set in the options. sl@0: The clock frequency is stored in the timestamp structure. sl@0: */ sl@0: TTimeIntervalMicroSeconds iPresentationTimestamp; sl@0: sl@0: /** sl@0: Picture decoding timestamp. Valid only if EDecodingTimestamp is set in the options. sl@0: */ sl@0: TTimeIntervalMicroSeconds iDecodingTimestamp; sl@0: sl@0: /** sl@0: Expected pre-decoder buffer size in bytes. Valid only if EPreDecoderBufferSize is set in the options. sl@0: */ sl@0: TUint iPreDecoderBufferSize; sl@0: sl@0: /** sl@0: Expected post-decoder buffer size in bytes. Valid only if EPostDecoderBufferSize is set in the options. sl@0: It is assumed that a frame buffer to be displayed is returned before the decoding of the next frame sl@0: is started. If this is not the case, a larger post-decoder buffer may actually be needed. sl@0: */ sl@0: TUint iPostDecoderBufferSize; sl@0: sl@0: /** sl@0: Picture number, valid only if EPictureNumber is set in the options. sl@0: This field is used to indicate one of the following: picture number or long-term picture index for H.263, sl@0: vop_id for MPEG-4 Visual, picture number or long-term picture number for AVC. sl@0: */ sl@0: TUint iPictureNumber; sl@0: sl@0: /** sl@0: Picture layer number if layered coding is used, valid only if ELayeredCoding is set in the options. sl@0: Layers are numbered [0…n-1], where n is the number of layers available. The first layer (layer zero) sl@0: is the base layer, it can be decoded independently from the other layers, and it has the lowest total bitrate. sl@0: */ sl@0: TUint iPictureLayer; sl@0: sl@0: /** sl@0: Picture supplemental data, valid only if ESupplementalData is set in the options. sl@0: The pointer and descriptor data are valid as long as the header information structure is valid. sl@0: */ sl@0: const TDesC8* iSupplementalData; sl@0: sl@0: /** sl@0: True if the picture is a random-accessible picture. sl@0: */ sl@0: TBool iIsRandomAccessible; sl@0: sl@0: /** sl@0: The expected initial pre-decoder buffering period before starting the playback from this picture. sl@0: Valid only if this picture is randomly accessible (iIsRandomAccessible is true) and sl@0: ERandomAccessBufferingPeriod is set in the options. MPEG-2 and H.264 | MPEG-4 AVC use this value. sl@0: */ sl@0: TTimeIntervalMicroSeconds32 iRandomAccessBufferingPeriod; sl@0: sl@0: /** sl@0: The expected initial pre-decoder buffer occupancy in bytes before starting the playback sl@0: from this picture. Valid if this picture is randomly accessible (iIsRandomAccessible is true) and sl@0: ERandomAccessBufferOccupancy is set in the options. MPEG-4 Visual uses this value. sl@0: */ sl@0: TUint iRandomAccessBufferOccupancy; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: One uncompressed video picture. Used for both decoded picture output as well as uncompressed picture input. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TVideoPicture sl@0: { sl@0: public: sl@0: /** sl@0: */ sl@0: enum TVideoPictureOptions sl@0: { sl@0: /** The timestamp field is valid. sl@0: */ sl@0: ETimestamp = 0x00000001, sl@0: /** The crop rectangle field is valid. sl@0: */ sl@0: ECropRect = 0x00000002, sl@0: /** Picture header information is present. sl@0: */ sl@0: EHeader = 0x00000004, sl@0: /** The layer bit count targets field is valid. sl@0: */ sl@0: EBitTargets = 0x00000008, sl@0: /** Set in encoder input to request an instantaneous decoder refresh. sl@0: As a response, the encoder should code an intra frame and no consecutive sl@0: frame should refer to any frame before the encoded intra frame (in coding order). sl@0: */ sl@0: EReqInstantRefresh = 0x00000010, sl@0: /** Set in encoder input to indicate a scene cut in the picture stream. sl@0: */ sl@0: ESceneCut = 0x00000020, sl@0: /** Set if a picture effect is in use and the picture effect field is valid. sl@0: */ sl@0: EPictureEffect = 0x00000040, sl@0: /** Set if picture effect parameters are valid. sl@0: */ sl@0: EEffectParameters = 0x00000080, sl@0: /** Content protected pictures cannot be displayed on unprotected sl@0: external displays such as TV-out. sl@0: */ sl@0: EContentProtected = 0x00000100 sl@0: }; sl@0: sl@0: /** sl@0: The picture data. The picture data, including all pointers, must remain valid until sl@0: the picture has been returned to its originator. sl@0: */ sl@0: TPictureData iData; sl@0: sl@0: /** sl@0: Picture options. The value is a bitfield combined from values from TVideoPictureOptions. sl@0: */ sl@0: TUint32 iOptions; sl@0: sl@0: /** sl@0: Picture timestamp. Valid if ETimestamp is set in the options. sl@0: Used for presentation timestamps in video playback and capture timestamps in uncompressed video sl@0: input for recording. If the timestamp is not specified for decoded video input for playback, sl@0: the picture is displayed immediately. For decoded video output in playback and uncompressed sl@0: video input for recording, the timestamp must always be set. sl@0: */ sl@0: TTimeIntervalMicroSeconds iTimestamp; sl@0: sl@0: /** sl@0: Pan-scan cropping rectangle. Defines the area of the picture used for further processing. sl@0: Only used for decoded video output. sl@0: */ sl@0: TRect iCropRect; sl@0: sl@0: /** sl@0: Picture header information. Valid if EHeader is set in the options. sl@0: Normally this field is only used in decoded pictures returned from the playback API. sl@0: In that case the header info pointer is valid until the picture is returned to the API. sl@0: */ sl@0: TVideoPictureHeader* iHeader; sl@0: sl@0: /** sl@0: The target number of bits for each bit-rate scalability layer, valid when EBitTargets is set in the options. sl@0: Used in video encoding when the caller controls the bit-rate for each picture separately. sl@0: The field points to a table containing the target number of bits to use for each layer when sl@0: encoding this picture, starting from the lowest layer. The bit count for an enhancement layer sl@0: includes all lower layers. For example, if the client uses two layers, and reserves 1.5 kilobits sl@0: for the base layer and three kilobits for the whole picture, this field is set to {1500, 3000}. sl@0: */ sl@0: RArray* iLayerBitRates; sl@0: sl@0: /** sl@0: The picture effect in use when capturing this picture, valid when EPictureEffect is set in the options. sl@0: This information can be used when encoding the picture. Note that setting a picture effect does not sl@0: imply that the encoder should modify the picture data based on the effect. Instead, it can be used as sl@0: an encoding hint. For example, fade to black implies that the global picture brightness has been decreased, sl@0: and this knowledge can be used to aid motion prediction. sl@0: @see TPictureEffects sl@0: */ sl@0: TPictureEffect iEffect; sl@0: sl@0: /** sl@0: Picture effect parameter for fade to/from black, valid when EEffectParameters is set in the options sl@0: and iEffect is EEffectFadeFromBlack or EEffectFadeToBlack. The value range is [0…65536], with zero sl@0: indicating the picture is black and 65536 indicating that the lightness of the picture is unchanged. sl@0: If the parameter is not given, the caller is unaware of the proper value or the value fluctuates spatially. sl@0: */ sl@0: TUint iFadeParam; sl@0: sl@0: /** sl@0: A pointer for free-form user data. The pointer is set by the module that created the buffer, and is sl@0: usually used for memory management purposes. sl@0: */ sl@0: TAny* iUser; sl@0: sl@0: /** sl@0: A queue link used internally by the MSL video components. sl@0: */ sl@0: TDblQueLink iLink; sl@0: }; sl@0: sl@0: /** sl@0: Identifies a video picture in feedback messages. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TPictureId sl@0: { sl@0: public: sl@0: enum TPictureIdType sl@0: { sl@0: /** Unidentified picture. */ sl@0: ENone, sl@0: /** The picture is identified using its temporal reference. */ sl@0: ETemporalReference, sl@0: /** The picture is identified using its picture number. Picture numbers are used in H.263 annex U and H.264 | MPEG-4 AVC, for example.. */ sl@0: EPictureNumber sl@0: }; sl@0: sl@0: /** Picture identified type. */ sl@0: TPictureIdType iIdType; sl@0: sl@0: /** The picture identifier. The interpretation of this field depends on the value iIdType */ sl@0: TUint32 iId; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Defines a compressed video format. The format is identified by its MIME type, which may include sl@0: parameters that describe the used format profile and level. The MIME type used for H.263 sl@0: is video/H263-2000, specified in TS 26.234, and the type for MPEG-4 is video/MP4V-ES, specified in RFC 3016. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CCompressedVideoFormat : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Static factory function for creating new CCompressedVideoFormat objects. sl@0: sl@0: @param "aMimeType" "Video codec MIME type, including optional parameters for profile, sl@0: level and version information. The CCompressedVideoFormat object creates sl@0: and owns a copy of this buffer and takes care of deallocation." sl@0: sl@0: @param "aOptionalData" "Reference to a descriptor that contains optional codec-specific data. sl@0: Set to KNullDesC8 if not used. [The format of the data is codec-specific, typically sl@0: a package buffer containing a data structure may be used. The pointer lifetime sl@0: and validity requirements are specified with each method that uses this structure." sl@0: sl@0: @return "Pointer to a fully constructed CCompressedVideoFormat object." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: */ sl@0: IMPORT_C static CCompressedVideoFormat* NewL(const TDesC8& aMimeType, const TDesC8& aOptionalData = KNullDesC8); sl@0: sl@0: /** sl@0: Static factory function for creating a copy of an existing CCompressedVideoFormat object. sl@0: sl@0: @param "aFormat" "The CCompressedVideoFormat object to copy." sl@0: sl@0: @return Pointer to a fully constructed CCompressedVideoFormat object. sl@0: @leave This method may leave with one of the system-wide error codes. sl@0: */ sl@0: IMPORT_C static CCompressedVideoFormat* NewL(const CCompressedVideoFormat& aFormat); sl@0: sl@0: /** sl@0: Virtual destructor. Destroys iMimeType. sl@0: */ sl@0: IMPORT_C virtual ~CCompressedVideoFormat(); sl@0: sl@0: /** sl@0: Returns the video codec MIME type. sl@0: sl@0: @return "Reference to a descriptor that contains the video codec MIME type." sl@0: */ sl@0: IMPORT_C const TDesC8& MimeType() const; sl@0: sl@0: /** sl@0: Returns the optional data. sl@0: sl@0: @return "Reference to a descriptor that contains optional codec-specific data. sl@0: Zero length if not used. The format of the data is codec-specific, typically a package buffer sl@0: containing a data structure may be used." sl@0: */ sl@0: IMPORT_C const TDesC8& OptionalData() const; sl@0: sl@0: /** sl@0: Tests whether this CCompressedVideoFormat is identical to aOther or not. sl@0: @return "ETrue if the two objects are identical, EFalse if not." sl@0: */ sl@0: IMPORT_C TBool operator==(const CCompressedVideoFormat& aOther) const; sl@0: protected: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: CCompressedVideoFormat(); sl@0: sl@0: /** sl@0: @internalTechnology sl@0: */ sl@0: void ConstructL(const TDesC8& aMimeType, const TDesC8& aOptionalData); sl@0: private: sl@0: HBufC8* iMimeType; sl@0: HBufC8* iOptionalData; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Specifies the HRD/VBV parameters used when 3GPP TS 26.234 annex G HRD/VBV settings are used (EHrdVbv3GPP). sl@0: See TS 26.234 Release 5 for details. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class T3gppHrdVbvParams sl@0: { sl@0: public: sl@0: /** Initial pre-decoder buffering period. */ sl@0: TTimeIntervalMicroSeconds iInitialPreDecoderBufferPeriod; sl@0: sl@0: /** Initial post-decoder buffering period. */ sl@0: TTimeIntervalMicroSeconds iInitialPostDecoderBufferPeriod; sl@0: sl@0: /** Hypothetical pre-decoder buffer size, in bytes. */ sl@0: TUint iPreDecoderBufferSize; sl@0: sl@0: /** Peak decoding byte rate. By default, the peak decoding byte rate is sl@0: defined according to the video coding profile and level in use. */ sl@0: TUint iPeakDecodingByteRate; sl@0: sl@0: /** Decoding macroblock rate. The default decoding macroblock rate is defined sl@0: according to the video coding profile and level in use. */ sl@0: TUint iDecodingMacroblockRate; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: YUV to RGB post-processing options. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TYuvToRgbOptions sl@0: { sl@0: public: sl@0: /** sl@0: Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in lightness. The actual lightness change formula sl@0: used is hardware device specific. sl@0: */ sl@0: TInt iLightness; sl@0: sl@0: /** sl@0: Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in saturation. The actual saturation formula used sl@0: is hardware device specific. sl@0: */ sl@0: TInt iSaturation; sl@0: sl@0: /** sl@0: Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in contrast. The actual contrast change formula sl@0: used is hardware device specific. sl@0: */ sl@0: TInt iContrast; sl@0: sl@0: /** sl@0: Gamma setting for conversion. Ignored if the converter does not support gamma correction. sl@0: The gamma correction is defined as x' = x^(1/g), where x' refers to the corrected value, sl@0: x to the original input value and g to this field. Gamma correction is performed on the RGB values. sl@0: Set gamma to 1.0 to disable gamma correction. sl@0: */ sl@0: TReal iGamma; sl@0: sl@0: /** sl@0: The dithering type to use. sl@0: */ sl@0: TDitherType iDitherType; sl@0: }; sl@0: sl@0: /** sl@0: Pre-processing options for color enhancement. sl@0: The value ranges have been chosen to match those in the Onboard Camera API. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TColorEnhancementOptions sl@0: { sl@0: public: sl@0: /** sl@0: Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in lightness. sl@0: */ sl@0: TInt iLightness; sl@0: sl@0: /** sl@0: Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in saturation. sl@0: */ sl@0: TInt iSaturation; sl@0: sl@0: /** sl@0: Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, sl@0: 100 to maximum setting, and 0 to no change in contrast. sl@0: */ sl@0: TInt iContrast; sl@0: }; sl@0: sl@0: /** sl@0: Describes the YUV to RGB color conversion capabilities of a post-processor. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TYuvToRgbCapabilities sl@0: { sl@0: public: sl@0: /** sl@0: Input YUV sampling patterns supported, a bitfield combination (bitwise OR) of TYuvSamplingPattern. sl@0: */ sl@0: TUint32 iSamplingPatterns; sl@0: sl@0: /** sl@0: YUV to RGB conversion coefficients supported, a bitfield combination of TYuvCoefficients. sl@0: */ sl@0: TUint32 iCoefficients; sl@0: sl@0: /** sl@0: Output RGB formats supported, a bitfield combination of TRgbFormat. sl@0: */ sl@0: TUint32 iRgbFormats; sl@0: sl@0: /** sl@0: True if lightness control is supported. sl@0: */ sl@0: TBool iLightnessControl; sl@0: sl@0: /** sl@0: True if saturation control is supported. sl@0: */ sl@0: TBool iSaturationControl; sl@0: sl@0: /** sl@0: True if contrast control is supported. sl@0: */ sl@0: TBool iContrastControl; sl@0: sl@0: /** sl@0: True if gamma correction is supported. sl@0: */ sl@0: TBool iGammaCorrection; sl@0: sl@0: /** sl@0: Dithering types supported, a bitfield combination of TDitherType. sl@0: */ sl@0: TUint32 iDitherTypes; sl@0: }; sl@0: sl@0: /** sl@0: Specifies the YUV-to-YUV conversion capabilities for a plug-in. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TYuvToYuvCapabilities sl@0: { sl@0: public: sl@0: /** sl@0: The YUV sampling patterns supported for input data, a combination (binary OR) of values from TYuvSamplingPatterns. sl@0: */ sl@0: TUint32 iInputSamplingPatterns; sl@0: sl@0: /** sl@0: The YUV data layouts supported for input data, a combination (binary OR) of values from TYuvDataLayout. sl@0: */ sl@0: TUint32 iInputDataLayouts; sl@0: sl@0: /** sl@0: The YUV sampling patterns supported for output data, a combination (binary OR) of values from TYuvSamplingPatterns. sl@0: */ sl@0: TUint32 iOutputSamplingPatterns; sl@0: sl@0: /** sl@0: The YUV data layouts supported for output data, a combination (binary OR) of values from TYuvDataLayout. sl@0: */ sl@0: TUint32 iOutputDataLayouts; sl@0: }; sl@0: sl@0: /** sl@0: Structure to combine a picture rate and size. Used when defining the maximum rate/size combinations sl@0: available. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TPictureRateAndSize sl@0: { sl@0: public: sl@0: /** The picture rate. */ sl@0: TReal iPictureRate; sl@0: sl@0: /** The picture size. */ sl@0: TSize iPictureSize; sl@0: }; sl@0: sl@0: /** sl@0: CMMFVideoHwDevice is a base class for all video hardware devices. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CMMFVideoHwDevice : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Retrieves a custom interface to the device. sl@0: @param "aInterface" "Interface UID, defined with the custom interface." sl@0: @return "Pointer to the interface implementation, or NULL if the device does not sl@0: implement the interface requested. The return value must be cast to the sl@0: correct type by the user." sl@0: */ sl@0: virtual TAny* CustomInterface(TUid aInterface) = 0; sl@0: }; sl@0: sl@0: sl@0: sl@0: /** sl@0: Defines the interface that video clock sources must to implement. sl@0: sl@0: A clock source can be used to synchronize video processing to some other processing entity, sl@0: for example an audio stream. The clock source is created and controlled by the DevVideo client, sl@0: and passed to the video hwdevices via the DevVideo interface. This allows the hwdevice to query sl@0: the current stream time, so it can ascertain which frame should be processed at any given moment. sl@0: sl@0: "Stream time" is defined as the current position in the media stream. For example, when playing sl@0: a video clip, the stream time will always equal the current position in the clip. So, when the sl@0: clip is repositioned, the stream time will be equal to the new clip position. When the clip is sl@0: paused, the stream time will pause too. sl@0: sl@0: Many hwdevice implementations will use extra threads to perform the video processing, so it is sl@0: essential that all implementations of the MMMFClockSource interface can be used from multiple sl@0: threads. A hwdevice that receives a clock source from the DevVideo client must be able to sl@0: assume that it can pass a pointer to the clock source object into another thread and use the sl@0: object directly from there. sl@0: sl@0: All clock source implementations must protect the methods defined in the MMMFClockSource interface sl@0: so they can be called from any thread within the current process. Practically speaking, this means sl@0: using mutexes and critical sections to protect member data from being accessed from multiple threads sl@0: simultaneously. Also, any use of thread-specific handles (e.g. a CMMFDevSound object) must be sl@0: avoided from within these methods. sl@0: sl@0: It can be assumed that any methods defined outside the MMMFClockSource interface (for example sl@0: methods used to control the clock source) will only be executed within the DevVideo client's thread, sl@0: so do not require protection. sl@0: sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class MMMFClockSource sl@0: { sl@0: public: sl@0: /** sl@0: Retrieves a custom interface for the clock source. sl@0: sl@0: This method can be called from any thread running inside the process in which the concrete sl@0: clock source was created. Note that this does not mean that all methods in the custom sl@0: interface can be called from any thread - that will be specified by the custom interface itself. sl@0: sl@0: @param "aInterface" "Interface UID, defined by the entity specifying the interface." sl@0: @return "Pointer to the interface implementation, or NULL if the interface is not available. sl@0: The pointer must be cast to the appropriate interface class." sl@0: */ sl@0: virtual TAny* CustomInterface(TUid aInterface) = 0; sl@0: sl@0: /** sl@0: Retrieves the current stream time. For example, if a clip is being played, the stream time will sl@0: be equal to the current position in the clip. sl@0: sl@0: This method can be called from any thread running inside the process in which the concrete clock sl@0: source was created. sl@0: sl@0: @return "The number of microseconds passed in the clock compared to the reference time." sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds Time() = 0; sl@0: }; sl@0: sl@0: /** sl@0: The CSystemClockSource provides a basic clock source implementation based on the system clock. sl@0: It will count microseconds since the object was created or Reset() was last called, and return sl@0: that count from Time(). It does not implement any custom interfaces. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CSystemClockSource : public CBase, public MMMFClockSource sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new CSystemClockSource object. sl@0: @return "A new clock source object." sl@0: @leave "This method may leave with one of the system-wide error codes." sl@0: */ sl@0: IMPORT_C static CSystemClockSource* NewL(); sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C ~CSystemClockSource(); sl@0: sl@0: // Control methods sl@0: /** sl@0: Resets the clock source to zero. Typically called by the DevVideo client at stream start. sl@0: */ sl@0: IMPORT_C void Reset(); sl@0: sl@0: /** sl@0: Resets the clock source to a user-defined offset. Typically called by the DevVideo client sl@0: when seeking in a file. sl@0: sl@0: @param "aOffset" "The clock offset." sl@0: */ sl@0: IMPORT_C void Reset(const TTimeIntervalMicroSeconds& aOffset); sl@0: sl@0: /** sl@0: Suspends the clock source. The clock time will not increment until the clock has been resumed. sl@0: This method is used when pausing playback. sl@0: */ sl@0: IMPORT_C void Suspend(); sl@0: sl@0: /** sl@0: Resumes the clock source after a Suspend() method call. This method is used when resuming playback. sl@0: */ sl@0: IMPORT_C void Resume(); sl@0: sl@0: // Implementation of MMMFClockSource sl@0: /** sl@0: No custom interfaces are implemented by this clock source, so this method will always return NULL. sl@0: @param "aInterface" "The interface" sl@0: @return "NULL" sl@0: */ sl@0: virtual TAny* CustomInterface(TUid aInterface); sl@0: /** sl@0: Retrieves the time that has elapsed since Reset() was last called, subtracting any time sl@0: during which the clock was suspended. sl@0: sl@0: @return "The number of microseconds that have elapsed in the stream." sl@0: */ sl@0: virtual TTimeIntervalMicroSeconds Time(); sl@0: sl@0: private: sl@0: CSystemClockSource(); sl@0: void ConstructL(); sl@0: private: sl@0: TTime iStartTime; sl@0: TTime iCurrentTime; sl@0: sl@0: TTimeIntervalMicroSeconds iOffset; sl@0: sl@0: TTime iTimeWhenSuspended; sl@0: TTimeIntervalMicroSeconds iTimeSuspended; sl@0: TBool iSuspended; sl@0: sl@0: RCriticalSection iCriticalSection; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Observer class to be used with class CMMFClockSourcePeriodicUtility. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class MMMFClockSourcePeriodicUtilityObserver sl@0: { sl@0: public: sl@0: /** sl@0: Notifies the observer that the specified period has elapsed. sl@0: @param "aTime" "The current time, queried from the clock source." sl@0: */ sl@0: virtual void MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) = 0; sl@0: }; sl@0: sl@0: /** sl@0: Utility class that can be used by video HW devices to receive periodic callbacks with the current time. sl@0: Note that the exact timing of the callbacks cannot be guaranteed due to other things pre-empting sl@0: the execution of the active object or thread. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class CMMFClockSourcePeriodicUtility : public CBase sl@0: { sl@0: public: sl@0: /** sl@0: Creates a new clock source periodic utility object. sl@0: sl@0: @param "aClockSource" "A reference to the clock source to be used to query the current time." sl@0: @param "aObserver" "A reference to the observer of the utility that will receive callbacks sl@0: each time the specified period elapses." sl@0: @return "A new clock source periodic utility object." sl@0: @leave "The method will leave if an error occurs." sl@0: */ sl@0: IMPORT_C static CMMFClockSourcePeriodicUtility* NewL(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver); sl@0: sl@0: /** sl@0: Starts the clock source periodic utility. The utility will call MmcspuoTick on its observer sl@0: every aPeriod microseconds until Stop() is called. Note that the utility will not stop sl@0: automatically when the clock source is stopped. sl@0: sl@0: @param "aPeriod" "Defines the period with which the observer will receive callbacks." sl@0: */ sl@0: IMPORT_C void Start(TTimeIntervalMicroSeconds32 aPeriod); sl@0: sl@0: /** sl@0: Stops the clock source periodic utility. No more callbacks will be made after this method has sl@0: been called. sl@0: */ sl@0: IMPORT_C void Stop(); sl@0: sl@0: /** sl@0: Destructor. sl@0: */ sl@0: IMPORT_C ~CMMFClockSourcePeriodicUtility(); sl@0: private: sl@0: CMMFClockSourcePeriodicUtility(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver); sl@0: void ConstructL(); sl@0: static TInt Callback(TAny* aAny); sl@0: void DoCallback(); sl@0: private: sl@0: CPeriodic* iTimer; sl@0: MMMFClockSource& iClockSource; sl@0: MMMFClockSourcePeriodicUtilityObserver& iObserver; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: Specifies the encoder buffering options. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TEncoderBufferOptions sl@0: { sl@0: public: sl@0: /** sl@0: The maximum number of pictures in the pre-encoder buffer. sl@0: */ sl@0: TUint iMaxPreEncoderBufferPictures; sl@0: sl@0: /** sl@0: The HRD/VBV specification that shall be fullfilled. sl@0: */ sl@0: THrdVbvSpecification iHrdVbvSpec; sl@0: sl@0: /** sl@0: The HRD/VBV buffering parameters. The data format depends on the parameters chosen. For sl@0: 3GPP TS 26.234 parameters (iHrdVbvSpec=EHrdVbv3GPP), the data in the descriptor is a package of type sl@0: TPckC (see T3gppHrdVbvParams). If no HRD/VBV parameters are used, the sl@0: descriptor is empty. sl@0: */ sl@0: TPtrC8 iHrdVbvParams; sl@0: sl@0: /** sl@0: The maximum size of an output buffer, in bytes. Use KMaxTUint for an unlimited size. sl@0: */ sl@0: TUint iMaxOutputBufferSize; sl@0: sl@0: /** sl@0: The maximum size of a coded picture, in bytes. Use KMaxTUint for an unlimited size. sl@0: */ sl@0: TUint iMaxCodedPictureSize; sl@0: sl@0: /** sl@0: The maximum size of a coded video segment, in bytes. Use KMaxTUint for an unlimited size. sl@0: */ sl@0: TUint iMaxCodedSegmentSize; sl@0: sl@0: /** sl@0: The mimimum number of output buffers. sl@0: */ sl@0: TUint iMinNumOutputBuffers; sl@0: }; sl@0: sl@0: /** sl@0: Specifies the video encoder bit-rate control options. sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: class TRateControlOptions sl@0: { sl@0: public: sl@0: /** sl@0: Defines the bit-rate control type. sl@0: */ sl@0: TBitrateControlType iControl; sl@0: sl@0: /** sl@0: The target bit-rate, in bits per second. Used if bit-rate control type is EBrControlStream. sl@0: If specified for an enhancement layer, the target bit-rate includes all lower layers. For example, sl@0: if the client uses two layers, with the base layer using 64000 bps and the whole stream 192000 bps, sl@0: this field is set to 64000 for layer zero and 192000 for layer one. sl@0: */ sl@0: TUint iBitrate; sl@0: sl@0: /** sl@0: The target picture quality. The value range is [0…100], with 0 corresponding to minimum quality sl@0: and 100 to lossless coding (or the closest equivalent supported). sl@0: */ sl@0: TUint iPictureQuality; sl@0: sl@0: /** sl@0: The target picture rate, in pictures per second. If specified for an enhancement layer, the target sl@0: frame rate includes all lower layers. sl@0: */ sl@0: TReal iPictureRate; sl@0: sl@0: /** sl@0: The quality/temporal tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0 sl@0: specifies that picture quality should be maintained as well as possible, sacrificing picture rate. sl@0: Value 1.0 specifies that picture rate should be maintained as well as possible, sacrificing sl@0: picture quality. sl@0: */ sl@0: TReal iQualityTemporalTradeoff; sl@0: sl@0: /** sl@0: The latency/quality tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0 sl@0: specifies that the transmission delay and the decoder input buffer occupancy level caused by sl@0: the bit-rate control is minimized, i.e. the actual coded bit-rate follows the target bit-rate sl@0: as closely as possible. 1.0 specifies that the transmission delay caused by the bit-rate control sl@0: should be as high as needed to guarantee a constant picture quality and frame rate as long as sl@0: the coded data conforms to the given HRD/VBV parameters (if any). sl@0: */ sl@0: sl@0: TReal iLatencyQualityTradeoff; sl@0: }; sl@0: sl@0: /** sl@0: Custom interface Uid for setting up the DevVideo hw device adapter sl@0: */ sl@0: const TInt KUidDevVideoHwDeviceAdapterSetup = 0x102737EF; sl@0: sl@0: #include sl@0: sl@0: #endif sl@0: