1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/epoc32/include/mmf/devvideo/devvideobase.h Tue Mar 16 16:12:26 2010 +0000
1.3 @@ -0,0 +1,1123 @@
1.4 +// Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// 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
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +//
1.18 +
1.19 +#ifndef __DEVVIDEOBASE_H__
1.20 +#define __DEVVIDEOBASE_H__
1.21 +
1.22 +#include <e32base.h>
1.23 +#include <w32std.h>
1.24 +#include <mmf/devvideo/devvideoconstants.h>
1.25 +#include <ecom/ecom.h>
1.26 +
1.27 +
1.28 +/**
1.29 +Panic utility function
1.30 +@internalTechnology
1.31 +*/
1.32 +LOCAL_C void DevVideoPanic(TInt aReason)
1.33 + {
1.34 + User::Panic(KDevVideoPanicCategory, aReason);
1.35 + }
1.36 +
1.37 +
1.38 +/**
1.39 +A hardware device ID that identifies an instantiated video hardware device.
1.40 +Used in the playback and recording APIs to identify the component being controlled.
1.41 +@publishedAll
1.42 +@released
1.43 +*/
1.44 +typedef TInt THwDeviceId;
1.45 +
1.46 +
1.47 +/**
1.48 +Defines a supported scale factor for a scaling pre-processor or post-processor.
1.49 +
1.50 +The scale factor is defined as iScaleNum/iScaleDenom,
1.51 +where the values are positive integers and relatively prime.
1.52 +@publishedAll
1.53 +@released
1.54 +*/
1.55 +class TScaleFactor
1.56 + {
1.57 +public:
1.58 + /**Scale factor numerator. Non-zero.*/
1.59 + TUint iScaleNum;
1.60 + /**Scale factor denominator. Non-zero.*/
1.61 + TUint iScaleDenom;
1.62 + };
1.63 +
1.64 +
1.65 +/**
1.66 +A custom YUV/RGB conversion matrix. The same matrix structure is used for both conversion directions.
1.67 +@publishedAll
1.68 +@released
1.69 +*/
1.70 +class TYuvConversionMatrix
1.71 + {
1.72 +public:
1.73 + /**
1.74 + Post-multiplication offset, a three-item vector.
1.75 + */
1.76 + TReal iPostOffset[3];
1.77 +
1.78 + /**
1.79 + Multiplication matrix, a 3x3 matrix. iMatrix[3*i+j] contains the j:th item on the i:th row of the matrix.
1.80 + */
1.81 + TReal iMatrix[9];
1.82 +
1.83 + /**
1.84 + Pre-multiplication offset, a three-item vector.
1.85 + */
1.86 + TReal iPreOffset[3];
1.87 + };
1.88 +
1.89 +
1.90 +/**
1.91 +YUV (YCbCr) uncompressed image data format.
1.92 +@publishedAll
1.93 +@released
1.94 +*/
1.95 +class TYuvFormat
1.96 + {
1.97 +public:
1.98 + /**
1.99 + The YUV/RGB conversion coefficients to use
1.100 + */
1.101 + TYuvCoefficients iCoefficients;
1.102 +
1.103 + /**
1.104 + Luminance/chrominance sampling pattern.
1.105 + */
1.106 + TYuvSamplingPattern iPattern;
1.107 +
1.108 + /**
1.109 + Data layout, specifies whether the data is stored in a planar or interleaved mode.
1.110 + */
1.111 + TYuvDataLayout iDataLayout;
1.112 +
1.113 + /**
1.114 + Custom YUV to RGB conversion matrix to use.
1.115 + Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix).
1.116 + */
1.117 + TYuvConversionMatrix* iYuv2RgbMatrix;
1.118 +
1.119 + /**
1.120 + Custom RGB to YUV conversion matrix to use.
1.121 + Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix).
1.122 + */
1.123 + TYuvConversionMatrix* iRgb2YuvMatrix;
1.124 +
1.125 + /**
1.126 + Pixel aspect ratio numerator.
1.127 + */
1.128 + TUint iAspectRatioNum;
1.129 +
1.130 + /**
1.131 + Pixel aspect ratio denominator.
1.132 + The aspect ratio is defined as iAspectRatioNum/iAspectRatioDenom,
1.133 + where the values are positive integers and relatively prime.
1.134 + */
1.135 + TUint iAspectRatioDenom;
1.136 +
1.137 + /**
1.138 + Tests whether this TYuvFormat object is the same as aOther.
1.139 + @param "aOther" "The object to compare."
1.140 + @return "ETrue if they are the same, EFalse if not."
1.141 + */
1.142 + inline TBool operator==(const TYuvFormat& aOther) const;
1.143 + };
1.144 +
1.145 +/**
1.146 +Defines an uncompressed video format.
1.147 +This structure is mainly just a combination of YUV and RGB formats, defined to simplify the rest of the API.
1.148 +@publishedAll
1.149 +@released
1.150 +*/
1.151 +class TUncompressedVideoFormat
1.152 + {
1.153 +public:
1.154 + /**
1.155 + The image data format. The validity of the rest of the fields depends on the data format used.
1.156 + */
1.157 + TImageDataFormat iDataFormat;
1.158 + union
1.159 + {
1.160 + /**
1.161 + YUV picture format details, valid if iDataFormat is EYuvRawData.
1.162 + */
1.163 + TYuvFormat iYuvFormat;
1.164 +
1.165 + /**
1.166 + RGB picture format details, valid if iDataFormat is ERgbRawData or ERgbFbsBitmap.
1.167 + */
1.168 + TRgbFormat iRgbFormat;
1.169 + };
1.170 +
1.171 + /**
1.172 + Tests whether this TUncompressedVideoFormat object is the same as aOther.
1.173 + @param "aOther" "The object to compare."
1.174 + @return "ETrue if they are the same, EFalse if not."
1.175 + */
1.176 + inline TBool operator==(const TUncompressedVideoFormat& aOther) const;
1.177 +
1.178 + /**
1.179 + Sets this object equal to aOther.
1.180 + @param "aOther" "The object to clone."
1.181 + */
1.182 + inline void operator=(const TUncompressedVideoFormat& aOther);
1.183 + };
1.184 +
1.185 +
1.186 +/**
1.187 +Uncompressed picture data for one video picture.
1.188 +@publishedAll
1.189 +@released
1.190 +*/
1.191 +class TPictureData
1.192 + {
1.193 +public:
1.194 + /**
1.195 + The image data format. The validity of the rest of the fields depends on the data format used.
1.196 + */
1.197 + TImageDataFormat iDataFormat;
1.198 +
1.199 + /**
1.200 + Image data size in pixels. In decoder output pictures the actual active picture area may be smaller,
1.201 + this is indicated using TVideoPicture.iCropRect.
1.202 + */
1.203 + TSize iDataSize;
1.204 +
1.205 + union
1.206 + {
1.207 + /**
1.208 + Pointer to raw image data. Valid if iDataFormat is ERgbRawData or iYuvRawData.
1.209 + The data layout depends on the format used.
1.210 + */
1.211 + TPtr8* iRawData;
1.212 +
1.213 + /**
1.214 + Pointer to an RGB bitmap. Valid if iDataFormat is ERgbFbsBitmap.
1.215 + */
1.216 + CFbsBitmap* iRgbBitmap;
1.217 + };
1.218 + };
1.219 +
1.220 +/**
1.221 +Header information for one decoded picture.
1.222 +The header information is returned alongside with decoded pictures,
1.223 +or it can be read separately when DevVideoPlay is being initialized.
1.224 +
1.225 +@publishedAll
1.226 +@released
1.227 +*/
1.228 +class TVideoPictureHeader
1.229 + {
1.230 +public:
1.231 + /**
1.232 + */
1.233 + enum THeaderOptions
1.234 + {
1.235 + /** Decoding timestamp is valid
1.236 + */
1.237 + EDecodingTimestamp = 0x00000001,
1.238 + /** Presentation timestamp is valid
1.239 + */
1.240 + EPresentationTimestamp = 0x00000002,
1.241 + /** Pre-decoder buffersize is valid
1.242 + */
1.243 + EPreDecoderBufferSize = 0x00000004,
1.244 + /** Post-decoder buffersize is valid
1.245 + */
1.246 + EPostDecoderBufferSize = 0x00000008,
1.247 + /** Picture number field is valid
1.248 + */
1.249 + EPictureNumber = 0x00000010,
1.250 + /** Layered coding is used and the layer number field is valid
1.251 + */
1.252 + ELayeredCoding = 0x00000020,
1.253 + /** Supplemental data is available
1.254 + */
1.255 + ESupplementalData = 0x00000040,
1.256 + /** Random access buffering period is valid
1.257 + */
1.258 + ERandomAccessBufferingPeriod = 0x00000080,
1.259 + /** Random access buffer occupancy is valid
1.260 + */
1.261 + ERandomAccessBufferOccupancy = 0x00000100
1.262 + };
1.263 +
1.264 + /**
1.265 + Header options. The value is a bitfield combined from values from THeaderOptions.
1.266 + */
1.267 + TUint32 iOptions;
1.268 +
1.269 + /**
1.270 + Video codec profile used. Use -1 if not applicable or not defined.
1.271 + */
1.272 + TInt iProfile;
1.273 +
1.274 + /**
1.275 + Video codec level. Use -1 if not applicable or not defined.
1.276 + */
1.277 + TInt iLevel;
1.278 +
1.279 + /**
1.280 + Video codec version. Use -1 if not applicable or not defined.
1.281 + */
1.282 + TInt iVersion;
1.283 +
1.284 + /**
1.285 + Pointer to a descriptor that contains optional codec-specific features. Set to NULL if not used.
1.286 + The format of the data is codec-specific. The pointer and descriptor data are valid as long as
1.287 + the header information structure is valid.
1.288 + */
1.289 + const TDesC8* iOptional;
1.290 +
1.291 + /**
1.292 + Image size in memory, in pixels. May be larger than the displayed picture.
1.293 + */
1.294 + TSize iSizeInMemory;
1.295 +
1.296 + /**
1.297 + The portion of the full image to display.
1.298 + */
1.299 + TRect iDisplayedRect;
1.300 +
1.301 + /**
1.302 + Picture presentation timestamp. Valid only if EPresentationTimestamp is set in the options.
1.303 + The clock frequency is stored in the timestamp structure.
1.304 + */
1.305 + TTimeIntervalMicroSeconds iPresentationTimestamp;
1.306 +
1.307 + /**
1.308 + Picture decoding timestamp. Valid only if EDecodingTimestamp is set in the options.
1.309 + */
1.310 + TTimeIntervalMicroSeconds iDecodingTimestamp;
1.311 +
1.312 + /**
1.313 + Expected pre-decoder buffer size in bytes. Valid only if EPreDecoderBufferSize is set in the options.
1.314 + */
1.315 + TUint iPreDecoderBufferSize;
1.316 +
1.317 + /**
1.318 + Expected post-decoder buffer size in bytes. Valid only if EPostDecoderBufferSize is set in the options.
1.319 + It is assumed that a frame buffer to be displayed is returned before the decoding of the next frame
1.320 + is started. If this is not the case, a larger post-decoder buffer may actually be needed.
1.321 + */
1.322 + TUint iPostDecoderBufferSize;
1.323 +
1.324 + /**
1.325 + Picture number, valid only if EPictureNumber is set in the options.
1.326 + This field is used to indicate one of the following: picture number or long-term picture index for H.263,
1.327 + vop_id for MPEG-4 Visual, picture number or long-term picture number for AVC.
1.328 + */
1.329 + TUint iPictureNumber;
1.330 +
1.331 + /**
1.332 + Picture layer number if layered coding is used, valid only if ELayeredCoding is set in the options.
1.333 + Layers are numbered [0…n-1], where n is the number of layers available. The first layer (layer zero)
1.334 + is the base layer, it can be decoded independently from the other layers, and it has the lowest total bitrate.
1.335 + */
1.336 + TUint iPictureLayer;
1.337 +
1.338 + /**
1.339 + Picture supplemental data, valid only if ESupplementalData is set in the options.
1.340 + The pointer and descriptor data are valid as long as the header information structure is valid.
1.341 + */
1.342 + const TDesC8* iSupplementalData;
1.343 +
1.344 + /**
1.345 + True if the picture is a random-accessible picture.
1.346 + */
1.347 + TBool iIsRandomAccessible;
1.348 +
1.349 + /**
1.350 + The expected initial pre-decoder buffering period before starting the playback from this picture.
1.351 + Valid only if this picture is randomly accessible (iIsRandomAccessible is true) and
1.352 + ERandomAccessBufferingPeriod is set in the options. MPEG-2 and H.264 | MPEG-4 AVC use this value.
1.353 + */
1.354 + TTimeIntervalMicroSeconds32 iRandomAccessBufferingPeriod;
1.355 +
1.356 + /**
1.357 + The expected initial pre-decoder buffer occupancy in bytes before starting the playback
1.358 + from this picture. Valid if this picture is randomly accessible (iIsRandomAccessible is true) and
1.359 + ERandomAccessBufferOccupancy is set in the options. MPEG-4 Visual uses this value.
1.360 + */
1.361 + TUint iRandomAccessBufferOccupancy;
1.362 + };
1.363 +
1.364 +
1.365 +
1.366 +/**
1.367 +One uncompressed video picture. Used for both decoded picture output as well as uncompressed picture input.
1.368 +
1.369 +@publishedAll
1.370 +@released
1.371 +*/
1.372 +class TVideoPicture
1.373 + {
1.374 +public:
1.375 + /**
1.376 + */
1.377 + enum TVideoPictureOptions
1.378 + {
1.379 + /** The timestamp field is valid.
1.380 + */
1.381 + ETimestamp = 0x00000001,
1.382 + /** The crop rectangle field is valid.
1.383 + */
1.384 + ECropRect = 0x00000002,
1.385 + /** Picture header information is present.
1.386 + */
1.387 + EHeader = 0x00000004,
1.388 + /** The layer bit count targets field is valid.
1.389 + */
1.390 + EBitTargets = 0x00000008,
1.391 + /** Set in encoder input to request an instantaneous decoder refresh.
1.392 + As a response, the encoder should code an intra frame and no consecutive
1.393 + frame should refer to any frame before the encoded intra frame (in coding order).
1.394 + */
1.395 + EReqInstantRefresh = 0x00000010,
1.396 + /** Set in encoder input to indicate a scene cut in the picture stream.
1.397 + */
1.398 + ESceneCut = 0x00000020,
1.399 + /** Set if a picture effect is in use and the picture effect field is valid.
1.400 + */
1.401 + EPictureEffect = 0x00000040,
1.402 + /** Set if picture effect parameters are valid.
1.403 + */
1.404 + EEffectParameters = 0x00000080
1.405 + };
1.406 +
1.407 + /**
1.408 + The picture data. The picture data, including all pointers, must remain valid until
1.409 + the picture has been returned to its originator.
1.410 + */
1.411 + TPictureData iData;
1.412 +
1.413 + /**
1.414 + Picture options. The value is a bitfield combined from values from TVideoPictureOptions.
1.415 + */
1.416 + TUint32 iOptions;
1.417 +
1.418 + /**
1.419 + Picture timestamp. Valid if ETimestamp is set in the options.
1.420 + Used for presentation timestamps in video playback and capture timestamps in uncompressed video
1.421 + input for recording. If the timestamp is not specified for decoded video input for playback,
1.422 + the picture is displayed immediately. For decoded video output in playback and uncompressed
1.423 + video input for recording, the timestamp must always be set.
1.424 + */
1.425 + TTimeIntervalMicroSeconds iTimestamp;
1.426 +
1.427 + /**
1.428 + Pan-scan cropping rectangle. Defines the area of the picture used for further processing.
1.429 + Only used for decoded video output.
1.430 + */
1.431 + TRect iCropRect;
1.432 +
1.433 + /**
1.434 + Picture header information. Valid if EHeader is set in the options.
1.435 + Normally this field is only used in decoded pictures returned from the playback API.
1.436 + In that case the header info pointer is valid until the picture is returned to the API.
1.437 + */
1.438 + TVideoPictureHeader* iHeader;
1.439 +
1.440 + /**
1.441 + The target number of bits for each bit-rate scalability layer, valid when EBitTargets is set in the options.
1.442 + Used in video encoding when the caller controls the bit-rate for each picture separately.
1.443 + The field points to a table containing the target number of bits to use for each layer when
1.444 + encoding this picture, starting from the lowest layer. The bit count for an enhancement layer
1.445 + includes all lower layers. For example, if the client uses two layers, and reserves 1.5 kilobits
1.446 + for the base layer and three kilobits for the whole picture, this field is set to {1500, 3000}.
1.447 + */
1.448 + RArray<TUint>* iLayerBitRates;
1.449 +
1.450 + /**
1.451 + The picture effect in use when capturing this picture, valid when EPictureEffect is set in the options.
1.452 + This information can be used when encoding the picture. Note that setting a picture effect does not
1.453 + imply that the encoder should modify the picture data based on the effect. Instead, it can be used as
1.454 + an encoding hint. For example, fade to black implies that the global picture brightness has been decreased,
1.455 + and this knowledge can be used to aid motion prediction.
1.456 + @see TPictureEffects
1.457 + */
1.458 + TPictureEffect iEffect;
1.459 +
1.460 + /**
1.461 + Picture effect parameter for fade to/from black, valid when EEffectParameters is set in the options
1.462 + and iEffect is EEffectFadeFromBlack or EEffectFadeToBlack. The value range is [0…65536], with zero
1.463 + indicating the picture is black and 65536 indicating that the lightness of the picture is unchanged.
1.464 + If the parameter is not given, the caller is unaware of the proper value or the value fluctuates spatially.
1.465 + */
1.466 + TUint iFadeParam;
1.467 +
1.468 + /**
1.469 + A pointer for free-form user data. The pointer is set by the module that created the buffer, and is
1.470 + usually used for memory management purposes.
1.471 + */
1.472 + TAny* iUser;
1.473 +
1.474 + /**
1.475 + A queue link used internally by the MSL video components.
1.476 + */
1.477 + TDblQueLink iLink;
1.478 + };
1.479 +
1.480 +/**
1.481 +Identifies a video picture in feedback messages.
1.482 +
1.483 +@publishedAll
1.484 +@released
1.485 +*/
1.486 +class TPictureId
1.487 + {
1.488 +public:
1.489 + enum TPictureIdType
1.490 + {
1.491 + /** Unidentified picture. */
1.492 + ENone,
1.493 + /** The picture is identified using its temporal reference. */
1.494 + ETemporalReference,
1.495 + /** 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.. */
1.496 + EPictureNumber
1.497 + };
1.498 +
1.499 + /** Picture identified type. */
1.500 + TPictureIdType iIdType;
1.501 +
1.502 + /** The picture identifier. The interpretation of this field depends on the value iIdType */
1.503 + TUint32 iId;
1.504 + };
1.505 +
1.506 +
1.507 +/**
1.508 +Defines a compressed video format. The format is identified by its MIME type, which may include
1.509 +parameters that describe the used format profile and level. The MIME type used for H.263
1.510 +is video/H263-2000, specified in TS 26.234, and the type for MPEG-4 is video/MP4V-ES, specified in RFC 3016.
1.511 +
1.512 +@publishedAll
1.513 +@released
1.514 +*/
1.515 +class CCompressedVideoFormat : public CBase
1.516 + {
1.517 +public:
1.518 + /**
1.519 + Static factory function for creating new CCompressedVideoFormat objects.
1.520 +
1.521 + @param "aMimeType" "Video codec MIME type, including optional parameters for profile,
1.522 + level and version information. The CCompressedVideoFormat object creates
1.523 + and owns a copy of this buffer and takes care of deallocation."
1.524 +
1.525 + @param "aOptionalData" "Reference to a descriptor that contains optional codec-specific data.
1.526 + Set to KNullDesC8 if not used. [The format of the data is codec-specific, typically
1.527 + a package buffer containing a data structure may be used. The pointer lifetime
1.528 + and validity requirements are specified with each method that uses this structure."
1.529 +
1.530 + @return "Pointer to a fully constructed CCompressedVideoFormat object."
1.531 + @leave "This method may leave with one of the system-wide error codes."
1.532 + */
1.533 + IMPORT_C static CCompressedVideoFormat* NewL(const TDesC8& aMimeType, const TDesC8& aOptionalData = KNullDesC8);
1.534 +
1.535 + /**
1.536 + Static factory function for creating a copy of an existing CCompressedVideoFormat object.
1.537 +
1.538 + @param "aFormat" "The CCompressedVideoFormat object to copy."
1.539 +
1.540 + @return Pointer to a fully constructed CCompressedVideoFormat object.
1.541 + @leave This method may leave with one of the system-wide error codes.
1.542 + */
1.543 + IMPORT_C static CCompressedVideoFormat* NewL(const CCompressedVideoFormat& aFormat);
1.544 +
1.545 + /**
1.546 + Virtual destructor. Destroys iMimeType.
1.547 + */
1.548 + IMPORT_C virtual ~CCompressedVideoFormat();
1.549 +
1.550 + /**
1.551 + Returns the video codec MIME type.
1.552 +
1.553 + @return "Reference to a descriptor that contains the video codec MIME type."
1.554 + */
1.555 + IMPORT_C const TDesC8& MimeType() const;
1.556 +
1.557 + /**
1.558 + Returns the optional data.
1.559 +
1.560 + @return "Reference to a descriptor that contains optional codec-specific data.
1.561 + Zero length if not used. The format of the data is codec-specific, typically a package buffer
1.562 + containing a data structure may be used."
1.563 + */
1.564 + IMPORT_C const TDesC8& OptionalData() const;
1.565 +
1.566 + /**
1.567 + Tests whether this CCompressedVideoFormat is identical to aOther or not.
1.568 + @return "ETrue if the two objects are identical, EFalse if not."
1.569 + */
1.570 + IMPORT_C TBool operator==(const CCompressedVideoFormat& aOther) const;
1.571 +protected:
1.572 + /**
1.573 + @internalTechnology
1.574 + */
1.575 + CCompressedVideoFormat();
1.576 +
1.577 + /**
1.578 + @internalTechnology
1.579 + */
1.580 + void ConstructL(const TDesC8& aMimeType, const TDesC8& aOptionalData);
1.581 +private:
1.582 + HBufC8* iMimeType;
1.583 + HBufC8* iOptionalData;
1.584 + };
1.585 +
1.586 +
1.587 +/**
1.588 +Specifies the HRD/VBV parameters used when 3GPP TS 26.234 annex G HRD/VBV settings are used (EHrdVbv3GPP).
1.589 +See TS 26.234 Release 5 for details.
1.590 +@publishedAll
1.591 +@released
1.592 +*/
1.593 +class T3gppHrdVbvParams
1.594 + {
1.595 +public:
1.596 + /** Initial pre-decoder buffering period. */
1.597 + TTimeIntervalMicroSeconds iInitialPreDecoderBufferPeriod;
1.598 +
1.599 + /** Initial post-decoder buffering period. */
1.600 + TTimeIntervalMicroSeconds iInitialPostDecoderBufferPeriod;
1.601 +
1.602 + /** Hypothetical pre-decoder buffer size, in bytes. */
1.603 + TUint iPreDecoderBufferSize;
1.604 +
1.605 + /** Peak decoding byte rate. By default, the peak decoding byte rate is
1.606 + defined according to the video coding profile and level in use. */
1.607 + TUint iPeakDecodingByteRate;
1.608 +
1.609 + /** Decoding macroblock rate. The default decoding macroblock rate is defined
1.610 + according to the video coding profile and level in use. */
1.611 + TUint iDecodingMacroblockRate;
1.612 + };
1.613 +
1.614 +
1.615 +/**
1.616 +YUV to RGB post-processing options.
1.617 +@publishedAll
1.618 +@released
1.619 +*/
1.620 +class TYuvToRgbOptions
1.621 + {
1.622 +public:
1.623 + /**
1.624 + Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.625 + 100 to maximum setting, and 0 to no change in lightness. The actual lightness change formula
1.626 + used is hardware device specific.
1.627 + */
1.628 + TInt iLightness;
1.629 +
1.630 + /**
1.631 + Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.632 + 100 to maximum setting, and 0 to no change in saturation. The actual saturation formula used
1.633 + is hardware device specific.
1.634 + */
1.635 + TInt iSaturation;
1.636 +
1.637 + /**
1.638 + Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.639 + 100 to maximum setting, and 0 to no change in contrast. The actual contrast change formula
1.640 + used is hardware device specific.
1.641 + */
1.642 + TInt iContrast;
1.643 +
1.644 + /**
1.645 + Gamma setting for conversion. Ignored if the converter does not support gamma correction.
1.646 + The gamma correction is defined as x' = x^(1/g), where x' refers to the corrected value,
1.647 + x to the original input value and g to this field. Gamma correction is performed on the RGB values.
1.648 + Set gamma to 1.0 to disable gamma correction.
1.649 + */
1.650 + TReal iGamma;
1.651 +
1.652 + /**
1.653 + The dithering type to use.
1.654 + */
1.655 + TDitherType iDitherType;
1.656 + };
1.657 +
1.658 +/**
1.659 +Pre-processing options for color enhancement.
1.660 +The value ranges have been chosen to match those in the Onboard Camera API.
1.661 +@publishedAll
1.662 +@released
1.663 +*/
1.664 +class TColorEnhancementOptions
1.665 + {
1.666 +public:
1.667 + /**
1.668 + Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.669 + 100 to maximum setting, and 0 to no change in lightness.
1.670 + */
1.671 + TInt iLightness;
1.672 +
1.673 + /**
1.674 + Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.675 + 100 to maximum setting, and 0 to no change in saturation.
1.676 + */
1.677 + TInt iSaturation;
1.678 +
1.679 + /**
1.680 + Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting,
1.681 + 100 to maximum setting, and 0 to no change in contrast.
1.682 + */
1.683 + TInt iContrast;
1.684 + };
1.685 +
1.686 +/**
1.687 +Describes the YUV to RGB color conversion capabilities of a post-processor.
1.688 +@publishedAll
1.689 +@released
1.690 +*/
1.691 +class TYuvToRgbCapabilities
1.692 + {
1.693 +public:
1.694 + /**
1.695 + Input YUV sampling patterns supported, a bitfield combination (bitwise OR) of TYuvSamplingPattern.
1.696 + */
1.697 + TUint32 iSamplingPatterns;
1.698 +
1.699 + /**
1.700 + YUV to RGB conversion coefficients supported, a bitfield combination of TYuvCoefficients.
1.701 + */
1.702 + TUint32 iCoefficients;
1.703 +
1.704 + /**
1.705 + Output RGB formats supported, a bitfield combination of TRgbFormat.
1.706 + */
1.707 + TUint32 iRgbFormats;
1.708 +
1.709 + /**
1.710 + True if lightness control is supported.
1.711 + */
1.712 + TBool iLightnessControl;
1.713 +
1.714 + /**
1.715 + True if saturation control is supported.
1.716 + */
1.717 + TBool iSaturationControl;
1.718 +
1.719 + /**
1.720 + True if contrast control is supported.
1.721 + */
1.722 + TBool iContrastControl;
1.723 +
1.724 + /**
1.725 + True if gamma correction is supported.
1.726 + */
1.727 + TBool iGammaCorrection;
1.728 +
1.729 + /**
1.730 + Dithering types supported, a bitfield combination of TDitherType.
1.731 + */
1.732 + TUint32 iDitherTypes;
1.733 + };
1.734 +
1.735 +/**
1.736 +Specifies the YUV-to-YUV conversion capabilities for a plug-in.
1.737 +@publishedAll
1.738 +@released
1.739 +*/
1.740 +class TYuvToYuvCapabilities
1.741 + {
1.742 +public:
1.743 + /**
1.744 + The YUV sampling patterns supported for input data, a combination (binary OR) of values from TYuvSamplingPatterns.
1.745 + */
1.746 + TUint32 iInputSamplingPatterns;
1.747 +
1.748 + /**
1.749 + The YUV data layouts supported for input data, a combination (binary OR) of values from TYuvDataLayout.
1.750 + */
1.751 + TUint32 iInputDataLayouts;
1.752 +
1.753 + /**
1.754 + The YUV sampling patterns supported for output data, a combination (binary OR) of values from TYuvSamplingPatterns.
1.755 + */
1.756 + TUint32 iOutputSamplingPatterns;
1.757 +
1.758 + /**
1.759 + The YUV data layouts supported for output data, a combination (binary OR) of values from TYuvDataLayout.
1.760 + */
1.761 + TUint32 iOutputDataLayouts;
1.762 + };
1.763 +
1.764 +/**
1.765 +Structure to combine a picture rate and size. Used when defining the maximum rate/size combinations
1.766 +available.
1.767 +@publishedAll
1.768 +@released
1.769 +*/
1.770 +class TPictureRateAndSize
1.771 + {
1.772 +public:
1.773 + /** The picture rate. */
1.774 + TReal iPictureRate;
1.775 +
1.776 + /** The picture size. */
1.777 + TSize iPictureSize;
1.778 + };
1.779 +
1.780 +/**
1.781 +CMMFVideoHwDevice is a base class for all video hardware devices.
1.782 +@publishedAll
1.783 +@released
1.784 +*/
1.785 +class CMMFVideoHwDevice : public CBase
1.786 + {
1.787 +public:
1.788 + /**
1.789 + Retrieves a custom interface to the device.
1.790 + @param "aInterface" "Interface UID, defined with the custom interface."
1.791 + @return "Pointer to the interface implementation, or NULL if the device does not
1.792 + implement the interface requested. The return value must be cast to the
1.793 + correct type by the user."
1.794 + */
1.795 + virtual TAny* CustomInterface(TUid aInterface) = 0;
1.796 + };
1.797 +
1.798 +
1.799 +
1.800 +/**
1.801 +Defines the interface that video clock sources must to implement.
1.802 +
1.803 +A clock source can be used to synchronize video processing to some other processing entity,
1.804 +for example an audio stream. The clock source is created and controlled by the DevVideo client,
1.805 +and passed to the video hwdevices via the DevVideo interface. This allows the hwdevice to query
1.806 +the current stream time, so it can ascertain which frame should be processed at any given moment.
1.807 +
1.808 +"Stream time" is defined as the current position in the media stream. For example, when playing
1.809 +a video clip, the stream time will always equal the current position in the clip. So, when the
1.810 +clip is repositioned, the stream time will be equal to the new clip position. When the clip is
1.811 +paused, the stream time will pause too.
1.812 +
1.813 +Many hwdevice implementations will use extra threads to perform the video processing, so it is
1.814 +essential that all implementations of the MMMFClockSource interface can be used from multiple
1.815 +threads. A hwdevice that receives a clock source from the DevVideo client must be able to
1.816 +assume that it can pass a pointer to the clock source object into another thread and use the
1.817 +object directly from there.
1.818 +
1.819 +All clock source implementations must protect the methods defined in the MMMFClockSource interface
1.820 +so they can be called from any thread within the current process. Practically speaking, this means
1.821 +using mutexes and critical sections to protect member data from being accessed from multiple threads
1.822 +simultaneously. Also, any use of thread-specific handles (e.g. a CMMFDevSound object) must be
1.823 +avoided from within these methods.
1.824 +
1.825 +It can be assumed that any methods defined outside the MMMFClockSource interface (for example
1.826 +methods used to control the clock source) will only be executed within the DevVideo client's thread,
1.827 +so do not require protection.
1.828 +
1.829 +@publishedAll
1.830 +@released
1.831 +*/
1.832 +class MMMFClockSource
1.833 + {
1.834 +public:
1.835 + /**
1.836 + Retrieves a custom interface for the clock source.
1.837 +
1.838 + This method can be called from any thread running inside the process in which the concrete
1.839 + clock source was created. Note that this does not mean that all methods in the custom
1.840 + interface can be called from any thread - that will be specified by the custom interface itself.
1.841 +
1.842 + @param "aInterface" "Interface UID, defined by the entity specifying the interface."
1.843 + @return "Pointer to the interface implementation, or NULL if the interface is not available.
1.844 + The pointer must be cast to the appropriate interface class."
1.845 + */
1.846 + virtual TAny* CustomInterface(TUid aInterface) = 0;
1.847 +
1.848 + /**
1.849 + Retrieves the current stream time. For example, if a clip is being played, the stream time will
1.850 + be equal to the current position in the clip.
1.851 +
1.852 + This method can be called from any thread running inside the process in which the concrete clock
1.853 + source was created.
1.854 +
1.855 + @return "The number of microseconds passed in the clock compared to the reference time."
1.856 + */
1.857 + virtual TTimeIntervalMicroSeconds Time() = 0;
1.858 + };
1.859 +
1.860 +/**
1.861 +The CSystemClockSource provides a basic clock source implementation based on the system clock.
1.862 +It will count microseconds since the object was created or Reset() was last called, and return
1.863 +that count from Time(). It does not implement any custom interfaces.
1.864 +@publishedAll
1.865 +@released
1.866 +*/
1.867 +class CSystemClockSource : public CBase, public MMMFClockSource
1.868 + {
1.869 +public:
1.870 + /**
1.871 + Creates a new CSystemClockSource object.
1.872 + @return "A new clock source object."
1.873 + @leave "This method may leave with one of the system-wide error codes."
1.874 + */
1.875 + IMPORT_C static CSystemClockSource* NewL();
1.876 +
1.877 + /**
1.878 + Destructor.
1.879 + */
1.880 + IMPORT_C ~CSystemClockSource();
1.881 +
1.882 +// Control methods
1.883 + /**
1.884 + Resets the clock source to zero. Typically called by the DevVideo client at stream start.
1.885 + */
1.886 + IMPORT_C void Reset();
1.887 +
1.888 + /**
1.889 + Resets the clock source to a user-defined offset. Typically called by the DevVideo client
1.890 + when seeking in a file.
1.891 +
1.892 + @param "aOffset" "The clock offset."
1.893 + */
1.894 + IMPORT_C void Reset(const TTimeIntervalMicroSeconds& aOffset);
1.895 +
1.896 + /**
1.897 + Suspends the clock source. The clock time will not increment until the clock has been resumed.
1.898 + This method is used when pausing playback.
1.899 + */
1.900 + IMPORT_C void Suspend();
1.901 +
1.902 + /**
1.903 + Resumes the clock source after a Suspend() method call. This method is used when resuming playback.
1.904 + */
1.905 + IMPORT_C void Resume();
1.906 +
1.907 +// Implementation of MMMFClockSource
1.908 + /**
1.909 + No custom interfaces are implemented by this clock source, so this method will always return NULL.
1.910 + @param "aInterface" "The interface"
1.911 + @return "NULL"
1.912 + */
1.913 + virtual TAny* CustomInterface(TUid aInterface);
1.914 + /**
1.915 + Retrieves the time that has elapsed since Reset() was last called, subtracting any time
1.916 + during which the clock was suspended.
1.917 +
1.918 + @return "The number of microseconds that have elapsed in the stream."
1.919 + */
1.920 + virtual TTimeIntervalMicroSeconds Time();
1.921 +
1.922 +private:
1.923 + CSystemClockSource();
1.924 + void ConstructL();
1.925 +private:
1.926 + TTime iStartTime;
1.927 + TTime iCurrentTime;
1.928 +
1.929 + TTimeIntervalMicroSeconds iOffset;
1.930 +
1.931 + TTime iTimeWhenSuspended;
1.932 + TTimeIntervalMicroSeconds iTimeSuspended;
1.933 + TBool iSuspended;
1.934 +
1.935 + RCriticalSection iCriticalSection;
1.936 + };
1.937 +
1.938 +
1.939 +/**
1.940 +Observer class to be used with class CMMFClockSourcePeriodicUtility.
1.941 +@publishedAll
1.942 +@released
1.943 +*/
1.944 +class MMMFClockSourcePeriodicUtilityObserver
1.945 + {
1.946 +public:
1.947 + /**
1.948 + Notifies the observer that the specified period has elapsed.
1.949 + @param "aTime" "The current time, queried from the clock source."
1.950 + */
1.951 + virtual void MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) = 0;
1.952 + };
1.953 +
1.954 +/**
1.955 +Utility class that can be used by video HW devices to receive periodic callbacks with the current time.
1.956 +Note that the exact timing of the callbacks cannot be guaranteed due to other things pre-empting
1.957 +the execution of the active object or thread.
1.958 +@publishedAll
1.959 +@released
1.960 +*/
1.961 +class CMMFClockSourcePeriodicUtility : public CBase
1.962 + {
1.963 +public:
1.964 + /**
1.965 + Creates a new clock source periodic utility object.
1.966 +
1.967 + @param "aClockSource" "A reference to the clock source to be used to query the current time."
1.968 + @param "aObserver" "A reference to the observer of the utility that will receive callbacks
1.969 + each time the specified period elapses."
1.970 + @return "A new clock source periodic utility object."
1.971 + @leave "The method will leave if an error occurs."
1.972 + */
1.973 + IMPORT_C static CMMFClockSourcePeriodicUtility* NewL(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver);
1.974 +
1.975 + /**
1.976 + Starts the clock source periodic utility. The utility will call MmcspuoTick on its observer
1.977 + every aPeriod microseconds until Stop() is called. Note that the utility will not stop
1.978 + automatically when the clock source is stopped.
1.979 +
1.980 + @param "aPeriod" "Defines the period with which the observer will receive callbacks."
1.981 + */
1.982 + IMPORT_C void Start(TTimeIntervalMicroSeconds32 aPeriod);
1.983 +
1.984 + /**
1.985 + Stops the clock source periodic utility. No more callbacks will be made after this method has
1.986 + been called.
1.987 + */
1.988 + IMPORT_C void Stop();
1.989 +
1.990 + /**
1.991 + Destructor.
1.992 + */
1.993 + IMPORT_C ~CMMFClockSourcePeriodicUtility();
1.994 +private:
1.995 + CMMFClockSourcePeriodicUtility(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver);
1.996 + void ConstructL();
1.997 + static TInt Callback(TAny* aAny);
1.998 + void DoCallback();
1.999 +private:
1.1000 + CPeriodic* iTimer;
1.1001 + MMMFClockSource& iClockSource;
1.1002 + MMMFClockSourcePeriodicUtilityObserver& iObserver;
1.1003 + };
1.1004 +
1.1005 +
1.1006 +/**
1.1007 +Specifies the encoder buffering options.
1.1008 +@publishedAll
1.1009 +@released
1.1010 +*/
1.1011 +class TEncoderBufferOptions
1.1012 + {
1.1013 +public:
1.1014 + /**
1.1015 + The maximum number of pictures in the pre-encoder buffer.
1.1016 + */
1.1017 + TUint iMaxPreEncoderBufferPictures;
1.1018 +
1.1019 + /**
1.1020 + The HRD/VBV specification that shall be fullfilled.
1.1021 + */
1.1022 + THrdVbvSpecification iHrdVbvSpec;
1.1023 +
1.1024 + /**
1.1025 + The HRD/VBV buffering parameters. The data format depends on the parameters chosen. For
1.1026 + 3GPP TS 26.234 parameters (iHrdVbvSpec=EHrdVbv3GPP), the data in the descriptor is a package of type
1.1027 + TPckC<T3gppHrdVbvParams> (see T3gppHrdVbvParams). If no HRD/VBV parameters are used, the
1.1028 + descriptor is empty.
1.1029 + */
1.1030 + TPtrC8 iHrdVbvParams;
1.1031 +
1.1032 + /**
1.1033 + The maximum size of an output buffer, in bytes. Use KMaxTUint for an unlimited size.
1.1034 + */
1.1035 + TUint iMaxOutputBufferSize;
1.1036 +
1.1037 + /**
1.1038 + The maximum size of a coded picture, in bytes. Use KMaxTUint for an unlimited size.
1.1039 + */
1.1040 + TUint iMaxCodedPictureSize;
1.1041 +
1.1042 + /**
1.1043 + The maximum size of a coded video segment, in bytes. Use KMaxTUint for an unlimited size.
1.1044 + */
1.1045 + TUint iMaxCodedSegmentSize;
1.1046 +
1.1047 + /**
1.1048 + The mimimum number of output buffers.
1.1049 + */
1.1050 + TUint iMinNumOutputBuffers;
1.1051 + };
1.1052 +
1.1053 +/**
1.1054 +Specifies the video encoder bit-rate control options.
1.1055 +@publishedAll
1.1056 +@released
1.1057 +*/
1.1058 +class TRateControlOptions
1.1059 + {
1.1060 +public:
1.1061 + /**
1.1062 + Defines the bit-rate control type.
1.1063 + */
1.1064 + TBitrateControlType iControl;
1.1065 +
1.1066 + /**
1.1067 + The target bit-rate, in bits per second. Used if bit-rate control type is EBrControlStream.
1.1068 + If specified for an enhancement layer, the target bit-rate includes all lower layers. For example,
1.1069 + if the client uses two layers, with the base layer using 64000 bps and the whole stream 192000 bps,
1.1070 + this field is set to 64000 for layer zero and 192000 for layer one.
1.1071 + */
1.1072 + TUint iBitrate;
1.1073 +
1.1074 + /**
1.1075 + The target picture quality. The value range is [0…100], with 0 corresponding to minimum quality
1.1076 + and 100 to lossless coding (or the closest equivalent supported).
1.1077 + */
1.1078 + TUint iPictureQuality;
1.1079 +
1.1080 + /**
1.1081 + The target picture rate, in pictures per second. If specified for an enhancement layer, the target
1.1082 + frame rate includes all lower layers.
1.1083 + */
1.1084 + TReal iPictureRate;
1.1085 +
1.1086 + /**
1.1087 + The quality/temporal tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0
1.1088 + specifies that picture quality should be maintained as well as possible, sacrificing picture rate.
1.1089 + Value 1.0 specifies that picture rate should be maintained as well as possible, sacrificing
1.1090 + picture quality.
1.1091 + */
1.1092 + TReal iQualityTemporalTradeoff;
1.1093 +
1.1094 + /**
1.1095 + The latency/quality tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0
1.1096 + specifies that the transmission delay and the decoder input buffer occupancy level caused by
1.1097 + the bit-rate control is minimized, i.e. the actual coded bit-rate follows the target bit-rate
1.1098 + as closely as possible. 1.0 specifies that the transmission delay caused by the bit-rate control
1.1099 + should be as high as needed to guarantee a constant picture quality and frame rate as long as
1.1100 + the coded data conforms to the given HRD/VBV parameters (if any).
1.1101 + */
1.1102 + TReal iLatencyQualityTradeoff;
1.1103 + };
1.1104 +
1.1105 +/**
1.1106 +Custom interface Uid for setting up the DevVideo hw device adapter
1.1107 +*/
1.1108 +const TInt KUidDevVideoHwDeviceAdapterSetup = 0x102737EF;
1.1109 +
1.1110 +/**
1.1111 +Custom interface for setting up the DevVideo hw device adapter
1.1112 +@publishedPartner
1.1113 +@prototype
1.1114 +*/
1.1115 +class MDevVideoHwDeviceAdapterSetup
1.1116 + {
1.1117 +public:
1.1118 + /**
1.1119 + Set the Uid of the processing unit into the hw device adapter
1.1120 + */
1.1121 + virtual void LoadProcessingUnitL(const CImplementationInformation& aImplInfo) = 0;
1.1122 + };
1.1123 +
1.1124 +#include <mmf/devvideo/devvideobase.inl>
1.1125 +
1.1126 +#endif