1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2017 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:LGPL$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU Lesser General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU Lesser |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the |
21 | ** packaging of this file. Please review the following information to |
22 | ** ensure the GNU Lesser General Public License version 3 requirements |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. |
24 | ** |
25 | ** GNU General Public License Usage |
26 | ** Alternatively, this file may be used under the terms of the GNU |
27 | ** General Public License version 2.0 or (at your option) the GNU General |
28 | ** Public license version 3 or any later version approved by the KDE Free |
29 | ** Qt Foundation. The licenses are as published by the Free Software |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 |
31 | ** included in the packaging of this file. Please review the following |
32 | ** information to ensure the GNU General Public License requirements will |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. |
35 | ** |
36 | ** $QT_END_LICENSE$ |
37 | ** |
38 | ****************************************************************************/ |
39 | |
40 | #include "qmediametadata.h" |
41 | |
42 | QT_BEGIN_NAMESPACE |
43 | |
44 | /* |
45 | When these conditions are satisfied, QStringLiteral is implemented by |
46 | gcc's statement-expression extension. However, in this file it will |
47 | not work, because "statement-expressions are not allowed outside functions |
48 | nor in template-argument lists". |
49 | MSVC 2012 produces an internal compiler error on encountering |
50 | QStringLiteral in this context. |
51 | |
52 | Fall back to the less-performant QLatin1String in this case. |
53 | */ |
54 | #if defined(Q_CC_GNU) && defined(Q_COMPILER_LAMBDA) |
55 | # define Q_DEFINE_METADATA(key) const QString QMediaMetaData::key(QStringLiteral(#key)) |
56 | #else |
57 | # define Q_DEFINE_METADATA(key) const QString QMediaMetaData::key(QLatin1String(#key)) |
58 | #endif |
59 | |
60 | // Common |
61 | Q_DEFINE_METADATA(Title); |
62 | Q_DEFINE_METADATA(SubTitle); |
63 | Q_DEFINE_METADATA(Author); |
64 | Q_DEFINE_METADATA(); |
65 | Q_DEFINE_METADATA(Description); |
66 | Q_DEFINE_METADATA(Category); |
67 | Q_DEFINE_METADATA(Genre); |
68 | Q_DEFINE_METADATA(Year); |
69 | Q_DEFINE_METADATA(Date); |
70 | Q_DEFINE_METADATA(UserRating); |
71 | Q_DEFINE_METADATA(Keywords); |
72 | Q_DEFINE_METADATA(Language); |
73 | Q_DEFINE_METADATA(Publisher); |
74 | Q_DEFINE_METADATA(Copyright); |
75 | Q_DEFINE_METADATA(ParentalRating); |
76 | Q_DEFINE_METADATA(RatingOrganization); |
77 | |
78 | // Media |
79 | Q_DEFINE_METADATA(Size); |
80 | Q_DEFINE_METADATA(MediaType); |
81 | Q_DEFINE_METADATA(Duration); |
82 | |
83 | // Audio |
84 | Q_DEFINE_METADATA(AudioBitRate); |
85 | Q_DEFINE_METADATA(AudioCodec); |
86 | Q_DEFINE_METADATA(AverageLevel); |
87 | Q_DEFINE_METADATA(ChannelCount); |
88 | Q_DEFINE_METADATA(PeakValue); |
89 | Q_DEFINE_METADATA(SampleRate); |
90 | |
91 | // Music |
92 | Q_DEFINE_METADATA(AlbumTitle); |
93 | Q_DEFINE_METADATA(AlbumArtist); |
94 | Q_DEFINE_METADATA(ContributingArtist); |
95 | Q_DEFINE_METADATA(Composer); |
96 | Q_DEFINE_METADATA(Conductor); |
97 | Q_DEFINE_METADATA(Lyrics); |
98 | Q_DEFINE_METADATA(Mood); |
99 | Q_DEFINE_METADATA(TrackNumber); |
100 | Q_DEFINE_METADATA(TrackCount); |
101 | |
102 | Q_DEFINE_METADATA(CoverArtUrlSmall); |
103 | Q_DEFINE_METADATA(CoverArtUrlLarge); |
104 | |
105 | // Image/Video |
106 | Q_DEFINE_METADATA(Resolution); |
107 | Q_DEFINE_METADATA(PixelAspectRatio); |
108 | Q_DEFINE_METADATA(Orientation); |
109 | |
110 | // Video |
111 | Q_DEFINE_METADATA(VideoFrameRate); |
112 | Q_DEFINE_METADATA(VideoBitRate); |
113 | Q_DEFINE_METADATA(VideoCodec); |
114 | |
115 | Q_DEFINE_METADATA(PosterUrl); |
116 | |
117 | // Movie |
118 | Q_DEFINE_METADATA(ChapterNumber); |
119 | Q_DEFINE_METADATA(Director); |
120 | Q_DEFINE_METADATA(LeadPerformer); |
121 | Q_DEFINE_METADATA(Writer); |
122 | |
123 | // Photos |
124 | Q_DEFINE_METADATA(CameraManufacturer); |
125 | Q_DEFINE_METADATA(CameraModel); |
126 | Q_DEFINE_METADATA(Event); |
127 | Q_DEFINE_METADATA(Subject); |
128 | Q_DEFINE_METADATA(ExposureTime); |
129 | Q_DEFINE_METADATA(FNumber); |
130 | Q_DEFINE_METADATA(ExposureProgram); |
131 | Q_DEFINE_METADATA(ISOSpeedRatings); |
132 | Q_DEFINE_METADATA(ExposureBiasValue); |
133 | Q_DEFINE_METADATA(DateTimeOriginal); |
134 | Q_DEFINE_METADATA(DateTimeDigitized); |
135 | Q_DEFINE_METADATA(SubjectDistance); |
136 | Q_DEFINE_METADATA(MeteringMode); |
137 | Q_DEFINE_METADATA(LightSource); |
138 | Q_DEFINE_METADATA(Flash); |
139 | Q_DEFINE_METADATA(FocalLength); |
140 | Q_DEFINE_METADATA(ExposureMode); |
141 | Q_DEFINE_METADATA(WhiteBalance); |
142 | Q_DEFINE_METADATA(DigitalZoomRatio); |
143 | Q_DEFINE_METADATA(FocalLengthIn35mmFilm); |
144 | Q_DEFINE_METADATA(SceneCaptureType); |
145 | Q_DEFINE_METADATA(GainControl); |
146 | Q_DEFINE_METADATA(Contrast); |
147 | Q_DEFINE_METADATA(Saturation); |
148 | Q_DEFINE_METADATA(Sharpness); |
149 | Q_DEFINE_METADATA(DeviceSettingDescription); |
150 | |
151 | // Location |
152 | Q_DEFINE_METADATA(GPSLatitude); |
153 | Q_DEFINE_METADATA(GPSLongitude); |
154 | Q_DEFINE_METADATA(GPSAltitude); |
155 | Q_DEFINE_METADATA(GPSTimeStamp); |
156 | Q_DEFINE_METADATA(GPSSatellites); |
157 | Q_DEFINE_METADATA(GPSStatus); |
158 | Q_DEFINE_METADATA(GPSDOP); |
159 | Q_DEFINE_METADATA(GPSSpeed); |
160 | Q_DEFINE_METADATA(GPSTrack); |
161 | Q_DEFINE_METADATA(GPSTrackRef); |
162 | Q_DEFINE_METADATA(GPSImgDirection); |
163 | Q_DEFINE_METADATA(GPSImgDirectionRef); |
164 | Q_DEFINE_METADATA(GPSMapDatum); |
165 | Q_DEFINE_METADATA(GPSProcessingMethod); |
166 | Q_DEFINE_METADATA(GPSAreaInformation); |
167 | |
168 | Q_DEFINE_METADATA(PosterImage); |
169 | Q_DEFINE_METADATA(CoverArtImage); |
170 | Q_DEFINE_METADATA(ThumbnailImage); |
171 | |
172 | |
173 | /*! |
174 | \namespace QMediaMetaData |
175 | \ingroup multimedia-namespaces |
176 | \ingroup multimedia |
177 | \inmodule QtMultimedia |
178 | |
179 | \brief Provides identifiers for meta-data attributes. |
180 | |
181 | \note Not all identifiers are supported on all platforms. Please consult vendor documentation for specific support |
182 | on different platforms. |
183 | |
184 | \table 60% |
185 | \header \li {3,1} |
186 | Common attributes |
187 | \header \li Value \li Description \li Type |
188 | \row \li Title \li The title of the media. \li QString |
189 | \row \li SubTitle \li The sub-title of the media. \li QString |
190 | \row \li Author \li The authors of the media. \li QStringList |
191 | \row \li Comment \li A user comment about the media. \li QString |
192 | \row \li Description \li A description of the media. \li QString |
193 | \row \li Category \li The category of the media. \li QStringList |
194 | \row \li Genre \li The genre of the media. \li QStringList |
195 | \row \li Year \li The year of release of the media. \li int |
196 | \row \li Date \li The date of the media. \li QDate. |
197 | \row \li UserRating \li A user rating of the media. \li int [0..100] |
198 | \row \li Keywords \li A list of keywords describing the media. \li QStringList |
199 | \row \li Language \li The language of media, as an ISO 639-2 code. \li QString |
200 | |
201 | \row \li Publisher \li The publisher of the media. \li QString |
202 | \row \li Copyright \li The media's copyright notice. \li QString |
203 | \row \li ParentalRating \li The parental rating of the media. \li QString |
204 | \row \li RatingOrganization \li The organization responsible for the parental rating of the media. |
205 | \li QString |
206 | |
207 | \header \li {3,1} |
208 | Media attributes |
209 | \row \li Size \li The size in bytes of the media. \li qint64 |
210 | \row \li MediaType \li The type of the media (audio, video, etc). \li QString |
211 | \row \li Duration \li The duration in millseconds of the media. \li qint64 |
212 | |
213 | \header \li {3,1} |
214 | Audio attributes |
215 | \row \li AudioBitRate \li The bit rate of the media's audio stream in bits per second. \li int |
216 | \row \li AudioCodec \li The codec of the media's audio stream. \li QString |
217 | \row \li AverageLevel \li The average volume level of the media. \li int |
218 | \row \li ChannelCount \li The number of channels in the media's audio stream. \li int |
219 | \row \li PeakValue \li The peak volume of the media's audio stream. \li int |
220 | \row \li SampleRate \li The sample rate of the media's audio stream in hertz. \li int |
221 | |
222 | \header \li {3,1} |
223 | Music attributes |
224 | \row \li AlbumTitle \li The title of the album the media belongs to. \li QString |
225 | \row \li AlbumArtist \li The principal artist of the album the media belongs to. \li QString |
226 | \row \li ContributingArtist \li The artists contributing to the media. \li QStringList |
227 | \row \li Composer \li The composer of the media. \li QStringList |
228 | \row \li Conductor \li The conductor of the media. \li QString |
229 | \row \li Lyrics \li The lyrics to the media. \li QString |
230 | \row \li Mood \li The mood of the media. \li QString |
231 | \row \li TrackNumber \li The track number of the media. \li int |
232 | \row \li TrackCount \li The number of tracks on the album containing the media. \li int |
233 | |
234 | \row \li CoverArtUrlSmall \li The URL of a small cover art image. \li QUrl |
235 | \row \li CoverArtUrlLarge \li The URL of a large cover art image. \li QUrl |
236 | \row \li CoverArtImage \li An embedded cover art image. \li QImage |
237 | |
238 | \header \li {3,1} |
239 | Image and video attributes |
240 | \row \li Resolution \li The dimensions of an image or video. \li QSize |
241 | \row \li PixelAspectRatio \li The pixel aspect ratio of an image or video. \li QSize |
242 | \row \li Orientation \li Orientation of an image or video. \li int (degrees) |
243 | |
244 | \header \li {3,1} |
245 | Video attributes |
246 | \row \li VideoFrameRate \li The frame rate of the media's video stream. \li qreal |
247 | \row \li VideoBitRate \li The bit rate of the media's video stream in bits per second. \li int |
248 | \row \li VideoCodec \li The codec of the media's video stream. \li QString |
249 | |
250 | \row \li PosterUrl \li The URL of a poster image. \li QUrl |
251 | \row \li PosterImage \li An embedded poster image. \li QImage |
252 | |
253 | \header \li {3,1} |
254 | Movie attributes |
255 | \row \li ChapterNumber \li The chapter number of the media. \li int |
256 | \row \li Director \li The director of the media. \li QString |
257 | \row \li LeadPerformer \li The lead performer in the media. \li QStringList |
258 | \row \li Writer \li The writer of the media. \li QStringList |
259 | |
260 | \header \li {3,1} |
261 | Photo attributes. |
262 | \row \li CameraManufacturer \li The manufacturer of the camera used to capture the media. \li QString |
263 | \row \li CameraModel \li The model of the camera used to capture the media. \li QString |
264 | \row \li Event \li The event during which the media was captured. \li QString |
265 | \row \li Subject \li The subject of the media. \li QString |
266 | \row \li ExposureTime \li Exposure time, given in seconds. \li qreal |
267 | \row \li FNumber \li The F Number. \li int |
268 | \row \li ExposureProgram |
269 | \li The class of the program used by the camera to set exposure when the picture is taken. \li QString |
270 | \row \li ISOSpeedRatings |
271 | \li Indicates the ISO Speed and ISO Latitude of the camera or input device as specified in ISO 12232. \li qreal |
272 | \row \li ExposureBiasValue |
273 | \li The exposure bias. |
274 | The unit is the APEX (Additive System of Photographic Exposure) setting. \li qreal |
275 | \row \li DateTimeOriginal \li The date and time when the original image data was generated. \li QDateTime |
276 | \row \li DateTimeDigitized \li The date and time when the image was stored as digital data. \li QDateTime |
277 | \row \li SubjectDistance \li The distance to the subject, given in meters. \li qreal |
278 | \row \li MeteringMode \li The metering mode. \li QCameraExposure::MeteringMode |
279 | \row \li LightSource |
280 | \li The kind of light source. \li QString |
281 | \row \li Flash |
282 | \li Status of flash when the image was shot. \li QCameraExposure::FlashMode |
283 | \row \li FocalLength |
284 | \li The actual focal length of the lens, in mm. \li qreal |
285 | \row \li ExposureMode |
286 | \li Indicates the exposure mode set when the image was shot. \li QCameraExposure::ExposureMode |
287 | \row \li WhiteBalance |
288 | \li Indicates the white balance mode set when the image was shot. \li QCameraImageProcessing::WhiteBalanceMode |
289 | \row \li DigitalZoomRatio |
290 | \li Indicates the digital zoom ratio when the image was shot. \li qreal |
291 | \row \li FocalLengthIn35mmFilm |
292 | \li Indicates the equivalent focal length assuming a 35mm film camera, in mm. \li qreal |
293 | \row \li SceneCaptureType |
294 | \li Indicates the type of scene that was shot. |
295 | It can also be used to record the mode in which the image was shot. \li QString |
296 | \row \li GainControl |
297 | \li Indicates the degree of overall image gain adjustment. \li qreal |
298 | \row \li Contrast |
299 | \li Indicates the direction of contrast processing applied by the camera when the image was shot. \li qreal |
300 | \row \li Saturation |
301 | \li Indicates the direction of saturation processing applied by the camera when the image was shot. \li qreal |
302 | \row \li Sharpness |
303 | \li Indicates the direction of sharpness processing applied by the camera when the image was shot. \li qreal |
304 | \row \li DeviceSettingDescription |
305 | \li Exif tag, indicates information on the picture-taking conditions of a particular camera model. \li QString |
306 | |
307 | \row \li GPSLatitude |
308 | \li Latitude value of the geographical position (decimal degrees). |
309 | A positive latitude indicates the Northern Hemisphere, |
310 | and a negative latitude indicates the Southern Hemisphere. \li double |
311 | \row \li GPSLongitude |
312 | \li Longitude value of the geographical position (decimal degrees). |
313 | A positive longitude indicates the Eastern Hemisphere, |
314 | and a negative longitude indicates the Western Hemisphere. \li double |
315 | \row \li GPSAltitude |
316 | \li The value of altitude in meters above sea level. \li double |
317 | \row \li GPSTimeStamp |
318 | \li Time stamp of GPS data. \li QDateTime |
319 | \row \li GPSSatellites |
320 | \li GPS satellites used for measurements. \li QString |
321 | \row \li GPSStatus |
322 | \li Status of GPS receiver at image creation time. \li QString |
323 | \row \li GPSDOP |
324 | \li Degree of precision for GPS data. \li qreal |
325 | \row \li GPSSpeed |
326 | \li Speed of GPS receiver movement in kilometers per hour. \li qreal |
327 | \row \li GPSTrack |
328 | \li Direction of GPS receiver movement. |
329 | The range of values is [0.0, 360), |
330 | with 0 direction pointing on either true or magnetic north, |
331 | depending on GPSTrackRef. \li qreal |
332 | \row \li GPSTrackRef |
333 | \li Reference for movement direction. \li QChar. |
334 | 'T' means true direction and 'M' is magnetic direction. |
335 | \row \li GPSImgDirection |
336 | \li Direction of image when captured. \li qreal |
337 | The range of values is [0.0, 360). |
338 | \row \li GPSImgDirectionRef |
339 | \li Reference for image direction. \li QChar. |
340 | 'T' means true direction and 'M' is magnetic direction. |
341 | \row \li GPSMapDatum |
342 | \li Geodetic survey data used by the GPS receiver. \li QString |
343 | \row \li GPSProcessingMethod |
344 | \li The name of the method used for location finding. \li QString |
345 | \row \li GPSAreaInformation |
346 | \li The name of the GPS area. \li QString |
347 | |
348 | \row \li ThumbnailImage \li An embedded thumbnail image. \li QImage |
349 | \endtable |
350 | */ |
351 | |
352 | QT_END_NAMESPACE |
353 | |