|
1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
4 ** All rights reserved. |
|
5 ** Contact: Nokia Corporation (qt-info@nokia.com) |
|
6 ** |
|
7 ** This file is part of the Qt Mobility Components. |
|
8 ** |
|
9 ** $QT_BEGIN_LICENSE:LGPL$ |
|
10 ** No Commercial Usage |
|
11 ** This file contains pre-release code and may not be distributed. |
|
12 ** You may use this file in accordance with the terms and conditions |
|
13 ** contained in the Technology Preview License Agreement accompanying |
|
14 ** this package. |
|
15 ** |
|
16 ** GNU Lesser General Public License Usage |
|
17 ** Alternatively, this file may be used under the terms of the GNU Lesser |
|
18 ** General Public License version 2.1 as published by the Free Software |
|
19 ** Foundation and appearing in the file LICENSE.LGPL included in the |
|
20 ** packaging of this file. Please review the following information to |
|
21 ** ensure the GNU Lesser General Public License version 2.1 requirements |
|
22 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. |
|
23 ** |
|
24 ** In addition, as a special exception, Nokia gives you certain additional |
|
25 ** rights. These rights are described in the Nokia Qt LGPL Exception |
|
26 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. |
|
27 ** |
|
28 ** If you have questions regarding the use of this file, please contact |
|
29 ** Nokia at qt-info@nokia.com. |
|
30 ** |
|
31 ** |
|
32 ** |
|
33 ** |
|
34 ** |
|
35 ** |
|
36 ** |
|
37 ** |
|
38 ** $QT_END_LICENSE$ |
|
39 ** |
|
40 ****************************************************************************/ |
|
41 |
|
42 #include "qvideosurfaceformat.h" |
|
43 |
|
44 #include <qdebug.h> |
|
45 #include <qmetatype.h> |
|
46 #include <qpair.h> |
|
47 #include <qvariant.h> |
|
48 #include <qvector.h> |
|
49 |
|
50 QT_BEGIN_NAMESPACE |
|
51 |
|
52 class QVideoSurfaceFormatPrivate : public QSharedData |
|
53 { |
|
54 public: |
|
55 QVideoSurfaceFormatPrivate() |
|
56 : pixelFormat(QVideoFrame::Format_Invalid) |
|
57 , handleType(QAbstractVideoBuffer::NoHandle) |
|
58 , scanLineDirection(QVideoSurfaceFormat::TopToBottom) |
|
59 , pixelAspectRatio(1, 1) |
|
60 , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) |
|
61 , frameRate(0.0) |
|
62 { |
|
63 } |
|
64 |
|
65 QVideoSurfaceFormatPrivate( |
|
66 const QSize &size, |
|
67 QVideoFrame::PixelFormat format, |
|
68 QAbstractVideoBuffer::HandleType type) |
|
69 : pixelFormat(format) |
|
70 , handleType(type) |
|
71 , scanLineDirection(QVideoSurfaceFormat::TopToBottom) |
|
72 , frameSize(size) |
|
73 , pixelAspectRatio(1, 1) |
|
74 , ycbcrColorSpace(QVideoSurfaceFormat::YCbCr_Undefined) |
|
75 , viewport(QPoint(0, 0), size) |
|
76 , frameRate(0.0) |
|
77 { |
|
78 } |
|
79 |
|
80 QVideoSurfaceFormatPrivate(const QVideoSurfaceFormatPrivate &other) |
|
81 : QSharedData(other) |
|
82 , pixelFormat(other.pixelFormat) |
|
83 , handleType(other.handleType) |
|
84 , scanLineDirection(other.scanLineDirection) |
|
85 , frameSize(other.frameSize) |
|
86 , pixelAspectRatio(other.pixelAspectRatio) |
|
87 , ycbcrColorSpace(other.ycbcrColorSpace) |
|
88 , viewport(other.viewport) |
|
89 , frameRate(other.frameRate) |
|
90 , propertyNames(other.propertyNames) |
|
91 , propertyValues(other.propertyValues) |
|
92 { |
|
93 } |
|
94 |
|
95 bool operator ==(const QVideoSurfaceFormatPrivate &other) const |
|
96 { |
|
97 if (pixelFormat == other.pixelFormat |
|
98 && handleType == other.handleType |
|
99 && scanLineDirection == other.scanLineDirection |
|
100 && frameSize == other.frameSize |
|
101 && pixelAspectRatio == other.pixelAspectRatio |
|
102 && viewport == other.viewport |
|
103 && frameRatesEqual(frameRate, other.frameRate) |
|
104 && ycbcrColorSpace == other.ycbcrColorSpace |
|
105 && propertyNames.count() == other.propertyNames.count()) { |
|
106 for (int i = 0; i < propertyNames.count(); ++i) { |
|
107 int j = other.propertyNames.indexOf(propertyNames.at(i)); |
|
108 |
|
109 if (j == -1 || propertyValues.at(i) != other.propertyValues.at(j)) |
|
110 return false; |
|
111 } |
|
112 return true; |
|
113 } else { |
|
114 return false; |
|
115 } |
|
116 } |
|
117 |
|
118 inline static bool frameRatesEqual(qreal r1, qreal r2) |
|
119 { |
|
120 return qAbs(r1 - r2) <= 0.00001 * qMin(qAbs(r1), qAbs(r2)); |
|
121 } |
|
122 |
|
123 QVideoFrame::PixelFormat pixelFormat; |
|
124 QAbstractVideoBuffer::HandleType handleType; |
|
125 QVideoSurfaceFormat::Direction scanLineDirection; |
|
126 QSize frameSize; |
|
127 QSize pixelAspectRatio; |
|
128 QVideoSurfaceFormat::YCbCrColorSpace ycbcrColorSpace; |
|
129 QRect viewport; |
|
130 qreal frameRate; |
|
131 QList<QByteArray> propertyNames; |
|
132 QList<QVariant> propertyValues; |
|
133 }; |
|
134 |
|
135 /*! |
|
136 \class QVideoSurfaceFormat |
|
137 \brief The QVideoSurfaceFormat class specifies the stream format of a video presentation |
|
138 surface. |
|
139 \since 4.6 |
|
140 |
|
141 A video surface presents a stream of video frames. The surface's format describes the type of |
|
142 the frames and determines how they should be presented. |
|
143 |
|
144 The core properties of a video stream required to setup a video surface are the pixel format |
|
145 given by pixelFormat(), and the frame dimensions given by frameSize(). |
|
146 |
|
147 If the surface is to present frames using a frame's handle a surface format will also include |
|
148 a handle type which is given by the handleType() function. |
|
149 |
|
150 The region of a frame that is actually displayed on a video surface is given by the viewport(). |
|
151 A stream may have a viewport less than the entire region of a frame to allow for videos smaller |
|
152 than the nearest optimal size of a video frame. For example the width of a frame may be |
|
153 extended so that the start of each scan line is eight byte aligned. |
|
154 |
|
155 Other common properties are the pixelAspectRatio(), scanLineDirection(), and frameRate(). |
|
156 Additionally a stream may have some additional type specific properties which are listed by the |
|
157 dynamicPropertyNames() function and can be accessed using the property(), and setProperty() |
|
158 functions. |
|
159 */ |
|
160 |
|
161 /*! |
|
162 \enum QVideoSurfaceFormat::Direction |
|
163 |
|
164 Enumerates the layout direction of video scan lines. |
|
165 |
|
166 \value TopToBottom Scan lines are arranged from the top of the frame to the bottom. |
|
167 \value BottomToTop Scan lines are arranged from the bottom of the frame to the top. |
|
168 */ |
|
169 |
|
170 /*! |
|
171 \enum QVideoSurfaceFormat::YCbCrColorSpace |
|
172 |
|
173 Enumerates the Y'CbCr color space of video frames. |
|
174 |
|
175 \value YCbCr_Undefined |
|
176 No color space is specified. |
|
177 |
|
178 \value YCbCr_BT601 |
|
179 A Y'CbCr color space defined by ITU-R recommendation BT.601 |
|
180 with Y value range from 16 to 235, and Cb/Cr range from 16 to 240. |
|
181 Used in standard definition video. |
|
182 |
|
183 \value YCbCr_BT709 |
|
184 A Y'CbCr color space defined by ITU-R BT.709 with the same values range as YCbCr_BT601. Used |
|
185 for HDTV. |
|
186 |
|
187 \value YCbCr_xvYCC601 |
|
188 The BT.601 color space with the value range extended to 0 to 255. |
|
189 It is backward compatibile with BT.601 and uses values outside BT.601 range to represent |
|
190 wider colors range. |
|
191 |
|
192 \value YCbCr_xvYCC709 |
|
193 The BT.709 color space with the value range extended to 0 to 255. |
|
194 |
|
195 \value YCbCr_JPEG |
|
196 The full range Y'CbCr color space used in JPEG files. |
|
197 */ |
|
198 |
|
199 /*! |
|
200 Constructs a null video stream format. |
|
201 */ |
|
202 |
|
203 QVideoSurfaceFormat::QVideoSurfaceFormat() |
|
204 : d(new QVideoSurfaceFormatPrivate) |
|
205 { |
|
206 } |
|
207 |
|
208 /*! |
|
209 Contructs a description of stream which receives stream of \a type buffers with given frame |
|
210 \a size and pixel \a format. |
|
211 */ |
|
212 |
|
213 QVideoSurfaceFormat::QVideoSurfaceFormat( |
|
214 const QSize& size, QVideoFrame::PixelFormat format, QAbstractVideoBuffer::HandleType type) |
|
215 : d(new QVideoSurfaceFormatPrivate(size, format, type)) |
|
216 { |
|
217 } |
|
218 |
|
219 /*! |
|
220 Constructs a copy of \a other. |
|
221 */ |
|
222 |
|
223 QVideoSurfaceFormat::QVideoSurfaceFormat(const QVideoSurfaceFormat &other) |
|
224 : d(other.d) |
|
225 { |
|
226 } |
|
227 |
|
228 /*! |
|
229 Assigns the values of \a other to a video stream description. |
|
230 */ |
|
231 |
|
232 QVideoSurfaceFormat &QVideoSurfaceFormat::operator =(const QVideoSurfaceFormat &other) |
|
233 { |
|
234 d = other.d; |
|
235 |
|
236 return *this; |
|
237 } |
|
238 |
|
239 /*! |
|
240 Destroys a video stream description. |
|
241 */ |
|
242 |
|
243 QVideoSurfaceFormat::~QVideoSurfaceFormat() |
|
244 { |
|
245 } |
|
246 |
|
247 /*! |
|
248 Identifies if a video surface format has a valid pixel format and frame size. |
|
249 |
|
250 Returns true if the format is valid, and false otherwise. |
|
251 */ |
|
252 |
|
253 bool QVideoSurfaceFormat::isValid() const |
|
254 { |
|
255 return d->pixelFormat == QVideoFrame::Format_Invalid && d->frameSize.isValid(); |
|
256 } |
|
257 |
|
258 /*! |
|
259 Returns true if \a other is the same as a video format, and false if they are the different. |
|
260 */ |
|
261 |
|
262 bool QVideoSurfaceFormat::operator ==(const QVideoSurfaceFormat &other) const |
|
263 { |
|
264 return d == other.d || *d == *other.d; |
|
265 } |
|
266 |
|
267 /*! |
|
268 Returns true if \a other is different to a video format, and false if they are the same. |
|
269 */ |
|
270 |
|
271 bool QVideoSurfaceFormat::operator !=(const QVideoSurfaceFormat &other) const |
|
272 { |
|
273 return d != other.d && !(*d == *other.d); |
|
274 } |
|
275 |
|
276 /*! |
|
277 Returns the pixel format of frames in a video stream. |
|
278 */ |
|
279 |
|
280 QVideoFrame::PixelFormat QVideoSurfaceFormat::pixelFormat() const |
|
281 { |
|
282 return d->pixelFormat; |
|
283 } |
|
284 |
|
285 /*! |
|
286 Returns the type of handle the surface uses to present the frame data. |
|
287 |
|
288 If the handle type is QAbstractVideoBuffer::NoHandle buffers with any handle type are valid |
|
289 provided they can be \l {QAbstractVideoBuffer::map()}{mapped} with the |
|
290 QAbstractVideoBuffer::ReadOnly flag. If the handleType() is not QAbstractVideoBuffer::NoHandle |
|
291 then the handle type of the buffer be the same as that of the surface format. |
|
292 */ |
|
293 |
|
294 QAbstractVideoBuffer::HandleType QVideoSurfaceFormat::handleType() const |
|
295 { |
|
296 return d->handleType; |
|
297 } |
|
298 |
|
299 /*! |
|
300 Returns the size of frames in a video stream. |
|
301 |
|
302 \sa frameWidth(), frameHeight() |
|
303 */ |
|
304 |
|
305 QSize QVideoSurfaceFormat::frameSize() const |
|
306 { |
|
307 return d->frameSize; |
|
308 } |
|
309 |
|
310 /*! |
|
311 Returns the width of frames in a video stream. |
|
312 |
|
313 \sa frameSize(), frameHeight() |
|
314 */ |
|
315 |
|
316 int QVideoSurfaceFormat::frameWidth() const |
|
317 { |
|
318 return d->frameSize.width(); |
|
319 } |
|
320 |
|
321 /*! |
|
322 Returns the height of frame in a video stream. |
|
323 */ |
|
324 |
|
325 int QVideoSurfaceFormat::frameHeight() const |
|
326 { |
|
327 return d->frameSize.height(); |
|
328 } |
|
329 |
|
330 /*! |
|
331 Sets the size of frames in a video stream to \a size. |
|
332 |
|
333 This will reset the viewport() to fill the entire frame. |
|
334 */ |
|
335 |
|
336 void QVideoSurfaceFormat::setFrameSize(const QSize &size) |
|
337 { |
|
338 d->frameSize = size; |
|
339 d->viewport = QRect(QPoint(0, 0), size); |
|
340 } |
|
341 |
|
342 /*! |
|
343 \overload |
|
344 |
|
345 Sets the \a width and \a height of frames in a video stream. |
|
346 |
|
347 This will reset the viewport() to fill the entire frame. |
|
348 */ |
|
349 |
|
350 void QVideoSurfaceFormat::setFrameSize(int width, int height) |
|
351 { |
|
352 d->frameSize = QSize(width, height); |
|
353 d->viewport = QRect(0, 0, width, height); |
|
354 } |
|
355 |
|
356 /*! |
|
357 Returns the viewport of a video stream. |
|
358 |
|
359 The viewport is the region of a video frame that is actually displayed. |
|
360 |
|
361 By default the viewport covers an entire frame. |
|
362 */ |
|
363 |
|
364 QRect QVideoSurfaceFormat::viewport() const |
|
365 { |
|
366 return d->viewport; |
|
367 } |
|
368 |
|
369 /*! |
|
370 Sets the viewport of a video stream to \a viewport. |
|
371 */ |
|
372 |
|
373 void QVideoSurfaceFormat::setViewport(const QRect &viewport) |
|
374 { |
|
375 d->viewport = viewport; |
|
376 } |
|
377 |
|
378 /*! |
|
379 Returns the direction of scan lines. |
|
380 */ |
|
381 |
|
382 QVideoSurfaceFormat::Direction QVideoSurfaceFormat::scanLineDirection() const |
|
383 { |
|
384 return d->scanLineDirection; |
|
385 } |
|
386 |
|
387 /*! |
|
388 Sets the \a direction of scan lines. |
|
389 */ |
|
390 |
|
391 void QVideoSurfaceFormat::setScanLineDirection(Direction direction) |
|
392 { |
|
393 d->scanLineDirection = direction; |
|
394 } |
|
395 |
|
396 /*! |
|
397 Returns the frame rate of a video stream in frames per second. |
|
398 */ |
|
399 |
|
400 qreal QVideoSurfaceFormat::frameRate() const |
|
401 { |
|
402 return d->frameRate; |
|
403 } |
|
404 |
|
405 /*! |
|
406 Sets the frame \a rate of a video stream in frames per second. |
|
407 */ |
|
408 |
|
409 void QVideoSurfaceFormat::setFrameRate(qreal rate) |
|
410 { |
|
411 d->frameRate = rate; |
|
412 } |
|
413 |
|
414 /*! |
|
415 Returns a video stream's pixel aspect ratio. |
|
416 */ |
|
417 |
|
418 QSize QVideoSurfaceFormat::pixelAspectRatio() const |
|
419 { |
|
420 return d->pixelAspectRatio; |
|
421 } |
|
422 |
|
423 /*! |
|
424 Sets a video stream's pixel aspect \a ratio. |
|
425 */ |
|
426 |
|
427 void QVideoSurfaceFormat::setPixelAspectRatio(const QSize &ratio) |
|
428 { |
|
429 d->pixelAspectRatio = ratio; |
|
430 } |
|
431 |
|
432 /*! |
|
433 \overload |
|
434 |
|
435 Sets the \a horizontal and \a vertical elements of a video stream's pixel aspect ratio. |
|
436 */ |
|
437 |
|
438 void QVideoSurfaceFormat::setPixelAspectRatio(int horizontal, int vertical) |
|
439 { |
|
440 d->pixelAspectRatio = QSize(horizontal, vertical); |
|
441 } |
|
442 |
|
443 /*! |
|
444 Returns the Y'CbCr color space of a video stream. |
|
445 */ |
|
446 |
|
447 QVideoSurfaceFormat::YCbCrColorSpace QVideoSurfaceFormat::yCbCrColorSpace() const |
|
448 { |
|
449 return d->ycbcrColorSpace; |
|
450 } |
|
451 |
|
452 /*! |
|
453 Sets the Y'CbCr color \a space of a video stream. |
|
454 It is only used with raw YUV frame types. |
|
455 */ |
|
456 |
|
457 void QVideoSurfaceFormat::setYCbCrColorSpace(QVideoSurfaceFormat::YCbCrColorSpace space) |
|
458 { |
|
459 d->ycbcrColorSpace = space; |
|
460 } |
|
461 |
|
462 /*! |
|
463 Returns a suggested size in pixels for the video stream. |
|
464 |
|
465 This is the size of the viewport scaled according to the pixel aspect ratio. |
|
466 */ |
|
467 |
|
468 QSize QVideoSurfaceFormat::sizeHint() const |
|
469 { |
|
470 QSize size = d->viewport.size(); |
|
471 |
|
472 if (d->pixelAspectRatio.height() != 0) |
|
473 size.setWidth(size.width() * d->pixelAspectRatio.width() / d->pixelAspectRatio.height()); |
|
474 |
|
475 return size; |
|
476 } |
|
477 |
|
478 /*! |
|
479 Returns a list of video format dynamic property names. |
|
480 */ |
|
481 |
|
482 QList<QByteArray> QVideoSurfaceFormat::propertyNames() const |
|
483 { |
|
484 return (QList<QByteArray>() |
|
485 << "handleType" |
|
486 << "pixelFormat" |
|
487 << "frameSize" |
|
488 << "frameWidth" |
|
489 << "viewport" |
|
490 << "scanLineDirection" |
|
491 << "frameRate" |
|
492 << "pixelAspectRatio" |
|
493 << "sizeHint" |
|
494 << "yCbCrColorSpace") |
|
495 + d->propertyNames; |
|
496 } |
|
497 |
|
498 /*! |
|
499 Returns the value of the video format's \a name property. |
|
500 */ |
|
501 |
|
502 QVariant QVideoSurfaceFormat::property(const char *name) const |
|
503 { |
|
504 if (qstrcmp(name, "handleType") == 0) { |
|
505 return qVariantFromValue(d->handleType); |
|
506 } else if (qstrcmp(name, "pixelFormat") == 0) { |
|
507 return qVariantFromValue(d->pixelFormat); |
|
508 } else if (qstrcmp(name, "handleType") == 0) { |
|
509 return qVariantFromValue(d->handleType); |
|
510 } else if (qstrcmp(name, "frameSize") == 0) { |
|
511 return d->frameSize; |
|
512 } else if (qstrcmp(name, "frameWidth") == 0) { |
|
513 return d->frameSize.width(); |
|
514 } else if (qstrcmp(name, "frameHeight") == 0) { |
|
515 return d->frameSize.height(); |
|
516 } else if (qstrcmp(name, "viewport") == 0) { |
|
517 return d->viewport; |
|
518 } else if (qstrcmp(name, "scanLineDirection") == 0) { |
|
519 return qVariantFromValue(d->scanLineDirection); |
|
520 } else if (qstrcmp(name, "frameRate") == 0) { |
|
521 return qVariantFromValue(d->frameRate); |
|
522 } else if (qstrcmp(name, "pixelAspectRatio") == 0) { |
|
523 return qVariantFromValue(d->pixelAspectRatio); |
|
524 } else if (qstrcmp(name, "sizeHint") == 0) { |
|
525 return sizeHint(); |
|
526 } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { |
|
527 return qVariantFromValue(d->ycbcrColorSpace); |
|
528 } else { |
|
529 int id = 0; |
|
530 for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} |
|
531 |
|
532 return id < d->propertyValues.count() |
|
533 ? d->propertyValues.at(id) |
|
534 : QVariant(); |
|
535 } |
|
536 } |
|
537 |
|
538 /*! |
|
539 Sets the video format's \a name property to \a value. |
|
540 */ |
|
541 |
|
542 void QVideoSurfaceFormat::setProperty(const char *name, const QVariant &value) |
|
543 { |
|
544 if (qstrcmp(name, "handleType") == 0) { |
|
545 // read only. |
|
546 } else if (qstrcmp(name, "pixelFormat") == 0) { |
|
547 // read only. |
|
548 } else if (qstrcmp(name, "frameSize") == 0) { |
|
549 if (qVariantCanConvert<QSize>(value)) { |
|
550 d->frameSize = qvariant_cast<QSize>(value); |
|
551 d->viewport = QRect(QPoint(0, 0), d->frameSize); |
|
552 } |
|
553 } else if (qstrcmp(name, "frameWidth") == 0) { |
|
554 // read only. |
|
555 } else if (qstrcmp(name, "frameHeight") == 0) { |
|
556 // read only. |
|
557 } else if (qstrcmp(name, "viewport") == 0) { |
|
558 if (qVariantCanConvert<QRect>(value)) |
|
559 d->viewport = qvariant_cast<QRect>(value); |
|
560 } else if (qstrcmp(name, "scanLineDirection") == 0) { |
|
561 if (qVariantCanConvert<Direction>(value)) |
|
562 d->scanLineDirection = qvariant_cast<Direction>(value); |
|
563 } else if (qstrcmp(name, "frameRate") == 0) { |
|
564 if (qVariantCanConvert<qreal>(value)) |
|
565 d->frameRate = qvariant_cast<qreal>(value); |
|
566 } else if (qstrcmp(name, "pixelAspectRatio") == 0) { |
|
567 if (qVariantCanConvert<QSize>(value)) |
|
568 d->pixelAspectRatio = qvariant_cast<QSize>(value); |
|
569 } else if (qstrcmp(name, "sizeHint") == 0) { |
|
570 // read only. |
|
571 } else if (qstrcmp(name, "yCbCrColorSpace") == 0) { |
|
572 if (qVariantCanConvert<YCbCrColorSpace>(value)) |
|
573 d->ycbcrColorSpace = qvariant_cast<YCbCrColorSpace>(value); |
|
574 } else { |
|
575 int id = 0; |
|
576 for (; id < d->propertyNames.count() && d->propertyNames.at(id) != name; ++id) {} |
|
577 |
|
578 if (id < d->propertyValues.count()) { |
|
579 if (value.isNull()) { |
|
580 d->propertyNames.removeAt(id); |
|
581 d->propertyValues.removeAt(id); |
|
582 } else { |
|
583 d->propertyValues[id] = value; |
|
584 } |
|
585 } else if (!value.isNull()) { |
|
586 d->propertyNames.append(QByteArray(name)); |
|
587 d->propertyValues.append(value); |
|
588 } |
|
589 } |
|
590 } |
|
591 |
|
592 |
|
593 #ifndef QT_NO_DEBUG_STREAM |
|
594 QDebug operator<<(QDebug dbg, const QVideoSurfaceFormat &f) |
|
595 { |
|
596 QString typeName; |
|
597 switch (f.pixelFormat()) { |
|
598 case QVideoFrame::Format_Invalid: |
|
599 typeName = QLatin1String("Format_Invalid"); |
|
600 break; |
|
601 case QVideoFrame::Format_ARGB32: |
|
602 typeName = QLatin1String("Format_ARGB32"); |
|
603 break; |
|
604 case QVideoFrame::Format_ARGB32_Premultiplied: |
|
605 typeName = QLatin1String("Format_ARGB32_Premultiplied"); |
|
606 break; |
|
607 case QVideoFrame::Format_RGB32: |
|
608 typeName = QLatin1String("Format_RGB32"); |
|
609 break; |
|
610 case QVideoFrame::Format_RGB24: |
|
611 typeName = QLatin1String("Format_RGB24"); |
|
612 break; |
|
613 case QVideoFrame::Format_RGB565: |
|
614 typeName = QLatin1String("Format_RGB565"); |
|
615 break; |
|
616 case QVideoFrame::Format_RGB555: |
|
617 typeName = QLatin1String("Format_RGB555"); |
|
618 break; |
|
619 case QVideoFrame::Format_ARGB8565_Premultiplied: |
|
620 typeName = QLatin1String("Format_ARGB8565_Premultiplied"); |
|
621 break; |
|
622 case QVideoFrame::Format_BGRA32: |
|
623 typeName = QLatin1String("Format_BGRA32"); |
|
624 break; |
|
625 case QVideoFrame::Format_BGRA32_Premultiplied: |
|
626 typeName = QLatin1String("Format_BGRA32_Premultiplied"); |
|
627 break; |
|
628 case QVideoFrame::Format_BGR32: |
|
629 typeName = QLatin1String("Format_BGR32"); |
|
630 break; |
|
631 case QVideoFrame::Format_BGR24: |
|
632 typeName = QLatin1String("Format_BGR24"); |
|
633 break; |
|
634 case QVideoFrame::Format_BGR565: |
|
635 typeName = QLatin1String("Format_BGR565"); |
|
636 break; |
|
637 case QVideoFrame::Format_BGR555: |
|
638 typeName = QLatin1String("Format_BGR555"); |
|
639 break; |
|
640 case QVideoFrame::Format_BGRA5658_Premultiplied: |
|
641 typeName = QLatin1String("Format_BGRA5658_Premultiplied"); |
|
642 break; |
|
643 case QVideoFrame::Format_AYUV444: |
|
644 typeName = QLatin1String("Format_AYUV444"); |
|
645 break; |
|
646 case QVideoFrame::Format_AYUV444_Premultiplied: |
|
647 typeName = QLatin1String("Format_AYUV444_Premultiplied"); |
|
648 break; |
|
649 case QVideoFrame::Format_YUV444: |
|
650 typeName = QLatin1String("Format_YUV444"); |
|
651 break; |
|
652 case QVideoFrame::Format_YUV420P: |
|
653 typeName = QLatin1String("Format_YUV420P"); |
|
654 break; |
|
655 case QVideoFrame::Format_YV12: |
|
656 typeName = QLatin1String("Format_YV12"); |
|
657 break; |
|
658 case QVideoFrame::Format_UYVY: |
|
659 typeName = QLatin1String("Format_UYVY"); |
|
660 break; |
|
661 case QVideoFrame::Format_YUYV: |
|
662 typeName = QLatin1String("Format_YUYV"); |
|
663 break; |
|
664 case QVideoFrame::Format_NV12: |
|
665 typeName = QLatin1String("Format_NV12"); |
|
666 break; |
|
667 case QVideoFrame::Format_NV21: |
|
668 typeName = QLatin1String("Format_NV21"); |
|
669 break; |
|
670 case QVideoFrame::Format_IMC1: |
|
671 typeName = QLatin1String("Format_IMC1"); |
|
672 break; |
|
673 case QVideoFrame::Format_IMC2: |
|
674 typeName = QLatin1String("Format_IMC2"); |
|
675 break; |
|
676 case QVideoFrame::Format_IMC3: |
|
677 typeName = QLatin1String("Format_IMC3"); |
|
678 break; |
|
679 case QVideoFrame::Format_IMC4: |
|
680 typeName = QLatin1String("Format_IMC4"); |
|
681 break; |
|
682 case QVideoFrame::Format_Y8: |
|
683 typeName = QLatin1String("Format_Y8"); |
|
684 break; |
|
685 case QVideoFrame::Format_Y16: |
|
686 typeName = QLatin1String("Format_Y16"); |
|
687 default: |
|
688 typeName = QString(QLatin1String("UserType(%1)" )).arg(int(f.pixelFormat())); |
|
689 } |
|
690 |
|
691 dbg.nospace() << "QVideoSurfaceFormat(" << typeName; |
|
692 dbg.nospace() << ", " << f.frameSize(); |
|
693 dbg.nospace() << ", viewport=" << f.viewport(); |
|
694 dbg.nospace() << ", pixelAspectRatio=" << f.pixelAspectRatio(); |
|
695 dbg.nospace() << ")"; |
|
696 |
|
697 foreach(const QByteArray& propertyName, f.propertyNames()) |
|
698 dbg << "\n " << propertyName.data() << " = " << f.property(propertyName.data()); |
|
699 |
|
700 return dbg.space(); |
|
701 } |
|
702 #endif |
|
703 |
|
704 QT_END_NAMESPACE |