aboutsummaryrefslogtreecommitdiffstats
path: root/mpd-notification.c
diff options
context:
space:
mode:
authorGravatar Christian Hesse <mail@eworm.de>2015-07-03 17:35:18 +0200
committerGravatar Christian Hesse <mail@eworm.de>2015-07-03 17:35:18 +0200
commit360535171d457506deaad4210251939c08674a76 (patch)
treef35f356ee3e6000d59b0c9c687a32222fb1dc6db /mpd-notification.c
parent02a7441b621db03161061dbfd5a93f1a1adc7e75 (diff)
downloadmpd-notification-360535171d457506deaad4210251939c08674a76.tar.gz
mpd-notification-360535171d457506deaad4210251939c08674a76.tar.zst
make libav (and retrieving cover from media file) optional
Diffstat (limited to 'mpd-notification.c')
-rw-r--r--mpd-notification.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/mpd-notification.c b/mpd-notification.c
index 764df95..e79bc68 100644
--- a/mpd-notification.c
+++ b/mpd-notification.c
@@ -56,6 +56,7 @@ void received_signal(int signal) {
}
}
+#ifdef HAVE_LIBAV
/*** retrieve_album_art ***/
char * retrieve_album_art(const char *path) {
int i, ret = 0;
@@ -105,14 +106,18 @@ fail:
return NULL;
}
}
+#endif
/*** get_icon ***/
char * get_icon(const char * music_dir, const char * uri) {
- char * icon = NULL, * uri_path = NULL, * uri_dirname = NULL;
+ char * icon = NULL, * uri_dirname = NULL;
DIR * dir;
struct dirent * entry;
regex_t regex;
+#ifdef HAVE_LIBAV
+ char * uri_path = NULL;
+
/* try album artwork first */
uri_path = malloc(strlen(music_dir) + strlen(uri) + 2);
sprintf(uri_path, "%s/%s", music_dir, uri);
@@ -120,6 +125,7 @@ char * get_icon(const char * music_dir, const char * uri) {
if (icon != NULL)
goto found;
+#endif
uri_dirname = strdup(uri);
@@ -153,9 +159,12 @@ char * get_icon(const char * music_dir, const char * uri) {
regfree(&regex);
closedir(dir);
+#ifdef HAVE_LIBAV
found:
if (uri_path)
free(uri_path);
+#endif
+
if (uri_dirname)
free(uri_dirname);
@@ -243,8 +252,10 @@ int main(int argc, char ** argv) {
}
}
+#ifdef HAVE_LIBAV
/* libav */
av_register_all();
+#endif
conn = mpd_connection_new(mpd_host, mpd_port, mpd_timeout);