summaryrefslogtreecommitdiff
path: root/gst-plugin
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2012-09-26 16:09:07 +0200
committerWim Taymans <wim.taymans@collabora.co.uk>2012-09-26 16:09:07 +0200
commitafd75017e71129a200ca19ea68161f3526265e6a (patch)
tree591569b4917ea5e4cf74732c19d16de29a75c46d /gst-plugin
parenta94611fd0a4d32bdd9367375def9b05310274d5f (diff)
port to 1.0
Diffstat (limited to 'gst-plugin')
-rw-r--r--gst-plugin/configure.ac36
-rw-r--r--gst-plugin/src/gstplugin.c87
-rw-r--r--gst-plugin/src/gsttransform.c52
3 files changed, 88 insertions, 87 deletions
diff --git a/gst-plugin/configure.ac b/gst-plugin/configure.ac
index ea85c18..1908b28 100644
--- a/gst-plugin/configure.ac
+++ b/gst-plugin/configure.ac
@@ -2,11 +2,11 @@ dnl required version of autoconf
AC_PREREQ([2.53])
dnl TODO: fill in your package name and package version here
-AC_INIT([my-plugin-package],[0.10.0])
+AC_INIT([my-plugin-package],[1.0.0])
dnl required versions of gstreamer and plugins-base
-GST_REQUIRED=0.10.16
-GSTPB_REQUIRED=0.10.16
+GST_REQUIRED=1.0.0
+GSTPB_REQUIRED=1.0.0
AC_CONFIG_SRCDIR([src/gstplugin.c])
AC_CONFIG_HEADERS([config.h])
@@ -33,19 +33,19 @@ dnl Check for the required version of GStreamer core (and gst-plugins-base)
dnl This will export GST_CFLAGS and GST_LIBS variables for use in Makefile.am
dnl
dnl If you need libraries from gst-plugins-base here, also add:
-dnl for libgstaudio-0.10: gstreamer-audio-0.10 >= $GST_REQUIRED
-dnl for libgstvideo-0.10: gstreamer-video-0.10 >= $GST_REQUIRED
-dnl for libgsttag-0.10: gstreamer-tag-0.10 >= $GST_REQUIRED
-dnl for libgstpbutils-0.10: gstreamer-pbutils-0.10 >= $GST_REQUIRED
-dnl for libgstfft-0.10: gstreamer-fft-0.10 >= $GST_REQUIRED
-dnl for libgstinterfaces-0.10: gstreamer-interfaces-0.10 >= $GST_REQUIRED
-dnl for libgstrtp-0.10: gstreamer-rtp-0.10 >= $GST_REQUIRED
-dnl for libgstrtsp-0.10: gstreamer-rtsp-0.10 >= $GST_REQUIRED
+dnl for libgstaudio-1.0: gstreamer-audio-1.0 >= $GST_REQUIRED
+dnl for libgstvideo-1.0: gstreamer-video-1.0 >= $GST_REQUIRED
+dnl for libgsttag-1.0: gstreamer-tag-1.0 >= $GST_REQUIRED
+dnl for libgstpbutils-1.0: gstreamer-pbutils-1.0 >= $GST_REQUIRED
+dnl for libgstfft-1.0: gstreamer-fft-1.0 >= $GST_REQUIRED
+dnl for libgstinterfaces-1.0: gstreamer-interfaces-1.0 >= $GST_REQUIRED
+dnl for libgstrtp-1.0: gstreamer-rtp-1.0 >= $GST_REQUIRED
+dnl for libgstrtsp-1.0: gstreamer-rtsp-1.0 >= $GST_REQUIRED
dnl etc.
PKG_CHECK_MODULES(GST, [
- gstreamer-0.10 >= $GST_REQUIRED
- gstreamer-base-0.10 >= $GST_REQUIRED
- gstreamer-controller-0.10 >= $GST_REQUIRED
+ gstreamer-1.0 >= $GST_REQUIRED
+ gstreamer-base-1.0 >= $GST_REQUIRED
+ gstreamer-controller-1.0 >= $GST_REQUIRED
], [
AC_SUBST(GST_CFLAGS)
AC_SUBST(GST_LIBS)
@@ -53,8 +53,8 @@ PKG_CHECK_MODULES(GST, [
AC_MSG_ERROR([
You need to install or upgrade the GStreamer development
packages on your system. On debian-based systems these are
- libgstreamer0.10-dev and libgstreamer-plugins-base0.10-dev.
- on RPM-based systems gstreamer0.10-devel, libgstreamer0.10-devel
+ libgstreamer1.0-dev and libgstreamer-plugins-base1.0-dev.
+ on RPM-based systems gstreamer1.0-devel, libgstreamer1.0-devel
or similar. The minimum version required is $GST_REQUIRED.
])
])
@@ -72,9 +72,9 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([ ], [ ])], [
dnl set the plugindir where plugins should be installed (for src/Makefile.am)
if test "x${prefix}" = "x$HOME"; then
- plugindir="$HOME/.gstreamer-0.10/plugins"
+ plugindir="$HOME/.gstreamer-1.0/plugins"
else
- plugindir="\$(libdir)/gstreamer-0.10"
+ plugindir="\$(libdir)/gstreamer-1.0"
fi
AC_SUBST(plugindir)
diff --git a/gst-plugin/src/gstplugin.c b/gst-plugin/src/gstplugin.c
index 464be87..d6617ea 100644
--- a/gst-plugin/src/gstplugin.c
+++ b/gst-plugin/src/gstplugin.c
@@ -96,36 +96,19 @@ static GstStaticPadTemplate src_factory = GST_STATIC_PAD_TEMPLATE ("src",
GST_STATIC_CAPS ("ANY")
);
-GST_BOILERPLATE (GstPluginTemplate, gst_plugin_template, GstElement,
- GST_TYPE_ELEMENT);
+#define gst_plugin_template_parent_class parent_class
+G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_ELEMENT);
static void gst_plugin_template_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_plugin_template_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
-static gboolean gst_plugin_template_set_caps (GstPad * pad, GstCaps * caps);
-static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstBuffer * buf);
+static gboolean gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event);
+static GstFlowReturn gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf);
/* GObject vmethod implementations */
-static void
-gst_plugin_template_base_init (gpointer gclass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (gclass);
-
- gst_element_class_set_details_simple(element_class,
- "Plugin",
- "FIXME:Generic",
- "FIXME:Generic Template Element",
- "AUTHOR_NAME AUTHOR_EMAIL");
-
- 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));
-}
-
/* initialize the plugin's class */
static void
gst_plugin_template_class_init (GstPluginTemplateClass * klass)
@@ -142,6 +125,17 @@ gst_plugin_template_class_init (GstPluginTemplateClass * klass)
g_object_class_install_property (gobject_class, PROP_SILENT,
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE));
+
+ gst_element_class_set_details_simple(gstelement_class,
+ "Plugin",
+ "FIXME:Generic",
+ "FIXME:Generic Template Element",
+ "AUTHOR_NAME AUTHOR_EMAIL");
+
+ 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));
}
/* initialize the new element
@@ -150,23 +144,20 @@ gst_plugin_template_class_init (GstPluginTemplateClass * klass)
* initialize instance structure
*/
static void
-gst_plugin_template_init (GstPluginTemplate * filter,
- GstPluginTemplateClass * gclass)
+gst_plugin_template_init (GstPluginTemplate * filter)
{
filter->sinkpad = gst_pad_new_from_static_template (&sink_factory, "sink");
- gst_pad_set_setcaps_function (filter->sinkpad,
- GST_DEBUG_FUNCPTR(gst_plugin_template_set_caps));
- gst_pad_set_getcaps_function (filter->sinkpad,
- GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
+ gst_pad_set_event_function (filter->sinkpad,
+ GST_DEBUG_FUNCPTR(gst_plugin_template_sink_event));
gst_pad_set_chain_function (filter->sinkpad,
GST_DEBUG_FUNCPTR(gst_plugin_template_chain));
+ GST_PAD_SET_PROXY_CAPS (filter->sinkpad);
+ gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
filter->srcpad = gst_pad_new_from_static_template (&src_factory, "src");
- gst_pad_set_getcaps_function (filter->srcpad,
- GST_DEBUG_FUNCPTR(gst_pad_proxy_getcaps));
-
- gst_element_add_pad (GST_ELEMENT (filter), filter->sinkpad);
+ GST_PAD_SET_PROXY_CAPS (filter->srcpad);
gst_element_add_pad (GST_ELEMENT (filter), filter->srcpad);
+
filter->silent = FALSE;
}
@@ -204,29 +195,43 @@ gst_plugin_template_get_property (GObject * object, guint prop_id,
/* GstElement vmethod implementations */
-/* this function handles the link with other elements */
+/* this function handles sink events */
static gboolean
-gst_plugin_template_set_caps (GstPad * pad, GstCaps * caps)
+gst_plugin_template_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
{
+ gboolean ret;
GstPluginTemplate *filter;
- GstPad *otherpad;
- filter = GST_PLUGIN_TEMPLATE (gst_pad_get_parent (pad));
- otherpad = (pad == filter->srcpad) ? filter->sinkpad : filter->srcpad;
- gst_object_unref (filter);
+ filter = GST_PLUGIN_TEMPLATE (parent);
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_CAPS:
+ {
+ GstCaps * caps;
- return gst_pad_set_caps (otherpad, caps);
+ gst_event_parse_caps (event, &caps);
+ /* do something with the caps */
+
+ /* and forward */
+ ret = gst_pad_event_default (pad, parent, event);
+ break;
+ }
+ default:
+ ret = gst_pad_event_default (pad, parent, event);
+ break;
+ }
+ return ret;
}
/* chain function
* this function does the actual processing
*/
static GstFlowReturn
-gst_plugin_template_chain (GstPad * pad, GstBuffer * buf)
+gst_plugin_template_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
{
GstPluginTemplate *filter;
- filter = GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT (pad));
+ filter = GST_PLUGIN_TEMPLATE (parent);
if (filter->silent == FALSE)
g_print ("I'm plugged, therefore I'm in.\n");
@@ -270,7 +275,7 @@ plugin_init (GstPlugin * plugin)
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
- "plugin",
+ plugin,
"Template plugin",
plugin_init,
VERSION,
diff --git a/gst-plugin/src/gsttransform.c b/gst-plugin/src/gsttransform.c
index 6cf223e..536357b 100644
--- a/gst-plugin/src/gsttransform.c
+++ b/gst-plugin/src/gsttransform.c
@@ -78,15 +78,8 @@ GST_STATIC_PAD_TEMPLATE (
GST_STATIC_CAPS ("ANY")
);
-/* debug category for fltering log messages
- *
- * FIXME:exchange the string 'Template plugin' with your description
- */
-#define DEBUG_INIT(bla) \
- GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin");
-
-GST_BOILERPLATE_FULL (GstPluginTemplate, gst_plugin_template, GstBaseTransform,
- GST_TYPE_BASE_TRANSFORM, DEBUG_INIT);
+#define gst_plugin_template_parent_class parent_class
+G_DEFINE_TYPE (GstPluginTemplate, gst_plugin_template, GST_TYPE_BASE_TRANSFORM);
static void gst_plugin_template_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
@@ -98,30 +91,16 @@ static GstFlowReturn gst_plugin_template_transform_ip (GstBaseTransform * base,
/* GObject vmethod implementations */
-static void
-gst_plugin_template_base_init (gpointer klass)
-{
- GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
-
- gst_element_class_set_details_simple (element_class,
- "Plugin",
- "Generic/Filter",
- "FIXME:Generic Template Filter",
- "AUTHOR_NAME AUTHOR_EMAIL");
-
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&src_template));
- gst_element_class_add_pad_template (element_class,
- gst_static_pad_template_get (&sink_template));
-}
-
/* initialize the plugin's class */
static void
gst_plugin_template_class_init (GstPluginTemplateClass * klass)
{
GObjectClass *gobject_class;
+ GstElementClass *gstelement_class;
gobject_class = (GObjectClass *) klass;
+ gstelement_class = (GstElementClass *) klass;
+
gobject_class->set_property = gst_plugin_template_set_property;
gobject_class->get_property = gst_plugin_template_get_property;
@@ -129,15 +108,32 @@ gst_plugin_template_class_init (GstPluginTemplateClass * klass)
g_param_spec_boolean ("silent", "Silent", "Produce verbose output ?",
FALSE, G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
+ gst_element_class_set_details_simple (gstelement_class,
+ "Plugin",
+ "Generic/Filter",
+ "FIXME:Generic Template Filter",
+ "AUTHOR_NAME AUTHOR_EMAIL");
+
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&src_template));
+ gst_element_class_add_pad_template (gstelement_class,
+ gst_static_pad_template_get (&sink_template));
+
GST_BASE_TRANSFORM_CLASS (klass)->transform_ip =
GST_DEBUG_FUNCPTR (gst_plugin_template_transform_ip);
+
+ /* debug category for fltering log messages
+ *
+ * FIXME:exchange the string 'Template plugin' with your description
+ */
+ GST_DEBUG_CATEGORY_INIT (gst_plugin_template_debug, "plugin", 0, "Template plugin");
}
/* initialize the new element
* initialize instance structure
*/
static void
-gst_plugin_template_init (GstPluginTemplate *filter, GstPluginTemplateClass * klass)
+gst_plugin_template_init (GstPluginTemplate *filter)
{
filter->silent = FALSE;
}
@@ -217,7 +213,7 @@ plugin_init (GstPlugin * plugin)
GST_PLUGIN_DEFINE (
GST_VERSION_MAJOR,
GST_VERSION_MINOR,
- "plugin",
+ plugin,
"Template plugin",
plugin_init,
VERSION,