ffmpeg_use G_DEFINE_TYPE

This commit is contained in:
Wim Taymans 2011-04-19 19:04:36 +02:00
parent 198fa2571b
commit 6d4cdb2877
2 changed files with 20 additions and 29 deletions

View file

@ -80,31 +80,27 @@ static GstStaticPadTemplate sink_factory = GST_STATIC_PAD_TEMPLATE ("sink",
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420")) GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("I420"))
); );
GST_BOILERPLATE (GstFFMpegDeinterlace, gst_ffmpegdeinterlace, GstElement, G_DEFINE_TYPE (GstFFMpegDeinterlace, gst_ffmpegdeinterlace, GST_TYPE_ELEMENT);
GST_TYPE_ELEMENT);
static GstFlowReturn gst_ffmpegdeinterlace_chain (GstPad * pad, static GstFlowReturn gst_ffmpegdeinterlace_chain (GstPad * pad,
GstBuffer * inbuf); GstBuffer * inbuf);
static void static void
gst_ffmpegdeinterlace_base_init (gpointer g_class) gst_ffmpegdeinterlace_class_init (GstFFMpegDeinterlaceClass * klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory)); gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class, gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory)); gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details_simple (element_class, gst_element_class_set_details_simple (element_class,
"FFMPEG Deinterlace element", "Filter/Effect/Video/Deinterlace", "FFMPEG Deinterlace element", "Filter/Effect/Video/Deinterlace",
"Deinterlace video", "Luca Ognibene <luogni@tin.it>"); "Deinterlace video", "Luca Ognibene <luogni@tin.it>");
} }
static void
gst_ffmpegdeinterlace_class_init (GstFFMpegDeinterlaceClass * klass)
{
}
static gboolean static gboolean
gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps) gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps)
{ {
@ -147,8 +143,7 @@ gst_ffmpegdeinterlace_sink_setcaps (GstPad * pad, GstCaps * caps)
} }
static void static void
gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace, gst_ffmpegdeinterlace_init (GstFFMpegDeinterlace * deinterlace)
GstFFMpegDeinterlaceClass * klass)
{ {
deinterlace->sinkpad = deinterlace->sinkpad =
gst_pad_new_from_static_template (&sink_factory, "sink"); gst_pad_new_from_static_template (&sink_factory, "sink");

View file

@ -161,8 +161,8 @@ enum
/* FILL ME */ /* FILL ME */
}; };
GST_BOILERPLATE (GstFFMpegScale, gst_ffmpegscale, GstBaseTransform, #define gst_ffmpegscale_parent_class parent_class
GST_TYPE_BASE_TRANSFORM); G_DEFINE_TYPE (GstFFMpegScale, gst_ffmpegscale, GST_TYPE_BASE_TRANSFORM);
static void gst_ffmpegscale_finalize (GObject * object); static void gst_ffmpegscale_finalize (GObject * object);
static void gst_ffmpegscale_set_property (GObject * object, guint prop_id, static void gst_ffmpegscale_set_property (GObject * object, guint prop_id,
@ -185,25 +185,11 @@ static GstFlowReturn gst_ffmpegscale_transform (GstBaseTransform * trans,
static gboolean gst_ffmpegscale_handle_src_event (GstPad * pad, static gboolean gst_ffmpegscale_handle_src_event (GstPad * pad,
GstEvent * event); GstEvent * event);
static void
gst_ffmpegscale_base_init (gpointer g_class)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (element_class,
gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details_simple (element_class, "FFMPEG Scale element",
"Filter/Converter/Video",
"Converts video from one resolution to another",
"Luca Ognibene <luogni@tin.it>, Mark Nauwelaerts <mnauw@users.sf.net>");
}
static void static void
gst_ffmpegscale_class_init (GstFFMpegScaleClass * klass) gst_ffmpegscale_class_init (GstFFMpegScaleClass * klass)
{ {
GObjectClass *gobject_class = G_OBJECT_CLASS (klass); GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass); GstBaseTransformClass *trans_class = GST_BASE_TRANSFORM_CLASS (klass);
gobject_class->finalize = gst_ffmpegscale_finalize; gobject_class->finalize = gst_ffmpegscale_finalize;
@ -215,6 +201,16 @@ gst_ffmpegscale_class_init (GstFFMpegScaleClass * klass)
GST_TYPE_FFMPEGSCALE_METHOD, DEFAULT_PROP_METHOD, GST_TYPE_FFMPEGSCALE_METHOD, DEFAULT_PROP_METHOD,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&src_factory));
gst_element_class_add_pad_template (gstelement_class,
gst_static_pad_template_get (&sink_factory));
gst_element_class_set_details_simple (gstelement_class,
"FFMPEG Scale element", "Filter/Converter/Video",
"Converts video from one resolution to another",
"Luca Ognibene <luogni@tin.it>, Mark Nauwelaerts <mnauw@users.sf.net>");
trans_class->stop = GST_DEBUG_FUNCPTR (gst_ffmpegscale_stop); trans_class->stop = GST_DEBUG_FUNCPTR (gst_ffmpegscale_stop);
trans_class->transform_caps = trans_class->transform_caps =
GST_DEBUG_FUNCPTR (gst_ffmpegscale_transform_caps); GST_DEBUG_FUNCPTR (gst_ffmpegscale_transform_caps);
@ -228,7 +224,7 @@ gst_ffmpegscale_class_init (GstFFMpegScaleClass * klass)
} }
static void static void
gst_ffmpegscale_init (GstFFMpegScale * scale, GstFFMpegScaleClass * klass) gst_ffmpegscale_init (GstFFMpegScale * scale)
{ {
GstBaseTransform *trans = GST_BASE_TRANSFORM (scale); GstBaseTransform *trans = GST_BASE_TRANSFORM (scale);