GstPlaySink: Expose flags as a gobject property.
authorEdward Hervey <bilboed@bilboed.com>
Wed, 9 Sep 2009 09:17:28 +0000 (11:17 +0200)
committerEdward Hervey <bilboed@bilboed.com>
Mon, 14 Sep 2009 08:40:00 +0000 (10:40 +0200)
gst/playback/gstplaysink.c

index e242680d3695a6fcf384930caf29f825ba70a536..1d14a5b9d88c42df6770ab0c2d4368a1e8399af7 100644 (file)
@@ -220,6 +220,10 @@ static void gst_play_sink_class_init (GstPlaySinkClass * klass);
 static void gst_play_sink_init (GstPlaySink * playsink);
 static void gst_play_sink_dispose (GObject * object);
 static void gst_play_sink_finalize (GObject * object);
+static void gst_play_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * spec);
+static void gst_play_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * spec);
 
 static GstPad *gst_play_sink_request_new_pad (GstElement * element,
     GstPadTemplate * templ, const gchar * name);
@@ -255,6 +259,19 @@ gst_play_sink_class_init (GstPlaySinkClass * klass)
 
   gobject_klass->dispose = GST_DEBUG_FUNCPTR (gst_play_sink_dispose);
   gobject_klass->finalize = GST_DEBUG_FUNCPTR (gst_play_sink_finalize);
+  gobject_klass->set_property = GST_DEBUG_FUNCPTR (gst_play_sink_set_property);
+  gobject_klass->get_property = GST_DEBUG_FUNCPTR (gst_play_sink_get_property);
+
+
+  /**
+   * GstPlaySink:flags
+   *
+   * Control the behaviour of playsink.
+   */
+  g_object_class_install_property (gobject_klass, PROP_FLAGS,
+      g_param_spec_flags ("flags", "Flags", "Flags to control behaviour",
+          GST_TYPE_PLAY_FLAGS, DEFAULT_FLAGS,
+          G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
 
   gst_element_class_add_pad_template (gstelement_klass,
       gst_static_pad_template_get (&audiorawtemplate));
@@ -292,7 +309,7 @@ gst_play_sink_init (GstPlaySink * playsink)
   playsink->text_sink = NULL;
   playsink->volume = 1.0;
   playsink->font_desc = NULL;
-  playsink->flags = GST_PLAY_FLAG_SOFT_VOLUME;
+  playsink->flags = DEFAULT_FLAGS;
 
   playsink->lock = g_mutex_new ();
   playsink->need_async_start = TRUE;
@@ -2683,6 +2700,39 @@ activate_failed:
   }
 }
 
+static void
+gst_play_sink_set_property (GObject * object, guint prop_id,
+    const GValue * value, GParamSpec * spec)
+{
+  GstPlaySink *playsink = GST_PLAY_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FLAGS:
+      gst_play_sink_set_flags (playsink, g_value_get_flags (value));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
+      break;
+  }
+}
+
+static void
+gst_play_sink_get_property (GObject * object, guint prop_id,
+    GValue * value, GParamSpec * spec)
+{
+  GstPlaySink *playsink = GST_PLAY_SINK (object);
+
+  switch (prop_id) {
+    case PROP_FLAGS:
+      g_value_set_flags (value, gst_play_sink_get_flags (playsink));
+      break;
+    default:
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, spec);
+      break;
+  }
+}
+
+
 gboolean
 gst_play_sink_plugin_init (GstPlugin * plugin)
 {