[rhythmbox] add 'bus' property to player backends, exposing the GStreamer bus
- From: Jonathan Matthew <jmatthew src gnome org>
- To: svn-commits-list gnome org
- Subject: [rhythmbox] add 'bus' property to player backends, exposing the GStreamer bus
- Date: Thu, 30 Apr 2009 00:37:21 -0400 (EDT)
commit 93c4e34a664565a97d713c0e7f6560d081f7a819
Author: Jonathan Matthew <jonathan d14n org>
Date: Thu Apr 30 14:36:05 2009 +1000
add 'bus' property to player backends, exposing the GStreamer bus
---
backends/gstreamer/rb-player-gst-xfade.c | 22 ++++++++++++++++++++--
backends/gstreamer/rb-player-gst.c | 19 ++++++++++++++++++-
2 files changed, 38 insertions(+), 3 deletions(-)
diff --git a/backends/gstreamer/rb-player-gst-xfade.c b/backends/gstreamer/rb-player-gst-xfade.c
index 22ec512..0eeb8b8 100644
--- a/backends/gstreamer/rb-player-gst-xfade.c
+++ b/backends/gstreamer/rb-player-gst-xfade.c
@@ -233,7 +233,8 @@ G_DEFINE_TYPE_WITH_CODE(RBPlayerGstXFade, rb_player_gst_xfade, G_TYPE_OBJECT,
enum
{
PROP_0,
- PROP_BUFFER_SIZE
+ PROP_BUFFER_SIZE,
+ PROP_BUS
};
enum
@@ -590,6 +591,14 @@ rb_player_gst_xfade_get_property (GObject *object,
case PROP_BUFFER_SIZE:
g_value_set_uint (value, player->priv->buffer_size);
break;
+ case PROP_BUS:
+ if (player->priv->pipeline) {
+ GstBus *bus;
+ bus = gst_element_get_bus (player->priv->pipeline);
+ g_value_set_object (value, bus);
+ gst_object_unref (bus);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -628,11 +637,19 @@ rb_player_gst_xfade_class_init (RBPlayerGstXFadeClass *klass)
g_object_class_install_property (object_class,
PROP_BUFFER_SIZE,
g_param_spec_uint ("buffer-size",
- "buffer size",
+ "buffer size",
"Buffer size for network streams, in kB",
64, MAX_NETWORK_BUFFER_SIZE, 128,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_BUS,
+ g_param_spec_object ("bus",
+ "bus",
+ "GStreamer message bus",
+ GST_TYPE_BUS,
+ G_PARAM_READABLE));
+
signals[CAN_REUSE_STREAM] =
g_signal_new ("can-reuse-stream",
G_OBJECT_CLASS_TYPE (object_class),
@@ -2914,6 +2931,7 @@ create_sink (RBPlayerGstXFade *player, GError **error)
player->priv->pipeline = gst_pipeline_new ("rbplayer");
add_bus_watch (player);
+ g_object_notify (G_OBJECT (player), "bus");
player->priv->outputbin = gst_bin_new ("outputbin");
player->priv->adder = gst_element_factory_make ("adder", "outputadder");
diff --git a/backends/gstreamer/rb-player-gst.c b/backends/gstreamer/rb-player-gst.c
index 6645e86..c4e1d0c 100644
--- a/backends/gstreamer/rb-player-gst.c
+++ b/backends/gstreamer/rb-player-gst.c
@@ -95,7 +95,8 @@ G_DEFINE_TYPE_WITH_CODE(RBPlayerGst, rb_player_gst, G_TYPE_OBJECT,
enum
{
PROP_0,
- PROP_PLAYBIN
+ PROP_PLAYBIN,
+ PROP_BUS
};
enum
@@ -152,6 +153,13 @@ rb_player_gst_class_init (RBPlayerGstClass *klass)
"playbin element",
GST_TYPE_ELEMENT,
G_PARAM_READABLE));
+ g_object_class_install_property (object_class,
+ PROP_BUS,
+ g_param_spec_object ("bus",
+ "bus",
+ "GStreamer message bus",
+ GST_TYPE_BUS,
+ G_PARAM_READABLE));
signals[MISSING_PLUGINS] =
g_signal_new ("missing-plugins",
@@ -214,6 +222,14 @@ rb_player_gst_get_property (GObject *object,
case PROP_PLAYBIN:
g_value_set_object (value, mp->priv->playbin);
break;
+ case PROP_BUS:
+ if (mp->priv->playbin) {
+ GstBus *bus;
+ bus = gst_element_get_bus (mp->priv->playbin);
+ g_value_set_object (value, bus);
+ gst_object_unref (bus);
+ }
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -455,6 +471,7 @@ rb_player_gst_construct (RBPlayerGst *mp, GError **error)
/* let plugins add bits to playbin */
g_object_notify (G_OBJECT (mp), "playbin");
+ g_object_notify (G_OBJECT (mp), "bus");
/* Use gconfaudiosink for audio if there's no audio sink yet */
g_object_get (G_OBJECT (mp->priv->playbin), "audio-sink", &sink, NULL);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]