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