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

Neil Roberts neil at linux.intel.com
Wed Apr 24 08:45:07 PDT 2013


Hi,

Thanks for the patch. I wonder if we should just consider this a
programmer error instead of returning a value? Ie, we could just make it
do a g_return_val_if_fail. When we get round to writing the
documentation (hint hint :p) we can just document that you shouldn't
call setup_pipeline() or get_pipeline() before you've received the
“pipeline-ready” signal. I'm not sure how an application would be able
to handle this returning FALSE.

Regards,
- Neil

Plamena Manolova <plamena.n.manolova at intel.com> writes:

> 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.
>
> _______________________________________________
> Cogl mailing list
> Cogl at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/cogl
---------------------------------------------------------------------
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