|
1 // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #ifndef __DEVVIDEOBASE_H__ |
|
17 #define __DEVVIDEOBASE_H__ |
|
18 |
|
19 #include <e32base.h> |
|
20 #include <w32std.h> |
|
21 #include <mmf/devvideo/devvideoconstants.h> |
|
22 #include <ecom/ecom.h> |
|
23 #ifndef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
24 #include <mmf/devvideo/devvideohwdeviceadaptersetup.h> |
|
25 #endif |
|
26 |
|
27 |
|
28 /** |
|
29 Panic utility function |
|
30 @publishedAll |
|
31 */ |
|
32 LOCAL_C void DevVideoPanic(TInt aReason) |
|
33 { |
|
34 User::Panic(KDevVideoPanicCategory, aReason); |
|
35 } |
|
36 |
|
37 |
|
38 /** |
|
39 A hardware device ID that identifies an instantiated video hardware device. |
|
40 Used in the playback and recording APIs to identify the component being controlled. |
|
41 @publishedAll |
|
42 @released |
|
43 */ |
|
44 typedef TInt THwDeviceId; |
|
45 |
|
46 |
|
47 /** |
|
48 Defines a supported scale factor for a scaling pre-processor or post-processor. |
|
49 |
|
50 The scale factor is defined as iScaleNum/iScaleDenom, |
|
51 where the values are positive integers and relatively prime. |
|
52 @publishedAll |
|
53 @released |
|
54 */ |
|
55 class TScaleFactor |
|
56 { |
|
57 public: |
|
58 /**Scale factor numerator. Non-zero.*/ |
|
59 TUint iScaleNum; |
|
60 /**Scale factor denominator. Non-zero.*/ |
|
61 TUint iScaleDenom; |
|
62 }; |
|
63 |
|
64 |
|
65 /** |
|
66 A custom YUV/RGB conversion matrix. The same matrix structure is used for both conversion directions. |
|
67 @publishedAll |
|
68 @released |
|
69 */ |
|
70 class TYuvConversionMatrix |
|
71 { |
|
72 public: |
|
73 /** |
|
74 Post-multiplication offset, a three-item vector. |
|
75 */ |
|
76 TReal iPostOffset[3]; |
|
77 |
|
78 /** |
|
79 Multiplication matrix, a 3x3 matrix. iMatrix[3*i+j] contains the j:th item on the i:th row of the matrix. |
|
80 */ |
|
81 TReal iMatrix[9]; |
|
82 |
|
83 /** |
|
84 Pre-multiplication offset, a three-item vector. |
|
85 */ |
|
86 TReal iPreOffset[3]; |
|
87 }; |
|
88 |
|
89 |
|
90 /** |
|
91 YUV (YCbCr) uncompressed image data format. |
|
92 @publishedAll |
|
93 @released |
|
94 */ |
|
95 class TYuvFormat |
|
96 { |
|
97 public: |
|
98 /** |
|
99 The YUV/RGB conversion coefficients to use |
|
100 */ |
|
101 TYuvCoefficients iCoefficients; |
|
102 |
|
103 /** |
|
104 Luminance/chrominance sampling pattern. |
|
105 */ |
|
106 TYuvSamplingPattern iPattern; |
|
107 |
|
108 /** |
|
109 Data layout, specifies whether the data is stored in a planar or interleaved mode. |
|
110 */ |
|
111 TYuvDataLayout iDataLayout; |
|
112 |
|
113 /** |
|
114 Custom YUV to RGB conversion matrix to use. |
|
115 Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix). |
|
116 */ |
|
117 TYuvConversionMatrix* iYuv2RgbMatrix; |
|
118 |
|
119 /** |
|
120 Custom RGB to YUV conversion matrix to use. |
|
121 Valid only if custom conversion matrix is used (iCoefficients is ECustomYuvMatrix). |
|
122 */ |
|
123 TYuvConversionMatrix* iRgb2YuvMatrix; |
|
124 |
|
125 /** |
|
126 Pixel aspect ratio numerator. |
|
127 */ |
|
128 TUint iAspectRatioNum; |
|
129 |
|
130 /** |
|
131 Pixel aspect ratio denominator. |
|
132 The aspect ratio is defined as iAspectRatioNum/iAspectRatioDenom, |
|
133 where the values are positive integers and relatively prime. |
|
134 */ |
|
135 TUint iAspectRatioDenom; |
|
136 |
|
137 /** |
|
138 Tests whether this TYuvFormat object is the same as aOther. |
|
139 @param "aOther" "The object to compare." |
|
140 @return "ETrue if they are the same, EFalse if not." |
|
141 */ |
|
142 inline TBool operator==(const TYuvFormat& aOther) const; |
|
143 }; |
|
144 |
|
145 /** |
|
146 Defines an uncompressed video format. |
|
147 This structure is mainly just a combination of YUV and RGB formats, defined to simplify the rest of the API. |
|
148 @publishedAll |
|
149 @released |
|
150 */ |
|
151 class TUncompressedVideoFormat |
|
152 { |
|
153 public: |
|
154 /** |
|
155 The image data format. The validity of the rest of the fields depends on the data format used. |
|
156 */ |
|
157 TImageDataFormat iDataFormat; |
|
158 union |
|
159 { |
|
160 /** |
|
161 YUV picture format details, valid if iDataFormat is EYuvRawData. |
|
162 */ |
|
163 TYuvFormat iYuvFormat; |
|
164 |
|
165 /** |
|
166 RGB picture format details, valid if iDataFormat is ERgbRawData or ERgbFbsBitmap. |
|
167 */ |
|
168 TRgbFormat iRgbFormat; |
|
169 }; |
|
170 |
|
171 /** |
|
172 Tests whether this TUncompressedVideoFormat object is the same as aOther. |
|
173 @param "aOther" "The object to compare." |
|
174 @return "ETrue if they are the same, EFalse if not." |
|
175 */ |
|
176 inline TBool operator==(const TUncompressedVideoFormat& aOther) const; |
|
177 |
|
178 /** |
|
179 Sets this object equal to aOther. |
|
180 @param "aOther" "The object to clone." |
|
181 */ |
|
182 inline void operator=(const TUncompressedVideoFormat& aOther); |
|
183 }; |
|
184 |
|
185 |
|
186 /** |
|
187 Uncompressed picture data for one video picture. |
|
188 @publishedAll |
|
189 @released |
|
190 */ |
|
191 class TPictureData |
|
192 { |
|
193 public: |
|
194 /** |
|
195 The image data format. The validity of the rest of the fields depends on the data format used. |
|
196 */ |
|
197 TImageDataFormat iDataFormat; |
|
198 |
|
199 /** |
|
200 Image data size in pixels. In decoder output pictures the actual active picture area may be smaller, |
|
201 this is indicated using TVideoPicture.iCropRect. |
|
202 */ |
|
203 TSize iDataSize; |
|
204 |
|
205 union |
|
206 { |
|
207 /** |
|
208 Pointer to raw image data. Valid if iDataFormat is ERgbRawData or iYuvRawData. |
|
209 The data layout depends on the format used. |
|
210 */ |
|
211 TPtr8* iRawData; |
|
212 |
|
213 /** |
|
214 Pointer to an RGB bitmap. Valid if iDataFormat is ERgbFbsBitmap. |
|
215 */ |
|
216 CFbsBitmap* iRgbBitmap; |
|
217 |
|
218 /** |
|
219 Buffer number of current buffer for composition that is used when submitting a surface update. Valid if iDataFormat is set to ESurfaceBuffer |
|
220 */ |
|
221 TInt iSurfaceBufNum; |
|
222 }; |
|
223 }; |
|
224 |
|
225 /** |
|
226 Header information for one decoded picture. |
|
227 The header information is returned alongside with decoded pictures, |
|
228 or it can be read separately when DevVideoPlay is being initialized. |
|
229 |
|
230 @publishedAll |
|
231 @released |
|
232 */ |
|
233 class TVideoPictureHeader |
|
234 { |
|
235 public: |
|
236 /** |
|
237 */ |
|
238 enum THeaderOptions |
|
239 { |
|
240 /** Decoding timestamp is valid |
|
241 */ |
|
242 EDecodingTimestamp = 0x00000001, |
|
243 /** Presentation timestamp is valid |
|
244 */ |
|
245 EPresentationTimestamp = 0x00000002, |
|
246 /** Pre-decoder buffersize is valid |
|
247 */ |
|
248 EPreDecoderBufferSize = 0x00000004, |
|
249 /** Post-decoder buffersize is valid |
|
250 */ |
|
251 EPostDecoderBufferSize = 0x00000008, |
|
252 /** Picture number field is valid |
|
253 */ |
|
254 EPictureNumber = 0x00000010, |
|
255 /** Layered coding is used and the layer number field is valid |
|
256 */ |
|
257 ELayeredCoding = 0x00000020, |
|
258 /** Supplemental data is available |
|
259 */ |
|
260 ESupplementalData = 0x00000040, |
|
261 /** Random access buffering period is valid |
|
262 */ |
|
263 ERandomAccessBufferingPeriod = 0x00000080, |
|
264 /** Random access buffer occupancy is valid |
|
265 */ |
|
266 ERandomAccessBufferOccupancy = 0x00000100 |
|
267 }; |
|
268 |
|
269 /** |
|
270 Header options. The value is a bitfield combined from values from THeaderOptions. |
|
271 */ |
|
272 TUint32 iOptions; |
|
273 |
|
274 /** |
|
275 Video codec profile used. Use -1 if not applicable or not defined. |
|
276 */ |
|
277 TInt iProfile; |
|
278 |
|
279 /** |
|
280 Video codec level. Use -1 if not applicable or not defined. |
|
281 */ |
|
282 TInt iLevel; |
|
283 |
|
284 /** |
|
285 Video codec version. Use -1 if not applicable or not defined. |
|
286 */ |
|
287 TInt iVersion; |
|
288 |
|
289 /** |
|
290 Pointer to a descriptor that contains optional codec-specific features. Set to NULL if not used. |
|
291 The format of the data is codec-specific. The pointer and descriptor data are valid as long as |
|
292 the header information structure is valid. |
|
293 */ |
|
294 const TDesC8* iOptional; |
|
295 |
|
296 /** |
|
297 Image size in memory, in pixels. May be larger than the displayed picture. |
|
298 */ |
|
299 TSize iSizeInMemory; |
|
300 |
|
301 /** |
|
302 The portion of the full image to display. |
|
303 */ |
|
304 TRect iDisplayedRect; |
|
305 |
|
306 /** |
|
307 Picture presentation timestamp. Valid only if EPresentationTimestamp is set in the options. |
|
308 The clock frequency is stored in the timestamp structure. |
|
309 */ |
|
310 TTimeIntervalMicroSeconds iPresentationTimestamp; |
|
311 |
|
312 /** |
|
313 Picture decoding timestamp. Valid only if EDecodingTimestamp is set in the options. |
|
314 */ |
|
315 TTimeIntervalMicroSeconds iDecodingTimestamp; |
|
316 |
|
317 /** |
|
318 Expected pre-decoder buffer size in bytes. Valid only if EPreDecoderBufferSize is set in the options. |
|
319 */ |
|
320 TUint iPreDecoderBufferSize; |
|
321 |
|
322 /** |
|
323 Expected post-decoder buffer size in bytes. Valid only if EPostDecoderBufferSize is set in the options. |
|
324 It is assumed that a frame buffer to be displayed is returned before the decoding of the next frame |
|
325 is started. If this is not the case, a larger post-decoder buffer may actually be needed. |
|
326 */ |
|
327 TUint iPostDecoderBufferSize; |
|
328 |
|
329 /** |
|
330 Picture number, valid only if EPictureNumber is set in the options. |
|
331 This field is used to indicate one of the following: picture number or long-term picture index for H.263, |
|
332 vop_id for MPEG-4 Visual, picture number or long-term picture number for AVC. |
|
333 */ |
|
334 TUint iPictureNumber; |
|
335 |
|
336 /** |
|
337 Picture layer number if layered coding is used, valid only if ELayeredCoding is set in the options. |
|
338 Layers are numbered [0…n-1], where n is the number of layers available. The first layer (layer zero) |
|
339 is the base layer, it can be decoded independently from the other layers, and it has the lowest total bitrate. |
|
340 */ |
|
341 TUint iPictureLayer; |
|
342 |
|
343 /** |
|
344 Picture supplemental data, valid only if ESupplementalData is set in the options. |
|
345 The pointer and descriptor data are valid as long as the header information structure is valid. |
|
346 */ |
|
347 const TDesC8* iSupplementalData; |
|
348 |
|
349 /** |
|
350 True if the picture is a random-accessible picture. |
|
351 */ |
|
352 TBool iIsRandomAccessible; |
|
353 |
|
354 /** |
|
355 The expected initial pre-decoder buffering period before starting the playback from this picture. |
|
356 Valid only if this picture is randomly accessible (iIsRandomAccessible is true) and |
|
357 ERandomAccessBufferingPeriod is set in the options. MPEG-2 and H.264 | MPEG-4 AVC use this value. |
|
358 */ |
|
359 TTimeIntervalMicroSeconds32 iRandomAccessBufferingPeriod; |
|
360 |
|
361 /** |
|
362 The expected initial pre-decoder buffer occupancy in bytes before starting the playback |
|
363 from this picture. Valid if this picture is randomly accessible (iIsRandomAccessible is true) and |
|
364 ERandomAccessBufferOccupancy is set in the options. MPEG-4 Visual uses this value. |
|
365 */ |
|
366 TUint iRandomAccessBufferOccupancy; |
|
367 }; |
|
368 |
|
369 |
|
370 |
|
371 /** |
|
372 One uncompressed video picture. Used for both decoded picture output as well as uncompressed picture input. |
|
373 |
|
374 @publishedAll |
|
375 @released |
|
376 */ |
|
377 class TVideoPicture |
|
378 { |
|
379 public: |
|
380 /** |
|
381 */ |
|
382 enum TVideoPictureOptions |
|
383 { |
|
384 /** The timestamp field is valid. |
|
385 */ |
|
386 ETimestamp = 0x00000001, |
|
387 /** The crop rectangle field is valid. |
|
388 */ |
|
389 ECropRect = 0x00000002, |
|
390 /** Picture header information is present. |
|
391 */ |
|
392 EHeader = 0x00000004, |
|
393 /** The layer bit count targets field is valid. |
|
394 */ |
|
395 EBitTargets = 0x00000008, |
|
396 /** Set in encoder input to request an instantaneous decoder refresh. |
|
397 As a response, the encoder should code an intra frame and no consecutive |
|
398 frame should refer to any frame before the encoded intra frame (in coding order). |
|
399 */ |
|
400 EReqInstantRefresh = 0x00000010, |
|
401 /** Set in encoder input to indicate a scene cut in the picture stream. |
|
402 */ |
|
403 ESceneCut = 0x00000020, |
|
404 /** Set if a picture effect is in use and the picture effect field is valid. |
|
405 */ |
|
406 EPictureEffect = 0x00000040, |
|
407 /** Set if picture effect parameters are valid. |
|
408 */ |
|
409 EEffectParameters = 0x00000080, |
|
410 /** Content protected pictures cannot be displayed on unprotected |
|
411 external displays such as TV-out. |
|
412 */ |
|
413 EContentProtected = 0x00000100 |
|
414 }; |
|
415 |
|
416 /** |
|
417 The picture data. The picture data, including all pointers, must remain valid until |
|
418 the picture has been returned to its originator. |
|
419 */ |
|
420 TPictureData iData; |
|
421 |
|
422 /** |
|
423 Picture options. The value is a bitfield combined from values from TVideoPictureOptions. |
|
424 */ |
|
425 TUint32 iOptions; |
|
426 |
|
427 /** |
|
428 Picture timestamp. Valid if ETimestamp is set in the options. |
|
429 Used for presentation timestamps in video playback and capture timestamps in uncompressed video |
|
430 input for recording. If the timestamp is not specified for decoded video input for playback, |
|
431 the picture is displayed immediately. For decoded video output in playback and uncompressed |
|
432 video input for recording, the timestamp must always be set. |
|
433 */ |
|
434 TTimeIntervalMicroSeconds iTimestamp; |
|
435 |
|
436 /** |
|
437 Pan-scan cropping rectangle. Defines the area of the picture used for further processing. |
|
438 Only used for decoded video output. |
|
439 */ |
|
440 TRect iCropRect; |
|
441 |
|
442 /** |
|
443 Picture header information. Valid if EHeader is set in the options. |
|
444 Normally this field is only used in decoded pictures returned from the playback API. |
|
445 In that case the header info pointer is valid until the picture is returned to the API. |
|
446 */ |
|
447 TVideoPictureHeader* iHeader; |
|
448 |
|
449 /** |
|
450 The target number of bits for each bit-rate scalability layer, valid when EBitTargets is set in the options. |
|
451 Used in video encoding when the caller controls the bit-rate for each picture separately. |
|
452 The field points to a table containing the target number of bits to use for each layer when |
|
453 encoding this picture, starting from the lowest layer. The bit count for an enhancement layer |
|
454 includes all lower layers. For example, if the client uses two layers, and reserves 1.5 kilobits |
|
455 for the base layer and three kilobits for the whole picture, this field is set to {1500, 3000}. |
|
456 */ |
|
457 RArray<TUint>* iLayerBitRates; |
|
458 |
|
459 /** |
|
460 The picture effect in use when capturing this picture, valid when EPictureEffect is set in the options. |
|
461 This information can be used when encoding the picture. Note that setting a picture effect does not |
|
462 imply that the encoder should modify the picture data based on the effect. Instead, it can be used as |
|
463 an encoding hint. For example, fade to black implies that the global picture brightness has been decreased, |
|
464 and this knowledge can be used to aid motion prediction. |
|
465 @see TPictureEffects |
|
466 */ |
|
467 TPictureEffect iEffect; |
|
468 |
|
469 /** |
|
470 Picture effect parameter for fade to/from black, valid when EEffectParameters is set in the options |
|
471 and iEffect is EEffectFadeFromBlack or EEffectFadeToBlack. The value range is [0…65536], with zero |
|
472 indicating the picture is black and 65536 indicating that the lightness of the picture is unchanged. |
|
473 If the parameter is not given, the caller is unaware of the proper value or the value fluctuates spatially. |
|
474 */ |
|
475 TUint iFadeParam; |
|
476 |
|
477 /** |
|
478 A pointer for free-form user data. The pointer is set by the module that created the buffer, and is |
|
479 usually used for memory management purposes. |
|
480 */ |
|
481 TAny* iUser; |
|
482 |
|
483 /** |
|
484 A queue link used internally by the MSL video components. |
|
485 */ |
|
486 TDblQueLink iLink; |
|
487 }; |
|
488 |
|
489 /** |
|
490 Identifies a video picture in feedback messages. |
|
491 |
|
492 @publishedAll |
|
493 @released |
|
494 */ |
|
495 class TPictureId |
|
496 { |
|
497 public: |
|
498 enum TPictureIdType |
|
499 { |
|
500 /** Unidentified picture. */ |
|
501 ENone, |
|
502 /** The picture is identified using its temporal reference. */ |
|
503 ETemporalReference, |
|
504 /** 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.. */ |
|
505 EPictureNumber |
|
506 }; |
|
507 |
|
508 /** Picture identified type. */ |
|
509 TPictureIdType iIdType; |
|
510 |
|
511 /** The picture identifier. The interpretation of this field depends on the value iIdType */ |
|
512 TUint32 iId; |
|
513 }; |
|
514 |
|
515 |
|
516 /** |
|
517 Defines a compressed video format. The format is identified by its MIME type, which may include |
|
518 parameters that describe the used format profile and level. The MIME type used for H.263 |
|
519 is video/H263-2000, specified in TS 26.234, and the type for MPEG-4 is video/MP4V-ES, specified in RFC 3016. |
|
520 |
|
521 @publishedAll |
|
522 @released |
|
523 */ |
|
524 class CCompressedVideoFormat : public CBase |
|
525 { |
|
526 public: |
|
527 /** |
|
528 Static factory function for creating new CCompressedVideoFormat objects. |
|
529 |
|
530 @param "aMimeType" "Video codec MIME type, including optional parameters for profile, |
|
531 level and version information. The CCompressedVideoFormat object creates |
|
532 and owns a copy of this buffer and takes care of deallocation." |
|
533 |
|
534 @param "aOptionalData" "Reference to a descriptor that contains optional codec-specific data. |
|
535 Set to KNullDesC8 if not used. [The format of the data is codec-specific, typically |
|
536 a package buffer containing a data structure may be used. The pointer lifetime |
|
537 and validity requirements are specified with each method that uses this structure." |
|
538 |
|
539 @return "Pointer to a fully constructed CCompressedVideoFormat object." |
|
540 @leave "This method may leave with one of the system-wide error codes." |
|
541 */ |
|
542 IMPORT_C static CCompressedVideoFormat* NewL(const TDesC8& aMimeType, const TDesC8& aOptionalData = KNullDesC8); |
|
543 |
|
544 /** |
|
545 Static factory function for creating a copy of an existing CCompressedVideoFormat object. |
|
546 |
|
547 @param "aFormat" "The CCompressedVideoFormat object to copy." |
|
548 |
|
549 @return Pointer to a fully constructed CCompressedVideoFormat object. |
|
550 @leave This method may leave with one of the system-wide error codes. |
|
551 */ |
|
552 IMPORT_C static CCompressedVideoFormat* NewL(const CCompressedVideoFormat& aFormat); |
|
553 |
|
554 /** |
|
555 Virtual destructor. Destroys iMimeType. |
|
556 */ |
|
557 IMPORT_C virtual ~CCompressedVideoFormat(); |
|
558 |
|
559 /** |
|
560 Returns the video codec MIME type. |
|
561 |
|
562 @return "Reference to a descriptor that contains the video codec MIME type." |
|
563 */ |
|
564 IMPORT_C const TDesC8& MimeType() const; |
|
565 |
|
566 /** |
|
567 Returns the optional data. |
|
568 |
|
569 @return "Reference to a descriptor that contains optional codec-specific data. |
|
570 Zero length if not used. The format of the data is codec-specific, typically a package buffer |
|
571 containing a data structure may be used." |
|
572 */ |
|
573 IMPORT_C const TDesC8& OptionalData() const; |
|
574 |
|
575 /** |
|
576 Tests whether this CCompressedVideoFormat is identical to aOther or not. |
|
577 @return "ETrue if the two objects are identical, EFalse if not." |
|
578 */ |
|
579 IMPORT_C TBool operator==(const CCompressedVideoFormat& aOther) const; |
|
580 protected: |
|
581 /** |
|
582 @internalTechnology |
|
583 */ |
|
584 CCompressedVideoFormat(); |
|
585 |
|
586 /** |
|
587 @internalTechnology |
|
588 */ |
|
589 void ConstructL(const TDesC8& aMimeType, const TDesC8& aOptionalData); |
|
590 private: |
|
591 HBufC8* iMimeType; |
|
592 HBufC8* iOptionalData; |
|
593 }; |
|
594 |
|
595 |
|
596 /** |
|
597 Specifies the HRD/VBV parameters used when 3GPP TS 26.234 annex G HRD/VBV settings are used (EHrdVbv3GPP). |
|
598 See TS 26.234 Release 5 for details. |
|
599 @publishedAll |
|
600 @released |
|
601 */ |
|
602 class T3gppHrdVbvParams |
|
603 { |
|
604 public: |
|
605 /** Initial pre-decoder buffering period. */ |
|
606 TTimeIntervalMicroSeconds iInitialPreDecoderBufferPeriod; |
|
607 |
|
608 /** Initial post-decoder buffering period. */ |
|
609 TTimeIntervalMicroSeconds iInitialPostDecoderBufferPeriod; |
|
610 |
|
611 /** Hypothetical pre-decoder buffer size, in bytes. */ |
|
612 TUint iPreDecoderBufferSize; |
|
613 |
|
614 /** Peak decoding byte rate. By default, the peak decoding byte rate is |
|
615 defined according to the video coding profile and level in use. */ |
|
616 TUint iPeakDecodingByteRate; |
|
617 |
|
618 /** Decoding macroblock rate. The default decoding macroblock rate is defined |
|
619 according to the video coding profile and level in use. */ |
|
620 TUint iDecodingMacroblockRate; |
|
621 }; |
|
622 |
|
623 |
|
624 /** |
|
625 YUV to RGB post-processing options. |
|
626 @publishedAll |
|
627 @released |
|
628 */ |
|
629 class TYuvToRgbOptions |
|
630 { |
|
631 public: |
|
632 /** |
|
633 Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
634 100 to maximum setting, and 0 to no change in lightness. The actual lightness change formula |
|
635 used is hardware device specific. |
|
636 */ |
|
637 TInt iLightness; |
|
638 |
|
639 /** |
|
640 Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
641 100 to maximum setting, and 0 to no change in saturation. The actual saturation formula used |
|
642 is hardware device specific. |
|
643 */ |
|
644 TInt iSaturation; |
|
645 |
|
646 /** |
|
647 Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
648 100 to maximum setting, and 0 to no change in contrast. The actual contrast change formula |
|
649 used is hardware device specific. |
|
650 */ |
|
651 TInt iContrast; |
|
652 |
|
653 /** |
|
654 Gamma setting for conversion. Ignored if the converter does not support gamma correction. |
|
655 The gamma correction is defined as x' = x^(1/g), where x' refers to the corrected value, |
|
656 x to the original input value and g to this field. Gamma correction is performed on the RGB values. |
|
657 Set gamma to 1.0 to disable gamma correction. |
|
658 */ |
|
659 TReal iGamma; |
|
660 |
|
661 /** |
|
662 The dithering type to use. |
|
663 */ |
|
664 TDitherType iDitherType; |
|
665 }; |
|
666 |
|
667 /** |
|
668 Pre-processing options for color enhancement. |
|
669 The value ranges have been chosen to match those in the Onboard Camera API. |
|
670 @publishedAll |
|
671 @released |
|
672 */ |
|
673 class TColorEnhancementOptions |
|
674 { |
|
675 public: |
|
676 /** |
|
677 Lightness setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
678 100 to maximum setting, and 0 to no change in lightness. |
|
679 */ |
|
680 TInt iLightness; |
|
681 |
|
682 /** |
|
683 Saturation setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
684 100 to maximum setting, and 0 to no change in saturation. |
|
685 */ |
|
686 TInt iSaturation; |
|
687 |
|
688 /** |
|
689 Contrast setting. The value range is [-100 … 100], with -100 corresponding to minimum setting, |
|
690 100 to maximum setting, and 0 to no change in contrast. |
|
691 */ |
|
692 TInt iContrast; |
|
693 }; |
|
694 |
|
695 /** |
|
696 Describes the YUV to RGB color conversion capabilities of a post-processor. |
|
697 @publishedAll |
|
698 @released |
|
699 */ |
|
700 class TYuvToRgbCapabilities |
|
701 { |
|
702 public: |
|
703 /** |
|
704 Input YUV sampling patterns supported, a bitfield combination (bitwise OR) of TYuvSamplingPattern. |
|
705 */ |
|
706 TUint32 iSamplingPatterns; |
|
707 |
|
708 /** |
|
709 YUV to RGB conversion coefficients supported, a bitfield combination of TYuvCoefficients. |
|
710 */ |
|
711 TUint32 iCoefficients; |
|
712 |
|
713 /** |
|
714 Output RGB formats supported, a bitfield combination of TRgbFormat. |
|
715 */ |
|
716 TUint32 iRgbFormats; |
|
717 |
|
718 /** |
|
719 True if lightness control is supported. |
|
720 */ |
|
721 TBool iLightnessControl; |
|
722 |
|
723 /** |
|
724 True if saturation control is supported. |
|
725 */ |
|
726 TBool iSaturationControl; |
|
727 |
|
728 /** |
|
729 True if contrast control is supported. |
|
730 */ |
|
731 TBool iContrastControl; |
|
732 |
|
733 /** |
|
734 True if gamma correction is supported. |
|
735 */ |
|
736 TBool iGammaCorrection; |
|
737 |
|
738 /** |
|
739 Dithering types supported, a bitfield combination of TDitherType. |
|
740 */ |
|
741 TUint32 iDitherTypes; |
|
742 }; |
|
743 |
|
744 /** |
|
745 Specifies the YUV-to-YUV conversion capabilities for a plug-in. |
|
746 @publishedAll |
|
747 @released |
|
748 */ |
|
749 class TYuvToYuvCapabilities |
|
750 { |
|
751 public: |
|
752 /** |
|
753 The YUV sampling patterns supported for input data, a combination (binary OR) of values from TYuvSamplingPatterns. |
|
754 */ |
|
755 TUint32 iInputSamplingPatterns; |
|
756 |
|
757 /** |
|
758 The YUV data layouts supported for input data, a combination (binary OR) of values from TYuvDataLayout. |
|
759 */ |
|
760 TUint32 iInputDataLayouts; |
|
761 |
|
762 /** |
|
763 The YUV sampling patterns supported for output data, a combination (binary OR) of values from TYuvSamplingPatterns. |
|
764 */ |
|
765 TUint32 iOutputSamplingPatterns; |
|
766 |
|
767 /** |
|
768 The YUV data layouts supported for output data, a combination (binary OR) of values from TYuvDataLayout. |
|
769 */ |
|
770 TUint32 iOutputDataLayouts; |
|
771 }; |
|
772 |
|
773 /** |
|
774 Structure to combine a picture rate and size. Used when defining the maximum rate/size combinations |
|
775 available. |
|
776 @publishedAll |
|
777 @released |
|
778 */ |
|
779 class TPictureRateAndSize |
|
780 { |
|
781 public: |
|
782 /** The picture rate. */ |
|
783 TReal iPictureRate; |
|
784 |
|
785 /** The picture size. */ |
|
786 TSize iPictureSize; |
|
787 }; |
|
788 |
|
789 /** |
|
790 CMMFVideoHwDevice is a base class for all video hardware devices. |
|
791 @publishedAll |
|
792 @released |
|
793 */ |
|
794 class CMMFVideoHwDevice : public CBase |
|
795 { |
|
796 public: |
|
797 /** |
|
798 Retrieves a custom interface to the device. |
|
799 @param "aInterface" "Interface UID, defined with the custom interface." |
|
800 @return "Pointer to the interface implementation, or NULL if the device does not |
|
801 implement the interface requested. The return value must be cast to the |
|
802 correct type by the user." |
|
803 */ |
|
804 virtual TAny* CustomInterface(TUid aInterface) = 0; |
|
805 }; |
|
806 |
|
807 |
|
808 |
|
809 /** |
|
810 Defines the interface that video clock sources must to implement. |
|
811 |
|
812 A clock source can be used to synchronize video processing to some other processing entity, |
|
813 for example an audio stream. The clock source is created and controlled by the DevVideo client, |
|
814 and passed to the video hwdevices via the DevVideo interface. This allows the hwdevice to query |
|
815 the current stream time, so it can ascertain which frame should be processed at any given moment. |
|
816 |
|
817 "Stream time" is defined as the current position in the media stream. For example, when playing |
|
818 a video clip, the stream time will always equal the current position in the clip. So, when the |
|
819 clip is repositioned, the stream time will be equal to the new clip position. When the clip is |
|
820 paused, the stream time will pause too. |
|
821 |
|
822 Many hwdevice implementations will use extra threads to perform the video processing, so it is |
|
823 essential that all implementations of the MMMFClockSource interface can be used from multiple |
|
824 threads. A hwdevice that receives a clock source from the DevVideo client must be able to |
|
825 assume that it can pass a pointer to the clock source object into another thread and use the |
|
826 object directly from there. |
|
827 |
|
828 All clock source implementations must protect the methods defined in the MMMFClockSource interface |
|
829 so they can be called from any thread within the current process. Practically speaking, this means |
|
830 using mutexes and critical sections to protect member data from being accessed from multiple threads |
|
831 simultaneously. Also, any use of thread-specific handles (e.g. a CMMFDevSound object) must be |
|
832 avoided from within these methods. |
|
833 |
|
834 It can be assumed that any methods defined outside the MMMFClockSource interface (for example |
|
835 methods used to control the clock source) will only be executed within the DevVideo client's thread, |
|
836 so do not require protection. |
|
837 |
|
838 @publishedAll |
|
839 @released |
|
840 */ |
|
841 class MMMFClockSource |
|
842 { |
|
843 public: |
|
844 /** |
|
845 Retrieves a custom interface for the clock source. |
|
846 |
|
847 This method can be called from any thread running inside the process in which the concrete |
|
848 clock source was created. Note that this does not mean that all methods in the custom |
|
849 interface can be called from any thread - that will be specified by the custom interface itself. |
|
850 |
|
851 @param "aInterface" "Interface UID, defined by the entity specifying the interface." |
|
852 @return "Pointer to the interface implementation, or NULL if the interface is not available. |
|
853 The pointer must be cast to the appropriate interface class." |
|
854 */ |
|
855 virtual TAny* CustomInterface(TUid aInterface) = 0; |
|
856 |
|
857 /** |
|
858 Retrieves the current stream time. For example, if a clip is being played, the stream time will |
|
859 be equal to the current position in the clip. |
|
860 |
|
861 This method can be called from any thread running inside the process in which the concrete clock |
|
862 source was created. |
|
863 |
|
864 @return "The number of microseconds passed in the clock compared to the reference time." |
|
865 */ |
|
866 virtual TTimeIntervalMicroSeconds Time() = 0; |
|
867 }; |
|
868 |
|
869 /** |
|
870 The CSystemClockSource provides a basic clock source implementation based on the system clock. |
|
871 It will count microseconds since the object was created or Reset() was last called, and return |
|
872 that count from Time(). It does not implement any custom interfaces. |
|
873 @publishedAll |
|
874 @released |
|
875 */ |
|
876 class CSystemClockSource : public CBase, public MMMFClockSource |
|
877 { |
|
878 public: |
|
879 /** |
|
880 Creates a new CSystemClockSource object. |
|
881 @return "A new clock source object." |
|
882 @leave "This method may leave with one of the system-wide error codes." |
|
883 */ |
|
884 IMPORT_C static CSystemClockSource* NewL(); |
|
885 |
|
886 /** |
|
887 Destructor. |
|
888 */ |
|
889 IMPORT_C ~CSystemClockSource(); |
|
890 |
|
891 // Control methods |
|
892 /** |
|
893 Resets the clock source to zero. Typically called by the DevVideo client at stream start. |
|
894 */ |
|
895 IMPORT_C void Reset(); |
|
896 |
|
897 /** |
|
898 Resets the clock source to a user-defined offset. Typically called by the DevVideo client |
|
899 when seeking in a file. |
|
900 |
|
901 @param "aOffset" "The clock offset." |
|
902 */ |
|
903 IMPORT_C void Reset(const TTimeIntervalMicroSeconds& aOffset); |
|
904 |
|
905 /** |
|
906 Suspends the clock source. The clock time will not increment until the clock has been resumed. |
|
907 This method is used when pausing playback. |
|
908 */ |
|
909 IMPORT_C void Suspend(); |
|
910 |
|
911 /** |
|
912 Resumes the clock source after a Suspend() method call. This method is used when resuming playback. |
|
913 */ |
|
914 IMPORT_C void Resume(); |
|
915 |
|
916 // Implementation of MMMFClockSource |
|
917 /** |
|
918 No custom interfaces are implemented by this clock source, so this method will always return NULL. |
|
919 @param "aInterface" "The interface" |
|
920 @return "NULL" |
|
921 */ |
|
922 virtual TAny* CustomInterface(TUid aInterface); |
|
923 /** |
|
924 Retrieves the time that has elapsed since Reset() was last called, subtracting any time |
|
925 during which the clock was suspended. |
|
926 |
|
927 @return "The number of microseconds that have elapsed in the stream." |
|
928 */ |
|
929 virtual TTimeIntervalMicroSeconds Time(); |
|
930 |
|
931 private: |
|
932 CSystemClockSource(); |
|
933 void ConstructL(); |
|
934 private: |
|
935 TTime iStartTime; |
|
936 TTime iCurrentTime; |
|
937 |
|
938 TTimeIntervalMicroSeconds iOffset; |
|
939 |
|
940 TTime iTimeWhenSuspended; |
|
941 TTimeIntervalMicroSeconds iTimeSuspended; |
|
942 TBool iSuspended; |
|
943 |
|
944 RCriticalSection iCriticalSection; |
|
945 }; |
|
946 |
|
947 |
|
948 /** |
|
949 Observer class to be used with class CMMFClockSourcePeriodicUtility. |
|
950 @publishedAll |
|
951 @released |
|
952 */ |
|
953 class MMMFClockSourcePeriodicUtilityObserver |
|
954 { |
|
955 public: |
|
956 /** |
|
957 Notifies the observer that the specified period has elapsed. |
|
958 @param "aTime" "The current time, queried from the clock source." |
|
959 */ |
|
960 virtual void MmcspuoTick(const TTimeIntervalMicroSeconds& aTime) = 0; |
|
961 }; |
|
962 |
|
963 /** |
|
964 Utility class that can be used by video HW devices to receive periodic callbacks with the current time. |
|
965 Note that the exact timing of the callbacks cannot be guaranteed due to other things pre-empting |
|
966 the execution of the active object or thread. |
|
967 @publishedAll |
|
968 @released |
|
969 */ |
|
970 class CMMFClockSourcePeriodicUtility : public CBase |
|
971 { |
|
972 public: |
|
973 /** |
|
974 Creates a new clock source periodic utility object. |
|
975 |
|
976 @param "aClockSource" "A reference to the clock source to be used to query the current time." |
|
977 @param "aObserver" "A reference to the observer of the utility that will receive callbacks |
|
978 each time the specified period elapses." |
|
979 @return "A new clock source periodic utility object." |
|
980 @leave "The method will leave if an error occurs." |
|
981 */ |
|
982 IMPORT_C static CMMFClockSourcePeriodicUtility* NewL(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver); |
|
983 |
|
984 /** |
|
985 Starts the clock source periodic utility. The utility will call MmcspuoTick on its observer |
|
986 every aPeriod microseconds until Stop() is called. Note that the utility will not stop |
|
987 automatically when the clock source is stopped. |
|
988 |
|
989 @param "aPeriod" "Defines the period with which the observer will receive callbacks." |
|
990 */ |
|
991 IMPORT_C void Start(TTimeIntervalMicroSeconds32 aPeriod); |
|
992 |
|
993 /** |
|
994 Stops the clock source periodic utility. No more callbacks will be made after this method has |
|
995 been called. |
|
996 */ |
|
997 IMPORT_C void Stop(); |
|
998 |
|
999 /** |
|
1000 Destructor. |
|
1001 */ |
|
1002 IMPORT_C ~CMMFClockSourcePeriodicUtility(); |
|
1003 private: |
|
1004 CMMFClockSourcePeriodicUtility(MMMFClockSource& aClockSource, MMMFClockSourcePeriodicUtilityObserver& aObserver); |
|
1005 void ConstructL(); |
|
1006 static TInt Callback(TAny* aAny); |
|
1007 void DoCallback(); |
|
1008 private: |
|
1009 CPeriodic* iTimer; |
|
1010 MMMFClockSource& iClockSource; |
|
1011 MMMFClockSourcePeriodicUtilityObserver& iObserver; |
|
1012 }; |
|
1013 |
|
1014 |
|
1015 /** |
|
1016 Specifies the encoder buffering options. |
|
1017 @publishedAll |
|
1018 @released |
|
1019 */ |
|
1020 class TEncoderBufferOptions |
|
1021 { |
|
1022 public: |
|
1023 /** |
|
1024 The maximum number of pictures in the pre-encoder buffer. |
|
1025 */ |
|
1026 TUint iMaxPreEncoderBufferPictures; |
|
1027 |
|
1028 /** |
|
1029 The HRD/VBV specification that shall be fullfilled. |
|
1030 */ |
|
1031 THrdVbvSpecification iHrdVbvSpec; |
|
1032 |
|
1033 /** |
|
1034 The HRD/VBV buffering parameters. The data format depends on the parameters chosen. For |
|
1035 3GPP TS 26.234 parameters (iHrdVbvSpec=EHrdVbv3GPP), the data in the descriptor is a package of type |
|
1036 TPckC<T3gppHrdVbvParams> (see T3gppHrdVbvParams). If no HRD/VBV parameters are used, the |
|
1037 descriptor is empty. |
|
1038 */ |
|
1039 TPtrC8 iHrdVbvParams; |
|
1040 |
|
1041 /** |
|
1042 The maximum size of an output buffer, in bytes. Use KMaxTUint for an unlimited size. |
|
1043 */ |
|
1044 TUint iMaxOutputBufferSize; |
|
1045 |
|
1046 /** |
|
1047 The maximum size of a coded picture, in bytes. Use KMaxTUint for an unlimited size. |
|
1048 */ |
|
1049 TUint iMaxCodedPictureSize; |
|
1050 |
|
1051 /** |
|
1052 The maximum size of a coded video segment, in bytes. Use KMaxTUint for an unlimited size. |
|
1053 */ |
|
1054 TUint iMaxCodedSegmentSize; |
|
1055 |
|
1056 /** |
|
1057 The mimimum number of output buffers. |
|
1058 */ |
|
1059 TUint iMinNumOutputBuffers; |
|
1060 }; |
|
1061 |
|
1062 /** |
|
1063 Specifies the video encoder bit-rate control options. |
|
1064 @publishedAll |
|
1065 @released |
|
1066 */ |
|
1067 class TRateControlOptions |
|
1068 { |
|
1069 public: |
|
1070 /** |
|
1071 Defines the bit-rate control type. |
|
1072 */ |
|
1073 TBitrateControlType iControl; |
|
1074 |
|
1075 /** |
|
1076 The target bit-rate, in bits per second. Used if bit-rate control type is EBrControlStream. |
|
1077 If specified for an enhancement layer, the target bit-rate includes all lower layers. For example, |
|
1078 if the client uses two layers, with the base layer using 64000 bps and the whole stream 192000 bps, |
|
1079 this field is set to 64000 for layer zero and 192000 for layer one. |
|
1080 */ |
|
1081 TUint iBitrate; |
|
1082 |
|
1083 /** |
|
1084 The target picture quality. The value range is [0…100], with 0 corresponding to minimum quality |
|
1085 and 100 to lossless coding (or the closest equivalent supported). |
|
1086 */ |
|
1087 TUint iPictureQuality; |
|
1088 |
|
1089 /** |
|
1090 The target picture rate, in pictures per second. If specified for an enhancement layer, the target |
|
1091 frame rate includes all lower layers. |
|
1092 */ |
|
1093 TReal iPictureRate; |
|
1094 |
|
1095 /** |
|
1096 The quality/temporal tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0 |
|
1097 specifies that picture quality should be maintained as well as possible, sacrificing picture rate. |
|
1098 Value 1.0 specifies that picture rate should be maintained as well as possible, sacrificing |
|
1099 picture quality. |
|
1100 */ |
|
1101 TReal iQualityTemporalTradeoff; |
|
1102 |
|
1103 /** |
|
1104 The latency/quality tradeoff for bit-rate control. The value range is [0.0…1.0]. Value 0.0 |
|
1105 specifies that the transmission delay and the decoder input buffer occupancy level caused by |
|
1106 the bit-rate control is minimized, i.e. the actual coded bit-rate follows the target bit-rate |
|
1107 as closely as possible. 1.0 specifies that the transmission delay caused by the bit-rate control |
|
1108 should be as high as needed to guarantee a constant picture quality and frame rate as long as |
|
1109 the coded data conforms to the given HRD/VBV parameters (if any). |
|
1110 */ |
|
1111 |
|
1112 TReal iLatencyQualityTradeoff; |
|
1113 }; |
|
1114 |
|
1115 /** |
|
1116 Custom interface Uid for setting up the DevVideo hw device adapter |
|
1117 */ |
|
1118 const TInt KUidDevVideoHwDeviceAdapterSetup = 0x102737EF; |
|
1119 |
|
1120 #include <mmf/devvideo/devvideobase.inl> |
|
1121 |
|
1122 #endif |
|
1123 |