From 4d5af45d990c8a0aba19e941702a98598f44652d Mon Sep 17 00:00:00 2001 From: Robert Bragg Date: Tue, 9 Jul 2013 18:29:24 +0100 Subject: [PATCH] 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 (cherry picked from commit 9e7db391a87beee7c448f2a67b3e7202779ce9b2) --- 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(+) diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c index 65ecf4383..6fd69f88e 100644 --- a/cogl-gst/cogl-gst-video-sink.c +++ b/cogl-gst/cogl-gst-video-sink.c @@ -1352,3 +1352,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 45ed83556..6c59e7cfc 100644 --- a/cogl-gst/cogl-gst-video-sink.h +++ b/cogl-gst/cogl-gst-video-sink.h @@ -191,6 +191,26 @@ cogl_gst_video_sink_get_type (void) G_GNUC_CONST; 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 35dd3688b..0b6c0bde1 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