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