[rygel/wip/gst-1.0: 17/17] all: Port to GStreamer 1.0



commit 631fd8ec5ebc7b4ea0dedfef67d0685e50804660
Author: Jens Georg <jensg openismus com>
Date:   Tue Nov 20 20:16:15 2012 +0100

    all: Port to GStreamer 1.0

 configure.ac                                       |   29 ++--
 data/presets/GstFaac.prs                           |    5 +-
 data/presets/GstLameMP3Enc.prs                     |    2 +-
 data/presets/GstMP4Mux.prs                         |    2 +-
 data/presets/GstTwoLame.prs                        |    2 +-
 data/presets/GstX264Enc.prs                        |    2 +-
 data/presets/{ffenc_aac.prs => avenc_aac.prs}      |    4 +-
 data/presets/{ffenc_mp2.prs => avenc_mp2.prs}      |    4 +-
 .../{ffenc_mpeg2video.prs => avenc_mpeg2video.prs} |    4 +-
 data/presets/{ffenc_wmav1.prs => avenc_wmav1.prs}  |    4 +-
 data/presets/{ffenc_wmv1.prs => avenc_wmv1.prs}    |    4 +-
 src/librygel-renderer-gst/Makefile.am              |    1 +
 src/librygel-renderer-gst/filelist.am              |    2 +-
 .../rygel-playbin-player.vala                      |   18 +--
 .../rygel-playbin-renderer.vala                    |    4 +-
 src/media-engines/gstreamer/Makefile.am            |    7 +-
 .../gstreamer/rygel-audio-transcoder.vala          |    1 +
 .../gstreamer/rygel-avc-transcoder.vala            |    2 +-
 .../gstreamer/rygel-gst-data-source.vala           |    4 +-
 .../gstreamer/rygel-gst-media-engine.vala          |    3 +-
 src/media-engines/gstreamer/rygel-gst-sink.vala    |   12 ++-
 .../gstreamer/rygel-gst-transcoder.vala            |    5 +-
 src/media-engines/gstreamer/rygel-gst-utils.vala   |   16 +-
 .../gstreamer/rygel-l16-transcoder.vala            |    8 +-
 .../gstreamer/rygel-mp2ts-transcoder.vala          |    2 +-
 .../gstreamer/rygel-video-transcoder.vala          |    1 +
 src/plugins/gst-launch/Makefile.am                 |    3 +-
 src/plugins/media-export/Makefile.am               |    7 +-
 .../rygel-media-export-harvesting-task.vala        |    2 +-
 .../media-export/rygel-media-export-item.vala      |  149 ++++++++++---------
 .../rygel-media-export-jpeg-writer.vala            |   15 +-
 .../rygel-media-export-metadata-extractor.vala     |   18 ++-
 tests/Makefile.am                                  |    1 +
 tests/rygel-playbin-renderer-test.vala             |   10 +-
 34 files changed, 188 insertions(+), 165 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 10685b4..b0f03ff 100644
--- a/configure.ac
+++ b/configure.ac
@@ -29,14 +29,15 @@ LT_INIT([dlopen disable-static])
 
 dnl Required versions of library packages
 GLIB_REQUIRED=2.31.13
+LIBXML_REQUIRED=2.7
 VALA_REQUIRED=0.16.1
 VALADOC_REQUIRED=0.2
 GSSDP_REQUIRED=0.13.0
 GUPNP_REQUIRED=0.19.0
 GUPNP_AV_REQUIRED=0.11.2
-GUPNP_DLNA_REQUIRED=0.5.0
-GSTREAMER_REQUIRED=0.10.36
-GSTPBU_REQUIRED=0.10.35
+GUPNP_DLNA_REQUIRED=0.7.0
+GSTREAMER_REQUIRED=1.0
+GSTPBU_REQUIRED=1.0
 GIO_REQUIRED=2.26
 GEE_REQUIRED=0.8.0
 UUID_REQUIRED=1.41.3
@@ -44,8 +45,8 @@ LIBSOUP_REQUIRED=2.34.0
 GTK_REQUIRED=2.90.3
 
 dnl Additional requirements for media-export plugin
-GSTREAMER_TAG_REQUIRED=0.10.28
-GSTREAMER_APP_REQUIRED=0.10.28
+GSTREAMER_TAG_REQUIRED=1.0
+GSTREAMER_APP_REQUIRED=1.0
 LIBSQLITE3_REQUIRED=3.5
 
 dnl Additional requirements for tracker plugin
@@ -61,6 +62,7 @@ PKG_CHECK_MODULES(LIBGIO, gio-2.0 >= $GIO_REQUIRED)
 PKG_CHECK_MODULES(GEE, gee-0.8 >= $GEE_REQUIRED)
 PKG_CHECK_MODULES(UUID, uuid >= $UUID_REQUIRED)
 PKG_CHECK_MODULES(LIBSOUP, libsoup-2.4 >= $LIBSOUP_REQUIRED)
+PKG_CHECK_MODULES(LIBXML, libxml-2.0 >= $LIBXML_REQUIRED)
 
 dnl Media engine to use
 BUILT_ENGINES="librygel-media-engine-simple"
@@ -74,10 +76,10 @@ AC_ARG_WITH([media_engine],
 
 AS_IF([test "x$with_media_engine" = "xgstreamer"],
       [
-        PKG_CHECK_MODULES(LIBGUPNP_DLNA, gupnp-dlna-1.0 >= $GUPNP_DLNA_REQUIRED)
-        PKG_CHECK_MODULES(LIBGSTREAMER, gstreamer-0.10 >= $GSTREAMER_REQUIRED)
-        PKG_CHECK_MODULES(GSTREAMER_BASE, gstreamer-base-0.10 >= $GSTREAMER_REQUIRED)
-        PKG_CHECK_MODULES(GST_PBU, gstreamer-pbutils-0.10 >= $GSTPBU_REQUIRED)
+        PKG_CHECK_MODULES(LIBGUPNP_DLNA, gupnp-dlna-1.1 >= $GUPNP_DLNA_REQUIRED)
+        PKG_CHECK_MODULES(LIBGSTREAMER, gstreamer-1.0 >= $GSTREAMER_REQUIRED)
+        PKG_CHECK_MODULES(GSTREAMER_BASE, gstreamer-base-1.0 >= $GSTREAMER_REQUIRED)
+        PKG_CHECK_MODULES(GST_PBU, gstreamer-pbutils-1.0 >= $GSTPBU_REQUIRED)
         enable_gstreamer="yes"
         BUILT_ENGINES="$BUILT_ENGINES;librygel-media-engine-gst"
       ],
@@ -128,7 +130,8 @@ RYGEL_CHECK_VALA([$VALA_REQUIRED],
 
 AS_IF([test "x$with_media_engine" = "xgstreamer"],
       [
-        RYGEL_CHECK_PACKAGES([gupnp-dlna-1.0 gstreamer-0.10 gstreamer-pbutils-0.10])
+        RYGEL_CHECK_PACKAGES([gupnp-dlna-1.1 gstreamer-1.0
+                              gstreamer-pbutils-1.0])
       ])
 
 dnl Debugging
@@ -210,9 +213,9 @@ dnl Check additional requirements for MediaExport plugins
 if test "x$enable_media_export_plugin" = "xyes";
 then
     PKG_CHECK_MODULES(LIBSQLITE3, sqlite3 >= $LIBSQLITE3_REQUIRED)
-    PKG_CHECK_MODULES(GSTREAMER_TAG, gstreamer-tag-0.10 >= $GSTREAMER_TAG_REQUIRED);
-    PKG_CHECK_MODULES(GSTREAMER_APP, gstreamer-app-0.10 >= $GSTREAMER_APP_REQUIRED);
-    RYGEL_CHECK_PACKAGES([sqlite3 gstreamer-tag-0.10 gstreamer-app-0.10])
+    PKG_CHECK_MODULES(GSTREAMER_TAG, gstreamer-tag-1.0 >= $GSTREAMER_TAG_REQUIRED);
+    PKG_CHECK_MODULES(GSTREAMER_APP, gstreamer-app-1.0 >= $GSTREAMER_APP_REQUIRED);
+    RYGEL_CHECK_PACKAGES([sqlite3 gstreamer-tag-1.0 gstreamer-app-1.0])
     AC_CHECK_HEADER([unistr.h],
                     AC_CHECK_LIB([unistring],
                                  [u8_strcoll],
diff --git a/data/presets/GstFaac.prs b/data/presets/GstFaac.prs
index 6989485..c02d4fa 100644
--- a/data/presets/GstFaac.prs
+++ b/data/presets/GstFaac.prs
@@ -1,5 +1,5 @@
 [_presets_]
-version=0.10
+version=1.0
 element-name=GstFaac
 
 [Rygel DLNA preset]
@@ -7,3 +7,6 @@ bitrate=64000
 
 [Rygel AAC_ADTS_320 preset]
 bitrate=256000
+
+[Rygel AVC_MP4_BL_CIF15_AAC_520 preset]
+bitrate=256000
diff --git a/data/presets/GstLameMP3Enc.prs b/data/presets/GstLameMP3Enc.prs
index a80a10d..fd66ea1 100644
--- a/data/presets/GstLameMP3Enc.prs
+++ b/data/presets/GstLameMP3Enc.prs
@@ -1,5 +1,5 @@
 [_presets_]
-version=0.10
+version=1.0
 element-name=GstLameMP3Enc
 
 [Rygel DLNA preset]
diff --git a/data/presets/GstMP4Mux.prs b/data/presets/GstMP4Mux.prs
index 8c54280..c5a885c 100644
--- a/data/presets/GstMP4Mux.prs
+++ b/data/presets/GstMP4Mux.prs
@@ -1,5 +1,5 @@
 [_presets_]
-version=0.10
+version=1.0
 element-name=GstMP4Mux
 
 [Rygel DLNA preset]
diff --git a/data/presets/GstTwoLame.prs b/data/presets/GstTwoLame.prs
index e802529..7ad2523 100644
--- a/data/presets/GstTwoLame.prs
+++ b/data/presets/GstTwoLame.prs
@@ -1,5 +1,5 @@
 [_presets_]
-version=0.10
+version=1.0
 element-name=GstTwoLame
 
 [Rygel DLNA preset]
diff --git a/data/presets/GstX264Enc.prs b/data/presets/GstX264Enc.prs
index b126d36..400717d 100644
--- a/data/presets/GstX264Enc.prs
+++ b/data/presets/GstX264Enc.prs
@@ -1,5 +1,5 @@
 [_presets_]
-version=0.10
+version=1.0
 element-name=GstX264Enc
 
 [Rygel AVC_MP4_BL_CIF15_AAC_520 preset]
diff --git a/data/presets/ffenc_aac.prs b/data/presets/avenc_aac.prs
similarity index 80%
rename from data/presets/ffenc_aac.prs
rename to data/presets/avenc_aac.prs
index cd3838e..0ea27d0 100644
--- a/data/presets/ffenc_aac.prs
+++ b/data/presets/avenc_aac.prs
@@ -1,6 +1,6 @@
 [_presets_]
-version=0.10
-element-name=ffenc_aac
+version=1.0
+element-name=wvenc_aac
 
 [Rygel DLNA preset]
 bitrate=64000
diff --git a/data/presets/ffenc_mp2.prs b/data/presets/avenc_mp2.prs
similarity index 57%
rename from data/presets/ffenc_mp2.prs
rename to data/presets/avenc_mp2.prs
index 588af1b..bb557bc 100644
--- a/data/presets/ffenc_mp2.prs
+++ b/data/presets/avenc_mp2.prs
@@ -1,6 +1,6 @@
 [_presets_]
-version=0.10
-element-name=ffenc_mp2
+version=1.0
+element-name=avenc_mp2
 
 [Rygel DLNA preset]
 bitrate=256000
diff --git a/data/presets/ffenc_mpeg2video.prs b/data/presets/avenc_mpeg2video.prs
similarity index 53%
rename from data/presets/ffenc_mpeg2video.prs
rename to data/presets/avenc_mpeg2video.prs
index 32a14d4..bfd1f05 100644
--- a/data/presets/ffenc_mpeg2video.prs
+++ b/data/presets/avenc_mpeg2video.prs
@@ -1,6 +1,6 @@
 [_presets_]
-version=0.10
-element-name=ffenc_mpeg2video
+version=1.0
+element-name=avenc_mpeg2video
 
 [Rygel DLNA preset]
 bitrate=1500000
diff --git a/data/presets/ffenc_wmav1.prs b/data/presets/avenc_wmav1.prs
similarity index 55%
rename from data/presets/ffenc_wmav1.prs
rename to data/presets/avenc_wmav1.prs
index c28a00e..736b002 100644
--- a/data/presets/ffenc_wmav1.prs
+++ b/data/presets/avenc_wmav1.prs
@@ -1,6 +1,6 @@
 [_presets_]
-version=0.10
-element-name=ffenc_wmav1
+version=1.0
+element-name=avenc_wmav1
 
 [Rygel DLNA preset]
 bitrate=64000
diff --git a/data/presets/ffenc_wmv1.prs b/data/presets/avenc_wmv1.prs
similarity index 56%
rename from data/presets/ffenc_wmv1.prs
rename to data/presets/avenc_wmv1.prs
index 6434df4..0a8319e 100644
--- a/data/presets/ffenc_wmv1.prs
+++ b/data/presets/avenc_wmv1.prs
@@ -1,6 +1,6 @@
 [_presets_]
-version=0.10
-element-name=ffenc_wmv1
+version=1.0
+element-name=avenc_wmv1
 
 [Rygel DLNA preset]
 bitrate=1200000
diff --git a/src/librygel-renderer-gst/Makefile.am b/src/librygel-renderer-gst/Makefile.am
index 643a3e2..139877a 100644
--- a/src/librygel-renderer-gst/Makefile.am
+++ b/src/librygel-renderer-gst/Makefile.am
@@ -17,6 +17,7 @@ AM_CFLAGS += -DG_LOG_DOMAIN=\"Rygel\" \
 
 librygel_renderer_gst_2_0_la_VALAFLAGS = \
 	-H rygel-renderer-gst.h --library=rygel-renderer-gst-2.0 \
+	--enable-experimental \
 	$(LIBRYGEL_RENDERER_GST_VALAFLAGS_PKG) \
 	$(RYGEL_COMMON_RENDERER_PLUGIN_VALAFLAGS)
 librygel_renderer_gst_2_0_la_LIBADD = \
diff --git a/src/librygel-renderer-gst/filelist.am b/src/librygel-renderer-gst/filelist.am
index c21215d..379a9be 100644
--- a/src/librygel-renderer-gst/filelist.am
+++ b/src/librygel-renderer-gst/filelist.am
@@ -5,4 +5,4 @@ LIBRYGEL_RENDERER_GST_VAPI_SOURCE_FILES = \
 
 LIBRYGEL_RENDERER_GST_NONVAPI_SOURCE_FILES = 
 
-LIBRYGEL_RENDERER_GST_VALAFLAGS_PKG = --pkg gstreamer-0.10
+LIBRYGEL_RENDERER_GST_VALAFLAGS_PKG = --pkg gstreamer-1.0
diff --git a/src/librygel-renderer-gst/rygel-playbin-player.vala b/src/librygel-renderer-gst/rygel-playbin-player.vala
index 1f49de6..098255f 100644
--- a/src/librygel-renderer-gst/rygel-playbin-player.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-player.vala
@@ -243,10 +243,9 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
     public int64 duration {
         get {
-            var format = Format.TIME;
             int64 dur;
 
-            if (this.playbin.query_duration (ref format, out dur)) {
+            if (this.playbin.query_duration (Format.TIME, out dur)) {
                 return dur / Gst.USECOND;
             } else {
                 return 0;
@@ -256,10 +255,9 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
     public int64 position {
         get {
-            var format = Format.TIME;
             int64 pos;
 
-            if (this.playbin.query_position (ref format, out pos)) {
+            if (this.playbin.query_position (Format.TIME, out pos)) {
                 return pos / Gst.USECOND;
             } else {
                 return 0;
@@ -268,7 +266,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
     }
 
     private Player () {
-        this.playbin = ElementFactory.make ("playbin2", null);
+        this.playbin = ElementFactory.make ("playbin", null);
         this.foreign = false;
         this.setup_playbin ();
     }
@@ -276,7 +274,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
     public Player.wrap (Gst.Element playbin) {
 
         return_if_fail (playbin != null);
-        return_if_fail (playbin.get_type ().name() == "GstPlayBin2");
+        return_if_fail (playbin.get_type ().name() == "GstPlayBin");
 
         this.playbin = playbin;
         this.foreign = true;
@@ -323,7 +321,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
     private void bus_handler (Gst.Bus bus,
                               Message message) {
         switch (message.type) {
-        case MessageType.DURATION:
+        case MessageType.DURATION_CHANGED:
             this.duration_hint = true;
         break;
         case MessageType.STATE_CHANGED:
@@ -341,8 +339,8 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
 
                     if (this.uri_update_hint) {
                         this.uri_update_hint = false;
-                        string uri = this.playbin.uri;
-                        if (this._uri != uri) {
+                        string uri = this.playbin.current_uri;
+                        if (this._uri != uri && uri != "") {
                             // uri changed externally
                             this._uri = this.playbin.uri;
                             this.notify_property ("uri");
@@ -426,7 +424,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
             this.transfer_mode != null) {
             debug ("Setting transfer mode to %s", this.transfer_mode);
 
-            var structure = new Structure.empty ("Extra Headers");
+            var structure = new Structure.empty ("HTTPHeaders");
             structure.set_value ("transferMode.dlna.org", this.transfer_mode);
 
             source.extra_headers = structure;
diff --git a/src/librygel-renderer-gst/rygel-playbin-renderer.vala b/src/librygel-renderer-gst/rygel-playbin-renderer.vala
index 740401c..ea3c13a 100644
--- a/src/librygel-renderer-gst/rygel-playbin-renderer.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-renderer.vala
@@ -29,7 +29,7 @@ internal class Rygel.Playbin.WrappingPlugin : Rygel.MediaRendererPlugin {
         base ("LibRygel-Renderer", _("LibRygel Renderer"));
 
         return_val_if_fail (playbin != null, null);
-        return_val_if_fail (playbin.get_type ().name() == "GstPlayBin2", null);
+        return_val_if_fail (playbin.get_type ().name() == "GstPlayBin", null);
 
         this.player = new Player.wrap (playbin);
     }
@@ -84,7 +84,7 @@ public class Rygel.Playbin.Renderer : Rygel.MediaDevice {
         base ();
 
         return_val_if_fail (pipeline != null, null);
-        return_val_if_fail (pipeline.get_type ().name() == "GstPlayBin2", null);
+        return_val_if_fail (pipeline.get_type ().name() == "GstPlayBin", null);
 
         this.plugin = new WrappingPlugin (pipeline);
         this.prepare_upnp (title);
diff --git a/src/media-engines/gstreamer/Makefile.am b/src/media-engines/gstreamer/Makefile.am
index b853a6a..255b309 100644
--- a/src/media-engines/gstreamer/Makefile.am
+++ b/src/media-engines/gstreamer/Makefile.am
@@ -22,9 +22,10 @@ librygel_media_engine_gst_la_SOURCES = \
 	rygel-wmv-transcoder.vala
 
 librygel_media_engine_gst_la_VALAFLAGS = \
-	--pkg gstreamer-base-0.10 \
-	--pkg gstreamer-pbutils-0.10 \
-	--pkg gupnp-dlna-1.0 \
+	--enable-experimental \
+	--pkg gstreamer-base-1.0 \
+	--pkg gstreamer-pbutils-1.0 \
+	--pkg gupnp-dlna-1.1 \
 	--library rygel-media-engine-gst \
 	--use-header \
 	--header=rygel-media-engine-gst.h \
diff --git a/src/media-engines/gstreamer/rygel-audio-transcoder.vala b/src/media-engines/gstreamer/rygel-audio-transcoder.vala
index d46880c..76a503c 100644
--- a/src/media-engines/gstreamer/rygel-audio-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-audio-transcoder.vala
@@ -21,6 +21,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 using Gst;
+using Gst.PbUtils;
 using GUPnP;
 
 /**
diff --git a/src/media-engines/gstreamer/rygel-avc-transcoder.vala b/src/media-engines/gstreamer/rygel-avc-transcoder.vala
index d1a4e61..3e48efc 100644
--- a/src/media-engines/gstreamer/rygel-avc-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-avc-transcoder.vala
@@ -35,7 +35,7 @@ internal class Rygel.AVCTranscoder : Rygel.VideoTranscoder {
         "video/x-h264,stream-format=avc";
 
     private const string RESTRICTIONS =
-        "video/x-raw-yuv,framerate=(fraction)15/1,width=352,height=288";
+        "framerate=(fraction)15/1,width=352,height=288";
 
     public AVCTranscoder () {
         base ("video/mp4",
diff --git a/src/media-engines/gstreamer/rygel-gst-data-source.vala b/src/media-engines/gstreamer/rygel-gst-data-source.vala
index 3a94caf..1e536f6 100644
--- a/src/media-engines/gstreamer/rygel-gst-data-source.vala
+++ b/src/media-engines/gstreamer/rygel-gst-data-source.vala
@@ -108,11 +108,11 @@ internal class Rygel.GstDataSource : Rygel.DataSource, GLib.Object {
 
         // Bus handler
         var bus = this.pipeline.get_bus ();
-        this.bus_watch_id = bus.add_watch (this.bus_handler);
+        this.bus_watch_id = bus.add_watch (Priority.DEFAULT, this.bus_handler);
     }
 
     private void src_pad_added (Element src, Pad src_pad) {
-        var caps = src_pad.get_caps_reffed ();
+        var caps = src_pad.query_caps (null);
 
         var sink = this.pipeline.get_by_name (GstSink.NAME);
         Pad sink_pad;
diff --git a/src/media-engines/gstreamer/rygel-gst-media-engine.vala b/src/media-engines/gstreamer/rygel-gst-media-engine.vala
index af5b4cb..867b9c2 100644
--- a/src/media-engines/gstreamer/rygel-gst-media-engine.vala
+++ b/src/media-engines/gstreamer/rygel-gst-media-engine.vala
@@ -35,13 +35,12 @@ public class Rygel.GstMediaEngine : Rygel.MediaEngine {
     private GLib.List<Transcoder> transcoders = null;
 
     public GstMediaEngine () {
-        // Work-around vapi bug, fixed for GStreamer 1.0
         unowned string[] args = null;
 
         Gst.init (ref args);
         gst_preset_set_app_dir (PRESET_DIR);
 
-        var discoverer = new GUPnP.DLNADiscoverer ((ClockTime) SECOND,
+        var discoverer = new GUPnPDLNA.Discoverer ((ClockTime) SECOND,
                                                    true,
                                                    false);
         foreach (var profile in discoverer.list_profiles ()) {
diff --git a/src/media-engines/gstreamer/rygel-gst-sink.vala b/src/media-engines/gstreamer/rygel-gst-sink.vala
index 690977e..67e582d 100644
--- a/src/media-engines/gstreamer/rygel-gst-sink.vala
+++ b/src/media-engines/gstreamer/rygel-gst-sink.vala
@@ -24,8 +24,9 @@
  */
 
 using Gst;
+using Gst.Base;
 
-internal class Rygel.GstSink : BaseSink {
+internal class Rygel.GstSink : Sink {
     public const string NAME = "http-gst-sink";
     public const string PAD_NAME = "sink";
     // High and low threshold for number of buffered chunks
@@ -127,11 +128,16 @@ internal class Rygel.GstSink : BaseSink {
             return false;
         }
 
-        var to_send = int64.min (buffer.size, left);
+        var bufsize = buffer.get_size ();
+        var to_send = int64.min (bufsize, left);
+        MapInfo info;
 
-        this.source.data_available (buffer.data[0:to_send]);
+        buffer.map (out info, MapFlags.READ);
+
+        this.source.data_available (info.data[0:to_send]);
         this.chunks_buffered++;
         this.bytes_sent += to_send;
+        buffer.unmap (info);
 
         return false;
     }
diff --git a/src/media-engines/gstreamer/rygel-gst-transcoder.vala b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
index 1faea72..70ccf61 100644
--- a/src/media-engines/gstreamer/rygel-gst-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-gst-transcoder.vala
@@ -24,6 +24,7 @@
  */
 
 using Gst;
+using Gst.PbUtils;
 using GUPnP;
 
 /**
@@ -35,7 +36,7 @@ internal abstract class Rygel.GstTranscoder : Rygel.Transcoder {
                            protected set;
                            default =  DEFAULT_ENCODING_PRESET; }
 
-    private const string DECODE_BIN = "decodebin2";
+    private const string DECODE_BIN = "decodebin";
     private const string ENCODE_BIN = "encodebin";
     private const string DEFAULT_ENCODING_PRESET = "Rygel DLNA preset";
 
@@ -121,7 +122,7 @@ internal abstract class Rygel.GstTranscoder : Rygel.Transcoder {
         sinkpad = this.encoder.get_compatible_pad (new_pad, null);
 
         if (sinkpad == null) {
-            var caps = new_pad.get_caps_reffed ();
+            var caps = new_pad.query_caps (null);
             Signal.emit_by_name (this.encoder, "request-pad", caps, out sinkpad);
         }
 
diff --git a/src/media-engines/gstreamer/rygel-gst-utils.vala b/src/media-engines/gstreamer/rygel-gst-utils.vala
index bbef78b..4a440b3 100644
--- a/src/media-engines/gstreamer/rygel-gst-utils.vala
+++ b/src/media-engines/gstreamer/rygel-gst-utils.vala
@@ -22,6 +22,7 @@
  */
 
 using Gst;
+using Gst.PbUtils;
 
 internal errordomain Rygel.GstError {
     MISSING_PLUGIN,
@@ -43,11 +44,8 @@ internal abstract class Rygel.GstUtils {
     }
 
     public static Element? create_source_for_uri (string uri) {
-        dynamic Element src = Element.make_from_uri (URIType.SRC, uri, null);
-        if (src != null) {
-            if (src.is_floating ()) {
-                src.ref_sink ();
-            }
+        try {
+            dynamic Element src = Element.make_from_uri (URIType.SRC, uri, null);
 
             if (src.get_class ().find_property ("blocksize") != null) {
                 // The default is usually 4KiB which is not really big enough
@@ -60,9 +58,11 @@ internal abstract class Rygel.GstUtils {
                 // transmitting
                 src.tcp_timeout = (int64) 60000000;
             }
-        }
 
-        return src;
+            return src;
+        } catch (Error error) {
+            return null;
+        }
     }
 
     public static void dump_encoding_profile (EncodingProfile profile,
@@ -89,7 +89,7 @@ internal abstract class Rygel.GstUtils {
         }
 
         var features = ElementFactory.list_get_elements
-                                        (ELEMENT_FACTORY_TYPE_DEPAYLOADER,
+                                        (ElementFactoryType.DEPAYLOADER,
                                          Rank.NONE);
         features = ElementFactory.list_filter (features,
                                                caps,
diff --git a/src/media-engines/gstreamer/rygel-l16-transcoder.vala b/src/media-engines/gstreamer/rygel-l16-transcoder.vala
index 54516f5..538d405 100644
--- a/src/media-engines/gstreamer/rygel-l16-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-l16-transcoder.vala
@@ -40,13 +40,9 @@ internal class Rygel.L16Transcoder : Rygel.AudioTranscoder {
                         ";rate=" + L16Transcoder.FREQUENCY.to_string () +
                         ";channels=" + L16Transcoder.CHANNELS.to_string ();
 
-        var caps_str = "audio/x-raw-int" +
+        var caps_str = "audio/x-raw,format=S16BE" +
                        ",channels=" + CHANNELS.to_string () +
-                       ",rate=" +  FREQUENCY.to_string () +
-                       ",width=" + WIDTH.to_string () +
-                       ",depth=" + DEPTH.to_string () +
-                       ",signed=" + SIGNED.to_string () +
-                       ",endianness=" + ENDIANNESS.to_string();
+                       ",rate=" +  FREQUENCY.to_string ();
 
         base (mime_type,
               "LPCM",
diff --git a/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala b/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
index b3ffd70..da59e92 100644
--- a/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-mp2ts-transcoder.vala
@@ -51,7 +51,7 @@ internal class Rygel.MP2TSTranscoder : Rygel.VideoTranscoder {
         "video/mpeg,mpegversion=2,systemstream=false";
 
     private const string RESTRICTION_TEMPLATE =
-        "video/x-raw-yuv,framerate=(fraction)%d/1,width=%d,height=%d";
+        "framerate=(fraction)%d/1,width=%d,height=%d";
 
     private MP2TSProfile profile;
 
diff --git a/src/media-engines/gstreamer/rygel-video-transcoder.vala b/src/media-engines/gstreamer/rygel-video-transcoder.vala
index f01da21..7589ded 100644
--- a/src/media-engines/gstreamer/rygel-video-transcoder.vala
+++ b/src/media-engines/gstreamer/rygel-video-transcoder.vala
@@ -20,6 +20,7 @@
  * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 using Gst;
+using Gst.PbUtils;
 using GUPnP;
 
 /**
diff --git a/src/plugins/gst-launch/Makefile.am b/src/plugins/gst-launch/Makefile.am
index 07009ba..bdc2619 100644
--- a/src/plugins/gst-launch/Makefile.am
+++ b/src/plugins/gst-launch/Makefile.am
@@ -15,7 +15,8 @@ librygel_gst_launch_la_SOURCES = \
 	$(top_srcdir)/src/media-engines/gstreamer/rygel-media-engine-gst.vapi
 
 librygel_gst_launch_la_VALAFLAGS = \
-	--pkg gstreamer-0.10 \
+	--enable-experimental \
+	--pkg gstreamer-1.0 \
 	$(RYGEL_COMMON_SERVER_PLUGIN_VALAFLAGS)
 librygel_gst_launch_la_LIBADD = \
 	$(LIBGSTREAMER_LIBS) \
diff --git a/src/plugins/media-export/Makefile.am b/src/plugins/media-export/Makefile.am
index 3294d1f..5c9338b 100644
--- a/src/plugins/media-export/Makefile.am
+++ b/src/plugins/media-export/Makefile.am
@@ -42,9 +42,10 @@ librygel_media_export_la_SOURCES = \
 	rygel-media-export-collate.c
 
 librygel_media_export_la_VALAFLAGS = \
-	--pkg gupnp-dlna-1.0 \
-	--pkg gstreamer-tag-0.10 \
-	--pkg gstreamer-app-0.10 \
+	--enable-experimental \
+	--pkg gupnp-dlna-1.1 \
+	--pkg gstreamer-tag-1.0 \
+	--pkg gstreamer-app-1.0 \
 	--pkg sqlite3 \
 	$(RYGEL_COMMON_SERVER_PLUGIN_VALAFLAGS)
 
diff --git a/src/plugins/media-export/rygel-media-export-harvesting-task.vala b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
index a0fdb67..40470fa 100644
--- a/src/plugins/media-export/rygel-media-export-harvesting-task.vala
+++ b/src/plugins/media-export/rygel-media-export-harvesting-task.vala
@@ -282,7 +282,7 @@ public class Rygel.MediaExport.HarvestingTask : Rygel.StateMachine,
     }
 
     private void on_extracted_cb (File                   file,
-                                  GUPnP.DLNAInformation? dlna,
+                                  GUPnPDLNA.Information? dlna,
                                   FileInfo               file_info) {
         if (this.cancellable.is_cancelled ()) {
             this.completed ();
diff --git a/src/plugins/media-export/rygel-media-export-item.vala b/src/plugins/media-export/rygel-media-export-item.vala
index c8b46e3..90c100b 100644
--- a/src/plugins/media-export/rygel-media-export-item.vala
+++ b/src/plugins/media-export/rygel-media-export-item.vala
@@ -23,6 +23,7 @@
 
 using GUPnP;
 using Gst;
+using Gst.PbUtils;
 
 /**
  * Represents MediaExport item.
@@ -55,15 +56,17 @@ namespace Rygel.MediaExport.ItemFactory {
     public static MediaItem? create_from_info
                                         (MediaContainer        parent,
                                          File                  file,
-                                         GUPnP.DLNAInformation dlna_info,
+                                         GUPnPDLNA.Information dlna_info,
                                          FileInfo              file_info) {
         MediaItem item;
         string id = MediaCache.get_id (file);
         GLib.List<DiscovererAudioInfo> audio_streams;
         GLib.List<DiscovererVideoInfo> video_streams;
 
-        audio_streams = dlna_info.info.get_audio_streams ();
-        video_streams = dlna_info.info.get_video_streams ();
+        audio_streams = (GLib.List<DiscovererAudioInfo>)
+                                        dlna_info.info.get_audio_streams ();
+        video_streams = (GLib.List<DiscovererVideoInfo>)
+                                        dlna_info.info.get_video_streams ();
 
         if (audio_streams == null && video_streams == null) {
             debug ("%s had neither audio nor video/picture " +
@@ -106,9 +109,9 @@ namespace Rygel.MediaExport.ItemFactory {
         }
     }
 
-    private static void fill_audio_item (AudioItem            item,
-                                         DLNAInformation      dlna_info,
-                                         DiscovererAudioInfo? audio_info) {
+    private static void fill_audio_item (AudioItem             item,
+                                         GUPnPDLNA.Information dlna_info,
+                                         DiscovererAudioInfo?  audio_info) {
         if (dlna_info.info.get_duration () > 0) {
             item.duration = (long) (dlna_info.info.get_duration () / Gst.SECOND);
         } else {
@@ -118,7 +121,7 @@ namespace Rygel.MediaExport.ItemFactory {
         if (audio_info != null) {
             if (audio_info.get_tags () != null) {
                 uint tmp;
-                audio_info.get_tags ().get_uint (TAG_BITRATE, out tmp);
+                audio_info.get_tags ().get_uint (Tags.BITRATE, out tmp);
                 item.bitrate = (int) tmp / 8;
             }
             item.channels = (int) audio_info.get_channels ();
@@ -127,12 +130,12 @@ namespace Rygel.MediaExport.ItemFactory {
     }
 
 
-    private static MediaItem fill_video_item (VideoItem            item,
-                                              File                 file,
-                                              DLNAInformation      dlna_info,
-                                              DiscovererVideoInfo  video_info,
-                                              DiscovererAudioInfo? audio_info,
-                                              FileInfo             file_info) {
+    private static MediaItem fill_video_item (VideoItem             item,
+                                              File                  file,
+                                              GUPnPDLNA.Information dlna_info,
+                                              DiscovererVideoInfo   video_info,
+                                              DiscovererAudioInfo?  audio_info,
+                                              FileInfo              file_info) {
         fill_audio_item (item as AudioItem, dlna_info, audio_info);
         fill_media_item (item, file, dlna_info, file_info);
 
@@ -145,11 +148,11 @@ namespace Rygel.MediaExport.ItemFactory {
         return item;
     }
 
-    private static MediaItem fill_photo_item (PhotoItem           item,
-                                              File                file,
-                                              DLNAInformation     dlna_info,
-                                              DiscovererVideoInfo video_info,
-                                              FileInfo            file_info) {
+    private static MediaItem fill_photo_item (PhotoItem             item,
+                                              File                  file,
+                                              GUPnPDLNA.Information dlna_info,
+                                              DiscovererVideoInfo   video_info,
+                                              FileInfo              file_info) {
         fill_media_item (item, file, dlna_info, file_info);
 
         item.width = (int) video_info.get_width ();
@@ -161,74 +164,77 @@ namespace Rygel.MediaExport.ItemFactory {
         return item;
     }
 
-    private static MediaItem fill_music_item (MusicItem            item,
-                                              File                 file,
-                                              DLNAInformation      dlna_info,
-                                              DiscovererAudioInfo? audio_info,
-                                              FileInfo             file_info) {
+    private static MediaItem fill_music_item (MusicItem             item,
+                                              File                  file,
+                                              GUPnPDLNA.Information dlna_info,
+                                              DiscovererAudioInfo?  audio_info,
+                                              FileInfo              file_info) {
         fill_audio_item (item as AudioItem, dlna_info, audio_info);
         fill_media_item (item, file, dlna_info, file_info);
 
-        if (audio_info != null) {
-            if (audio_info.get_tags () != null) {
-                unowned Gst.Buffer buffer;
-                audio_info.get_tags ().get_buffer (TAG_IMAGE, out buffer);
-                if (buffer != null) {
-                    var structure = buffer.caps.get_structure (0);
-                    int image_type;
-                    structure.get_enum ("image-type",
-                            typeof (Gst.TagImageType),
-                            out image_type);
-                    switch (image_type) {
-                        case TagImageType.UNDEFINED:
-                        case TagImageType.FRONT_COVER:
-                            var store = MediaArtStore.get_default ();
-                            var thumb = store.get_media_art_file ("album",
-                                    item,
-                                    true);
-                            try {
-                                var writer = new JPEGWriter ();
-                                writer.write (buffer, thumb);
-                            } catch (Error error) {}
-                            break;
-                        default:
-                            break;
-                    }
-                }
-            }
+        if (audio_info == null) {
+            return item;
+        }
+        string artist;
+        dlna_info.info.get_tags ().get_string (Tags.ARTIST, out artist);
+        item.artist = artist;
 
-            string artist;
-            dlna_info.info.get_tags ().get_string (TAG_ARTIST, out artist);
-            item.artist = artist;
+        string album;
+        dlna_info.info.get_tags ().get_string (Tags.ALBUM, out album);
+        item.album = album;
 
-            string album;
-            dlna_info.info.get_tags ().get_string (TAG_ALBUM, out album);
-            item.album = album;
+        string genre;
+        dlna_info.info.get_tags ().get_string (Tags.GENRE, out genre);
+        item.genre = genre;
 
-            string genre;
-            dlna_info.info.get_tags ().get_string (TAG_GENRE, out genre);
-            item.genre = genre;
+        uint tmp;
+        dlna_info.info.get_tags ().get_uint (Tags.ALBUM_VOLUME_NUMBER,
+                                             out tmp);
+        item.disc = (int) tmp;
 
-            uint tmp;
-            dlna_info.info.get_tags ().get_uint (TAG_ALBUM_VOLUME_NUMBER,
-                                                 out tmp);
-            item.disc = (int) tmp;
+        dlna_info.info.get_tags() .get_uint (Tags.TRACK_NUMBER, out tmp);
+        item.track_number = (int) tmp;
 
-            dlna_info.info.get_tags() .get_uint (TAG_TRACK_NUMBER, out tmp);
-            item.track_number = (int) tmp;
+        if (audio_info.get_tags () == null) {
+            return item;
         }
 
+/*        Sample sample;
+        audio_info.get_tags ().get_sample (Tags.IMAGE, out sample);
+        if (sample == null) {
+            return item;
+        }
+        var structure = sample.get_caps ().get_structure (0);
+
+        int image_type;
+        structure.get_enum ("image-type",
+                            typeof (Gst.Tag.ImageType),
+                            out image_type);
+        switch (image_type) {
+            case Tag.ImageType.UNDEFINED:
+            case Tag.ImageType.FRONT_COVER:
+                var store = MediaArtStore.get_default ();
+                var thumb = store.get_media_art_file ("album", item, true);
+                try {
+                    var writer = new JPEGWriter ();
+                    writer.write (sample.get_buffer (), thumb);
+                } catch (Error error) {}
+                break;
+            default:
+                break;
+        } */
+
         return item;
     }
 
-    private static void fill_media_item (MediaItem       item,
-                                         File            file,
-                                         DLNAInformation dlna_info,
-                                         FileInfo        file_info) {
+    private static void fill_media_item (MediaItem             item,
+                                         File                  file,
+                                         GUPnPDLNA.Information dlna_info,
+                                         FileInfo              file_info) {
         string title = null;
 
         if (dlna_info.info.get_tags () == null ||
-            !dlna_info.info.get_tags ().get_string (TAG_TITLE, out title)) {
+            !dlna_info.info.get_tags ().get_string (Tags.TITLE, out title)) {
             title = file_info.get_display_name ();
         }
 
@@ -236,7 +242,8 @@ namespace Rygel.MediaExport.ItemFactory {
 
         if (dlna_info.info.get_tags () != null) {
             GLib.Date? date;
-            if (dlna_info.info.get_tags ().get_date (TAG_DATE, out date)) {
+            if (dlna_info.info.get_tags ().get_date (Tags.DATE, out date) &&
+                date.valid ()) {
                 char[] datestr = new char[30];
                 date.strftime (datestr, "%F");
                 item.date = (string) datestr;
diff --git a/src/plugins/media-export/rygel-media-export-jpeg-writer.vala b/src/plugins/media-export/rygel-media-export-jpeg-writer.vala
index 675bfd2..d5162fa 100644
--- a/src/plugins/media-export/rygel-media-export-jpeg-writer.vala
+++ b/src/plugins/media-export/rygel-media-export-jpeg-writer.vala
@@ -30,15 +30,15 @@ using Gst;
  */
 internal class Rygel.MediaExport.JPEGWriter : GLib.Object {
     private Bin bin;
-    private AppSrc appsrc;
+    private App.Src appsrc;
     private MainLoop loop;
     private dynamic Element sink;
 
     public JPEGWriter () throws Error {
-        this.bin = Gst.parse_launch ("appsrc name=src ! decodebin2 ! " +
-                                     "ffmpegcolorspace ! " +
+        this.bin = Gst.parse_launch ("appsrc name=src ! decodebin ! " +
+                                     "autovideoconvert ! " +
                                      "jpegenc ! giosink name=sink") as Bin;
-        this.appsrc = bin.get_by_name ("src") as AppSrc;
+        this.appsrc = bin.get_by_name ("src") as App.Src;
         this.sink = bin.get_by_name ("sink");
         var bus = bin.get_bus ();
         bus.add_signal_watch ();
@@ -55,12 +55,13 @@ internal class Rygel.MediaExport.JPEGWriter : GLib.Object {
      *
      * FIXME This uses a nested main-loop to block which is ugly.
      */
-    public void write (Gst.Buffer buffer, File file) {
+/*    public void write (Gst.Buffer buffer, File file) {
         this.sink.file = file;
-        this.appsrc.push_buffer (buffer);
+        var new_buffer = Gst.buffer_copy (buffer);
+        this.appsrc.push_buffer (new_buffer);
         this.appsrc.end_of_stream ();
         this.bin.set_state (State.PLAYING);
         this.loop.run ();
         this.bin.set_state (State.NULL);
-    }
+    } */
 }
diff --git a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
index 8c29212..7185ac7 100644
--- a/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
+++ b/src/plugins/media-export/rygel-media-export-metadata-extractor.vala
@@ -24,6 +24,7 @@
 
 
 using Gst;
+using Gst.PbUtils;
 using Gee;
 using GUPnP;
 
@@ -35,7 +36,7 @@ using GUPnP;
 public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
     /* Signals */
     public signal void extraction_done (File                   file,
-                                        GUPnP.DLNAInformation? dlna,
+                                        GUPnPDLNA.Information? dlna,
                                         FileInfo               file_info);
 
     /**
@@ -43,7 +44,7 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
      */
     public signal void error (File file, Error err);
 
-    private GUPnP.DLNADiscoverer discoverer;
+    private GUPnPDLNA.Discoverer discoverer;
     /**
      * We export a GLib.File-based API but GstDiscoverer works with URIs, so
      * we store uri->GLib.File mappings in this hashmap, so that we can get
@@ -76,7 +77,7 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
             string uri = file.get_uri ();
             this.file_hash.set (uri, file);
             var gst_timeout = (ClockTime) (this.timeout * Gst.SECOND);
-            this.discoverer = new GUPnP.DLNADiscoverer (gst_timeout,
+            this.discoverer = new GUPnPDLNA.Discoverer (gst_timeout,
                                                         true,
                                                         true);
             this.discoverer.done.connect (on_done);
@@ -87,7 +88,7 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         }
     }
 
-    private void on_done (GUPnP.DLNAInformation dlna,
+    private void on_done (GUPnPDLNA.Information dlna,
                           GLib.Error            err) {
         this.discoverer.done.disconnect (on_done);
         this.discoverer = null;
@@ -101,13 +102,13 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
 
         this.file_hash.unset (dlna.info.get_uri ());
 
-        if ((dlna.info.get_result () & Gst.DiscovererResult.TIMEOUT) != 0) {
+        if ((dlna.info.get_result () & DiscovererResult.TIMEOUT) != 0) {
             debug ("Extraction timed out on %s", file.get_uri ());
 
             // set dlna to null to extract basic file information
             dlna = null;
         } else if ((dlna.info.get_result () &
-                    Gst.DiscovererResult.ERROR) != 0) {
+                    DiscovererResult.ERROR) != 0) {
             this.error (file, err);
 
             return;
@@ -116,8 +117,9 @@ public class Rygel.MediaExport.MetadataExtractor: GLib.Object {
         this.extract_basic_information (file, dlna);
     }
 
-    private void extract_basic_information (File file,
-                                            DLNAInformation? dlna = null) {
+    private void extract_basic_information
+                                        (File file,
+                                         GUPnPDLNA.Information? dlna = null) {
         try {
             FileInfo file_info;
 
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 95f05c8..d095547 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -16,6 +16,7 @@ AM_CFLAGS = $(LIBGUPNP_CFLAGS) \
 
 LDADD = $(LIBGUPNP_LIBS) \
 	$(LIBGSSDP_LIBS) \
+	$(LIBXML_LIBS) \
 	$(LIBGUPNP_AV_LIBS) \
 	$(LIBGSTREAMER_LIBS) \
 	$(GSTREAMER_BASE_LIBS) \
diff --git a/tests/rygel-playbin-renderer-test.vala b/tests/rygel-playbin-renderer-test.vala
index 94d35ea..194ed5d 100644
--- a/tests/rygel-playbin-renderer-test.vala
+++ b/tests/rygel-playbin-renderer-test.vala
@@ -29,21 +29,21 @@ private class Rygel.PlaybinRendererTest : GLib.Object {
         Gst.init (ref args);
 
         var test = new PlaybinRendererTest ();
-        test.test_with_default_gstplaybin2 ();
-        test.test_with_existing_gstplaybin2 ();
+        test.test_with_default_gstplaybin ();
+        test.test_with_existing_gstplaybin ();
 
         return 0;
     }
 
-    public void test_with_default_gstplaybin2() {
+    public void test_with_default_gstplaybin() {
         var renderer = new Rygel.Playbin.Renderer ("test playbin renderer");
         assert (renderer != null);
         var player = Rygel.Playbin.Player.get_default ();
         assert (player.playbin != null);
     }
 
-    public void test_with_existing_gstplaybin2() {
-        var element = Gst.ElementFactory.make ("playbin2", null);
+    public void test_with_existing_gstplaybin() {
+        var element = Gst.ElementFactory.make ("playbin", null);
         var renderer = new Rygel.Playbin.Renderer.wrap (element, "test playbin renderer");
         assert (renderer != null);
         var player = Rygel.Playbin.Player.get_default ();



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