[cogl] cogl-gst: adds _sink_is_ready() api



commit 9e7db391a87beee7c448f2a67b3e7202779ce9b2
Author: Robert Bragg <robert sixbynine org>
Date:   Tue Jul 9 18:29:24 2013 +0100

    cogl-gst: adds _sink_is_ready() api
    
    This adds a cogl_gst_video_sink_is_ready() for code to be able to
    check if it's safe to call cogl_gst_video_sink_get_pipeline() or
    cogl_gst_video_sink_setup_pipeline() without causing an error.
    Normally an application can listen for the pipeline-ready signal but
    sometimes a sink can be passed between components that didn't have an
    opportunity to connect a signal handler, so they need a way to
    directly check the status.
    
    Reviewed-by: Neil Roberts <neil linux intel com>

 cogl-gst/cogl-gst-video-sink.c               |    6 ++++++
 cogl-gst/cogl-gst-video-sink.h               |   20 ++++++++++++++++++++
 doc/reference/cogl-gst/cogl-gst-sections.txt |    1 +
 3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
index 06b5988..073a398 100644
--- a/cogl-gst/cogl-gst-video-sink.c
+++ b/cogl-gst/cogl-gst-video-sink.c
@@ -1414,3 +1414,9 @@ cogl_gst_video_sink_fit_size (CoglGstVideoSink *vt,
         }
     }
 }
+
+CoglBool
+cogl_gst_video_sink_is_ready (CoglGstVideoSink *sink)
+{
+  return !!sink->priv->renderer;
+}
diff --git a/cogl-gst/cogl-gst-video-sink.h b/cogl-gst/cogl-gst-video-sink.h
index 45ed835..6c59e7c 100644
--- a/cogl-gst/cogl-gst-video-sink.h
+++ b/cogl-gst/cogl-gst-video-sink.h
@@ -192,6 +192,26 @@ CoglGstVideoSink *
 cogl_gst_video_sink_new (CoglContext *ctx);
 
 /**
+ * cogl_gst_video_sink_is_ready:
+ * @sink: The #CoglGstVideoSink
+ *
+ * Returns whether the pipeline is ready and so
+ * cogl_gst_video_sink_get_pipeline() and
+ * cogl_gst_video_sink_setup_pipeline() can be called without causing error.
+ *
+ * Note: Normally an application will wait until the
+ * #CoglGstVideoSink::pipeline-ready signal is emitted instead of
+ * polling the ready status with this api, but sometimes when a sink
+ * is passed between components that didn't have an opportunity to
+ * connect a signal handler this can be useful.
+ *
+ * Return value: %TRUE if the sink is ready, else %FALSE
+ * Since: 1.16
+ */
+CoglBool
+cogl_gst_video_sink_is_ready (CoglGstVideoSink *sink);
+
+/**
  * cogl_gst_video_sink_get_pipeline:
  * @vt: The #CoglGstVideoSink
  *
diff --git a/doc/reference/cogl-gst/cogl-gst-sections.txt b/doc/reference/cogl-gst/cogl-gst-sections.txt
index 35dd368..0b6c0bd 100644
--- a/doc/reference/cogl-gst/cogl-gst-sections.txt
+++ b/doc/reference/cogl-gst/cogl-gst-sections.txt
@@ -13,6 +13,7 @@ cogl_gst_video_sink_setup_pipeline
 cogl_gst_video_sink_get_free_layer
 cogl_gst_video_sink_set_first_layer
 cogl_gst_video_sink_set_default_sample
+cogl_gst_video_sink_is_ready
 cogl_gst_video_sink_get_aspect
 cogl_gst_video_sink_get_width_for_height
 cogl_gst_video_sink_get_height_for_width


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]