Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qmediametadata.cpp
Go to the documentation of this file.
1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#include "qmediametadata.h"
5#include <QtCore/qcoreapplication.h>
6#include <qvariant.h>
7#include <qobject.h>
8#include <qdatetime.h>
9#include <qmediaformat.h>
10#include <qsize.h>
11#include <qurl.h>
12#include <qimage.h>
13
15
83{
84 switch (key) {
85 case Title:
86 case Comment:
87 case Description:
88 case Publisher:
89 case Copyright:
90 case MediaType:
91 case AlbumTitle:
92 case AlbumArtist:
93 return QMetaType::fromType<QString>();
94 case Genre:
95 case Author:
97 case Composer:
98 case LeadPerformer:
99 return QMetaType::fromType<QStringList>();
100
101 case Date:
102 return QMetaType::fromType<QDateTime>();
103
104 case Language:
105 return QMetaType::fromType<QLocale::Language>();
106 case Url:
107 return QMetaType::fromType<QUrl>();
108
109 case Duration:
110 return QMetaType::fromType<qint64>();
111 case FileFormat:
112 return QMetaType::fromType<QMediaFormat::FileFormat>();
113
114 case AudioBitRate:
115 case VideoBitRate:
116 case TrackNumber:
117 case Orientation:
118 return QMetaType::fromType<int>();
119 case AudioCodec:
120 return QMetaType::fromType<QMediaFormat::AudioCodec>();
121 case VideoCodec:
122 return QMetaType::fromType<QMediaFormat::VideoCodec>();
123 case VideoFrameRate:
124 return QMetaType::fromType<qreal>();
125
126
127 case ThumbnailImage:
128 case CoverArtImage:
129 return QMetaType::fromType<QImage>();
130
131 case Resolution:
132 return QMetaType::fromType<QSize>();
133
134 case HasHdrContent:
135 return QMetaType::fromType<bool>();
136
137 default:
138 return QMetaType::fromType<void>();
139 }
140}
141
148
157/*
158 Some potential attributes to add if we can properly support them.
159 Might require that we add EXIF support to Qt Multimedia
160
161 \header \li {3,1}
162 Photo attributes.
163 \row \li CameraManufacturer \li The manufacturer of the camera used to capture the media. \li QString
164 \row \li CameraModel \li The model of the camera used to capture the media. \li QString
165 \row \li Event \li The event during which the media was captured. \li QString
166 \row \li Subject \li The subject of the media. \li QString
167 \row \li ExposureTime \li Exposure time, given in seconds. \li qreal
168 \row \li FNumber \li The F Number. \li int
169 \row \li ExposureProgram
170 \li The class of the program used by the camera to set exposure when the picture is taken. \li QString
171 \row \li ISOSpeedRatings
172 \li Indicates the ISO Speed and ISO Latitude of the camera or input device as specified in ISO 12232. \li qreal
173 \row \li ExposureBiasValue
174 \li The exposure bias.
175 The unit is the APEX (Additive System of Photographic Exposure) setting. \li qreal
176 \row \li DateTimeOriginal \li The date and time when the original image data was generated. \li QDateTime
177 \row \li DateTimeDigitized \li The date and time when the image was stored as digital data. \li QDateTime
178 \row \li SubjectDistance \li The distance to the subject, given in meters. \li qreal
179 \row \li LightSource
180 \li The kind of light source. \li QString
181 \row \li Flash
182 \li Status of flash when the image was shot. \li QCamera::FlashMode
183 \row \li FocalLength
184 \li The actual focal length of the lens, in mm. \li qreal
185 \row \li ExposureMode
186 \li Indicates the exposure mode set when the image was shot. \li QCamera::ExposureMode
187 \row \li WhiteBalance
188 \li Indicates the white balance mode set when the image was shot. \li QCamera::WhiteBalanceMode
189 \row \li DigitalZoomRatio
190 \li Indicates the digital zoom ratio when the image was shot. \li qreal
191 \row \li FocalLengthIn35mmFilm
192 \li Indicates the equivalent focal length assuming a 35mm film camera, in mm. \li qreal
193 \row \li SceneCaptureType
194 \li Indicates the type of scene that was shot.
195 It can also be used to record the mode in which the image was shot. \li QString
196 \row \li GainControl
197 \li Indicates the degree of overall image gain adjustment. \li qreal
198 \row \li Contrast
199 \li Indicates the direction of contrast processing applied by the camera when the image was shot. \li qreal
200 \row \li Saturation
201 \li Indicates the direction of saturation processing applied by the camera when the image was shot. \li qreal
202 \row \li Sharpness
203 \li Indicates the direction of sharpness processing applied by the camera when the image was shot. \li qreal
204 \row \li DeviceSettingDescription
205 \li Exif tag, indicates information on the picture-taking conditions of a particular camera model. \li QString
206
207 \row \li GPSLatitude
208 \li Latitude value of the geographical position (decimal degrees).
209 A positive latitude indicates the Northern Hemisphere,
210 and a negative latitude indicates the Southern Hemisphere. \li double
211 \row \li GPSLongitude
212 \li Longitude value of the geographical position (decimal degrees).
213 A positive longitude indicates the Eastern Hemisphere,
214 and a negative longitude indicates the Western Hemisphere. \li double
215 \row \li GPSAltitude
216 \li The value of altitude in meters above sea level. \li double
217 \row \li GPSTimeStamp
218 \li Time stamp of GPS data. \li QDateTime
219 \row \li GPSSatellites
220 \li GPS satellites used for measurements. \li QString
221 \row \li GPSStatus
222 \li Status of GPS receiver at image creation time. \li QString
223 \row \li GPSDOP
224 \li Degree of precision for GPS data. \li qreal
225 \row \li GPSSpeed
226 \li Speed of GPS receiver movement in kilometers per hour. \li qreal
227 \row \li GPSTrack
228 \li Direction of GPS receiver movement.
229 The range of values is [0.0, 360),
230 with 0 direction pointing on either true or magnetic north,
231 depending on GPSTrackRef. \li qreal
232 \row \li GPSTrackRef
233 \li Reference for movement direction. \li QChar.
234 'T' means true direction and 'M' is magnetic direction.
235 \row \li GPSImgDirection
236 \li Direction of image when captured. \li qreal
237 The range of values is [0.0, 360).
238 \row \li GPSImgDirectionRef
239 \li Reference for image direction. \li QChar.
240 'T' means true direction and 'M' is magnetic direction.
241 \row \li GPSMapDatum
242 \li Geodetic survey data used by the GPS receiver. \li QString
243 \row \li GPSProcessingMethod
244 \li The name of the method used for location finding. \li QString
245 \row \li GPSAreaInformation
246 \li The name of the GPS area. \li QString
247
248 \endtable
249*/
250
367{
369 if (value.isNull())
370 return QString();
371
372 switch (key) {
373 // string based or convertible to string
374 case Title:
375 case Author:
376 case Comment:
377 case Description:
378 case Genre:
379 case Publisher:
380 case Copyright:
381 case Date:
382 case Url:
383 case MediaType:
384 case AudioBitRate:
385 case VideoBitRate:
386 case VideoFrameRate:
387 case AlbumTitle:
388 case AlbumArtist:
390 case TrackNumber:
391 case Composer:
392 case Orientation:
393 case LeadPerformer:
394 case HasHdrContent:
395 return value.toString();
396 case Language: {
397 auto l = value.value<QLocale::Language>();
399 }
400 case Duration: {
402 return time.toString();
403 }
404 case FileFormat:
406 case AudioCodec:
408 case VideoCodec:
410 case Resolution: {
411 QSize size = value.toSize();
412 return QStringLiteral("%1 x %2").arg(size.width()).arg(size.height());
413 }
414 case ThumbnailImage:
415 case CoverArtImage:
416 break;
417 }
418 return QString();
419}
431{
432 switch (key) {
434 return (QCoreApplication::translate("QMediaMetaData", "Title"));
436 return (QCoreApplication::translate("QMediaMetaData", "Author"));
438 return (QCoreApplication::translate("QMediaMetaData", "Comment"));
440 return (QCoreApplication::translate("QMediaMetaData", "Description"));
442 return (QCoreApplication::translate("QMediaMetaData", "Genre"));
444 return (QCoreApplication::translate("QMediaMetaData", "Date"));
446 return (QCoreApplication::translate("QMediaMetaData", "Language"));
448 return (QCoreApplication::translate("QMediaMetaData", "Publisher"));
450 return (QCoreApplication::translate("QMediaMetaData", "Copyright"));
452 return (QCoreApplication::translate("QMediaMetaData", "Url"));
454 return (QCoreApplication::translate("QMediaMetaData", "Duration"));
456 return (QCoreApplication::translate("QMediaMetaData", "Media type"));
458 return (QCoreApplication::translate("QMediaMetaData", "Container Format"));
460 return (QCoreApplication::translate("QMediaMetaData", "Audio bit rate"));
462 return (QCoreApplication::translate("QMediaMetaData", "Audio codec"));
464 return (QCoreApplication::translate("QMediaMetaData", "Video bit rate"));
466 return (QCoreApplication::translate("QMediaMetaData", "Video codec"));
468 return (QCoreApplication::translate("QMediaMetaData", "Video frame rate"));
470 return (QCoreApplication::translate("QMediaMetaData", "Album title"));
472 return (QCoreApplication::translate("QMediaMetaData", "Album artist"));
474 return (QCoreApplication::translate("QMediaMetaData", "Contributing artist"));
476 return (QCoreApplication::translate("QMediaMetaData", "Track number"));
478 return (QCoreApplication::translate("QMediaMetaData", "Composer"));
480 return (QCoreApplication::translate("QMediaMetaData", "Thumbnail image"));
482 return (QCoreApplication::translate("QMediaMetaData", "Cover art image"));
484 return (QCoreApplication::translate("QMediaMetaData", "Orientation"));
486 return (QCoreApplication::translate("QMediaMetaData", "Resolution"));
488 return (QCoreApplication::translate("QMediaMetaData", "Lead performer"));
490 return (QCoreApplication::translate("QMediaMetaData", "Has HDR content"));
491 }
492 return QString();
493}
494
495// operator documentation
524
525#include "moc_qmediametadata.cpp"
static QString translate(const char *context, const char *key, const char *disambiguation=nullptr, int n=-1)
\threadsafe
static QString languageToString(Language language)
Returns a QString containing the name of language.
Definition qlocale.cpp:1632
static Q_INVOKABLE QString videoCodecName(VideoCodec codec)
\qmlmethod string QtMultimedia::mediaFormat::videoCodecName(codec) Returns a string based name for co...
AudioCodec
\qmlproperty enumeration QtMultimedia::mediaFormat::fileFormat
static Q_INVOKABLE QString audioCodecName(AudioCodec codec)
\qmlmethod string QtMultimedia::mediaFormat::audioCodecName(codec) Returns a string based name for co...
FileFormat
Describes the container format used in a multimedia file or stream.
VideoCodec
\qmlproperty enumeration QtMultimedia::mediaFormat::audioCodec
static Q_INVOKABLE QString fileFormatName(FileFormat fileFormat)
\qmlmethod string QtMultimedia::mediaFormat::fileFormatName(fileFormat) Returns a string based name f...
Q_INVOKABLE QString stringValue(Key k) const
\qmlmethod string QtMultimedia::mediaMetaData::stringValue(Key key) Returns the meta data for key key...
static Q_INVOKABLE QString metaDataKeyToString(Key k)
\qmlmethod string QtMultimedia::mediaMetaData::metaDataKeyToString(Key key) returns a string represen...
static QMetaType keyType(Key key)
Returns the meta type used to store data for Key key.
Key
Provides meta-data for media files.
\inmodule QtCore
Definition qmetatype.h:341
\inmodule QtCore
Definition qsize.h:25
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
\inmodule QtCore \reentrant
Definition qdatetime.h:215
static constexpr QTime fromMSecsSinceStartOfDay(int msecs)
Returns a new QTime instance with the time set to the number of msecs since the start of the day,...
Definition qdatetime.h:243
\inmodule QtCore
Definition qvariant.h:65
T value() const &
Definition qvariant.h:516
Combined button and popup list for selecting options.
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
GLuint64 key
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
#define QStringLiteral(str)