Thumbnailer Qt API
|
Class to obtain thumbnail images for various media types. More...
#include <unity/thumbnailer/qt/thumbnailer-qt.h>
Public Member Functions | |
Thumbnailer () | |
Constructs a thumbnailer instance. More... | |
Thumbnailer (QDBusConnection const &connection) | |
Constructs a thumbnailer instance, using the supplied DBus connection. More... | |
~Thumbnailer () | |
Destroys a thumbnailer instance. More... | |
QSharedPointer< Request > | getAlbumArt (QString const &artist, QString const &album, QSize const &requestedSize) |
Retrieves a thumbnail for an album cover from the remote image server. More... | |
QSharedPointer< Request > | getArtistArt (QString const &artist, QString const &album, QSize const &requestedSize) |
Retrieves a thumbnail for an artist from the remote image server. More... | |
QSharedPointer< Request > | getThumbnail (QString const &filePath, QSize const &requestedSize) |
Extracts a thumbnail from a media file. More... | |
Class to obtain thumbnail images for various media types.
Class Thumbnailer provides thumbnail images for local media (image, audio, and video) files, as well as album covers and artist images for many musicians and bands.
Most common image formats, such as PNG, JPEG, BMP, and so on, are recognized. For streaming media, the recognized formats depend on the installed GStreamer codecs.
For local media files, thumbnails are extracted directly from the file. (For audio files, this requires the file to contain embedded artwork.) For album covers and artist images, artwork is downloaded from a remote image server (dash.ubuntu.com) that maintains a large database of albums and musicians.
The requested size for a thumbnail specifies a bounding box (in pixels) of type QSize
to which the thumbnail will be scaled. (The aspect ratio of the original image is preserved.)
The returned thumbnails never exceed max-thumbnail-size (usually 1920, see thumbnailer-settings(7)) in their larger dimension, even if a larger size is requested.
QSize(0,
n)
or QSize(
n,0)
defines a bounding box of n pixels in one dimension, and unconstrained size in the other dimension (subject to the max-thumbnail-size limit).QSize(0,0)
requests a thumbnail that fits into a square bounding box of max-thumbnail-size.Original images are never scaled up, so the returned thumbnail may be smaller than its requested size.
All methods are asynchronous and are guaranteed not to block.
The return value is a shared pointer to a Request instance that provides access to the scaled thumbnail (or an error message).
unity::thumbnailer::qt::Thumbnailer::Thumbnailer | ( | ) |
Constructs a thumbnailer instance.
A default-constructed Thumbnailer instance communicates with the thumbnailer service via the session bus.
|
explicit |
Constructs a thumbnailer instance, using the supplied DBus connection.
Instead of connecting to the session bus, this constructor uses the supplied DBus connection to contact the thumbnailer service.
connection | The DBus connection via which to send requests. |
unity::thumbnailer::qt::Thumbnailer::~Thumbnailer | ( | ) |
Destroys a thumbnailer instance.
QSharedPointer<Request> unity::thumbnailer::qt::Thumbnailer::getAlbumArt | ( | QString const & | artist, |
QString const & | album, | ||
QSize const & | requestedSize | ||
) |
Retrieves a thumbnail for an album cover from the remote image server.
artist | The name of the artist. |
album | The name of the album. |
requestedSize | The bounding box for the thumbnail. |
QSharedPointer
to a unity::thumbnailer::qt::Request holding the request state. QSharedPointer<Request> unity::thumbnailer::qt::Thumbnailer::getArtistArt | ( | QString const & | artist, |
QString const & | album, | ||
QSize const & | requestedSize | ||
) |
Retrieves a thumbnail for an artist from the remote image server.
artist | The name of the artist. |
album | The name of the album. |
requestedSize | The bounding box for the thumbnail. |
QSharedPointer
to a unity::thumbnailer::qt::Request holding the request state. QSharedPointer<Request> unity::thumbnailer::qt::Thumbnailer::getThumbnail | ( | QString const & | filePath, |
QSize const & | requestedSize | ||
) |
Extracts a thumbnail from a media file.
filePath | The path to the file to extract the thumbnail from. |
requestedSize | The bounding box for the thumbnail. |
QSharedPointer
to a unity::thumbnailer::qt::Request holding the request state.