|
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 "qmediaencodersettings.h" |
|
43 |
|
44 QT_BEGIN_NAMESPACE |
|
45 |
|
46 class QAudioEncoderSettingsPrivate : public QSharedData |
|
47 { |
|
48 public: |
|
49 QAudioEncoderSettingsPrivate() : |
|
50 isNull(true), |
|
51 encodingMode(QtMultimediaKit::ConstantQualityEncoding), |
|
52 bitrate(-1), |
|
53 sampleRate(-1), |
|
54 channels(-1), |
|
55 quality(QtMultimediaKit::NormalQuality) |
|
56 { |
|
57 } |
|
58 |
|
59 QAudioEncoderSettingsPrivate(const QAudioEncoderSettingsPrivate &other): |
|
60 QSharedData(other), |
|
61 isNull(other.isNull), |
|
62 encodingMode(other.encodingMode), |
|
63 codec(other.codec), |
|
64 bitrate(other.bitrate), |
|
65 sampleRate(other.sampleRate), |
|
66 channels(other.channels), |
|
67 quality(other.quality) |
|
68 { |
|
69 } |
|
70 |
|
71 bool isNull; |
|
72 QtMultimediaKit::EncodingMode encodingMode; |
|
73 QString codec; |
|
74 int bitrate; |
|
75 int sampleRate; |
|
76 int channels; |
|
77 QtMultimediaKit::EncodingQuality quality; |
|
78 |
|
79 private: |
|
80 QAudioEncoderSettingsPrivate& operator=(const QAudioEncoderSettingsPrivate &other); |
|
81 }; |
|
82 |
|
83 /*! |
|
84 \class QAudioEncoderSettings |
|
85 \preliminary |
|
86 \brief The QAudioEncoderSettings class provides a set of audio encoder settings. |
|
87 |
|
88 \ingroup multimedia |
|
89 |
|
90 A audio encoder settings object is used to specify the audio encoder |
|
91 settings used by QMediaRecorder. Audio encoder settings are selected by |
|
92 constructing a QAudioEncoderSettings object, setting the desired properties |
|
93 and then passing it to a QMediaRecorder instance using the |
|
94 QMediaRecorder::setEncodingSettings() function. |
|
95 |
|
96 \code |
|
97 QAudioEncoderSettings audioSettings; |
|
98 audioSettings.setCodec("audio/mpeg"); |
|
99 audioSettings.setChannelCount(2); |
|
100 |
|
101 recorder->setEncodingSettings(audioSettings); |
|
102 \endcode |
|
103 |
|
104 \sa QMediaRecorder, QAudioEncoderControl |
|
105 */ |
|
106 |
|
107 /*! |
|
108 Construct a null audio encoder settings object. |
|
109 */ |
|
110 QAudioEncoderSettings::QAudioEncoderSettings() |
|
111 :d(new QAudioEncoderSettingsPrivate) |
|
112 { |
|
113 } |
|
114 |
|
115 /*! |
|
116 Constructs a copy of the audio encoder settings object \a other. |
|
117 */ |
|
118 |
|
119 QAudioEncoderSettings::QAudioEncoderSettings(const QAudioEncoderSettings& other) |
|
120 :d(other.d) |
|
121 { |
|
122 } |
|
123 |
|
124 /*! |
|
125 Destroys an audio encoder settings object. |
|
126 */ |
|
127 |
|
128 QAudioEncoderSettings::~QAudioEncoderSettings() |
|
129 { |
|
130 } |
|
131 |
|
132 /*! |
|
133 Assigns the value of \a other to an audio encoder settings object. |
|
134 */ |
|
135 |
|
136 QAudioEncoderSettings& QAudioEncoderSettings::operator=(const QAudioEncoderSettings &other) |
|
137 { |
|
138 d = other.d; |
|
139 return *this; |
|
140 } |
|
141 |
|
142 /*! |
|
143 Determines if \a other is of equal value to an audio encoder settings |
|
144 object. |
|
145 |
|
146 Returns true if the settings objects are of equal value, and false if they |
|
147 are not of equal value. |
|
148 */ |
|
149 |
|
150 bool QAudioEncoderSettings::operator==(const QAudioEncoderSettings &other) const |
|
151 { |
|
152 return (d == other.d) || |
|
153 (d->isNull == other.d->isNull && |
|
154 d->encodingMode == other.d->encodingMode && |
|
155 d->bitrate == other.d->bitrate && |
|
156 d->sampleRate == other.d->sampleRate && |
|
157 d->channels == other.d->channels && |
|
158 d->quality == other.d->quality && |
|
159 d->codec == other.d->codec); |
|
160 } |
|
161 |
|
162 /*! |
|
163 Determines if \a other is of equal value to an audio encoder settings |
|
164 object. |
|
165 |
|
166 Returns true if the settings objects are not of equal value, and true if |
|
167 they are of equal value. |
|
168 */ |
|
169 |
|
170 bool QAudioEncoderSettings::operator!=(const QAudioEncoderSettings &other) const |
|
171 { |
|
172 return !(*this == other); |
|
173 } |
|
174 |
|
175 /*! |
|
176 Identifies if an audio settings object is initialized. |
|
177 |
|
178 Returns true if the settings object is null, and false if it is not. |
|
179 */ |
|
180 |
|
181 bool QAudioEncoderSettings::isNull() const |
|
182 { |
|
183 return d->isNull; |
|
184 } |
|
185 |
|
186 /*! |
|
187 Returns the audio encoding mode. |
|
188 |
|
189 \sa QtMultimediaKit::EncodingMode |
|
190 */ |
|
191 QtMultimediaKit::EncodingMode QAudioEncoderSettings::encodingMode() const |
|
192 { |
|
193 return d->encodingMode; |
|
194 } |
|
195 |
|
196 /*! |
|
197 Sets the audio encoding \a mode setting. |
|
198 |
|
199 If QtMultimediaKit::ConstantQualityEncoding is set, the quality |
|
200 encoding parameter is used and bit rate is ignored, |
|
201 otherwise the bitrate is used. |
|
202 |
|
203 The audio codec, channels count and sample rate settings are used in all |
|
204 the encoding modes. |
|
205 |
|
206 \sa encodingMode(), QtMultimediaKit::EncodingMode |
|
207 */ |
|
208 void QAudioEncoderSettings::setEncodingMode(QtMultimediaKit::EncodingMode mode) |
|
209 { |
|
210 d->encodingMode = mode; |
|
211 } |
|
212 |
|
213 /*! |
|
214 Returns the audio codec. |
|
215 */ |
|
216 QString QAudioEncoderSettings::codec() const |
|
217 { |
|
218 return d->codec; |
|
219 } |
|
220 |
|
221 /*! |
|
222 Sets the audio \a codec. |
|
223 */ |
|
224 void QAudioEncoderSettings::setCodec(const QString& codec) |
|
225 { |
|
226 d->isNull = false; |
|
227 d->codec = codec; |
|
228 } |
|
229 |
|
230 /*! |
|
231 Returns the bit rate of the compressed audio stream in bits per second. |
|
232 */ |
|
233 int QAudioEncoderSettings::bitRate() const |
|
234 { |
|
235 return d->bitrate; |
|
236 } |
|
237 |
|
238 /*! |
|
239 Returns the number of audio channels. |
|
240 */ |
|
241 int QAudioEncoderSettings::channelCount() const |
|
242 { |
|
243 return d->channels; |
|
244 } |
|
245 |
|
246 /*! |
|
247 Sets the number of audio \a channels. |
|
248 |
|
249 A value of -1 indicates the encoder should make an optimal choice based on |
|
250 what is available from the audio source and the limitations of the codec. |
|
251 */ |
|
252 void QAudioEncoderSettings::setChannelCount(int channels) |
|
253 { |
|
254 d->isNull = false; |
|
255 d->channels = channels; |
|
256 } |
|
257 |
|
258 /*! |
|
259 Sets the audio bit \a rate in bits per second. |
|
260 */ |
|
261 void QAudioEncoderSettings::setBitRate(int rate) |
|
262 { |
|
263 d->isNull = false; |
|
264 d->bitrate = rate; |
|
265 } |
|
266 |
|
267 /*! |
|
268 Returns the audio sample rate in Hz. |
|
269 */ |
|
270 int QAudioEncoderSettings::sampleRate() const |
|
271 { |
|
272 return d->sampleRate; |
|
273 } |
|
274 |
|
275 /*! |
|
276 Sets the audio sample \a rate in Hz. |
|
277 |
|
278 A value of -1 indicates the encoder should make an optimal choice based on what is avaialbe |
|
279 from the audio source and the limitations of the codec. |
|
280 */ |
|
281 void QAudioEncoderSettings::setSampleRate(int rate) |
|
282 { |
|
283 d->isNull = false; |
|
284 d->sampleRate = rate; |
|
285 } |
|
286 |
|
287 /*! |
|
288 Returns the audio encoding quality. |
|
289 */ |
|
290 |
|
291 QtMultimediaKit::EncodingQuality QAudioEncoderSettings::quality() const |
|
292 { |
|
293 return d->quality; |
|
294 } |
|
295 |
|
296 /*! |
|
297 Set the audio encoding \a quality. |
|
298 |
|
299 Setting the audio quality parameter allows backend to choose the balanced |
|
300 set of encoding parameters to achieve the desired quality level. |
|
301 |
|
302 The \a quality settings parameter is only used in the |
|
303 \l {QtMultimediaKit::ConstantQualityEncoding}{constant quality} \l{encodingMode()}{encoding mode}. |
|
304 */ |
|
305 void QAudioEncoderSettings::setQuality(QtMultimediaKit::EncodingQuality quality) |
|
306 { |
|
307 d->isNull = false; |
|
308 d->quality = quality; |
|
309 } |
|
310 |
|
311 class QVideoEncoderSettingsPrivate : public QSharedData |
|
312 { |
|
313 public: |
|
314 QVideoEncoderSettingsPrivate() : |
|
315 isNull(true), |
|
316 encodingMode(QtMultimediaKit::ConstantQualityEncoding), |
|
317 bitrate(-1), |
|
318 frameRate(0), |
|
319 quality(QtMultimediaKit::NormalQuality) |
|
320 { |
|
321 } |
|
322 |
|
323 QVideoEncoderSettingsPrivate(const QVideoEncoderSettingsPrivate &other): |
|
324 QSharedData(other), |
|
325 isNull(other.isNull), |
|
326 encodingMode(other.encodingMode), |
|
327 codec(other.codec), |
|
328 bitrate(other.bitrate), |
|
329 resolution(other.resolution), |
|
330 frameRate(other.frameRate), |
|
331 quality(other.quality) |
|
332 { |
|
333 } |
|
334 |
|
335 bool isNull; |
|
336 QtMultimediaKit::EncodingMode encodingMode; |
|
337 QString codec; |
|
338 int bitrate; |
|
339 QSize resolution; |
|
340 qreal frameRate; |
|
341 QtMultimediaKit::EncodingQuality quality; |
|
342 |
|
343 private: |
|
344 QVideoEncoderSettingsPrivate& operator=(const QVideoEncoderSettingsPrivate &other); |
|
345 }; |
|
346 |
|
347 /*! |
|
348 \class QVideoEncoderSettings |
|
349 \preliminary |
|
350 \brief The QVideoEncoderSettings class provides a set of video encoder settings. |
|
351 |
|
352 A video encoder settings object is used to specify the video encoder |
|
353 settings used by QMediaRecorder. Video encoder settings are selected by |
|
354 constructing a QVideoEncoderSettings object, setting the desired properties |
|
355 and then passing it to a QMediaRecorder instance using the |
|
356 QMediaRecorder::setEncodingSettings() function. |
|
357 |
|
358 \code |
|
359 QVideoEncoderSettings videoSettings; |
|
360 videoSettings.setCodec("video/mpeg2"); |
|
361 videoSettings.setResolution(640, 480); |
|
362 |
|
363 recorder->setEncodingSettings(audioSettings, videoSettings); |
|
364 \endcode |
|
365 |
|
366 \sa QMediaRecorder, QVideoEncoderControl |
|
367 */ |
|
368 |
|
369 /*! |
|
370 Constructs a null video encoder settings object. |
|
371 */ |
|
372 |
|
373 QVideoEncoderSettings::QVideoEncoderSettings() |
|
374 :d(new QVideoEncoderSettingsPrivate) |
|
375 { |
|
376 } |
|
377 |
|
378 /*! |
|
379 Constructs a copy of the video encoder settings object \a other. |
|
380 */ |
|
381 |
|
382 QVideoEncoderSettings::QVideoEncoderSettings(const QVideoEncoderSettings& other) |
|
383 :d(other.d) |
|
384 { |
|
385 } |
|
386 |
|
387 /*! |
|
388 Destroys a video encoder settings object. |
|
389 */ |
|
390 |
|
391 QVideoEncoderSettings::~QVideoEncoderSettings() |
|
392 { |
|
393 } |
|
394 |
|
395 /*! |
|
396 Assigns the value of \a other to a video encoder settings object. |
|
397 */ |
|
398 QVideoEncoderSettings &QVideoEncoderSettings::operator=(const QVideoEncoderSettings &other) |
|
399 { |
|
400 d = other.d; |
|
401 return *this; |
|
402 } |
|
403 |
|
404 /*! |
|
405 Determines if \a other is of equal value to a video encoder settings object. |
|
406 |
|
407 Returns true if the settings objects are of equal value, and false if they |
|
408 are not of equal value. |
|
409 */ |
|
410 bool QVideoEncoderSettings::operator==(const QVideoEncoderSettings &other) const |
|
411 { |
|
412 return (d == other.d) || |
|
413 (d->isNull == other.d->isNull && |
|
414 d->encodingMode == other.d->encodingMode && |
|
415 d->bitrate == other.d->bitrate && |
|
416 d->quality == other.d->quality && |
|
417 d->codec == other.d->codec && |
|
418 d->resolution == other.d->resolution && |
|
419 qFuzzyCompare(d->frameRate, other.d->frameRate)); |
|
420 } |
|
421 |
|
422 /*! |
|
423 Determines if \a other is of equal value to a video encoder settings object. |
|
424 |
|
425 Returns true if the settings objects are not of equal value, and false if |
|
426 they are of equal value. |
|
427 */ |
|
428 bool QVideoEncoderSettings::operator!=(const QVideoEncoderSettings &other) const |
|
429 { |
|
430 return !(*this == other); |
|
431 } |
|
432 |
|
433 /*! |
|
434 Identifies if a video encoder settings object is uninitalized. |
|
435 |
|
436 Returns true if the settings are null, and false if they are not. |
|
437 */ |
|
438 bool QVideoEncoderSettings::isNull() const |
|
439 { |
|
440 return d->isNull; |
|
441 } |
|
442 |
|
443 /*! |
|
444 Returns the video encoding mode. |
|
445 |
|
446 \sa QtMultimediaKit::EncodingMode |
|
447 */ |
|
448 QtMultimediaKit::EncodingMode QVideoEncoderSettings::encodingMode() const |
|
449 { |
|
450 return d->encodingMode; |
|
451 } |
|
452 |
|
453 /*! |
|
454 Sets the video encoding \a mode. |
|
455 |
|
456 If QtMultimediaKit::ConstantQualityEncoding is set, |
|
457 the quality encoding parameter is used and bit rate is ignored, |
|
458 otherwise the bitrate is used. |
|
459 |
|
460 The rest of encoding settings are respected regardless of encoding mode. |
|
461 |
|
462 \sa QtMultimediaKit::EncodingMode |
|
463 */ |
|
464 void QVideoEncoderSettings::setEncodingMode(QtMultimediaKit::EncodingMode mode) |
|
465 { |
|
466 d->isNull = false; |
|
467 d->encodingMode = mode; |
|
468 } |
|
469 |
|
470 /*! |
|
471 Returns the video codec. |
|
472 */ |
|
473 |
|
474 QString QVideoEncoderSettings::codec() const |
|
475 { |
|
476 return d->codec; |
|
477 } |
|
478 |
|
479 /*! |
|
480 Sets the video \a codec. |
|
481 */ |
|
482 void QVideoEncoderSettings::setCodec(const QString& codec) |
|
483 { |
|
484 d->isNull = false; |
|
485 d->codec = codec; |
|
486 } |
|
487 |
|
488 /*! |
|
489 Returns bit rate of the encoded video stream in bits per second. |
|
490 */ |
|
491 int QVideoEncoderSettings::bitRate() const |
|
492 { |
|
493 return d->bitrate; |
|
494 } |
|
495 |
|
496 /*! |
|
497 Sets the bit rate of the encoded video stream to \a value. |
|
498 */ |
|
499 |
|
500 void QVideoEncoderSettings::setBitRate(int value) |
|
501 { |
|
502 d->isNull = false; |
|
503 d->bitrate = value; |
|
504 } |
|
505 |
|
506 /*! |
|
507 Returns the video frame rate. |
|
508 */ |
|
509 qreal QVideoEncoderSettings::frameRate() const |
|
510 { |
|
511 return d->frameRate; |
|
512 } |
|
513 |
|
514 /*! |
|
515 \fn QVideoEncoderSettings::setFrameRate(qreal rate) |
|
516 |
|
517 Sets the video frame \a rate. |
|
518 |
|
519 A value of 0 indicates the encoder should make an optimal choice based on what is available |
|
520 from the video source and the limitations of the codec. |
|
521 */ |
|
522 |
|
523 void QVideoEncoderSettings::setFrameRate(qreal rate) |
|
524 { |
|
525 d->isNull = false; |
|
526 d->frameRate = rate; |
|
527 } |
|
528 |
|
529 /*! |
|
530 Returns the resolution of the encoded video. |
|
531 */ |
|
532 |
|
533 QSize QVideoEncoderSettings::resolution() const |
|
534 { |
|
535 return d->resolution; |
|
536 } |
|
537 |
|
538 /*! |
|
539 Sets the \a resolution of the encoded video. |
|
540 |
|
541 An empty QSize indicates the encoder should make an optimal choice based on |
|
542 what is available from the video source and the limitations of the codec. |
|
543 */ |
|
544 |
|
545 void QVideoEncoderSettings::setResolution(const QSize &resolution) |
|
546 { |
|
547 d->isNull = false; |
|
548 d->resolution = resolution; |
|
549 } |
|
550 |
|
551 /*! |
|
552 Sets the \a width and \a height of the resolution of the encoded video. |
|
553 |
|
554 \overload |
|
555 */ |
|
556 |
|
557 void QVideoEncoderSettings::setResolution(int width, int height) |
|
558 { |
|
559 d->isNull = false; |
|
560 d->resolution = QSize(width, height); |
|
561 } |
|
562 |
|
563 /*! |
|
564 Returns the video encoding quality. |
|
565 */ |
|
566 |
|
567 QtMultimediaKit::EncodingQuality QVideoEncoderSettings::quality() const |
|
568 { |
|
569 return d->quality; |
|
570 } |
|
571 |
|
572 /*! |
|
573 Sets the video encoding \a quality. |
|
574 |
|
575 Setting the video quality parameter allows backend to choose the balanced |
|
576 set of encoding parameters to achieve the desired quality level. |
|
577 |
|
578 The \a quality settings parameter is only used in the |
|
579 \l {QtMultimediaKit::ConstantQualityEncoding}{constant quality} \l{encodingMode()}{encoding mode}. |
|
580 The \a quality settings parameter is only used in the \l |
|
581 {QtMultimediaKit::ConstantQualityEncoding}{constant quality} |
|
582 \l{encodingMode()}{encoding mode}. |
|
583 */ |
|
584 |
|
585 void QVideoEncoderSettings::setQuality(QtMultimediaKit::EncodingQuality quality) |
|
586 { |
|
587 d->isNull = false; |
|
588 d->quality = quality; |
|
589 } |
|
590 |
|
591 |
|
592 |
|
593 class QImageEncoderSettingsPrivate : public QSharedData |
|
594 { |
|
595 public: |
|
596 QImageEncoderSettingsPrivate() : |
|
597 isNull(true), |
|
598 quality(QtMultimediaKit::NormalQuality) |
|
599 { |
|
600 } |
|
601 |
|
602 QImageEncoderSettingsPrivate(const QImageEncoderSettingsPrivate &other): |
|
603 QSharedData(other), |
|
604 isNull(other.isNull), |
|
605 codec(other.codec), |
|
606 resolution(other.resolution), |
|
607 quality(other.quality) |
|
608 { |
|
609 } |
|
610 |
|
611 bool isNull; |
|
612 QString codec; |
|
613 QSize resolution; |
|
614 QtMultimediaKit::EncodingQuality quality; |
|
615 |
|
616 private: |
|
617 QImageEncoderSettingsPrivate& operator=(const QImageEncoderSettingsPrivate &other); |
|
618 }; |
|
619 |
|
620 /*! |
|
621 \class QImageEncoderSettings |
|
622 \preliminary |
|
623 |
|
624 \brief The QImageEncoderSettings class provides a set of image encoder |
|
625 settings. |
|
626 |
|
627 A image encoder settings object is used to specify the image encoder |
|
628 settings used by QStillImageCapture. Image encoder settings are selected |
|
629 by constructing a QImageEncoderSettings object, setting the desired |
|
630 properties and then passing it to a QStillImageCapture instance using the |
|
631 QStillImageCapture::setImageSettings() function. |
|
632 |
|
633 \code |
|
634 QImageEncoderSettings imageSettings; |
|
635 imageSettings.setCodec("image/jpeg"); |
|
636 imageSettings.setResolution(1600, 1200); |
|
637 |
|
638 imageCapture->setImageSettings(imageSettings); |
|
639 \endcode |
|
640 |
|
641 \sa QImageEncoderControl |
|
642 */ |
|
643 |
|
644 /*! |
|
645 Constructs a null image encoder settings object. |
|
646 */ |
|
647 |
|
648 QImageEncoderSettings::QImageEncoderSettings() |
|
649 :d(new QImageEncoderSettingsPrivate) |
|
650 { |
|
651 } |
|
652 |
|
653 /*! |
|
654 Constructs a copy of the image encoder settings object \a other. |
|
655 */ |
|
656 |
|
657 QImageEncoderSettings::QImageEncoderSettings(const QImageEncoderSettings& other) |
|
658 :d(other.d) |
|
659 { |
|
660 } |
|
661 |
|
662 /*! |
|
663 Destroys a image encoder settings object. |
|
664 */ |
|
665 |
|
666 QImageEncoderSettings::~QImageEncoderSettings() |
|
667 { |
|
668 } |
|
669 |
|
670 /*! |
|
671 Assigns the value of \a other to a image encoder settings object. |
|
672 */ |
|
673 QImageEncoderSettings &QImageEncoderSettings::operator=(const QImageEncoderSettings &other) |
|
674 { |
|
675 d = other.d; |
|
676 return *this; |
|
677 } |
|
678 |
|
679 /*! |
|
680 Determines if \a other is of equal value to a image encoder settings |
|
681 object. |
|
682 |
|
683 Returns true if the settings objects are of equal value, and false if they |
|
684 are not of equal value. |
|
685 */ |
|
686 bool QImageEncoderSettings::operator==(const QImageEncoderSettings &other) const |
|
687 { |
|
688 return (d == other.d) || |
|
689 (d->isNull == other.d->isNull && |
|
690 d->quality == other.d->quality && |
|
691 d->codec == other.d->codec && |
|
692 d->resolution == other.d->resolution); |
|
693 |
|
694 } |
|
695 |
|
696 /*! |
|
697 Determines if \a other is of equal value to a image encoder settings |
|
698 object. |
|
699 |
|
700 Returns true if the settings objects are not of equal value, and false if |
|
701 they are of equal value. |
|
702 */ |
|
703 bool QImageEncoderSettings::operator!=(const QImageEncoderSettings &other) const |
|
704 { |
|
705 return !(*this == other); |
|
706 } |
|
707 |
|
708 /*! |
|
709 Identifies if a image encoder settings object is uninitalized. |
|
710 |
|
711 Returns true if the settings are null, and false if they are not. |
|
712 */ |
|
713 bool QImageEncoderSettings::isNull() const |
|
714 { |
|
715 return d->isNull; |
|
716 } |
|
717 |
|
718 /*! |
|
719 Returns the image codec. |
|
720 */ |
|
721 |
|
722 QString QImageEncoderSettings::codec() const |
|
723 { |
|
724 return d->codec; |
|
725 } |
|
726 |
|
727 /*! |
|
728 Sets the image \a codec. |
|
729 */ |
|
730 void QImageEncoderSettings::setCodec(const QString& codec) |
|
731 { |
|
732 d->isNull = false; |
|
733 d->codec = codec; |
|
734 } |
|
735 |
|
736 /*! |
|
737 Returns the resolution of the encoded image. |
|
738 */ |
|
739 |
|
740 QSize QImageEncoderSettings::resolution() const |
|
741 { |
|
742 return d->resolution; |
|
743 } |
|
744 |
|
745 /*! |
|
746 Sets the \a resolution of the encoded image. |
|
747 |
|
748 An empty QSize indicates the encoder should make an optimal choice based on |
|
749 what is available from the image source and the limitations of the codec. |
|
750 */ |
|
751 |
|
752 void QImageEncoderSettings::setResolution(const QSize &resolution) |
|
753 { |
|
754 d->isNull = false; |
|
755 d->resolution = resolution; |
|
756 } |
|
757 |
|
758 /*! |
|
759 Sets the \a width and \a height of the resolution of the encoded image. |
|
760 |
|
761 \overload |
|
762 */ |
|
763 |
|
764 void QImageEncoderSettings::setResolution(int width, int height) |
|
765 { |
|
766 d->isNull = false; |
|
767 d->resolution = QSize(width, height); |
|
768 } |
|
769 |
|
770 /*! |
|
771 Returns the image encoding quality. |
|
772 */ |
|
773 |
|
774 QtMultimediaKit::EncodingQuality QImageEncoderSettings::quality() const |
|
775 { |
|
776 return d->quality; |
|
777 } |
|
778 |
|
779 /*! |
|
780 Sets the image encoding \a quality. |
|
781 */ |
|
782 |
|
783 void QImageEncoderSettings::setQuality(QtMultimediaKit::EncodingQuality quality) |
|
784 { |
|
785 d->isNull = false; |
|
786 d->quality = quality; |
|
787 } |
|
788 QT_END_NAMESPACE |
|
789 |