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

Lionel Landwerlin llandwerlin at gmail.com
Thu Jul 25 06:22:24 PDT 2013


Makes sense. Can we land this?

Cheers,

-
Lionel

On 09/07/13 18:29, Robert Bragg wrote:
> From: Robert Bragg <robert at linux.intel.com>
>
> Thinking about this a bit more, I realized that this makes the _get_pipeline()
> api inconsistent with the _setup_pipeline() api which can be used for
> completely custom pipelines and in the case of _setup_pipeline() we aren't able
> to just return NULL to indicate that the pipeline wasn't ready.
>
> Alternatively I wondered whether a cogl_gst_video_sink_is_ready() function
> would work for instead so you can directly check the status before calling
> cogl_gst_video_sink_get_pipeline() in any case where you haven't been able to
> connect a signal handler for the pipeline-ready signal?
>
> If this could work then maybe we can use the patch below?
>
> kind regards,
> - Robert
>
> --- >8 ---
>
> This adds a cogl_gst_video_sink_is_ready() for code to be able to check
> if its safe to call cogl_gst_video_sink_get_pipeline() or
> cogl_gst_video_sink_setup_pipeline() without causing an error. Normally
> application 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.
> ---
>   cogl-gst/cogl-gst-video-sink.c |  6 ++++++
>   cogl-gst/cogl-gst-video-sink.h | 20 ++++++++++++++++++++
>   2 files changed, 26 insertions(+)
>
> diff --git a/cogl-gst/cogl-gst-video-sink.c b/cogl-gst/cogl-gst-video-sink.c
> index 2cd63ae..3018de1 100644
> --- a/cogl-gst/cogl-gst-video-sink.c
> +++ b/cogl-gst/cogl-gst-video-sink.c
> @@ -1355,3 +1355,9 @@ cogl_gst_video_sink_fit_size (CoglGstVideoSink *vt,
>           }
>       }
>   }
> +
> +CoglBool
> +cogl_gst_video_sink_is_ready (CoglGstVideoSink *sink)
> +{
> +  return !!sink->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
>    *



More information about the Cogl mailing list