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>

(cherry picked from commit 9e7db391a87beee7c448f2a67b3e7202779ce9b2)
This commit is contained in:
Robert Bragg 2013-07-09 18:29:24 +01:00 committed by Neil Roberts
parent 887d2ebf2e
commit 4d5af45d99
3 changed files with 27 additions and 0 deletions

View File

@ -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;
}

View File

@ -191,6 +191,26 @@ cogl_gst_video_sink_get_type (void) G_GNUC_CONST;
CoglGstVideoSink * CoglGstVideoSink *
cogl_gst_video_sink_new (CoglContext *ctx); 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: * cogl_gst_video_sink_get_pipeline:
* @vt: The #CoglGstVideoSink * @vt: The #CoglGstVideoSink

View File

@ -13,6 +13,7 @@ cogl_gst_video_sink_setup_pipeline
cogl_gst_video_sink_get_free_layer cogl_gst_video_sink_get_free_layer
cogl_gst_video_sink_set_first_layer cogl_gst_video_sink_set_first_layer
cogl_gst_video_sink_set_default_sample cogl_gst_video_sink_set_default_sample
cogl_gst_video_sink_is_ready
cogl_gst_video_sink_get_aspect cogl_gst_video_sink_get_aspect
cogl_gst_video_sink_get_width_for_height cogl_gst_video_sink_get_width_for_height
cogl_gst_video_sink_get_height_for_width cogl_gst_video_sink_get_height_for_width