~jpakkane/thumbnailer/standalone-albumart

« back to all changes in this revision

Viewing changes to include/thumbnailer.h

  • Committer: Jussi Pakkanen
  • Date: 2013-09-25 12:45:32 UTC
  • Revision ID: jussi.pakkanen@canonical.com-20130925124532-spx31kdvxwizl34a
Added Debian packaging.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Copyright (C) 2013 Canonical Ltd.
3
3
 *
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.
7
7
 *
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.
12
12
 *
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/>.
15
15
 *
16
16
 * Authored by: Jussi Pakkanen <jussi.pakkanen@canonical.com>
24
24
class ThumbnailerPrivate;
25
25
 
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
31
 
};
32
 
 
33
 
enum ThumbnailPolicy {
34
 
    TN_LOCAL,  // Use only local information
35
 
    TN_REMOTE, // Use remote services (e.g. album art downloading)
36
 
};
37
 
 
38
 
/**
 
27
    TN_SIZE_SMALL, // maximum dimension 128 pixels
 
28
    TN_SIZE_LARGE  // maximum dimension 256 pixels
 
29
};
 
30
 
 
31
/*
39
32
 * This class provides a way to generate and access
40
33
 * thumbnails of video, audio and image files.
41
34
 *
43
36
 *
44
37
 * All methods are thread safe.
45
38
 *
46
 
 * Errors are reported as exceptions.
 
39
 * Errors are reported as exceptions (exact types TBD).
47
40
 */
48
41
 
49
 
class Thumbnailer {
 
42
class Thumbnailer final {
50
43
public:
51
44
    Thumbnailer();
52
45
    ~Thumbnailer();
53
46
 
54
 
    /**
55
 
     * Gets a thumbnail of the given input file in the requested size.
56
 
     *
57
 
     * Return value is a string pointing to the thumbnail file. If
58
 
     * the thumbnail could not be generated and empty string is returned.
59
 
     *
60
 
     * Applications should treat the returned file as read only. They should _not_
61
 
     * delete it.
62
 
     *
63
 
     * In case of unexpected problems, the function throws a
64
 
     * std::runtime_error.
65
 
     */
66
 
    std::string get_thumbnail(const std::string &filename, ThumbnailSize desired_size,
67
 
            ThumbnailPolicy policy);
68
 
    /**
69
 
     * Deprecated. Do not use!
70
 
     */
 
47
    Thumbnailer(const Thumbnailer &t) = delete;
 
48
    Thumbnailer & operator=(const Thumbnailer &t) = delete;
 
49
 
71
50
    std::string get_thumbnail(const std::string &filename, ThumbnailSize desired_size);
72
51
 
73
 
    std::string get_album_art(const std::string &artist, const std::string &album,
74
 
            ThumbnailSize desiredSize, ThumbnailPolicy policy);
75
 
 
76
 
    std::string get_artist_art(const std::string &artist, const std::string &album,
77
 
            ThumbnailSize desiredSize, ThumbnailPolicy policy);
78
 
 
79
52
private:
80
 
    Thumbnailer(const Thumbnailer &t);
81
 
    Thumbnailer & operator=(const Thumbnailer &t);
82
 
 
83
53
    ThumbnailerPrivate *p;
84
54
};
85
55