[rygel/wip/media-engine: 12/13] renderer: Remove GStreamer references
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/media-engine: 12/13] renderer: Remove GStreamer references
- Date: Thu, 27 Sep 2012 14:37:43 +0000 (UTC)
commit 287460dcf61e33b5fada8312e4fed332bbf533c1
Author: Jens Georg <jensg openismus com>
Date: Thu Sep 27 14:44:59 2012 +0200
renderer: Remove GStreamer references
Change API to be more like libserver. Extract Playbin-specific implementation
into an additional library.
configure.ac | 2 +
doc/reference/Makefile.am | 2 +-
src/Makefile.am | 5 ++-
src/librygel-renderer-gst/Makefile.am | 31 +++++++++++
src/librygel-renderer-gst/filelist.am | 8 +++
.../rygel-gst-utils.vala | 0
.../rygel-playbin-player.vala | 8 ++--
.../rygel-playbin-plugin.vala | 0
.../rygel-playbin-renderer.vala | 0
src/librygel-renderer/Makefile.am | 5 +--
src/librygel-renderer/filelist.am | 6 +--
src/librygel-renderer/rygel-av-transport.vala | 2 +-
src/librygel-renderer/rygel-media-player.vala | 10 +++-
src/librygel-renderer/rygel-media-renderer.vala | 58 ++++++++++++++++++++
...{rygel-gst-utils.vala => rygel-time-utils.vala} | 22 +++-----
src/librygel-server/rygel-media-server.vala | 1 +
src/plugins/mpris/rygel-mpris-player.vala | 8 ++--
src/plugins/playbin/Makefile.am | 11 +++-
18 files changed, 140 insertions(+), 39 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 5f48fbf..7e25284 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,6 +234,7 @@ Makefile
src/Makefile
src/librygel-core/Makefile
src/librygel-renderer/Makefile
+src/librygel-renderer-gst/Makefile
src/librygel-server/Makefile
src/rygel/Makefile
src/ui/Makefile
@@ -255,6 +256,7 @@ doc/reference/Makefile
doc/reference/librygel-core/Makefile
doc/reference/librygel-renderer/Makefile
doc/reference/librygel-server/Makefile
+doc/reference/librygel-renderer-gst/Makefile
po/Makefile.in
rygel-core-1.0.pc
rygel-renderer-1.0.pc
diff --git a/doc/reference/Makefile.am b/doc/reference/Makefile.am
index b911f1b..9072c1e 100644
--- a/doc/reference/Makefile.am
+++ b/doc/reference/Makefile.am
@@ -1 +1 @@
-SUBDIRS = librygel-core librygel-renderer librygel-server
+SUBDIRS = librygel-core librygel-renderer librygel-server librygel-renderer-gst
diff --git a/src/Makefile.am b/src/Makefile.am
index e18dcf3..754e42d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,4 +1,7 @@
-SUBDIRS = librygel-core librygel-renderer librygel-server rygel media-engines plugins
+SUBDIRS = librygel-core librygel-renderer librygel-server librygel-renderer-gst
+
+SUBDIRS += rygel media-engines plugins
+
if BUILD_UI
SUBDIRS += ui
endif
diff --git a/src/librygel-renderer-gst/Makefile.am b/src/librygel-renderer-gst/Makefile.am
new file mode 100644
index 0000000..c95b5ec
--- /dev/null
+++ b/src/librygel-renderer-gst/Makefile.am
@@ -0,0 +1,31 @@
+include ../../common.am
+include $(srcdir)/filelist.am
+
+librygel_renderer_includedir=$(includedir)/rygel-1.0
+librygel_renderer_include_HEADERS = rygel-renderer-gst.h
+
+lib_LTLIBRARIES = librygel-renderer-gst-1.0.la
+
+LIBRYGEL_RENDERER_GST_VERSION=0:0:0
+
+librygel_renderer_gst_1_0_la_SOURCES = \
+ $(LIBRYGEL_RENDERER_GST_VAPI_SOURCE_FILES) \
+ $(LIBRYGEL_RENDERER_GST_NONVAPI_SOURCE_FILES)
+
+AM_CFLAGS += -DG_LOG_DOMAIN=\"Rygel\" \
+ $(LIBGSTREAMER_CFLAGS)
+
+librygel_renderer_gst_1_0_la_VALAFLAGS = \
+ -H rygel-renderer-gst.h --library=rygel-renderer-gst-1.0 \
+ $(LIBRYGEL_RENDERER_GST_VALAFLAGS_PKG) \
+ $(RYGEL_COMMON_RENDERER_PLUGIN_VALAFLAGS)
+librygel_renderer_gst_1_0_la_LIBADD = \
+ $(RYGEL_COMMON_RENDERER_LIBS) \
+ $(LIBGSTREAMER_LIBS) \
+ $(LIBGUPNP_DLNA_LIBS)
+librygel_renderer_gst_1_0_la_LDFLAGS = -version-info $(LIBRYGEL_RENDERER_GST_VERSION)
+
+rygel-renderer-gst.h rygel-renderer-gst-1.0.vapi: \
+ librygel_renderer_gst_1_0_la_vala.stamp
+
+EXTRA_DIST=rygel-renderer-gst.h rygel-renderer-gst-1.0.vapi
diff --git a/src/librygel-renderer-gst/filelist.am b/src/librygel-renderer-gst/filelist.am
new file mode 100644
index 0000000..c6fcc9d
--- /dev/null
+++ b/src/librygel-renderer-gst/filelist.am
@@ -0,0 +1,8 @@
+LIBRYGEL_RENDERER_GST_VAPI_SOURCE_FILES = \
+ rygel-playbin-player.vala \
+ rygel-playbin-plugin.vala \
+ rygel-playbin-renderer.vala
+
+LIBRYGEL_RENDERER_GST_NONVAPI_SOURCE_FILES =
+
+LIBRYGEL_RENDERER_GST_VALAFLAGS_PKG = --pkg gstreamer-0.10
diff --git a/src/librygel-renderer/rygel-gst-utils.vala b/src/librygel-renderer-gst/rygel-gst-utils.vala
similarity index 100%
copy from src/librygel-renderer/rygel-gst-utils.vala
copy to src/librygel-renderer-gst/rygel-gst-utils.vala
diff --git a/src/librygel-renderer/rygel-playbin-player.vala b/src/librygel-renderer-gst/rygel-playbin-player.vala
similarity index 98%
rename from src/librygel-renderer/rygel-playbin-player.vala
rename to src/librygel-renderer-gst/rygel-playbin-player.vala
index 43c069b..5f3a2c4 100644
--- a/src/librygel-renderer/rygel-playbin-player.vala
+++ b/src/librygel-renderer-gst/rygel-playbin-player.vala
@@ -233,7 +233,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
int64 dur;
if (this.playbin.query_duration (ref format, out dur)) {
- return dur;
+ return dur / Gst.USECOND;
} else {
return 0;
}
@@ -246,7 +246,7 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
int64 pos;
if (this.playbin.query_position (ref format, out pos)) {
- return pos;
+ return pos / Gst.USECOND;
} else {
return 0;
}
@@ -275,12 +275,12 @@ public class Rygel.Playbin.Player : GLib.Object, Rygel.MediaPlayer {
return player;
}
- public bool seek (ClockTime time) {
+ public bool seek (int64 time) {
return this.playbin.seek (1.0,
Format.TIME,
SeekFlags.FLUSH,
Gst.SeekType.SET,
- (int64) time,
+ time * Gst.USECOND,
Gst.SeekType.NONE,
-1);
}
diff --git a/src/librygel-renderer/rygel-playbin-plugin.vala b/src/librygel-renderer-gst/rygel-playbin-plugin.vala
similarity index 100%
rename from src/librygel-renderer/rygel-playbin-plugin.vala
rename to src/librygel-renderer-gst/rygel-playbin-plugin.vala
diff --git a/src/librygel-renderer/rygel-playbin-renderer.vala b/src/librygel-renderer-gst/rygel-playbin-renderer.vala
similarity index 100%
rename from src/librygel-renderer/rygel-playbin-renderer.vala
rename to src/librygel-renderer-gst/rygel-playbin-renderer.vala
diff --git a/src/librygel-renderer/Makefile.am b/src/librygel-renderer/Makefile.am
index d04f75b..c643a48 100644
--- a/src/librygel-renderer/Makefile.am
+++ b/src/librygel-renderer/Makefile.am
@@ -12,13 +12,10 @@ librygel_renderer_1_0_la_SOURCES = \
$(LIBRYGEL_RENDERER_VAPI_SOURCE_FILES) \
$(LIBRYGEL_RENDERER_NONVAPI_SOURCE_FILES)
-librygel_renderer_1_0_la_CFLAGS = \
- $(AM_CFLAGS) \
- $(LIBGSTREAMER_CFLAGS)
+AM_CFLAGS += -DG_LOG_DOMAIN=\"Rygel\"
librygel_renderer_1_0_la_VALAFLAGS = \
-H rygel-renderer.h --library=rygel-renderer-1.0 \
- --pkg gstreamer-0.10 \
$(RYGEL_COMMON_PLUGIN_VALAFLAGS)
librygel_renderer_1_0_la_LIBADD = $(RYGEL_COMMON_LIBS) $(LIBGSTREAMER_LIBS)
librygel_renderer_1_0_la_LDFLAGS = -version-info $(LIBRYGEL_RENDERER_VERSION)
diff --git a/src/librygel-renderer/filelist.am b/src/librygel-renderer/filelist.am
index bc87bb0..5048e79 100644
--- a/src/librygel-renderer/filelist.am
+++ b/src/librygel-renderer/filelist.am
@@ -1,16 +1,14 @@
LIBRYGEL_RENDERER_VAPI_SOURCE_FILES = \
- rygel-playbin-player.vala \
- rygel-playbin-plugin.vala \
rygel-media-renderer-plugin.vala \
rygel-media-player.vala \
- rygel-playbin-renderer.vala
+ rygel-media-renderer.vala
LIBRYGEL_RENDERER_NONVAPI_SOURCE_FILES = \
rygel-av-transport.vala \
rygel-rendering-control.vala \
rygel-sink-connection-manager.vala \
+ rygel-time-utils.vala \
rygel-changelog.vala \
- rygel-gst-utils.vala \
rygel-volume.vala
LIBRYGEL_RENDERER_VALAFLAGS_PKG =
diff --git a/src/librygel-renderer/rygel-av-transport.vala b/src/librygel-renderer/rygel-av-transport.vala
index 3f5e676..28b57e4 100644
--- a/src/librygel-renderer/rygel-av-transport.vala
+++ b/src/librygel-renderer/rygel-av-transport.vala
@@ -522,7 +522,7 @@ internal class Rygel.AVTransport : Service {
case "REL_TIME":
debug ("Seeking to %s.", target);
- if (!this.player.seek (GstUtils.time_from_string (target))) {
+ if (!this.player.seek (TimeUtils.time_from_string (target))) {
action.return_error (710, _("Seek mode not supported"));
return;
diff --git a/src/librygel-renderer/rygel-media-player.vala b/src/librygel-renderer/rygel-media-player.vala
index 26cc071..d88834a 100644
--- a/src/librygel-renderer/rygel-media-player.vala
+++ b/src/librygel-renderer/rygel-media-player.vala
@@ -33,23 +33,27 @@ public interface Rygel.MediaPlayer : GLib.Object {
public abstract string playback_state { owned get; set; }
public abstract string? uri { owned get; set; }
public abstract double volume { get; set; }
+
+ /// Duration of the current media in microseconds
public abstract int64 duration { get; }
public abstract string? metadata { owned get; set; }
public abstract string? mime_type { owned get; set; }
public abstract string? content_features { owned get; set; }
public string duration_as_str {
owned get {
- return GstUtils.time_to_string ((ClockTime) this.duration);
+ return TimeUtils.time_to_string (duration);
}
}
+
+ /// Position in the current media in microseconds
public abstract int64 position { get; }
public string position_as_str {
owned get {
- return GstUtils.time_to_string ((ClockTime) this.position);
+ return TimeUtils.time_to_string (position);
}
}
- public abstract bool seek (ClockTime time);
+ public abstract bool seek (int64 time);
public abstract string[] get_protocols ();
public abstract string[] get_mime_types ();
}
diff --git a/src/librygel-renderer/rygel-media-renderer.vala b/src/librygel-renderer/rygel-media-renderer.vala
new file mode 100644
index 0000000..2d87604
--- /dev/null
+++ b/src/librygel-renderer/rygel-media-renderer.vala
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2012 Openismus GmbH.
+ * Copyright (C) 2012 Intel Corporation.
+ *
+ * Author: Jens Georg <jensg openismus com>
+ *
+ * Rygel is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * Rygel is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+internal class Plugin : Rygel.MediaRendererPlugin {
+ private Rygel.MediaPlayer player;
+
+ public Plugin (Rygel.MediaPlayer root_container) {
+ base ("LibRygelRenderer", _("LibRygelRenderer"));
+ }
+
+ public override Rygel.MediaPlayer? get_player () {
+ return this.player;
+ }
+}
+
+/**
+ * This class may be used to implement in-process UPnP-AV media renderers.
+ *
+ * Call rygel_media_device_add_interface() on the RygelMediaServer to allow it
+ * to serve media via that network interface.
+ *
+ * See the standalone-renderer.c example.
+ */
+public class Rygel.MediaRenderer : MediaDevice {
+
+ /**
+ * Create a MediaRenderer to serve the media in the RygelMediaContainer.
+ * For instance, you might use a RygelSimpleContainer. Alternatively,
+ * you might use your own RygelMediaContainer implementation.
+ *
+ * Assuming that the RygelMediaContainer is correctly implemented,
+ * the RygelMediaServer will respond appropriately to changes in the
+ * RygelMediaContainer.
+ */
+ public MediaRenderer (string title, MediaPlayer player) {
+ base ();
+ this.plugin = new global::Plugin (player);
+ this.plugin.title = title;
+ }
+}
diff --git a/src/librygel-renderer/rygel-gst-utils.vala b/src/librygel-renderer/rygel-time-utils.vala
similarity index 73%
rename from src/librygel-renderer/rygel-gst-utils.vala
rename to src/librygel-renderer/rygel-time-utils.vala
index ff512ae..aeffc0f 100644
--- a/src/librygel-renderer/rygel-gst-utils.vala
+++ b/src/librygel-renderer/rygel-time-utils.vala
@@ -1,8 +1,10 @@
/*
* Copyright (C) 2009 Nokia Corporation.
+ * Copyright (C) 2012 Intel Corporation.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
+ * Jens Georg <jensg openismus com>
*
* This file is part of Rygel.
*
@@ -21,28 +23,20 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-using Gst;
-
-internal errordomain Rygel.GstError {
- MISSING_PLUGIN,
- LINK
-}
-
-internal abstract class Rygel.GstUtils {
- public static ClockTime time_from_string (string str) {
+internal abstract class Rygel.TimeUtils {
+ public static int64 time_from_string (string str) {
uint64 hours, minutes, seconds;
str.scanf ("%llu:%2llu:%2llu%*s", out hours, out minutes, out seconds);
- return (ClockTime) ((hours * 3600 + minutes * 60 + seconds) *
- Gst.SECOND);
+ return (int64)(hours * 3600 + minutes * 60 + seconds) * TimeSpan.SECOND;
}
- public static string time_to_string (ClockTime time) {
+ public static string time_to_string (int64 time) {
uint64 hours, minutes, seconds;
- hours = time / Gst.SECOND / 3600;
- seconds = time / Gst.SECOND % 3600;
+ hours = time / TimeSpan.SECOND / 3600;
+ seconds = time / TimeSpan.SECOND % 3600;
minutes = seconds / 60;
seconds = seconds % 60;
diff --git a/src/librygel-server/rygel-media-server.vala b/src/librygel-server/rygel-media-server.vala
index f48e48a..00e88da 100644
--- a/src/librygel-server/rygel-media-server.vala
+++ b/src/librygel-server/rygel-media-server.vala
@@ -47,5 +47,6 @@ public class Rygel.MediaServer : MediaDevice {
public MediaServer (string title, MediaContainer root_container) {
base ();
this.plugin = new global::Plugin (root_container);
+ this.plugin.title = title;
}
}
diff --git a/src/plugins/mpris/rygel-mpris-player.vala b/src/plugins/mpris/rygel-mpris-player.vala
index 9935e09..80e9569 100644
--- a/src/plugins/mpris/rygel-mpris-player.vala
+++ b/src/plugins/mpris/rygel-mpris-player.vala
@@ -103,7 +103,7 @@ public class Rygel.MPRIS.Player : GLib.Object, Rygel.MediaPlayer {
int64 dur = 0;
if (val != null) {
- dur = (int64) val * 1000;
+ dur = (int64) val;
}
return dur;
@@ -112,7 +112,7 @@ public class Rygel.MPRIS.Player : GLib.Object, Rygel.MediaPlayer {
public int64 position {
get {
- return this.actual_player.position * 1000;
+ return this.actual_player.position;
}
}
@@ -124,11 +124,11 @@ public class Rygel.MPRIS.Player : GLib.Object, Rygel.MediaPlayer {
actual_player.g_properties_changed.connect (this.on_properties_changed);
}
- public bool seek (Gst.ClockTime time) {
+ public bool seek (int64 time) {
var ret = false;
try {
- this.actual_player.seek ((int64) (time / 1000));
+ this.actual_player.seek (time);
ret = true;
} catch (Error error) {}
diff --git a/src/plugins/playbin/Makefile.am b/src/plugins/playbin/Makefile.am
index 3a53300..476263b 100644
--- a/src/plugins/playbin/Makefile.am
+++ b/src/plugins/playbin/Makefile.am
@@ -3,10 +3,15 @@ include ../../../common.am
plugin_LTLIBRARIES = librygel-playbin.la
AM_CFLAGS += -DG_LOG_DOMAIN='"Playbin"' \
+ -I$(top_srcdir)/src/librygel-renderer-gst \
$(LIBGSTREAMER_CFLAGS)
librygel_playbin_la_SOURCES = rygel-module.vala
-librygel_playbin_la_CFLAGS = $(AM_CFLAGS)
-librygel_playbin_la_VALAFLAGS = $(RYGEL_COMMON_RENDERER_PLUGIN_VALAFLAGS)
-librygel_playbin_la_LIBADD = $(RYGEL_COMMON_RENDERER_LIBS)
+librygel_playbin_la_VALAFLAGS = \
+ --pkg rygel-renderer-gst-1.0 \
+ --vapidir $(top_srcdir)/src/librygel-renderer-gst \
+ $(RYGEL_COMMON_RENDERER_PLUGIN_VALAFLAGS)
+librygel_playbin_la_LIBADD = \
+ $(top_builddir)/src/librygel-renderer-gst/librygel-renderer-gst-1.0.la \
+ $(RYGEL_COMMON_RENDERER_LIBS)
librygel_playbin_la_LDFLAGS = $(RYGEL_PLUGIN_LINKER_FLAGS)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]