diff --git a/gst-libs/gst/video/gstvideoaggregator.c b/gst-libs/gst/video/gstvideoaggregator.c index 06d80e19d6..b0ea776544 100644 --- a/gst-libs/gst/video/gstvideoaggregator.c +++ b/gst-libs/gst/video/gstvideoaggregator.c @@ -40,9 +40,10 @@ #include +#include "videoconvert.h" + #include "gstvideoaggregator.h" #include "gstvideoaggregatorpad.h" -#include "videoconvert.h" GST_DEBUG_CATEGORY_STATIC (gst_videoaggregator_debug); #define GST_CAT_DEFAULT gst_videoaggregator_debug @@ -61,6 +62,13 @@ enum PROP_PAD_ZORDER, }; + +struct _GstVideoAggregatorPadPrivate +{ + /* Converter, if NULL no conversion is done */ + VideoConvert *convert; +}; + G_DEFINE_TYPE (GstVideoAggregatorPad, gst_videoaggregator_pad, GST_TYPE_AGGREGATOR_PAD); @@ -130,9 +138,9 @@ gst_videoaggregator_pad_finalize (GObject * o) { GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o); - if (vaggpad->convert) - videoconvert_convert_free (vaggpad->convert); - vaggpad->convert = NULL; + if (vaggpad->priv->convert) + videoconvert_convert_free (vaggpad->priv->convert); + vaggpad->priv->convert = NULL; G_OBJECT_CLASS (gst_videoaggregator_pad_parent_class)->dispose (o); } @@ -152,17 +160,24 @@ gst_videoaggregator_pad_class_init (GstVideoAggregatorPadClass * klass) 0, 10000, DEFAULT_PAD_ZORDER, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS)); + g_type_class_add_private (klass, sizeof (GstVideoAggregatorPadPrivate)); + aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad); } static void gst_videoaggregator_pad_init (GstVideoAggregatorPad * vaggpad) { + vaggpad->priv = + G_TYPE_INSTANCE_GET_PRIVATE (vaggpad, GST_TYPE_VIDEO_AGGREGATOR_PAD, + GstVideoAggregatorPadPrivate); + vaggpad->zorder = DEFAULT_PAD_ZORDER; - vaggpad->convert = NULL; vaggpad->need_conversion_update = FALSE; vaggpad->aggregated_frame = NULL; vaggpad->converted_buffer = NULL; + + vaggpad->priv->convert = NULL; } /********************************* @@ -417,10 +432,10 @@ gst_videoaggregator_update_converters (GstVideoAggregator * vagg) if (GST_VIDEO_INFO_FORMAT (&pad->info) == GST_VIDEO_FORMAT_UNKNOWN) continue; - if (pad->convert) - videoconvert_convert_free (pad->convert); + if (pad->priv->convert) + videoconvert_convert_free (pad->priv->convert); - pad->convert = NULL; + pad->priv->convert = NULL; colorimetry = gst_video_colorimetry_to_string (&(pad->info.colorimetry)); chroma = gst_video_chroma_to_string (pad->info.chroma_site); @@ -431,9 +446,9 @@ gst_videoaggregator_update_converters (GstVideoAggregator * vagg) GST_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d", GST_VIDEO_INFO_FORMAT (&pad->info), GST_VIDEO_INFO_FORMAT (&best_info)); - pad->convert = videoconvert_convert_new (&pad->info, &best_info); + pad->priv->convert = videoconvert_convert_new (&pad->info, &best_info); pad->need_conversion_update = TRUE; - if (!pad->convert) { + if (!pad->priv->convert) { g_free (colorimetry); g_free (best_colorimetry); GST_WARNING ("No path found for conversion"); @@ -1016,7 +1031,7 @@ prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad) GST_WARNING_OBJECT (vagg, "Could not map input buffer"); } - if (pad->convert) { + if (pad->priv->convert) { gint converted_size; /* We wait until here to set the conversion infos, in case vagg->info changed */ @@ -1040,7 +1055,7 @@ prepare_frames (GstVideoAggregator * vagg, GstVideoAggregatorPad * pad) return FALSE; } - videoconvert_convert_convert (pad->convert, converted_frame, frame); + videoconvert_convert_convert (pad->priv->convert, converted_frame, frame); pad->converted_buffer = converted_buf; gst_video_frame_unmap (frame); } else { diff --git a/gst-libs/gst/video/gstvideoaggregatorpad.h b/gst-libs/gst/video/gstvideoaggregatorpad.h index 84a4fa24c7..8f7f8ad96e 100644 --- a/gst-libs/gst/video/gstvideoaggregatorpad.h +++ b/gst-libs/gst/video/gstvideoaggregatorpad.h @@ -26,8 +26,6 @@ #include -#include "videoconvert.h" - G_BEGIN_DECLS #define GST_TYPE_VIDEO_AGGREGATOR_PAD (gst_videoaggregator_pad_get_type()) @@ -42,7 +40,7 @@ G_BEGIN_DECLS typedef struct _GstVideoAggregatorPad GstVideoAggregatorPad; typedef struct _GstVideoAggregatorPadClass GstVideoAggregatorPadClass; -typedef struct _GstVideoAggregatorCollect GstVideoAggregatorCollect; +typedef struct _GstVideoAggregatorPadPrivate GstVideoAggregatorPadPrivate; /** * GstVideoAggregatorPad: @@ -64,8 +62,6 @@ struct _GstVideoAggregatorPad /* caps used for conversion if needed */ GstVideoInfo conversion_info; - /* Converter, if NULL no conversion is done */ - VideoConvert *convert; gboolean need_conversion_update; GstBuffer *converted_buffer; @@ -77,11 +73,17 @@ struct _GstVideoAggregatorPad GstClockTime start_time; GstClockTime end_time; GstVideoFrame *aggregated_frame; + + /* < private > */ + GstVideoAggregatorPadPrivate *priv; + gpointer _gst_reserved[GST_PADDING]; }; struct _GstVideoAggregatorPadClass { GstAggregatorPadClass parent_class; + + gpointer _gst_reserved[GST_PADDING]; }; GType gst_videoaggregator_pad_get_type (void);