[rygel] server: Fix build with new libmediaart



commit 8cce523f2bf722e90951391a2d120af6d205d347
Author: Rico Tzschichholz <ricotz t-online de>
Date:   Fri Aug 15 23:23:13 2014 +0200

    server: Fix build with new libmediaart
    
    Signed-off-by: Jens Georg <mail jensge org>

 configure.ac                                   |    4 +-
 src/librygel-server/filelist.am                |    3 +-
 src/librygel-server/libmediaart-1.0.vapi       |   35 ------------------------
 src/librygel-server/rygel-media-art-store.vala |   23 +++++++++++++---
 4 files changed, 22 insertions(+), 43 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 8929066..236f3c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ GEE_REQUIRED=0.8.0
 UUID_REQUIRED=1.41.3
 LIBSOUP_REQUIRED=2.44.0
 GTK_REQUIRED=3.0
-MEDIAART_REQUIRED=0.4.0
+MEDIAART_REQUIRED=0.5.0
 
 dnl Additional requirements for media-export plugin
 GSTREAMER_TAG_REQUIRED=1.0
@@ -74,7 +74,7 @@ PKG_CHECK_MODULES([LIBRYGEL_SERVER_DEPS], [$RYGEL_COMMON_MODULES uuid >=
                    libsoup-2.4 >= $LIBSOUP_REQUIRED libmediaart-1.0 >=
                    $MEDIAART_REQUIRED])
 RYGEL_COMMON_MODULES_VALAFLAGS="$RYGEL_BASE_MODULES_VALAFLAGS --pkg gupnp-av-1.0"
-LIBRYGEL_SERVER_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gssdp-1.0 --pkg gio-2.0 --pkg 
libsoup-2.4 --pkg gmodule-2.0"
+LIBRYGEL_SERVER_DEPS_VALAFLAGS="$RYGEL_COMMON_MODULES_VALAFLAGS --pkg gssdp-1.0 --pkg gio-2.0 --pkg 
libsoup-2.4 --pkg gmodule-2.0 --pkg libmediaart-1.0"
 AC_SUBST([LIBRYGEL_SERVER_DEPS_VALAFLAGS])
 
 PKG_CHECK_MODULES([LIBRYGEL_RENDERER_DEPS], [$RYGEL_COMMON_MODULES gio-2.0 >= $GIO_REQUIRED libsoup-2.4 >= 
$LIBSOUP_REQUIRED])
diff --git a/src/librygel-server/filelist.am b/src/librygel-server/filelist.am
index 44cfe04..f40d699 100644
--- a/src/librygel-server/filelist.am
+++ b/src/librygel-server/filelist.am
@@ -78,5 +78,4 @@ LIBRYGEL_SERVER_NONVAPI_SOURCE_FILES = \
        rygel-wmp-hacks.vala \
        rygel-xbmc-hacks.vala \
        rygel-xbox-hacks.vala \
-       rygel-data-sink.vala \
-       libmediaart-1.0.vapi
+       rygel-data-sink.vala
diff --git a/src/librygel-server/rygel-media-art-store.vala b/src/librygel-server/rygel-media-art-store.vala
index 453c09c..5d939f1 100644
--- a/src/librygel-server/rygel-media-art-store.vala
+++ b/src/librygel-server/rygel-media-art-store.vala
@@ -36,11 +36,12 @@ public class Rygel.MediaArtStore : GLib.Object {
     private static bool first_time = true;
 
     private string directory;
+    private MediaArt.Process? media_art_process;
 
     public static MediaArtStore? get_default () {
         if (first_time) {
             try {
-                MediaArt.init ();
+                MediaArt.plugin_init (128);
                 media_art_store = new MediaArtStore ();
             } catch (MediaArtStoreError error) {
                 warning ("No media art available: %s", error.message);
@@ -107,9 +108,16 @@ public class Rygel.MediaArtStore : GLib.Object {
     }
 
     public void add (MusicItem item, File file, uint8[]? data) {
-        MediaArt.process_file (data, item.mime_type,
-                               MediaArt.Type.ALBUM, item.artist, item.album,
-                               file);
+        if (media_art_process == null) {
+            return;
+        }
+
+        try {
+            media_art_process.buffer (MediaArt.Type.ALBUM, MediaArt.ProcessFlags.NONE, file,
+                                      data, item.mime_type, item.artist, item.album);
+        } catch (Error error) {
+            warning ("%s", error.message);
+        }
     }
 
     private MediaArtStore () throws MediaArtStoreError {
@@ -122,5 +130,12 @@ public class Rygel.MediaArtStore : GLib.Object {
         }
 
         this.directory = dir;
+
+        try {
+            this.media_art_process = new MediaArt.Process ();
+        } catch (Error error) {
+            this.media_art_process = null;
+            throw new MediaArtStoreError.NO_MEDIA_ART ("%s", error.message);
+        }
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]