Add boilerplate for vaapiconvert and vaapisink elements.

This commit is contained in:
gb 2010-03-05 17:11:52 +00:00
parent d80785fda6
commit 95a4bca0ee
7 changed files with 391 additions and 6 deletions

View file

@ -80,6 +80,20 @@ PKG_CHECK_MODULES([GST_PLUGINS_BASE],
AC_SUBST(GST_PLUGINS_BASE_CFLAGS)
AC_SUBST(GST_PLUGINS_BASE_LIBS)
dnl Check for GStreamer base
PKG_CHECK_MODULES([GST_BASE],
[gstreamer-base-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
)
AC_SUBST(GST_BASE_CFLAGS)
AC_SUBST(GST_BASE_LIBS)
dnl Check for GStreamer video
PKG_CHECK_MODULES([GST_VIDEO],
[gstreamer-video-$GST_MAJORMINOR >= $GST_VERSION_REQUIRED]
)
AC_SUBST(GST_VIDEO_CFLAGS)
AC_SUBST(GST_VIDEO_LIBS)
dnl Check for the GStreamer plugins directory
AC_MSG_CHECKING([for GStreamer plugins directory])
GST_PLUGINS_DIR=`$PKG_CONFIG gstreamer-$GST_MAJORMINOR --variable pluginsdir`

View file

@ -1,14 +1,23 @@
plugin_LTLIBRARIES = libgstvaapiconvert.la
libgstvaapiconvert_la_SOURCES = \
gstvaapiconvert.c \
$(NULL)
noinst_HEADERS = \
gstvaapiconvert.h \
$(NULL)
libgstvaapiconvert_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstvaapiconvert_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS)
libgstvaapiconvert_la_LDFLAGS =
libgstvaapiconvert_la_CFLAGS = \
$(GST_CFLAGS) \
$(GST_BASE_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS)
libgstvaapiconvert_la_LIBADD = \
$(GST_LIBS) \
$(GST_BASE_LIBS) \
$(GST_PLUGINS_BASE_LIBS)
libgstvaapiconvert_la_LIBTOOLFLAGS = --tag=disable-static
# Extra clean files so that maintainer-clean removes *everything*

View file

@ -0,0 +1,122 @@
/*
* gstvaapiconvert.c - VA-API video converter
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include <gst/gst.h>
#include "gstvaapiconvert.h"
/* ElementFactory information */
static const GstElementDetails gst_vaapiconvert_details =
GST_ELEMENT_DETAILS(
"Video convert",
"Convert/Video",
"A VA-API based videoconvert",
"Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>");
/* Default templates */
static GstStaticPadTemplate gst_vaapiconvert_sink_factory =
GST_STATIC_PAD_TEMPLATE(
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS(
"video/x-raw-yuv, "
"width = (int) [ 1, MAX ], "
"height = (int) [ 1, MAX ]; "));
static GstStaticPadTemplate gst_vaapiconvert_src_factory =
GST_STATIC_PAD_TEMPLATE(
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
GST_STATIC_CAPS(
"video/x-vaapi-surface, "
"width = (int) [ 1, MAX ], "
"height = (int) [ 1, MAX ]; "));
GST_BOILERPLATE(
GstVaapiConvert,
gst_vaapiconvert,
GstBaseTransform,
GST_TYPE_BASE_TRANSFORM);
static GstFlowReturn
gst_vaapiconvert_transform(
GstBaseTransform *trans,
GstBuffer *inbuf,
GstBuffer *outbuf
);
static void gst_vaapiconvert_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
gst_element_class_set_details(element_class, &gst_vaapiconvert_details);
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapiconvert_sink_factory)
);
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapiconvert_src_factory)
);
}
static void gst_vaapiconvert_class_init(GstVaapiConvertClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstBaseTransformClass * const trans_class = GST_BASE_TRANSFORM_CLASS(klass);
trans_class->transform = GST_DEBUG_FUNCPTR(gst_vaapiconvert_transform);
}
static void
gst_vaapiconvert_init(GstVaapiConvert *convert, GstVaapiConvertClass *klass)
{
}
static GstFlowReturn
gst_vaapiconvert_transform(
GstBaseTransform *trans,
GstBuffer *inbuf,
GstBuffer *outbuf
)
{
return GST_FLOW_OK;
}
static gboolean plugin_init(GstPlugin *plugin)
{
return gst_element_register(plugin,
"vaapiconvert",
GST_RANK_PRIMARY,
GST_TYPE_VAAPICONVERT);
}
GST_PLUGIN_DEFINE(
GST_VERSION_MAJOR, GST_VERSION_MINOR,
"vaapiconvert",
"A VA-API based video pixels format converter",
plugin_init,
PACKAGE_VERSION,
"GPL",
PACKAGE,
PACKAGE_BUGREPORT);

View file

@ -0,0 +1,73 @@
/*
* gstvaapiconvert.h - VA-API video converter
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GST_VAAPICONVERT_H
#define GST_VAAPICONVERT_H
#include <gst/base/gstbasetransform.h>
G_BEGIN_DECLS
#define GST_TYPE_VAAPICONVERT \
(gst_vaapiconvert_get_type())
#define GST_VAAPICONVERT(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_TYPE_VAAPICONVERT, \
GstVaapiConvert))
#define GST_VAAPICONVERT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_TYPE_VAAPICONVERT, \
GstVaapiConvertClass))
#define GST_IS_VAAPICONVERT(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPICONVERT))
#define GST_IS_VAAPICONVERT_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPICONVERT))
#define GST_VAAPICONVERT_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_TYPE_VAAPICONVERT, \
GstVaapiConvert))
typedef struct _GstVaapiConvert GstVaapiConvert;
typedef struct _GstVaapiConvertPrivate GstVaapiConvertPrivate;
typedef struct _GstVaapiConvertClass GstVaapiConvertClass;
struct _GstVaapiConvert {
/*< private >*/
GstBaseTransform parent_instance;
GstVaapiConvertPrivate *priv;
};
struct _GstVaapiConvertClass {
/*< private >*/
GstBaseTransformClass parent_class;
};
GType
gst_vaapiconvert_get_type(void);
G_END_DECLS
#endif /* GST_VAAPICONVERT_H */

View file

@ -1,14 +1,23 @@
plugin_LTLIBRARIES = libgstvaapisink.la
libgstvaapisink_la_SOURCES = \
gstvaapisink.c \
$(NULL)
noinst_HEADERS = \
gstvaapisink.h \
$(NULL)
libgstvaapisink_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstvaapisink_la_LIBADD = $(GST_LIBS) $(GST_PLUGINS_BASE_LIBS)
libgstvaapisink_la_LDFLAGS =
libgstvaapisink_la_CFLAGS = \
$(GST_CFLAGS) \
$(GST_VIDEO_CFLAGS) \
$(GST_PLUGINS_BASE_CFLAGS)
libgstvaapisink_la_LIBADD = \
$(GST_LIBS) \
$(GST_VIDEO_LIBS) \
$(GST_PLUGINS_BASE_LIBS)
libgstvaapisink_la_LIBTOOLFLAGS = --tag=disable-static
# Extra clean files so that maintainer-clean removes *everything*

View file

@ -0,0 +1,85 @@
/*
* gstvaapisink.c - VA-API video sink
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "config.h"
#include "gstvaapisink.h"
/* ElementFactory information */
static const GstElementDetails gst_vaapisink_details =
GST_ELEMENT_DETAILS(
"Video sink",
"Sink/Video",
"A VA-API based videosink",
"Gwenole Beauchesne <gbeauchesne@splitted-desktop.com>");
/* Default template */
static GstStaticPadTemplate gst_vaapisink_sink_factory =
GST_STATIC_PAD_TEMPLATE(
"sink",
GST_PAD_SINK,
GST_PAD_ALWAYS,
GST_STATIC_CAPS(
"video/x-vaapi-surface, "
"width = (int) [ 1, MAX ], "
"height = (int) [ 1, MAX ]; "));
GST_BOILERPLATE(GstVaapiSink, gst_vaapisink, GstVideoSink, GST_TYPE_VIDEO_SINK);
static void gst_vaapisink_base_init(gpointer klass)
{
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
gst_element_class_set_details(element_class, &gst_vaapisink_details);
gst_element_class_add_pad_template(
element_class,
gst_static_pad_template_get(&gst_vaapisink_sink_factory)
);
}
static void gst_vaapisink_class_init(GstVaapiSinkClass *klass)
{
GObjectClass * const object_class = G_OBJECT_CLASS(klass);
GstElementClass * const element_class = GST_ELEMENT_CLASS(klass);
GstBaseSinkClass * const basesink_class = GST_BASE_SINK_CLASS(klass);
GstVideoSinkClass * const videosink_class = GST_VIDEO_SINK_CLASS(klass);
}
static void gst_vaapisink_init(GstVaapiSink *sink, GstVaapiSinkClass *klass)
{
}
static gboolean plugin_init(GstPlugin *plugin)
{
return gst_element_register(plugin,
"vaapisink",
GST_RANK_PRIMARY,
GST_TYPE_VAAPISINK);
}
GST_PLUGIN_DEFINE(
GST_VERSION_MAJOR, GST_VERSION_MINOR,
"vaapisink",
"A VA-API based videosink",
plugin_init,
PACKAGE_VERSION,
"GPL",
PACKAGE,
PACKAGE_BUGREPORT);

View file

@ -0,0 +1,73 @@
/*
* gstvaapisink.h - VA-API video sink
*
* gstreamer-vaapi (C) 2010 Splitted-Desktop Systems
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef GST_VAAPISINK_H
#define GST_VAAPISINK_H
#include <gst/video/gstvideosink.h>
G_BEGIN_DECLS
#define GST_TYPE_VAAPISINK \
(gst_vaapisink_get_type())
#define GST_VAAPISINK(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), \
GST_TYPE_VAAPISINK, \
GstVaapiSink))
#define GST_VAAPISINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), \
GST_TYPE_VAAPISINK, \
GstVaapiSinkClass))
#define GST_IS_VAAPISINK(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VAAPISINK))
#define GST_IS_VAAPISINK_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VAAPISINK))
#define GST_VAAPISINK_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), \
GST_TYPE_VAAPISINK, \
GstVaapiSink))
typedef struct _GstVaapiSink GstVaapiSink;
typedef struct _GstVaapiSinkPrivate GstVaapiSinkPrivate;
typedef struct _GstVaapiSinkClass GstVaapiSinkClass;
struct _GstVaapiSink {
/*< private >*/
GstVideoSink parent_instance;
GstVaapiSinkPrivate *priv;
};
struct _GstVaapiSinkClass {
/*< private >*/
GstVideoSinkClass parent_class;
};
GType
gst_vaapisink_get_type(void);
G_END_DECLS
#endif /* GST_VAAPISINK_H */