Top | ![]() |
![]() |
![]() |
![]() |
MediaArtProcess * | media_art_process_new () |
gboolean | media_art_process_uri () |
void | media_art_process_uri_async () |
gboolean | media_art_process_uri_finish () |
gboolean | media_art_process_file () |
void | media_art_process_file_async () |
gboolean | media_art_process_file_finish () |
gboolean | media_art_process_buffer () |
void | media_art_process_buffer_async () |
gboolean | media_art_process_buffer_finish () |
GQuark | media_art_error_quark () |
enum | MediaArtType |
enum | MediaArtError |
enum | MediaArtProcessFlags |
struct | MediaArtProcess |
struct | MediaArtProcessClass |
The libmediaart library supports taking image data that you have extracted
from a media file and saving it into the media art cache, so that future
applications can display the media art without having to extract the image
again. This is done using the media_art_process_file()
or
media_art_process_buffer()
functions.
Extracting new media art from a file needs to be done by your application.
Usually, when an application loads a media file any embedded images will be
made available as a side effect. For example, if you are using GStreamer any
images will be returned through the GstTagList interface as GST_TAG_IMAGE
tags.
The media art cache requires that all images are saved as 'application/jpeg'
files. Embedded images can be in several formats, and
media_art_process_file()
and media_art_process_buffer()
functions will
convert the supplied image data into the correct format if
necessary. There are multiple backends that can be used for this,
and you can choose which is used at build time using the library's
'configure' script.
If there is no embedded media art in a file,
media_art_process_file()
and media_art_process_buffer()
functions will
look in the directory that contains the media file for likely media
art using a simple heuristic.
MediaArtProcess *
media_art_process_new (GError **error
);
Initialize a GObject for processing and extracting media art.
This function initializes cache hash tables and backend plugins,
A new MediaArtProcess object on success or NULL
if
error
is set. This object must be freed using g_object_unref()
.
Since: 0.5.0
gboolean media_art_process_uri (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,const gchar *uri
,const gchar *artist
,const gchar *title
,GCancellable *cancellable
,GError **error
);
This function calls media_art_process_file()
, but takes the uri
as
a string rather than a GFile object. Either artist
OR title
can be
NULL
, but they can not both be NULL
.
process |
Media art process object |
|
type |
The type of media that contained the image data |
|
flags |
How the media art is processed |
|
uri |
URI of the media file that contained the data |
|
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
cancellable |
optional GCancellable object, |
[allow-none] |
error |
Pointer to potential GLib / MediaArt error, or |
Since: 0.5.0
void media_art_process_uri_async (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,const gchar *uri
,const gchar *artist
,const gchar *title
,gint io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Processes media art. Precisely the same operation as
media_art_process_uri()
is performing, but asynchronously.
When all i/o for the operation is finished the callback
will be
called.
In case of a partial error the callback will be called with any
succeeding items and no error, and on the next request the error
will be reported. If a request is cancelled the callback will be
called with G_IO_ERROR_CANCELLED
.
During an async request no other sync and async calls are allowed,
and will result in G_IO_ERROR_PENDING
errors.
Any outstanding i/o request with higher priority (lower numerical
value) will be executed before an outstanding request with lower
priority. Default priority is G_PRIORITY_DEFAULT
.
process |
Media art process object |
|
type |
The type of media |
|
flags |
The options given for how to process the media art |
|
uri |
A string representing a URI to be processed |
|
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
io_priority |
the I/O priority of the request |
|
cancellable |
optional GCancellable object, |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
Since: 0.7.0
gboolean media_art_process_uri_finish (MediaArtProcess *process
,GAsyncResult *result
,GError **error
);
Finishes the asynchronous operation started with
media_art_process_file_async()
.
process |
the MediaArtProcess |
|
result |
a GAsyncResult. |
|
error |
a GError location to store the error occurring, or |
Since: 0.7.0
gboolean media_art_process_file (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,GFile *file
,const gchar *artist
,const gchar *title
,GCancellable *cancellable
,GError **error
);
Process file
and check if media art exists and if it is up to date
with artist
and title
provided. Either artist
OR title
can be
NULL
, but they can not both be NULL
.
NOTE: This function MAY retrieve media art for
artist
and title
combinations. It is not guaranteed and depends
on download services available over DBus at the time.
In cases where download is unavailable, media_art_process_file()
will only try to procure a cache for possible media art found in
directories surrounding the location of file
. If a buffer or
memory chunk needs to be saved to disk which has been retrieved
from an MP3 (for example), you should use
media_art_process_buffer()
.
The modification time (mtime) of file
is checked against the
cached stored for artist
and title
. If the cache is old or
doesn't exist, it will be updated. What this actually does is
update the mtime of the cache (a symlink) on the disk.
If there is no actual media art stored locally (for example, it's stored in a directory on a removable device), it is copied locally (usually to an XDG cache directory).
If file
is on a removable filesystem, the media art file will be
saved in a cache on the removable file system rather than on the
host machine.
process |
Media art process object |
|
type |
The type of media |
|
flags |
The options given for how to process the media art |
|
file |
File to be processed |
|
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
cancellable |
optional GCancellable object, |
[allow-none] |
error |
a GError location to store the error occurring, or |
Since: 0.3.0
void media_art_process_file_async (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,GFile *file
,const gchar *artist
,const gchar *title
,gint io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Processes media art. Precisely the same operation as
media_art_process_file()
is performing, but asynchronously.
When all i/o for the operation is finished the callback
will be
called.
In case of a partial error the callback will be called with any
succeeding items and no error, and on the next request the error
will be reported. If a request is cancelled the callback will be
called with G_IO_ERROR_CANCELLED
.
During an async request no other sync and async calls are allowed,
and will result in G_IO_ERROR_PENDING
errors.
Any outstanding i/o request with higher priority (lower numerical
value) will be executed before an outstanding request with lower
priority. Default priority is G_PRIORITY_DEFAULT
.
process |
Media art process object |
|
type |
The type of media |
|
flags |
The options given for how to process the media art |
|
file |
File to be processed |
|
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
io_priority |
the I/O priority of the request |
|
cancellable |
optional GCancellable object, |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
Since: 0.7.0
gboolean media_art_process_file_finish (MediaArtProcess *process
,GAsyncResult *result
,GError **error
);
Finishes the asynchronous operation started with
media_art_process_file_async()
.
process |
the MediaArtProcess |
|
result |
a GAsyncResult. |
|
error |
a GError location to store the error occurring, or |
Since: 0.7.0
gboolean media_art_process_buffer (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,GFile *related_file
,const guchar *buffer
,gsize len
,const gchar *mime
,const gchar *artist
,const gchar *title
,GCancellable *cancellable
,GError **error
);
Processes a memory buffer represented by buffer
and len
. If you
have extracted any embedded media art and passed this in as
buffer
, the image data will be converted to the correct format and
saved in the media art cache.
Either artist
OR title
can be NULL
, but they can not both be NULL
.
If file
is on a removable filesystem, the media art file will be saved in a
cache on the removable file system rather than on the host machine.
process |
Media art process object |
|
type |
The type of media |
|
flags |
The options given for how to process the media art |
|
related_file |
File related to the media art |
|
buffer |
a buffer containing |
[array length=len][allow-none] |
len |
length of |
|
mime |
MIME type of |
[allow-none] |
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
cancellable |
optional GCancellable object, |
[allow-none] |
error |
a GError location to store the error occurring, or |
Since: 0.5.0
void media_art_process_buffer_async (MediaArtProcess *process
,MediaArtType type
,MediaArtProcessFlags flags
,GFile *related_file
,const guchar *buffer
,gsize len
,const gchar *mime
,const gchar *artist
,const gchar *title
,gint io_priority
,GCancellable *cancellable
,GAsyncReadyCallback callback
,gpointer user_data
);
Processes media art. Precisely the same operation as
media_art_process_buffer()
is performing, but asynchronously.
When all i/o for the operation is finished the callback
will be
called.
In case of a partial error the callback will be called with any
succeeding items and no error, and on the next request the error
will be reported. If a request is cancelled the callback will be
called with G_IO_ERROR_CANCELLED
.
Dbufferng an async request no other sync and async calls are allowed,
and will result in G_IO_ERROR_PENDING
errors.
Any outstanding i/o request with higher priority (lower numerical
value) will be executed before an outstanding request with lower
priority. Default priority is G_PRIORITY_DEFAULT
.
process |
Media art process object |
|
type |
The type of media |
|
flags |
The options given for how to process the media art |
|
related_file |
File related to the media art |
|
buffer |
a buffer containing |
[array length=len][allow-none] |
len |
length of |
|
mime |
MIME type of |
|
artist |
The artist name |
[allow-none] |
title |
The title for |
[allow-none] |
io_priority |
the I/O priority of the request |
|
cancellable |
optional GCancellable object, |
[allow-none] |
callback |
a GAsyncReadyCallback to call when the request is satisfied. |
[scope async] |
user_data |
the data to pass to callback function. |
[closure] |
Since: 0.7.0
gboolean media_art_process_buffer_finish (MediaArtProcess *process
,GAsyncResult *result
,GError **error
);
Finishes the asynchronous operation started with
media_art_process_file_async()
.
process |
the MediaArtProcess |
|
result |
a GAsyncResult. |
|
error |
a GError location to store the error occurring, or |
Since: 0.7.0
GQuark
media_art_error_quark (void
);
The error domain for MediaArtError.
Since: 0.2.0
Enumeration values used in errors returned by the MediaArtError API.
Storage information is unknown, we have no knowledge about removable media. |
||
Title is required, but was not provided, or was empty. |
||
A call to |
||
File could not be renamed. |
||
This is given when the XDG_CACHE_HOME directory could not be used to create the 'media-art' subdirectory used for caching media art. This is usually an initiation error. |
Since: 0.2.0
This type categorized the flags used when processing media art.
Since: 0.3.0
struct MediaArtProcess;
A class implementation for processing and extracting media art.