2
2
* Copyright (C) 2013 Canonical Ltd.
4
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU Lesser General Public License version 3 as
5
* it under the terms of the GNU General Public License version 3 as
6
6
* published by the Free Software Foundation.
8
8
* This program is distributed in the hope that it will be useful,
9
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU Lesser General Public License for more details.
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU Lesser General Public License
13
* You should have received a copy of the GNU General Public License
14
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
16
16
* Authored by: Jussi Pakkanen <jussi.pakkanen@canonical.com>
24
24
class ThumbnailerPrivate;
26
26
enum ThumbnailSize {
27
TN_SIZE_SMALL, // maximum dimension 128 pixels
28
TN_SIZE_LARGE, // maximum dimension 256 pixels
29
TN_SIZE_XLARGE, // maximum dimension 512 pixels
30
TN_SIZE_ORIGINAL // Whatever the original size was, e.g. 1920x1080 for FullHD video
33
enum ThumbnailPolicy {
34
TN_LOCAL, // Use only local information
35
TN_REMOTE, // Use remote services (e.g. album art downloading)
27
TN_SIZE_SMALL, // maximum dimension 128 pixels
28
TN_SIZE_LARGE // maximum dimension 256 pixels
39
32
* This class provides a way to generate and access
40
33
* thumbnails of video, audio and image files.
44
37
* All methods are thread safe.
46
* Errors are reported as exceptions.
39
* Errors are reported as exceptions (exact types TBD).
42
class Thumbnailer final {
55
* Gets a thumbnail of the given input file in the requested size.
57
* Return value is a string pointing to the thumbnail file. If
58
* the thumbnail could not be generated and empty string is returned.
60
* Applications should treat the returned file as read only. They should _not_
63
* In case of unexpected problems, the function throws a
66
std::string get_thumbnail(const std::string &filename, ThumbnailSize desired_size,
67
ThumbnailPolicy policy);
69
* Deprecated. Do not use!
47
Thumbnailer(const Thumbnailer &t) = delete;
48
Thumbnailer & operator=(const Thumbnailer &t) = delete;
71
50
std::string get_thumbnail(const std::string &filename, ThumbnailSize desired_size);
73
std::string get_album_art(const std::string &artist, const std::string &album,
74
ThumbnailSize desiredSize, ThumbnailPolicy policy);
76
std::string get_artist_art(const std::string &artist, const std::string &album,
77
ThumbnailSize desiredSize, ThumbnailPolicy policy);
80
Thumbnailer(const Thumbnailer &t);
81
Thumbnailer & operator=(const Thumbnailer &t);
83
53
ThumbnailerPrivate *p;