mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-01 14:11:15 +00:00
libs: videoaggregato: Do not import videoconvert.h in gstvideoaggregatorpad.h
+ Add a Private structure to the GstVideoAggregatorPad + Add some padding
This commit is contained in:
parent
1f1283b4d8
commit
9e0c81cb62
1 changed files with 27 additions and 12 deletions
|
@ -40,9 +40,10 @@
|
||||||
|
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "videoconvert.h"
|
||||||
|
|
||||||
#include "gstvideoaggregator.h"
|
#include "gstvideoaggregator.h"
|
||||||
#include "gstvideoaggregatorpad.h"
|
#include "gstvideoaggregatorpad.h"
|
||||||
#include "videoconvert.h"
|
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_STATIC (gst_videoaggregator_debug);
|
GST_DEBUG_CATEGORY_STATIC (gst_videoaggregator_debug);
|
||||||
#define GST_CAT_DEFAULT gst_videoaggregator_debug
|
#define GST_CAT_DEFAULT gst_videoaggregator_debug
|
||||||
|
@ -61,6 +62,13 @@ enum
|
||||||
PROP_PAD_ZORDER,
|
PROP_PAD_ZORDER,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
struct _GstVideoAggregatorPadPrivate
|
||||||
|
{
|
||||||
|
/* Converter, if NULL no conversion is done */
|
||||||
|
VideoConvert *convert;
|
||||||
|
};
|
||||||
|
|
||||||
G_DEFINE_TYPE (GstVideoAggregatorPad, gst_videoaggregator_pad,
|
G_DEFINE_TYPE (GstVideoAggregatorPad, gst_videoaggregator_pad,
|
||||||
GST_TYPE_AGGREGATOR_PAD);
|
GST_TYPE_AGGREGATOR_PAD);
|
||||||
|
|
||||||
|
@ -130,9 +138,9 @@ gst_videoaggregator_pad_finalize (GObject * o)
|
||||||
{
|
{
|
||||||
GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o);
|
GstVideoAggregatorPad *vaggpad = GST_VIDEO_AGGREGATOR_PAD (o);
|
||||||
|
|
||||||
if (vaggpad->convert)
|
if (vaggpad->priv->convert)
|
||||||
videoconvert_convert_free (vaggpad->convert);
|
videoconvert_convert_free (vaggpad->priv->convert);
|
||||||
vaggpad->convert = NULL;
|
vaggpad->priv->convert = NULL;
|
||||||
|
|
||||||
G_OBJECT_CLASS (gst_videoaggregator_pad_parent_class)->dispose (o);
|
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,
|
0, 10000, DEFAULT_PAD_ZORDER,
|
||||||
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
|
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);
|
aggpadclass->flush = GST_DEBUG_FUNCPTR (_flush_pad);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_videoaggregator_pad_init (GstVideoAggregatorPad * vaggpad)
|
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->zorder = DEFAULT_PAD_ZORDER;
|
||||||
vaggpad->convert = NULL;
|
|
||||||
vaggpad->need_conversion_update = FALSE;
|
vaggpad->need_conversion_update = FALSE;
|
||||||
vaggpad->aggregated_frame = NULL;
|
vaggpad->aggregated_frame = NULL;
|
||||||
vaggpad->converted_buffer = 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)
|
if (GST_VIDEO_INFO_FORMAT (&pad->info) == GST_VIDEO_FORMAT_UNKNOWN)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (pad->convert)
|
if (pad->priv->convert)
|
||||||
videoconvert_convert_free (pad->convert);
|
videoconvert_convert_free (pad->priv->convert);
|
||||||
|
|
||||||
pad->convert = NULL;
|
pad->priv->convert = NULL;
|
||||||
|
|
||||||
colorimetry = gst_video_colorimetry_to_string (&(pad->info.colorimetry));
|
colorimetry = gst_video_colorimetry_to_string (&(pad->info.colorimetry));
|
||||||
chroma = gst_video_chroma_to_string (pad->info.chroma_site);
|
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_DEBUG_OBJECT (pad, "This pad will be converted from %d to %d",
|
||||||
GST_VIDEO_INFO_FORMAT (&pad->info),
|
GST_VIDEO_INFO_FORMAT (&pad->info),
|
||||||
GST_VIDEO_INFO_FORMAT (&best_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;
|
pad->need_conversion_update = TRUE;
|
||||||
if (!pad->convert) {
|
if (!pad->priv->convert) {
|
||||||
g_free (colorimetry);
|
g_free (colorimetry);
|
||||||
g_free (best_colorimetry);
|
g_free (best_colorimetry);
|
||||||
GST_WARNING ("No path found for conversion");
|
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");
|
GST_WARNING_OBJECT (vagg, "Could not map input buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pad->convert) {
|
if (pad->priv->convert) {
|
||||||
gint converted_size;
|
gint converted_size;
|
||||||
|
|
||||||
/* We wait until here to set the conversion infos, in case vagg->info changed */
|
/* 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;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
videoconvert_convert_convert (pad->convert, converted_frame, frame);
|
videoconvert_convert_convert (pad->priv->convert, converted_frame, frame);
|
||||||
pad->converted_buffer = converted_buf;
|
pad->converted_buffer = converted_buf;
|
||||||
gst_video_frame_unmap (frame);
|
gst_video_frame_unmap (frame);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue