#include <orc/orc.h>
#endif
-#ifdef HAVE_FFMPEG_UNINSTALLED
+#ifdef HAVE_LIBAV_UNINSTALLED
#include <avcodec.h>
#include <postprocess.h>
#else
guint quality;
gint width, height;
- gint ystride, ustride, vstride;
- gint ysize, usize, vsize;
-
pp_mode *mode;
pp_context *context;
GST_STATIC_PAD_TEMPLATE ("src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ IYUV, I420, YV12, Y42B, Y41B }"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ IYUV, I420, YV12, Y42B, Y41B }"))
);
static GstStaticPadTemplate gst_post_proc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
- GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ IYUV, I420, YV12, Y42B, Y41B }"))
+ GST_STATIC_CAPS (GST_VIDEO_CAPS_MAKE ("{ IYUV, I420, YV12, Y42B, Y41B }"))
);
GST_DEBUG_CATEGORY (postproc_debug);
static void gst_post_proc_init (GstPostProc * pproc);
static void gst_post_proc_dispose (GObject * object);
-static gboolean gst_post_proc_setcaps (GstBaseTransform * btrans,
- GstCaps * incaps, GstCaps * outcaps);
-static GstFlowReturn gst_post_proc_transform_ip (GstBaseTransform * btrans,
- GstBuffer * in);
+static gboolean gst_post_proc_set_info (GstVideoFilter * vfilter,
+ GstCaps * incaps, GstVideoInfo * in_info, GstCaps * outcaps,
+ GstVideoInfo * out_info);
+static GstFlowReturn gst_post_proc_transform_frame_ip (GstVideoFilter * vfilter,
+ GstVideoFrame * frame);
/* static GstStateChangeReturn gst_post_proc_change_state (GstElement * element, */
/* GstStateChange transition); */
postproc->context = pp_get_context (width, height, PP_FORMAT_420 | ppflags);
postproc->width = width;
postproc->height = height;
- postproc->ystride = ROUND_UP_4 (width);
- postproc->ustride = ROUND_UP_8 (width) / 2;
- postproc->vstride = ROUND_UP_8 (postproc->ystride) / 2;
- postproc->ysize = postproc->ystride * ROUND_UP_2 (height);
- postproc->usize = postproc->ustride * ROUND_UP_2 (height) / 2;
- postproc->vsize = postproc->vstride * ROUND_UP_2 (height) / 2;
- GST_DEBUG_OBJECT (postproc, "new strides are (YUV) : %d %d %d",
- postproc->ystride, postproc->ustride, postproc->vstride);
}
}
filterdetails[ppidx].longname);
description = g_strdup_printf ("LibPostProc %s",
filterdetails[ppidx].description);
- gst_element_class_set_details_simple (element_class, longname, "Filter/Video",
- description,
+ gst_element_class_set_static_metadata (element_class, longname,
+ "Filter/Video", description,
"Edward Hervey <edward@fluendo.com>, Mark Nauwelaerts (manauw@skynet.be)");
g_free (longname);
g_free (description);
- gst_element_class_add_static_pad_template (element_class,
- &gst_post_proc_src_template);
- gst_element_class_add_static_pad_template (element_class,
- &gst_post_proc_sink_template);
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_post_proc_src_template));
+ gst_element_class_add_pad_template (element_class,
+ gst_static_pad_template_get (&gst_post_proc_sink_template));
klass->filterid = ppidx;
}
gst_post_proc_class_init (GstPostProcClass * klass)
{
GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
-
/* GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass); */
- GstBaseTransformClass *btrans_class = GST_BASE_TRANSFORM_CLASS (klass);
+ GstVideoFilterClass *vfilter_class = GST_VIDEO_FILTER_CLASS (klass);
gint ppidx;
parent_class = g_type_class_peek_parent (klass);
}
gobject_class->dispose = GST_DEBUG_FUNCPTR (gst_post_proc_dispose);
- btrans_class->set_caps = GST_DEBUG_FUNCPTR (gst_post_proc_setcaps);
- btrans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_post_proc_transform_ip);
+
+ vfilter_class->set_info = GST_DEBUG_FUNCPTR (gst_post_proc_set_info);
+ vfilter_class->transform_frame_ip =
+ GST_DEBUG_FUNCPTR (gst_post_proc_transform_frame_ip);
}
static void
postproc->context = NULL;
postproc->width = 0;
postproc->height = 0;
- postproc->ystride = 0;
- postproc->ustride = 0;
- postproc->vstride = 0;
- postproc->ysize = 0;
- postproc->usize = 0;
- postproc->vsize = 0;
}
static void
}
static gboolean
-gst_post_proc_setcaps (GstBaseTransform * btrans, GstCaps * incaps,
- GstCaps * outcaps)
+gst_post_proc_set_info (GstVideoFilter * vfilter, GstCaps * incaps,
+ GstVideoInfo * in_info, GstCaps * outcaps, GstVideoInfo * out_info)
{
- GstPostProc *postproc = (GstPostProc *) (btrans);
- GstStructure *structure;
- gboolean ret = FALSE;
- gint width, height;
-
- structure = gst_caps_get_structure (incaps, 0);
+ GstPostProc *postproc = (GstPostProc *) (vfilter);
- if (gst_structure_get_int (structure, "width", &width) &&
- gst_structure_get_int (structure, "height", &height)) {
- change_context (postproc, width, height);
- ret = TRUE;
- }
+ change_context (postproc, in_info->width, in_info->height);
- return ret;
+ return TRUE;
}
static GstFlowReturn
-gst_post_proc_transform_ip (GstBaseTransform * btrans, GstBuffer * in)
+gst_post_proc_transform_frame_ip (GstVideoFilter * vfilter,
+ GstVideoFrame * frame)
{
GstPostProc *postproc;
gint stride[3];
guint8 *outplane[3];
guint8 *inplane[3];
+ gint width, height;
/* postprocess the buffer ! */
- postproc = (GstPostProc *) btrans;
+ postproc = (GstPostProc *) vfilter;
- stride[0] = postproc->ystride;
- stride[1] = postproc->ustride;
- stride[2] = postproc->vstride;
- outplane[0] = inplane[0] = GST_BUFFER_DATA (in);
- outplane[1] = inplane[1] = outplane[0] + postproc->ysize;
- outplane[2] = inplane[2] = outplane[1] + postproc->usize;
+ stride[0] = GST_VIDEO_FRAME_COMP_STRIDE (frame, 0);
+ stride[1] = GST_VIDEO_FRAME_COMP_STRIDE (frame, 1);
+ stride[2] = GST_VIDEO_FRAME_COMP_STRIDE (frame, 2);
+ outplane[0] = inplane[0] = GST_VIDEO_FRAME_COMP_DATA (frame, 0);
+ outplane[1] = inplane[1] = GST_VIDEO_FRAME_COMP_DATA (frame, 1);
+ outplane[2] = inplane[2] = GST_VIDEO_FRAME_COMP_DATA (frame, 2);
+
+ width = GST_VIDEO_FRAME_WIDTH (frame);
+ height = GST_VIDEO_FRAME_HEIGHT (frame);
GST_DEBUG_OBJECT (postproc, "calling pp_postprocess, width:%d, height:%d",
- postproc->width, postproc->height);
+ width, height);
pp_postprocess ((const guint8 **) inplane, stride, outplane, stride,
- postproc->width, postproc->height, (int8_t *) "", 0,
- postproc->mode, postproc->context, 0);
+ width, height, (int8_t *) "", 0, postproc->mode, postproc->context, 0);
return GST_FLOW_OK;
}
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR,
- "postproc",
- "postprocessing elements (" FFMPEG_SOURCE ")",
- plugin_init,
- PACKAGE_VERSION, "GPL", "FFMpeg", "http://ffmpeg.sourceforge.net/")
+ postproc,
+ "postprocessing elements (" LIBAV_SOURCE ")",
+ plugin_init, PACKAGE_VERSION, "GPL", "libav", "http://www.libav.org")