gst-plugins-bad: glvideomixer: bas output width/ height on the pad properties

Thibault Saunier tsaunier at gnome.org
Wed Jun 25 16:27:22 PDT 2014


It looks like it is a copy paste from compositor, should we offer such a
functionnality in videoaggregator itself instead of copying that code
around? We could imagine that vmethod is actually default behaviour and
classes that do not want it could remove its implementation  (overriding it
with NULL) maybe?


On Wed, Jun 25, 2014 at 4:03 AM, Matthew Waters <
ystreet at kemper.freedesktop.org> wrote:

> Module: gst-plugins-bad
> Branch: master
> Commit: c37ace184428e3096f57ccd89b67434eab632e6e
> URL:
> http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=c37ace184428e3096f57ccd89b67434eab632e6e
>
> Author: Matthew Waters <ystreet00 at gmail.com>
> Date:   Wed Jun 25 12:00:34 2014 +1000
>
> glvideomixer: bas output width/height on the pad properties
>
> Allows automatic negotiation of the size in the following case:
> gst-launch-1.0 glvideomixer name=m sink_0::xpos=0 sink_1::xpos=320 !
> glimagesink \
>     videotestsrc ! m. \
>     videotestsrc pattern=1 ! m.
>
> https://bugzilla.gnome.org/show_bug.cgi?id=731878
>
> ---
>
>  ext/gl/gstglvideomixer.c |   51
> +++++++++++++++++++++++++++++++++++++++++++++-
>  1 file changed, 50 insertions(+), 1 deletion(-)
>
> diff --git a/ext/gl/gstglvideomixer.c b/ext/gl/gstglvideomixer.c
> index 1d0299c..7b3904e 100644
> --- a/ext/gl/gstglvideomixer.c
> +++ b/ext/gl/gstglvideomixer.c
> @@ -60,6 +60,7 @@ static void gst_gl_video_mixer_set_property (GObject *
> object, guint prop_id,
>  static void gst_gl_video_mixer_get_property (GObject * object, guint
> prop_id,
>      GValue * value, GParamSpec * pspec);
>
> +static gboolean _update_info (GstVideoAggregator * vagg, GstVideoInfo *
> info);
>  static void gst_gl_video_mixer_reset (GstGLMixer * mixer);
>  static gboolean gst_gl_video_mixer_init_shader (GstGLMixer * mixer,
>      GstCaps * outcaps);
> @@ -249,6 +250,7 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass *
> klass)
>    GObjectClass *gobject_class;
>    GstElementClass *element_class;
>    GstAggregatorClass *agg_class = (GstAggregatorClass *) klass;
> +  GstVideoAggregatorClass *vagg_class = (GstVideoAggregatorClass *) klass;
>
>    gobject_class = (GObjectClass *) klass;
>    element_class = GST_ELEMENT_CLASS (klass);
> @@ -265,8 +267,9 @@ gst_gl_video_mixer_class_init (GstGLVideoMixerClass *
> klass)
>    GST_GL_MIXER_CLASS (klass)->process_textures =
>        gst_gl_video_mixer_process_textures;
>
> -  agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
> +  vagg_class->update_info = _update_info;
>
> +  agg_class->sinkpads_type = GST_TYPE_GL_VIDEO_MIXER_PAD;
>  }
>
>  static void
> @@ -298,6 +301,52 @@ gst_gl_video_mixer_get_property (GObject * object,
> guint prop_id,
>    }
>  }
>
> +static gboolean
> +_update_info (GstVideoAggregator * vagg, GstVideoInfo * info)
> +{
> +  GList *l;
> +  gint best_width = -1, best_height = -1;
> +  gboolean ret = FALSE;
> +
> +  GST_OBJECT_LOCK (vagg);
> +  for (l = GST_ELEMENT (vagg)->sinkpads; l; l = l->next) {
> +    GstVideoAggregatorPad *vaggpad = l->data;
> +    GstGLVideoMixerPad *mixer_pad = GST_GL_VIDEO_MIXER_PAD (vaggpad);
> +    gint this_width, this_height;
> +    gint width, height;
> +
> +    if (mixer_pad->width > 0)
> +      width = mixer_pad->width;
> +    else
> +      width = GST_VIDEO_INFO_WIDTH (&vaggpad->info);
> +
> +    if (mixer_pad->height > 0)
> +      height = mixer_pad->height;
> +    else
> +      height = GST_VIDEO_INFO_HEIGHT (&vaggpad->info);
> +
> +    if (width == 0 || height == 0)
> +      continue;
> +
> +    this_width = width + MAX (mixer_pad->xpos, 0);
> +    this_height = height + MAX (mixer_pad->ypos, 0);
> +
> +    if (best_width < this_width)
> +      best_width = this_width;
> +    if (best_height < this_height)
> +      best_height = this_height;
> +  }
> +  GST_OBJECT_UNLOCK (vagg);
> +
> +  if (best_width > 0 && best_height > 0) {
> +    gst_video_info_set_format (info, GST_VIDEO_INFO_FORMAT (info),
> +        best_width, best_height);
> +    ret = TRUE;
> +  }
> +
> +  return ret;
> +}
> +
>  static void
>  gst_gl_video_mixer_reset (GstGLMixer * mixer)
>  {
>
> _______________________________________________
> gstreamer-commits mailing list
> gstreamer-commits at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20140626/64902d34/attachment.html>


More information about the gstreamer-devel mailing list