[Cogl] [PATCH] cogl-gst: Check success of cogl_gst_video_set_up_pipeline

Plamena Manolova plamena.n.manolova at intel.com
Fri Apr 19 09:07:35 PDT 2013


The pipeline set up function now returns a boolean value
to indicate whether pipeline set up has been successful.
The return value is false if the user attempts to set up
a pipeline before cogl-gst has resolved the caps and chosen
a renderer.
---
 cogl-gst/cogl-gst-video-sink.c | 18 +++++++++++++++---
 cogl-gst/cogl-gst-video-sink.h |  2 +-
 2 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 321ded8..1091dbb 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -258,11 +258,17 @@ cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink,
     }
 }
 
-void
+CoglBool
 cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink,
                                     CoglPipeline *pipeline)
 {
-  sink->priv->renderer->setup_pipeline (sink, pipeline);
+  if (sink->priv->renderer)
+    {
+      sink->priv->renderer->setup_pipeline (sink, pipeline);
+      return TRUE;
+    }
+  else
+    return FALSE;
 }
 
 static SnippetCacheEntry *
@@ -363,7 +369,13 @@ cogl_gst_video_sink_get_pipeline (CoglGstVideoSink *vt)
   if (priv->pipeline == NULL)
     {
       priv->pipeline = cogl_pipeline_new (priv->ctx);
-      cogl_gst_video_sink_setup_pipeline (vt, priv->pipeline);
+      if (!cogl_gst_video_sink_setup_pipeline (vt, priv->pipeline))
+        {
+          cogl_object_unref (priv->pipeline);
+          priv->pipeline = NULL;
+          return priv->pipeline;
+        }
+
       cogl_gst_video_sink_attach_frame (vt, priv->pipeline);
       priv->frame_dirty = FALSE;
     }
diff --git a/cogl-gst/cogl-gst-video-sink.h b/cogl-gst/cogl-gst-video-sink.h
index 0bdf679..5894699 100644
--- a/cogl-gst/cogl-gst-video-sink.h
+++ b/cogl-gst/cogl-gst-video-sink.h
@@ -125,7 +125,7 @@ void
 cogl_gst_video_sink_set_default_sample (CoglGstVideoSink *sink,
                                         CoglBool default_sample);
 
-void
+CoglBool
 cogl_gst_video_sink_setup_pipeline (CoglGstVideoSink *sink,
                                     CoglPipeline *pipeline);
 G_END_DECLS
-- 
1.8.1.2

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.



More information about the Cogl mailing list