summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLionel Landwerlin <llandwerlin@gmail.com>2013-11-19 15:51:01 +0000
committerLionel Landwerlin <llandwerlin@gmail.com>2013-11-19 16:42:13 +0000
commita39564ed057da0f075a45854467037280ba81773 (patch)
treeded7cc2b622dae795e9d78998d60ae467a6a3775
parentca46a8874486b787b0720312dbb04fd5741643d6 (diff)
downloadclutter-gst-a39564ed057da0f075a45854467037280ba81773.tar.gz
plugin: return error on state change if Clutter is not initialized
-rw-r--r--clutter-gst/clutter-gst-auto-video-sink.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/clutter-gst/clutter-gst-auto-video-sink.c b/clutter-gst/clutter-gst-auto-video-sink.c
index 089170b..0b82e7e 100644
--- a/clutter-gst/clutter-gst-auto-video-sink.c
+++ b/clutter-gst/clutter-gst-auto-video-sink.c
@@ -65,11 +65,14 @@ static GstStaticPadTemplate sink_template =
GST_PAD_ALWAYS,
GST_STATIC_CAPS_ANY);
+static ClutterInitError _clutter_initialized = CLUTTER_INIT_ERROR_UNKNOWN;
+
static void
_clutter_init (void)
{
/* We must ensure that clutter is initialized */
- if (clutter_init (NULL, NULL) != CLUTTER_INIT_SUCCESS)
+ _clutter_initialized = clutter_init (NULL, NULL);
+ if (_clutter_initialized != CLUTTER_INIT_SUCCESS)
g_critical ("Unable to initialize Clutter");
}
@@ -228,6 +231,9 @@ clutter_gst_auto_video_sink_change_state (GstElement *element,
switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY:
+ if (_clutter_initialized != CLUTTER_INIT_SUCCESS)
+ return GST_STATE_CHANGE_FAILURE;
+
if (!sink->content)
{
ClutterActor *stage = clutter_stage_new ();
@@ -253,13 +259,5 @@ clutter_gst_auto_video_sink_change_state (GstElement *element,
ret = GST_ELEMENT_CLASS (parent_class)->change_state (element, transition);
- /* switch (transition) { */
- /* case GST_STATE_CHANGE_READY_TO_NULL: */
- /* gst_auto_video_sink_reset (sink); */
- /* break; */
- /* default: */
- /* break; */
- /* } */
-
return ret;
}