1 /**************************************************************************** |
|
2 ** |
|
3 ** Copyright (C) 2009 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 "s60cameraimageencodercontrol.h" |
|
43 #include "s60camerasession.h" |
|
44 |
|
45 #include <QtCore/qdebug.h> |
|
46 #include <QtCore/qstring.h> |
|
47 |
|
48 S60CameraImageEncoderControl::S60CameraImageEncoderControl(QObject *parent) |
|
49 :QImageEncoderControl(parent) |
|
50 { |
|
51 } |
|
52 |
|
53 S60CameraImageEncoderControl::S60CameraImageEncoderControl(QObject *session, QObject *parent) |
|
54 :QImageEncoderControl(parent) |
|
55 { |
|
56 m_session = qobject_cast<S60CameraSession*>(session); |
|
57 } |
|
58 |
|
59 S60CameraImageEncoderControl::~S60CameraImageEncoderControl() |
|
60 { |
|
61 } |
|
62 |
|
63 QList<QSize> S60CameraImageEncoderControl::supportedResolutions( |
|
64 const QImageEncoderSettings &settings, bool *continuous) const |
|
65 { |
|
66 // we support arbitary resolutions. they are converted to nearest real resolution |
|
67 *continuous = true; |
|
68 |
|
69 QList<QSize> resolutions; |
|
70 if (m_session) |
|
71 resolutions = m_session->supportedCaptureSizesForCodec(settings.codec()); |
|
72 return resolutions; |
|
73 } |
|
74 QStringList S60CameraImageEncoderControl::supportedImageCodecs() const |
|
75 { |
|
76 QStringList codecs; |
|
77 if (m_session) |
|
78 codecs = m_session->supportedImageCaptureCodecs(); |
|
79 return codecs; |
|
80 } |
|
81 |
|
82 QString S60CameraImageEncoderControl::imageCodecDescription(const QString &codecName) const |
|
83 { |
|
84 QString codecDesc; |
|
85 if (m_session) |
|
86 codecDesc = m_session->imageCaptureCodecDescription(codecName); |
|
87 return codecDesc; |
|
88 } |
|
89 |
|
90 QImageEncoderSettings S60CameraImageEncoderControl::imageSettings() const |
|
91 { |
|
92 return m_imageEncoderSettings; |
|
93 } |
|
94 void S60CameraImageEncoderControl::setImageSettings(const QImageEncoderSettings &settings) |
|
95 { |
|
96 m_imageEncoderSettings = settings; |
|
97 if (m_session && !settings.isNull()) { |
|
98 // set codec first as optiomal capturesize is decided based on chosen codec |
|
99 m_session->setImageCaptureCodec(m_imageEncoderSettings.codec()); |
|
100 m_session->setCaptureSize(m_imageEncoderSettings.resolution()); |
|
101 m_session->setCaptureQuality(m_imageEncoderSettings.quality()); |
|
102 //update setting |
|
103 m_session->updateImageCaptureCodecs(); |
|
104 } |
|
105 } |
|
106 |
|
107 //QSize S60CameraImageEncoderControl::resolution() const |
|
108 //{ |
|
109 // QSize resolution; |
|
110 // if (m_session) |
|
111 // resolution = m_session->captureSize(); |
|
112 // return resolution; |
|
113 //} |
|
114 //QSize S60CameraImageEncoderControl::minimumResolution() const |
|
115 //{ |
|
116 // QSize resolution; |
|
117 // if (m_session) |
|
118 // resolution = m_session->minimumCaptureSize(); |
|
119 // return resolution; |
|
120 //} |
|
121 //QSize S60CameraImageEncoderControl::maximumResolution() const |
|
122 //{ |
|
123 // QSize resolution; |
|
124 // if (m_session) |
|
125 // resolution = m_session->maximumCaptureSize(); |
|
126 // return resolution; |
|
127 //} |
|
128 // |
|
129 //QtMedia::EncodingQuality S60CameraImageEncoderControl::quality() const |
|
130 //{ |
|
131 // //TODO: what is the quality if no session is available? |
|
132 // int quality = KErrNotFound; |
|
133 // if (m_session) |
|
134 // quality = m_session->captureQuality(); |
|
135 // return (QtMedia::EncodingQuality) quality; |
|
136 //} |
|
137 // |
|
138 //QString S60CameraImageEncoderControl::imageCodec() const |
|
139 //{ |
|
140 // QString codec; |
|
141 // if (m_session) |
|
142 // codec = m_session->imageCaptureCodec(); |
|
143 // return codec; |
|
144 //} |
|