summaryrefslogtreecommitdiff
path: root/plugins/artwork
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/artwork')
-rw-r--r--plugins/artwork/artwork.c68
-rw-r--r--plugins/artwork/artwork.h1
2 files changed, 35 insertions, 34 deletions
diff --git a/plugins/artwork/artwork.c b/plugins/artwork/artwork.c
index 32cd1b96..cc0e632e 100644
--- a/plugins/artwork/artwork.c
+++ b/plugins/artwork/artwork.c
@@ -139,7 +139,7 @@ esc_char (char c) {
return '_';
}
-int
+static int
make_cache_dir_path (char *path, int size, const char *artist, int img_size) {
char esc_artist[PATH_MAX];
int i;
@@ -174,29 +174,32 @@ make_cache_dir_path (char *path, int size, const char *artist, int img_size) {
return sz;
}
-int
+static int
make_cache_path2 (char *path, int size, const char *fname, const char *album, const char *artist, int img_size) {
- if (!album) {
- album = "";
- }
- if (!artist) {
- artist = "";
- }
+ *path = 0;
+
+ int unk = 0;
+ int unk_artist = 0;
- if (*album && !(*artist)) {
- artist = album;
+ if (!album || !(*album)) {
+ album = "Unknown album";
+ unk = 1;
+ }
+ if (!artist || !(*artist)) {
+ artist = "Unknown artist";
+ unk_artist = 1;
}
- if (!*artist || !*album)
+ if (unk)
{
if (fname) {
- // album=escape(path), artist=uknown
- artist = "Unknown artist";
album = fname;
}
+ else if (!unk_artist) {
+ album = artist;
+ }
else {
- trace ("artist or album is empty, give up\n");
- *path = 0;
+ trace ("not possible to get any unique album name\n");
return -1;
}
}
@@ -225,12 +228,12 @@ make_cache_path2 (char *path, int size, const char *fname, const char *album, co
}
}
-void
+static void
make_cache_path (char *path, int size, const char *album, const char *artist, int img_size) {
make_cache_path2 (path, size, NULL, album, artist, img_size);
}
-void
+static void
queue_add (const char *fname, const char *artist, const char *album, int img_size, artwork_callback callback, void *user_data) {
if (!artist) {
artist = "";
@@ -274,7 +277,7 @@ queue_add (const char *fname, const char *artist, const char *album, int img_siz
deadbeef->cond_signal (cond);
}
-void
+static void
queue_pop (void) {
deadbeef->mutex_lock (mutex);
cover_query_t *next = queue ? queue->next : NULL;
@@ -481,7 +484,7 @@ jpeg_resize (const char *fname, const char *outname, int scaled_size) {
return 0;
}
-int
+static int
png_resize (const char *fname, const char *outname, int scaled_size) {
png_structp png_ptr = NULL;
png_infop info_ptr = NULL;
@@ -629,6 +632,8 @@ png_resize (const char *fname, const char *outname, int scaled_size) {
for (row = 0; row < height; row++)
row_pointers[row] = NULL;
+ png_read_update_info(png_ptr, info_ptr);
+
for (row = 0; row < height; row++)
row_pointers[row] = png_malloc(png_ptr, png_get_rowbytes(png_ptr,
info_ptr));
@@ -859,6 +864,7 @@ copy_file (const char *in, const char *out, int img_size) {
}
static const char *filter_custom_mask = NULL;
+
static int
filter_custom (const struct dirent *f)
{
@@ -1397,18 +1403,11 @@ find_image (const char *path) {
return NULL;
}
-char*
+static char*
get_album_art (const char *fname, const char *artist, const char *album, int size, artwork_callback callback, void *user_data)
{
char path [1024];
-// if (!deadbeef->is_local_file (fname)) {
-// if (callback) {
-// callback (NULL, NULL, NULL, user_data);
-// }
-// return NULL;
-// }
-
make_cache_path2 (path, sizeof (path), fname, album, artist, size);
char *p = find_image (path);
if (p) {
@@ -1471,13 +1470,7 @@ get_album_art_sync (const char *fname, const char *artist, const char *album, in
return image_fname;
}
-DB_plugin_t *
-artwork_load (DB_functions_t *api) {
- deadbeef = api;
- return DB_PLUGIN (&plugin);
-}
-
-void
+static void
artwork_reset (int fast) {
if (fast) {
// if (current_file) {
@@ -1691,3 +1684,10 @@ static DB_artwork_plugin_t plugin = {
.make_cache_path = make_cache_path,
.make_cache_path2 = make_cache_path2,
};
+
+DB_plugin_t *
+artwork_load (DB_functions_t *api) {
+ deadbeef = api;
+ return DB_PLUGIN (&plugin);
+}
+
diff --git a/plugins/artwork/artwork.h b/plugins/artwork/artwork.h
index 850937e1..f4b278e3 100644
--- a/plugins/artwork/artwork.h
+++ b/plugins/artwork/artwork.h
@@ -46,6 +46,7 @@ typedef struct {
char* (*get_album_art_sync) (const char *fname, const char *artist, const char *album, int size);
// creates full path string for cache storage
+ // NOTE: this function is deprecated, please use make_cache_path2
void (*make_cache_path) (char *path, int size, const char *album, const char *artist, int img_size);
// creates full path string for cache storage