dnl Non ported plugins (non-dependant, then dependant)
dnl Make sure you have a space before and after all plugins
GST_PLUGINS_NONPORTED=" aiff \
- camerabin cdxaparse coloreffects \
+ camerabin cdxaparse \
dccp faceoverlay festival \
fieldanalysis freeverb freeze frei0r gaudieffects \
hdvparse id3tag inter interlace ivfparse jpegformat jp2kdecimator \
};
static GstStaticPadTemplate gst_chroma_hold_src_template =
- GST_STATIC_PAD_TEMPLATE ("src",
+GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB ";" GST_VIDEO_CAPS_BGRA ";"
- GST_VIDEO_CAPS_ABGR ";" GST_VIDEO_CAPS_RGBA
- ";" GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_xBGR
- ";" GST_VIDEO_CAPS_RGBx)
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE
+ ("{ ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx}"))
);
static GstStaticPadTemplate gst_chroma_hold_sink_template =
- GST_STATIC_PAD_TEMPLATE ("sink",
+GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_ARGB ";" GST_VIDEO_CAPS_BGRA ";"
- GST_VIDEO_CAPS_ABGR ";" GST_VIDEO_CAPS_RGBA
- ";" GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_BGRx ";" GST_VIDEO_CAPS_xBGR
- ";" GST_VIDEO_CAPS_RGBx)
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE
+ ("{ ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx}"))
);
#define GST_CHROMA_HOLD_LOCK(self) G_STMT_START { \
} G_STMT_END
static gboolean gst_chroma_hold_start (GstBaseTransform * trans);
-static gboolean gst_chroma_hold_get_unit_size (GstBaseTransform * btrans,
- GstCaps * caps, guint * size);
-static gboolean gst_chroma_hold_set_caps (GstBaseTransform * btrans,
- GstCaps * incaps, GstCaps * outcaps);
-static GstFlowReturn gst_chroma_hold_transform_ip (GstBaseTransform * btrans,
- GstBuffer * buf);
+static gboolean gst_chroma_hold_set_info (GstVideoFilter * vfilter,
+ GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
+ GstVideoInfo * out_info);
+static GstFlowReturn gst_chroma_hold_transform_frame_ip (GstVideoFilter *
+ vfilter, GstVideoFrame * frame);
static void gst_chroma_hold_before_transform (GstBaseTransform * btrans,
GstBuffer * buf);
GValue * value, GParamSpec * pspec);
static void gst_chroma_hold_finalize (GObject * object);
-GST_BOILERPLATE (GstChromaHold, gst_chroma_hold, GstVideoFilter,
- GST_TYPE_VIDEO_FILTER);
-
-static void
-gst_chroma_hold_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class, "Chroma hold filter",
- "Filter/Effect/Video",
- "Removes all color information except for one color",
- "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_chroma_hold_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_chroma_hold_src_template));
-
- GST_DEBUG_CATEGORY_INIT (gst_chroma_hold_debug, "chromahold", 0,
- "chromahold - Removes all color information except for one color");
-}
+#define gst_chroma_hold_parent_class parent_class
+G_DEFINE_TYPE (GstChromaHold, gst_chroma_hold, GST_TYPE_VIDEO_FILTER);
static void
gst_chroma_hold_class_init (GstChromaHoldClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
+ GstElementClass *gstelement_class = (GstElementClass *) klass;
GstBaseTransformClass *btrans_class = (GstBaseTransformClass *) klass;
+ GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
gobject_class->set_property = gst_chroma_hold_set_property;
gobject_class->get_property = gst_chroma_hold_get_property;
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE | G_PARAM_STATIC_STRINGS));
btrans_class->start = GST_DEBUG_FUNCPTR (gst_chroma_hold_start);
- btrans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_chroma_hold_transform_ip);
btrans_class->before_transform =
GST_DEBUG_FUNCPTR (gst_chroma_hold_before_transform);
- btrans_class->get_unit_size =
- GST_DEBUG_FUNCPTR (gst_chroma_hold_get_unit_size);
- btrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_chroma_hold_set_caps);
+
+ vfilter_class->transform_frame_ip =
+ GST_DEBUG_FUNCPTR (gst_chroma_hold_transform_frame_ip);
+ vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_chroma_hold_set_info);
+
+ gst_element_class_set_details_simple (gstelement_class, "Chroma hold filter",
+ "Filter/Effect/Video",
+ "Removes all color information except for one color",
+ "Sebastian Dröge <sebastian.droege@collabora.co.uk>");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_chroma_hold_sink_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&gst_chroma_hold_src_template));
+
+ GST_DEBUG_CATEGORY_INIT (gst_chroma_hold_debug, "chromahold", 0,
+ "chromahold - Removes all color information except for one color");
}
static void
-gst_chroma_hold_init (GstChromaHold * self, GstChromaHoldClass * klass)
+gst_chroma_hold_init (GstChromaHold * self)
{
self->target_r = DEFAULT_TARGET_R;
self->target_g = DEFAULT_TARGET_G;
}
static gboolean
-gst_chroma_hold_get_unit_size (GstBaseTransform * btrans,
- GstCaps * caps, guint * size)
-{
- GstVideoFormat format;
- gint width, height;
-
- if (!gst_video_format_parse_caps (caps, &format, &width, &height))
- return FALSE;
-
- *size = gst_video_format_get_size (format, width, height);
-
- GST_DEBUG_OBJECT (btrans, "unit size = %d for format %d w %d height %d",
- *size, format, width, height);
-
- return TRUE;
-}
-
-static gboolean
-gst_chroma_hold_set_caps (GstBaseTransform * btrans,
- GstCaps * incaps, GstCaps * outcaps)
+gst_chroma_hold_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
+ GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
- GstChromaHold *self = GST_CHROMA_HOLD (btrans);
+ GstChromaHold *self = GST_CHROMA_HOLD (vfilter);
GST_CHROMA_HOLD_LOCK (self);
- if (!gst_video_format_parse_caps (outcaps, &self->format,
- &self->width, &self->height)) {
- GST_WARNING_OBJECT (self,
- "Failed to parse caps %" GST_PTR_FORMAT " -> %" GST_PTR_FORMAT, incaps,
- outcaps);
- GST_CHROMA_HOLD_UNLOCK (self);
- return FALSE;
- }
-
GST_DEBUG_OBJECT (self,
"Setting caps %" GST_PTR_FORMAT " -> %" GST_PTR_FORMAT, incaps, outcaps);
+ self->format = GST_VIDEO_INFO_FORMAT (in_info);
+ self->width = GST_VIDEO_INFO_WIDTH (in_info);
+ self->height = GST_VIDEO_INFO_HEIGHT (in_info);
+
if (!gst_chroma_hold_set_process_function (self)) {
GST_WARNING_OBJECT (self, "No processing function for this caps");
GST_CHROMA_HOLD_UNLOCK (self);
}
static void
-gst_chroma_hold_process_xrgb (guint8 * dest, gint width,
+gst_chroma_hold_process_xrgb (GstVideoFrame * frame, gint width,
gint height, GstChromaHold * self)
{
gint i, j;
gint tolerance = self->tolerance;
gint p[4];
gint diff;
+ gint row_wrap;
+ guint8 *dest;
- p[0] = gst_video_format_get_component_offset (self->format, 3, width, height);
- p[1] = gst_video_format_get_component_offset (self->format, 0, width, height);
- p[2] = gst_video_format_get_component_offset (self->format, 1, width, height);
- p[3] = gst_video_format_get_component_offset (self->format, 2, width, height);
+ dest = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+ p[0] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 3);
+ p[1] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 0);
+ p[2] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 1);
+ p[3] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 2);
+ row_wrap = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0) - 4 * width;
h1 = self->hue;
dest += 4;
}
+ dest += row_wrap;
}
}
}
static GstFlowReturn
-gst_chroma_hold_transform_ip (GstBaseTransform * btrans, GstBuffer * buf)
+gst_chroma_hold_transform_frame_ip (GstVideoFilter * vfilter,
+ GstVideoFrame * frame)
{
- GstChromaHold *self = GST_CHROMA_HOLD (btrans);
- gint width, height;
+ GstChromaHold *self = GST_CHROMA_HOLD (vfilter);
GST_CHROMA_HOLD_LOCK (self);
return GST_FLOW_NOT_NEGOTIATED;
}
- width = self->width;
- height = self->height;
-
- self->process (GST_BUFFER_DATA (buf), width, height, self);
+ self->process (frame, self->width, self->height, self);
GST_CHROMA_HOLD_UNLOCK (self);
#include <gst/gst.h>
#include <gst/video/video.h>
#include <gst/video/gstvideofilter.h>
-#include <gst/controller/gstcontroller.h>
G_BEGIN_DECLS
#define GST_TYPE_CHROMA_HOLD \
guint tolerance;
/* processing function */
- void (*process) (guint8 * dest, gint width, gint height,
+ void (*process) (GstVideoFrame * frame, gint width, gint height,
GstChromaHold * chroma_hold);
/* pre-calculated values */
PROP_PRESET
};
-GST_BOILERPLATE (GstColorEffects, gst_color_effects, GstVideoFilter,
- GST_TYPE_VIDEO_FILTER);
+#define gst_color_effects_parent_class parent_class
+G_DEFINE_TYPE (GstColorEffects, gst_color_effects, GST_TYPE_VIDEO_FILTER);
-#define CAPS_STR GST_VIDEO_CAPS_ARGB ";" GST_VIDEO_CAPS_BGRA ";"\
- GST_VIDEO_CAPS_ABGR ";" GST_VIDEO_CAPS_RGBA ";"\
- GST_VIDEO_CAPS_xRGB ";" GST_VIDEO_CAPS_RGBx ";"\
- GST_VIDEO_CAPS_xBGR ";" GST_VIDEO_CAPS_BGRx ";"\
- GST_VIDEO_CAPS_RGB ";" GST_VIDEO_CAPS_BGR ";" \
- GST_VIDEO_CAPS_YUV ("AYUV") ";"
+#define CAPS_STR GST_VIDEO_CAPS_MAKE ("{ " \
+ "ARGB, BGRA, ABGR, RGBA, xRGB, BGRx, xBGR, RGBx, RGB, BGR, AYUV }")
static GstStaticPadTemplate gst_color_effects_src_template =
GST_STATIC_PAD_TEMPLATE ("src",
m[o*4+2] * v3 + m[o*4+3]) >> 8)
static void
-gst_color_effects_transform_rgb (GstColorEffects * filter, guint8 * data)
+gst_color_effects_transform_rgb (GstColorEffects * filter,
+ GstVideoFrame * frame)
{
gint i, j;
gint width, height;
guint32 r, g, b;
guint32 luma;
gint offsets[3];
+ guint8 *data;
+
+ data = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+ offsets[0] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 0);
+ offsets[1] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 1);
+ offsets[2] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 2);
+
+ width = GST_VIDEO_FRAME_WIDTH (frame);
+ height = GST_VIDEO_FRAME_HEIGHT (frame);
- /* videoformat fun copied from videobalance */
-
- offsets[0] = gst_video_format_get_component_offset (filter->format, 0,
- filter->width, filter->height);
- offsets[1] = gst_video_format_get_component_offset (filter->format, 1,
- filter->width, filter->height);
- offsets[2] = gst_video_format_get_component_offset (filter->format, 2,
- filter->width, filter->height);
-
- width =
- gst_video_format_get_component_width (filter->format, 0, filter->width);
- height =
- gst_video_format_get_component_height (filter->format, 0, filter->height);
- row_stride =
- gst_video_format_get_row_stride (filter->format, 0, filter->width);
- pixel_stride = gst_video_format_get_pixel_stride (filter->format, 0);
+ row_stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+ pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
row_wrap = row_stride - pixel_stride * width;
/* transform */
}
static void
-gst_color_effects_transform_ayuv (GstColorEffects * filter, guint8 * data)
+gst_color_effects_transform_ayuv (GstColorEffects * filter,
+ GstVideoFrame * frame)
{
gint i, j;
gint width, height;
gint r, g, b;
gint y, u, v;
gint offsets[3];
+ guint8 *data;
+
+ data = GST_VIDEO_FRAME_PLANE_DATA (frame, 0);
+ offsets[0] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 0);
+ offsets[1] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 1);
+ offsets[2] = GST_VIDEO_FRAME_COMP_POFFSET (frame, 2);
- /* videoformat fun copied from videobalance */
-
- offsets[0] = gst_video_format_get_component_offset (filter->format, 0,
- filter->width, filter->height);
- offsets[1] = gst_video_format_get_component_offset (filter->format, 1,
- filter->width, filter->height);
- offsets[2] = gst_video_format_get_component_offset (filter->format, 2,
- filter->width, filter->height);
-
- width =
- gst_video_format_get_component_width (filter->format, 0, filter->width);
- height =
- gst_video_format_get_component_height (filter->format, 0, filter->height);
- row_stride =
- gst_video_format_get_row_stride (filter->format, 0, filter->width);
- pixel_stride = gst_video_format_get_pixel_stride (filter->format, 0);
+ width = GST_VIDEO_FRAME_WIDTH (frame);
+ height = GST_VIDEO_FRAME_HEIGHT (frame);
+
+ row_stride = GST_VIDEO_FRAME_PLANE_STRIDE (frame, 0);
+ pixel_stride = GST_VIDEO_FRAME_COMP_PSTRIDE (frame, 0);
row_wrap = row_stride - pixel_stride * width;
for (i = 0; i < height; i++) {
}
static gboolean
-gst_color_effects_set_caps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
+gst_color_effects_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
+ GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
- GstColorEffects *filter = GST_COLOR_EFFECTS (btrans);
+ GstColorEffects *filter = GST_COLOR_EFFECTS (vfilter);
GST_DEBUG_OBJECT (filter,
"in %" GST_PTR_FORMAT " out %" GST_PTR_FORMAT, incaps, outcaps);
filter->process = NULL;
- if (!gst_video_format_parse_caps (incaps, &filter->format,
- &filter->width, &filter->height))
- goto invalid_caps;
+ filter->format = GST_VIDEO_INFO_FORMAT (in_info);
+ filter->width = GST_VIDEO_INFO_WIDTH (in_info);
+ filter->height = GST_VIDEO_INFO_HEIGHT (in_info);
GST_OBJECT_LOCK (filter);
- filter->size =
- gst_video_format_get_size (filter->format, filter->width, filter->height);
-
switch (filter->format) {
case GST_VIDEO_FORMAT_AYUV:
filter->process = gst_color_effects_transform_ayuv;
GST_OBJECT_UNLOCK (filter);
return filter->process != NULL;
-
-invalid_caps:
- GST_ERROR_OBJECT (filter, "Invalid caps: %" GST_PTR_FORMAT, incaps);
- return FALSE;
}
static GstFlowReturn
-gst_color_effects_transform_ip (GstBaseTransform * trans, GstBuffer * out)
+gst_color_effects_transform_frame_ip (GstVideoFilter * vfilter,
+ GstVideoFrame * out)
{
- GstColorEffects *filter = GST_COLOR_EFFECTS (trans);
- guint8 *data;
- gint size;
+ GstColorEffects *filter = GST_COLOR_EFFECTS (vfilter);
if (!filter->process)
goto not_negotiated;
- data = GST_BUFFER_DATA (out);
- size = GST_BUFFER_SIZE (out);
-
- if (size != filter->size)
- goto wrong_size;
-
/* do nothing if there is no table ("none" preset) */
if (filter->table == NULL)
return GST_FLOW_OK;
GST_OBJECT_LOCK (filter);
- filter->process (filter, data);
+ filter->process (filter, out);
GST_OBJECT_UNLOCK (filter);
return GST_FLOW_OK;
-wrong_size:
- {
- GST_ELEMENT_ERROR (filter, STREAM, FORMAT,
- (NULL), ("Invalid buffer size %d, expected %d", size, filter->size));
- return GST_FLOW_ERROR;
- }
not_negotiated:
GST_ERROR_OBJECT (filter, "Not negotiated yet");
return GST_FLOW_NOT_NEGOTIATED;
}
static void
-gst_color_effects_base_init (gpointer g_class)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
-
- gst_element_class_set_details_simple (element_class,
- "Color Look-up Table filter", "Filter/Effect/Video",
- "Color Look-up Table filter",
- "Filippo Argiolas <filippo.argiolas@gmail.com>");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_color_effects_sink_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&gst_color_effects_src_template));
-}
-
-static void
gst_color_effects_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec)
{
gst_color_effects_class_init (GstColorEffectsClass * klass)
{
GObjectClass *gobject_class = (GObjectClass *) klass;
- GstBaseTransformClass *trans_class = (GstBaseTransformClass *) klass;
+ GstElementClass *element_class = (GstElementClass *) klass;
+ GstVideoFilterClass *vfilter_class = (GstVideoFilterClass *) klass;
GST_DEBUG_CATEGORY_INIT (coloreffects_debug, "coloreffects", 0,
"coloreffects");
GST_TYPE_COLOR_EFFECTS_PRESET, DEFAULT_PROP_PRESET,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
- trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_color_effects_set_caps);
- trans_class->transform_ip =
- GST_DEBUG_FUNCPTR (gst_color_effects_transform_ip);
+ vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_color_effects_set_info);
+ vfilter_class->transform_frame_ip =
+ GST_DEBUG_FUNCPTR (gst_color_effects_transform_frame_ip);
+
+ gst_element_class_set_details_simple (element_class,
+ "Color Look-up Table filter", "Filter/Effect/Video",
+ "Color Look-up Table filter",
+ "Filippo Argiolas <filippo.argiolas@gmail.com>");
+
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_color_effects_sink_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_color_effects_src_template));
}
static void
-gst_color_effects_init (GstColorEffects * filter, GstColorEffectsClass * klass)
+gst_color_effects_init (GstColorEffects * filter)
{
filter->preset = GST_COLOR_EFFECTS_PRESET_NONE;
filter->table = NULL;
GstVideoFormat format;
gint width;
gint height;
- gint size;
- void (*process) (GstColorEffects * filter, guint8 * data);
+ void (*process) (GstColorEffects * filter, GstVideoFrame * frame);
};
struct _GstColorEffectsClass