summaryrefslogtreecommitdiffstats
path: root/ext
diff options
context:
space:
mode:
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-04-22 14:55:12 +0000
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>2003-04-22 14:55:12 +0000
commit08889d7a8ffaac8e6195783d70e496ede7dea11d (patch)
treea56f1d6fa6e14b65074458b6eafa95c5564af02e /ext
parentcb4ce3dd598b1653461f5cc1b6276812699bb5f7 (diff)
downloadgst-plugins-bad-08889d7a8ffaac8e6195783d70e496ede7dea11d.tar.gz
gst-plugins-bad-08889d7a8ffaac8e6195783d70e496ede7dea11d.tar.bz2
gst-plugins-bad-08889d7a8ffaac8e6195783d70e496ede7dea11d.zip
Added corresponding divx/xvid decoders and fixed some first-hand encoder bugs
Original commit message from CVS: Added corresponding divx/xvid decoders and fixed some first-hand encoder bugs
Diffstat (limited to 'ext')
-rw-r--r--ext/divx/Makefile.am17
-rw-r--r--ext/divx/gstdivxdec.c435
-rw-r--r--ext/divx/gstdivxdec.h70
-rw-r--r--ext/divx/gstdivxenc.c42
-rw-r--r--ext/xvid/Makefile.am4
-rw-r--r--ext/xvid/gstxvid.c40
-rw-r--r--ext/xvid/gstxviddec.c388
-rw-r--r--ext/xvid/gstxviddec.h72
-rw-r--r--ext/xvid/gstxvidenc.c22
-rw-r--r--ext/xvid/gstxvidenc.h3
10 files changed, 1057 insertions, 36 deletions
diff --git a/ext/divx/Makefile.am b/ext/divx/Makefile.am
index e6a6eaa5..301657c8 100644
--- a/ext/divx/Makefile.am
+++ b/ext/divx/Makefile.am
@@ -1,10 +1,15 @@
plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
-plugin_LTLIBRARIES = libgstdivx.la
+plugin_LTLIBRARIES = libgstdivxenc.la libgstdivxdec.la
-libgstdivx_la_SOURCES = gstdivxenc.c
-libgstdivx_la_CFLAGS = $(GST_CFLAGS) $(DIVX_CFLAGS)
-libgstdivx_la_LIBADD = $(DIVX_LIBS)
-libgstdivx_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+libgstdivxenc_la_SOURCES = gstdivxenc.c
+libgstdivxenc_la_CFLAGS = $(GST_CFLAGS) $(DIVX_CFLAGS)
+libgstdivxenc_la_LIBADD = $(DIVXENC_LIBS)
+libgstdivxenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-noinst_HEADERS = gstdivxenc.h
+libgstdivxdec_la_SOURCES = gstdivxdec.c
+libgstdivxdec_la_CFLAGS = $(GST_CFLAGS) $(DIVX_CFLAGS)
+libgstdivxdec_la_LIBADD = $(DIVXDEC_LIBS)
+libgstdivxdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
+
+noinst_HEADERS = gstdivxenc.h gstdivxdec.h
diff --git a/ext/divx/gstdivxdec.c b/ext/divx/gstdivxdec.c
new file mode 100644
index 00000000..c928c9ad
--- /dev/null
+++ b/ext/divx/gstdivxdec.c
@@ -0,0 +1,435 @@
+/* GStreamer divx decoder plugin
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include "gstdivxdec.h"
+#include <gst/video/video.h>
+
+/* elementfactory information */
+GstElementDetails gst_divxdec_details = {
+ "Divx decoder",
+ "Codec/Video/Decoder",
+ "Commercial",
+ "Divx decoder based on divxdecore",
+ VERSION,
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>",
+ "(C) 2003",
+};
+
+GST_PAD_TEMPLATE_FACTORY(sink_template,
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW("divxdec_sink",
+ "video/divx",
+ NULL)
+)
+
+GST_PAD_TEMPLATE_FACTORY(src_template,
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW("divxdec_src",
+ "video/raw",
+ "format", GST_PROPS_LIST(
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','Y','U','V')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','2')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y'))
+ ),
+ "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE(0, G_MAXINT),
+ NULL)
+)
+
+
+/* DivxDec signals and args */
+enum {
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum {
+ ARG_0
+ /* FILL ME */
+};
+
+
+static void gst_divxdec_class_init (GstDivxDecClass *klass);
+static void gst_divxdec_init (GstDivxDec *divxdec);
+static void gst_divxdec_dispose (GObject *object);
+static void gst_divxdec_chain (GstPad *pad,
+ GstBuffer *buf);
+static GstPadLinkReturn gst_divxdec_connect (GstPad *pad,
+ GstCaps *vscapslist);
+
+static GstElementClass *parent_class = NULL;
+/* static guint gst_divxdec_signals[LAST_SIGNAL] = { 0 }; */
+
+
+GType
+gst_divxdec_get_type(void)
+{
+ static GType divxdec_type = 0;
+
+ if (!divxdec_type)
+ {
+ static const GTypeInfo divxdec_info = {
+ sizeof(GstDivxDecClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_divxdec_class_init,
+ NULL,
+ NULL,
+ sizeof(GstDivxDec),
+ 0,
+ (GInstanceInitFunc) gst_divxdec_init,
+ };
+ divxdec_type = g_type_register_static(GST_TYPE_ELEMENT,
+ "GstDivxDec",
+ &divxdec_info, 0);
+ }
+ return divxdec_type;
+}
+
+
+static void
+gst_divxdec_class_init (GstDivxDecClass *klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+
+ parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+
+ gobject_class->dispose = gst_divxdec_dispose;
+}
+
+
+static void
+gst_divxdec_init (GstDivxDec *divxdec)
+{
+ /* create the sink pad */
+ divxdec->sinkpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(sink_template),
+ "sink");
+ gst_element_add_pad(GST_ELEMENT(divxdec), divxdec->sinkpad);
+
+ gst_pad_set_chain_function(divxdec->sinkpad, gst_divxdec_chain);
+ gst_pad_set_link_function(divxdec->sinkpad, gst_divxdec_connect);
+
+ /* create the src pad */
+ divxdec->srcpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(src_template),
+ "src");
+ gst_element_add_pad(GST_ELEMENT(divxdec), divxdec->srcpad);
+
+ /* bitrate, etc. */
+ divxdec->width = divxdec->height = divxdec->csp = -1;
+
+ /* set divx handle to NULL */
+ divxdec->handle = NULL;
+}
+
+
+static void
+gst_divxdec_unset (GstDivxDec *divxdec)
+{
+ /* free allocated memory */
+ g_free(divxdec->bufinfo.mp4_edged_ref_buffers);
+ g_free(divxdec->bufinfo.mp4_edged_for_buffers);
+ g_free(divxdec->bufinfo.mp4_edged_back_buffers);
+ g_free(divxdec->bufinfo.mp4_display_buffers);
+ g_free(divxdec->bufinfo.mp4_state);
+ g_free(divxdec->bufinfo.mp4_tables);
+ g_free(divxdec->bufinfo.mp4_stream);
+ g_free(divxdec->bufinfo.mp4_reference);
+
+ if (divxdec->handle) {
+ /* unref this instance */
+ decore((gulong) divxdec->handle, DEC_OPT_RELEASE,
+ NULL, NULL);
+ divxdec->handle = NULL;
+ }
+}
+
+
+static gboolean
+gst_divxdec_setup (GstDivxDec *divxdec)
+{
+ DEC_PARAM xdec;
+ DEC_MEM_REQS xreq;
+ int ret;
+
+ /* initialise parameters, see divx documentation */
+ memset(&xdec, 0, sizeof(DEC_PARAM));
+ xdec.x_dim = divxdec->width;
+ xdec.y_dim = divxdec->height;
+ xdec.time_incr = 15; /* default - what is this? */
+ xdec.output_format = divxdec->csp;
+
+ if ((ret = decore((gulong) divxdec, DEC_OPT_MEMORY_REQS,
+ &xdec, &xreq)) != 0) {
+ char *error;
+ switch (ret) {
+ case DEC_MEMORY:
+ error = "Memory allocation error";
+ break;
+ case DEC_BAD_FORMAT:
+ error = "Format";
+ break;
+ default:
+ error = "Internal failure";
+ break;
+ }
+ GST_DEBUG(GST_CAT_PLUGIN_INFO,
+ "Setting parameters %dx%d@%d failed: %s",
+ divxdec->width, divxdec->height, divxdec->csp, error);
+ return FALSE;
+ }
+
+ /* allocate memory */
+ xdec.buffers.mp4_edged_ref_buffers = g_malloc(xreq.mp4_edged_ref_buffers_size);
+ memset(xdec.buffers.mp4_edged_ref_buffers, 0, xreq.mp4_edged_ref_buffers_size);
+
+ xdec.buffers.mp4_edged_for_buffers = g_malloc(xreq.mp4_edged_for_buffers_size);
+ memset(xdec.buffers.mp4_edged_for_buffers, 0, xreq.mp4_edged_for_buffers_size);
+
+ xdec.buffers.mp4_edged_back_buffers = g_malloc(xreq.mp4_edged_back_buffers_size);
+ memset(xdec.buffers.mp4_edged_back_buffers, 0, xreq.mp4_edged_back_buffers_size);
+
+ xdec.buffers.mp4_display_buffers = g_malloc(xreq.mp4_display_buffers_size);
+ memset(xdec.buffers.mp4_display_buffers, 0, xreq.mp4_display_buffers_size);
+
+ xdec.buffers.mp4_state = g_malloc(xreq.mp4_state_size);
+ memset(xdec.buffers.mp4_state, 0, xreq.mp4_state_size);
+
+ xdec.buffers.mp4_tables = g_malloc(xreq.mp4_tables_size);
+ memset(xdec.buffers.mp4_tables, 0, xreq.mp4_tables_size);
+
+ xdec.buffers.mp4_stream = g_malloc(xreq.mp4_stream_size);
+ memset(xdec.buffers.mp4_stream, 0, xreq.mp4_stream_size);
+
+ xdec.buffers.mp4_reference = g_malloc(xreq.mp4_reference_size);
+ memset(xdec.buffers.mp4_reference, 0, xreq.mp4_reference_size);
+
+ divxdec->bufinfo = xdec.buffers;
+
+ if ((ret = decore((gulong) divxdec, DEC_OPT_INIT,
+ &xdec, &xreq)) != 0) {
+ gst_element_error(GST_ELEMENT(divxdec),
+ "Expected error when confirming current settings: %d",
+ ret);
+ gst_divxdec_unset(divxdec);
+ return FALSE;
+ }
+
+ /* don't tell me this sucks - this is how divx4linux works... */
+ divxdec->handle = divxdec;
+
+ return TRUE;
+}
+
+
+static void
+gst_divxdec_dispose (GObject *object)
+{
+ GstDivxDec *divxdec = GST_DIVXDEC(object);
+
+ gst_divxdec_unset(divxdec);
+}
+
+
+static void
+gst_divxdec_chain (GstPad *pad,
+ GstBuffer *buf)
+{
+ GstDivxDec *divxdec;
+ GstBuffer *outbuf;
+ DEC_FRAME xframe;
+ int ret;
+
+ g_return_if_fail(pad != NULL);
+ g_return_if_fail(GST_IS_PAD(pad));
+ g_return_if_fail(buf != NULL);
+
+ divxdec = GST_DIVXDEC(GST_OBJECT_PARENT(pad));
+
+ if (!divxdec->handle) {
+ gst_element_error(GST_ELEMENT(divxdec),
+ "No format set - aborting");
+ gst_buffer_unref(buf);
+ return;
+ }
+
+ outbuf = gst_buffer_new_and_alloc(divxdec->width *
+ divxdec->height *
+ divxdec->bpp / 8);
+ GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
+ GST_BUFFER_SIZE(outbuf) = divxdec->width *
+ divxdec->height *
+ divxdec->bpp / 8;
+
+ /* encode and so ... */
+ xframe.bitstream = (void *) GST_BUFFER_DATA(buf);
+ xframe.bmp = (void *) GST_BUFFER_DATA(outbuf);
+ xframe.length = GST_BUFFER_SIZE(buf);
+ xframe.stride = divxdec->width * divxdec->bpp / 8;
+ xframe.render_flag = 1;
+
+ if ((ret = decore((gulong) divxdec->handle, DEC_OPT_FRAME,
+ &xframe, NULL))) {
+ gst_element_error(GST_ELEMENT(divxdec),
+ "Error decoding divx frame: %d\n", ret);
+ gst_buffer_unref(buf);
+ return;
+ }
+
+ gst_pad_push(divxdec->srcpad, outbuf);
+ gst_buffer_unref(buf);
+}
+
+
+static GstPadLinkReturn
+gst_divxdec_connect (GstPad *pad,
+ GstCaps *vscaps)
+{
+ GstDivxDec *divxdec;
+ GstCaps *caps;
+ struct {
+ guint32 fourcc;
+ gint depth, bpp;
+ gint csp;
+ } fmt_list[] = {
+ { GST_MAKE_FOURCC('Y','U','Y','V'), 16, 16, DEC_YUY2 },
+ { GST_MAKE_FOURCC('U','Y','V','Y'), 16, 16, DEC_UYVY },
+ { GST_MAKE_FOURCC('I','4','2','0'), 12, 12, DEC_420 },
+ { GST_MAKE_FOURCC('I','Y','U','V'), 12, 12, DEC_420 },
+ { GST_MAKE_FOURCC('Y','V','1','2'), 12, 12, DEC_YV12 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 32, 32, DEC_RGB32 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 24, 24, DEC_RGB24 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 16, 16, DEC_RGB555 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 15, 16, DEC_RGB565 },
+ { 0, 0, 0 }
+ };
+ gint i;
+
+ divxdec = GST_DIVXDEC(gst_pad_get_parent (pad));
+
+ /* if there's something old around, remove it */
+ if (divxdec->handle) {
+ gst_divxdec_unset(divxdec);
+ }
+
+ /* we are not going to act on variable caps */
+ if (!GST_CAPS_IS_FIXED(vscaps))
+ return GST_PAD_LINK_DELAYED;
+
+ /* if we get here, we know the input is divx. we
+ * only need to bother with the output colorspace */
+ gst_caps_get_int(vscaps, "width", &divxdec->width);
+ gst_caps_get_int(vscaps, "height", &divxdec->height);
+
+ for (i = 0; fmt_list[i].fourcc != 0; i++) {
+ divxdec->csp = fmt_list[i].csp;
+
+ /* try making a caps to set on the other side */
+ if (fmt_list[i].fourcc == GST_MAKE_FOURCC('R','G','B',' ')) {
+ guint32 r_mask = 0, b_mask = 0, g_mask = 0;
+ switch (fmt_list[i].depth) {
+ case 15:
+ r_mask = 0xf800; g_mask = 0x07c0; b_mask = 0x003e;
+ break;
+ case 16:
+ r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
+ break;
+ case 24:
+ r_mask = 0xff0000; g_mask = 0x00ff00; b_mask = 0x0000ff;
+ break;
+ case 32:
+ r_mask = 0xff000000; g_mask = 0x00ff0000; b_mask = 0x0000ff00;
+ break;
+ }
+ caps = GST_CAPS_NEW("divxdec_src_pad_rgb",
+ "video/raw",
+ "width", GST_PROPS_INT(divxdec->width),
+ "height", GST_PROPS_INT(divxdec->height),
+ "format", GST_PROPS_FOURCC(fmt_list[i].fourcc),
+ "depth", GST_PROPS_INT(fmt_list[i].depth),
+ "bpp", GST_PROPS_INT(fmt_list[i].bpp),
+ "endianness", GST_PROPS_INT(G_BYTE_ORDER),
+ "red_mask", GST_PROPS_INT(r_mask),
+ "green_mask", GST_PROPS_INT(g_mask),
+ "blue_mask", GST_PROPS_INT(b_mask),
+ NULL);
+ } else {
+ caps = GST_CAPS_NEW("divxdec_src_pad_yuv",
+ "video/raw",
+ "width", GST_PROPS_INT(divxdec->width),
+ "height", GST_PROPS_INT(divxdec->height),
+ "format", GST_PROPS_FOURCC(fmt_list[i].fourcc),
+ NULL);
+ }
+
+ if (gst_pad_try_set_caps(divxdec->srcpad, caps) > 0) {
+ divxdec->csp = fmt_list[i].csp;
+ divxdec->bpp = fmt_list[i].bpp;
+ if (gst_divxdec_setup(divxdec))
+ return GST_PAD_LINK_OK;
+ }
+ }
+
+ /* if we got here - it's not good */
+ return GST_PAD_LINK_REFUSED;
+}
+
+
+static gboolean
+plugin_init (GModule *module,
+ GstPlugin *plugin)
+{
+ GstElementFactory *factory;
+
+ /* create an elementfactory for the v4lmjpegsrcparse element */
+ factory = gst_element_factory_new("divxdec", GST_TYPE_DIVXDEC,
+ &gst_divxdec_details);
+ g_return_val_if_fail(factory != NULL, FALSE);
+
+ /* add pad templates */
+ gst_element_factory_add_pad_template(factory,
+ GST_PAD_TEMPLATE_GET(sink_template));
+ gst_element_factory_add_pad_template(factory,
+ GST_PAD_TEMPLATE_GET(src_template));
+
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+
+ return TRUE;
+}
+
+
+GstPluginDesc plugin_desc = {
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "divxdec",
+ plugin_init
+};
diff --git a/ext/divx/gstdivxdec.h b/ext/divx/gstdivxdec.h
new file mode 100644
index 00000000..727da7c2
--- /dev/null
+++ b/ext/divx/gstdivxdec.h
@@ -0,0 +1,70 @@
+/* GStreamer divx decoder plugin
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_DIVXDEC_H__
+#define __GST_DIVXDEC_H__
+
+#include <gst/gst.h>
+#include <decore.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#define GST_TYPE_DIVXDEC \
+ (gst_divxdec_get_type())
+#define GST_DIVXDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DIVXDEC, GstDivxDec))
+#define GST_DIVXDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DIVXDEC, GstDivxDec))
+#define GST_IS_DIVXDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DIVXDEC))
+#define GST_IS_DIVXDEC_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DIVXDEC))
+
+typedef struct _GstDivxDec GstDivxDec;
+typedef struct _GstDivxDecClass GstDivxDecClass;
+
+struct _GstDivxDec {
+ GstElement element;
+
+ /* pads */
+ GstPad *sinkpad, *srcpad;
+
+ /* divx handle */
+ void *handle;
+ DEC_BUFFERS bufinfo;
+
+ /* video (output) settings */
+ int csp, bpp;
+ int width, height;
+};
+
+struct _GstDivxDecClass {
+ GstElementClass parent_class;
+};
+
+GType gst_divxdec_get_type(void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_DIVXDEC_H__ */
diff --git a/ext/divx/gstdivxenc.c b/ext/divx/gstdivxenc.c
index 207d1e19..3d1c93bb 100644
--- a/ext/divx/gstdivxenc.c
+++ b/ext/divx/gstdivxenc.c
@@ -60,7 +60,7 @@ GST_PAD_TEMPLATE_FACTORY(src_template,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("divxenc_sink",
+ GST_CAPS_NEW("divxenc_src",
"video/divx",
NULL)
)
@@ -82,6 +82,7 @@ enum {
static void gst_divxenc_class_init (GstDivxEncClass *klass);
static void gst_divxenc_init (GstDivxEnc *divxenc);
+static void gst_divxenc_dispose (GObject *object);
static void gst_divxenc_chain (GstPad *pad,
GstBuffer *buf);
static GstPadLinkReturn gst_divxenc_connect (GstPad *pad,
@@ -156,6 +157,8 @@ gst_divxenc_class_init (GstDivxEncClass *klass)
gobject_class->set_property = gst_divxenc_set_property;
gobject_class->get_property = gst_divxenc_get_property;
+ gobject_class->dispose = gst_divxenc_dispose;
+
gst_divxenc_signals[FRAME_ENCODED] =
g_signal_new ("frame_encoded", G_TYPE_FROM_CLASS(klass),
G_SIGNAL_RUN_LAST,
@@ -178,9 +181,9 @@ gst_divxenc_init (GstDivxEnc *divxenc)
gst_pad_set_link_function(divxenc->sinkpad, gst_divxenc_connect);
/* create the src pad */
- divxenc->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(src_template),
- "src");
+ divxenc->srcpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(src_template),
+ "src");
gst_element_add_pad(GST_ELEMENT(divxenc), divxenc->srcpad);
/* bitrate, etc. */
@@ -240,6 +243,23 @@ gst_divxenc_setup (GstDivxEnc *divxenc)
static void
+gst_divxenc_unset (GstDivxEnc *divxenc)
+{
+ encore(divxenc->handle, ENC_OPT_RELEASE, NULL, NULL);
+ divxenc->handle = NULL;
+}
+
+
+static void
+gst_divxenc_dispose (GObject *object)
+{
+ GstDivxEnc *divxenc = GST_DIVXENC(object);
+
+ gst_divxenc_unset(divxenc);
+}
+
+
+static void
gst_divxenc_chain (GstPad *pad,
GstBuffer *buf)
{
@@ -306,16 +326,14 @@ gst_divxenc_connect (GstPad *pad,
/* if there's something old around, remove it */
if (divxenc->handle) {
- encore(divxenc->handle, ENC_OPT_RELEASE, NULL, NULL);
- divxenc->handle = NULL;
+ gst_divxenc_unset(divxenc);
}
/* we are not going to act on variable caps */
if (!GST_CAPS_IS_FIXED(vscaps))
return GST_PAD_LINK_DELAYED;
- for (caps = vscaps; caps != NULL; caps = caps->next)
- {
+ for (caps = vscaps; caps != NULL; caps = caps->next) {
int w,h,d;
guint32 fourcc;
gint divx_cs;
@@ -323,8 +341,7 @@ gst_divxenc_connect (GstPad *pad,
gst_caps_get_int(caps, "height", &h);
gst_caps_get_fourcc_int(caps, "format", &fourcc);
- switch (fourcc)
- {
+ switch (fourcc) {
case GST_MAKE_FOURCC('I','4','2','0'):
case GST_MAKE_FOURCC('I','Y','U','V'):
divx_cs = ENC_CSP_I420;
@@ -388,8 +405,7 @@ gst_divxenc_set_property (GObject *object,
g_return_if_fail (GST_IS_DIVXENC (object));
divxenc = GST_DIVXENC(object);
- switch (prop_id)
- {
+ switch (prop_id) {
case ARG_BITRATE:
divxenc->bitrate = g_value_get_ulong(value);
break;
@@ -444,7 +460,7 @@ plugin_init (GModule *module,
if (!gst_library_load("gstvideo"))
return FALSE;
- /* create an elementfactory for the v4lmjpegsrcparse element */
+ /* create an elementfactory for the element */
factory = gst_element_factory_new("divxenc", GST_TYPE_DIVXENC,
&gst_divxenc_details);
g_return_val_if_fail(factory != NULL, FALSE);
diff --git a/ext/xvid/Makefile.am b/ext/xvid/Makefile.am
index 267b1ccc..50e36859 100644
--- a/ext/xvid/Makefile.am
+++ b/ext/xvid/Makefile.am
@@ -2,9 +2,9 @@ plugindir = $(libdir)/gstreamer-@GST_MAJORMINOR@
plugin_LTLIBRARIES = libgstxvid.la
-libgstxvid_la_SOURCES = gstxvidenc.c
+libgstxvid_la_SOURCES = gstxvidenc.c gstxviddec.c gstxvid.c
libgstxvid_la_CFLAGS = $(GST_CFLAGS) $(XVID_CFLAGS)
libgstxvid_la_LIBADD = $(XVID_LIBS)
libgstxvid_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
-noinst_HEADERS = gstxvidenc.h
+noinst_HEADERS = gstxvidenc.h gstxviddec.h
diff --git a/ext/xvid/gstxvid.c b/ext/xvid/gstxvid.c
new file mode 100644
index 00000000..3683a0f6
--- /dev/null
+++ b/ext/xvid/gstxvid.c
@@ -0,0 +1,40 @@
+/* GStreamer xvid decoder plugin
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include "gstxviddec.h"
+#include "gstxvidenc.h"
+
+static gboolean
+plugin_init (GModule *module,
+ GstPlugin *plugin)
+{
+ return (gst_xviddec_plugin_init(module, plugin) &&
+ gst_xvidenc_plugin_init(module, plugin));
+}
+
+GstPluginDesc plugin_desc = {
+ GST_VERSION_MAJOR,
+ GST_VERSION_MINOR,
+ "xvid",
+ plugin_init
+};
diff --git a/ext/xvid/gstxviddec.c b/ext/xvid/gstxviddec.c
new file mode 100644
index 00000000..4e5ab26f
--- /dev/null
+++ b/ext/xvid/gstxviddec.c
@@ -0,0 +1,388 @@
+/* GStreamer xvid decoder plugin
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <string.h>
+#include "gstxviddec.h"
+#include <gst/video/video.h>
+
+/* elementfactory information */
+GstElementDetails gst_xviddec_details = {
+ "Xvid decoder",
+ "Codec/Video/Decoder",
+ "GPL",
+ "Xvid decoder based on xviddecore",
+ VERSION,
+ "Ronald Bultje <rbultje@ronald.bitfreak.net>",
+ "(C) 2003",
+};
+
+GST_PAD_TEMPLATE_FACTORY(sink_template,
+ "sink",
+ GST_PAD_SINK,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW("xviddec_sink",
+ "video/xvid",
+ NULL)
+)
+
+GST_PAD_TEMPLATE_FACTORY(src_template,
+ "src",
+ GST_PAD_SRC,
+ GST_PAD_ALWAYS,
+ GST_CAPS_NEW("xviddec_src",
+ "video/raw",
+ "format", GST_PROPS_LIST(
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('R','G','B',' ')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','4','2','0')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('I','Y','U','V')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','U','Y','2')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','Y','U')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('Y','V','1','2')),
+ GST_PROPS_FOURCC(GST_MAKE_FOURCC('U','Y','V','Y'))
+ ),
+ "width", GST_PROPS_INT_RANGE(0, G_MAXINT),
+ "height", GST_PROPS_INT_RANGE(0, G_MAXINT),
+ NULL)
+)
+
+
+/* XvidDec signals and args */
+enum {
+ /* FILL ME */
+ LAST_SIGNAL
+};
+
+enum {
+ ARG_0
+ /* FILL ME */
+};
+
+
+static void gst_xviddec_class_init (GstXvidDecClass *klass);
+static void gst_xviddec_init (GstXvidDec *xviddec);
+static void gst_xviddec_dispose (GObject *object);
+static void gst_xviddec_chain (GstPad *pad,
+ GstBuffer *buf);
+static GstPadLinkReturn gst_xviddec_connect (GstPad *pad,
+ GstCaps *vscapslist);
+
+static GstElementClass *parent_class = NULL;
+/* static guint gst_xviddec_signals[LAST_SIGNAL] = { 0 }; */
+
+
+GType
+gst_xviddec_get_type(void)
+{
+ static GType xviddec_type = 0;
+
+ if (!xviddec_type)
+ {
+ static const GTypeInfo xviddec_info = {
+ sizeof(GstXvidDecClass),
+ NULL,
+ NULL,
+ (GClassInitFunc) gst_xviddec_class_init,
+ NULL,
+ NULL,
+ sizeof(GstXvidDec),
+ 0,
+ (GInstanceInitFunc) gst_xviddec_init,
+ };
+ xviddec_type = g_type_register_static(GST_TYPE_ELEMENT,
+ "GstXvidDec",
+ &xviddec_info, 0);
+ }
+ return xviddec_type;
+}
+
+
+static void
+gst_xviddec_class_init (GstXvidDecClass *klass)
+{
+ GObjectClass *gobject_class = (GObjectClass *) klass;
+ XVID_INIT_PARAM xinit;
+
+ /* set up xvid initially (function pointers, CPU flags) */
+ memset(&xinit, 0, sizeof(xinit));
+ xinit.cpu_flags = 0;
+ xvid_init(NULL, 0, &xinit, NULL);
+ if (xinit.api_version != API_VERSION) {
+ g_error("Xvid API version mismatch! %d.%d (that's us) != %d.%d (lib)",
+ (API_VERSION >> 8) & 0xff, API_VERSION & 0xff,
+ (xinit.api_version >> 8) & 0xff, xinit.api_version & 0xff);
+ return;
+ }
+
+ parent_class = g_type_class_ref(GST_TYPE_ELEMENT);
+
+ gobject_class->dispose = gst_xviddec_dispose;
+}
+
+
+static void
+gst_xviddec_init (GstXvidDec *xviddec)
+{
+ /* create the sink pad */
+ xviddec->sinkpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(sink_template),
+ "sink");
+ gst_element_add_pad(GST_ELEMENT(xviddec), xviddec->sinkpad);
+
+ gst_pad_set_chain_function(xviddec->sinkpad, gst_xviddec_chain);
+ gst_pad_set_link_function(xviddec->sinkpad, gst_xviddec_connect);
+
+ /* create the src pad */
+ xviddec->srcpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(src_template),
+ "src");
+ gst_element_add_pad(GST_ELEMENT(xviddec), xviddec->srcpad);
+
+ /* bitrate, etc. */
+ xviddec->width = xviddec->height = xviddec->csp = -1;
+
+ /* set xvid handle to NULL */
+ xviddec->handle = NULL;
+}
+
+
+static void
+gst_xviddec_unset (GstXvidDec *xviddec)
+{
+ /* unref this instance */
+ xvid_decore(xviddec->handle, XVID_DEC_DESTROY, NULL, NULL);
+ xviddec->handle = NULL;
+}
+
+
+static gboolean
+gst_xviddec_setup (GstXvidDec *xviddec)
+{
+ XVID_DEC_PARAM xdec;
+ int ret;
+
+ /* initialise parameters, see xvid documentation */
+ memset(&xdec, 0, sizeof(XVID_DEC_PARAM));
+ xdec.width = xviddec->width;
+ xdec.height = xviddec->height;
+
+ if ((ret = xvid_decore(NULL, XVID_DEC_CREATE,
+ &xdec, NULL)) != XVID_ERR_OK) {
+ char *error;
+ switch (ret) {
+ case XVID_ERR_MEMORY:
+ error = "Memory allocation error";
+ break;
+ case XVID_ERR_FORMAT:
+ error = "Bad format";
+ break;
+ default:
+ error = "Internal failure";
+ break;
+ }
+ GST_DEBUG(GST_CAT_PLUGIN_INFO,
+ "Setting parameters %dx%d@%d failed: %s",
+ xviddec->width, xviddec->height, xviddec->csp, error);
+ return FALSE;
+ }
+
+ xviddec->handle = xdec.handle;
+
+ return TRUE;
+}
+
+
+static void
+gst_xviddec_dispose (GObject *object)
+{
+ GstXvidDec *xviddec = GST_XVIDDEC(object);
+
+ gst_xviddec_unset(xviddec);
+}
+
+
+static void
+gst_xviddec_chain (GstPad *pad,
+ GstBuffer *buf)
+{
+ GstXvidDec *xviddec;
+ GstBuffer *outbuf;
+ XVID_DEC_FRAME xframe;
+ int ret;
+
+ g_return_if_fail(pad != NULL);
+ g_return_if_fail(GST_IS_PAD(pad));
+ g_return_if_fail(buf != NULL);
+
+ xviddec = GST_XVIDDEC(GST_OBJECT_PARENT(pad));
+
+ if (!xviddec->handle) {
+ gst_element_error(GST_ELEMENT(xviddec),
+ "No format set - aborting");
+ gst_buffer_unref(buf);
+ return;
+ }
+
+ outbuf = gst_buffer_new_and_alloc(xviddec->width *
+ xviddec->height *
+ xviddec->bpp / 8);
+ GST_BUFFER_TIMESTAMP(outbuf) = GST_BUFFER_TIMESTAMP(buf);
+ GST_BUFFER_SIZE(outbuf) = xviddec->width *
+ xviddec->height *
+ xviddec->bpp / 8;
+
+ /* encode and so ... */
+ xframe.bitstream = (void *) GST_BUFFER_DATA(buf);
+ xframe.image = (void *) GST_BUFFER_DATA(outbuf);
+ xframe.length = GST_BUFFER_SIZE(buf);
+ xframe.stride = xviddec->width * xviddec->bpp / 8;
+ xframe.colorspace = xviddec->csp;
+
+ if ((ret = xvid_decore(xviddec->handle, XVID_DEC_DECODE,
+ &xframe, NULL))) {
+ gst_element_error(GST_ELEMENT(xviddec),
+ "Error decoding xvid frame: %d\n", ret);
+ gst_buffer_unref(buf);
+ return;
+ }
+
+ gst_pad_push(xviddec->srcpad, outbuf);
+ gst_buffer_unref(buf);
+}
+
+
+static GstPadLinkReturn
+gst_xviddec_connect (GstPad *pad,
+ GstCaps *vscaps)
+{
+ GstXvidDec *xviddec;
+ GstCaps *caps;
+ struct {
+ guint32 fourcc;
+ gint depth, bpp;
+ gint csp;
+ } fmt_list[] = {
+ { GST_MAKE_FOURCC('Y','U','Y','V'), 16, 16, XVID_CSP_YUY2 },
+ { GST_MAKE_FOURCC('U','Y','V','Y'), 16, 16, XVID_CSP_UYVY },
+ { GST_MAKE_FOURCC('Y','V','Y','U'), 16, 16, XVID_CSP_YVYU },
+ { GST_MAKE_FOURCC('I','4','2','0'), 12, 12, XVID_CSP_I420 },
+ { GST_MAKE_FOURCC('I','Y','U','V'), 12, 12, XVID_CSP_I420 },
+ { GST_MAKE_FOURCC('Y','V','1','2'), 12, 12, XVID_CSP_YV12 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 32, 32, XVID_CSP_RGB32 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 24, 24, XVID_CSP_RGB24 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 16, 16, XVID_CSP_RGB555 },
+ { GST_MAKE_FOURCC('R','G','B',' '), 15, 16, XVID_CSP_RGB565 },
+ { 0, 0, 0 }
+ };
+ gint i;
+
+ xviddec = GST_XVIDDEC(gst_pad_get_parent (pad));
+
+ /* if there's something old around, remove it */
+ if (xviddec->handle) {
+ gst_xviddec_unset(xviddec);
+ }
+
+ /* we are not going to act on variable caps */
+ if (!GST_CAPS_IS_FIXED(vscaps))
+ return GST_PAD_LINK_DELAYED;
+
+ /* if we get here, we know the input is xvid. we
+ * only need to bother with the output colorspace */
+ gst_caps_get_int(vscaps, "width", &xviddec->width);
+ gst_caps_get_int(vscaps, "height", &xviddec->height);
+
+ for (i = 0; fmt_list[i].fourcc != 0; i++) {
+ xviddec->csp = fmt_list[i].csp;
+
+ /* try making a caps to set on the other side */
+ if (fmt_list[i].fourcc == GST_MAKE_FOURCC('R','G','B',' ')) {
+ guint32 r_mask = 0, b_mask = 0, g_mask = 0;
+ switch (fmt_list[i].depth) {
+ case 15:
+ r_mask = 0xf800; g_mask = 0x07c0; b_mask = 0x003e;
+ break;
+ case 16:
+ r_mask = 0xf800; g_mask = 0x07e0; b_mask = 0x001f;
+ break;
+ case 24:
+ r_mask = 0xff0000; g_mask = 0x00ff00; b_mask = 0x0000ff;
+ break;
+ case 32:
+ r_mask = 0xff000000; g_mask = 0x00ff0000; b_mask = 0x0000ff00;
+ break;
+ }
+ caps = GST_CAPS_NEW("xviddec_src_pad_rgb",
+ "video/raw",
+ "width", GST_PROPS_INT(xviddec->width),
+ "height", GST_PROPS_INT(xviddec->height),
+ "format", GST_PROPS_FOURCC(fmt_list[i].fourcc),
+ "depth", GST_PROPS_INT(fmt_list[i].depth),
+ "bpp", GST_PROPS_INT(fmt_list[i].bpp),
+ "endianness", GST_PROPS_INT(G_BYTE_ORDER),
+ "red_mask", GST_PROPS_INT(r_mask),
+ "green_mask", GST_PROPS_INT(g_mask),
+ "blue_mask", GST_PROPS_INT(b_mask),
+ NULL);
+ } else {
+ caps = GST_CAPS_NEW("xviddec_src_pad_yuv",
+ "video/raw",
+ "width", GST_PROPS_INT(xviddec->width),
+ "height", GST_PROPS_INT(xviddec->height),
+ "format", GST_PROPS_FOURCC(fmt_list[i].fourcc),
+ NULL);
+ }
+
+ if (gst_pad_try_set_caps(xviddec->srcpad, caps) > 0) {
+ xviddec->csp = fmt_list[i].csp;
+ xviddec->bpp = fmt_list[i].bpp;
+ if (gst_xviddec_setup(xviddec))
+ return GST_PAD_LINK_OK;
+ }
+ }
+
+ /* if we got here - it's not good */
+ return GST_PAD_LINK_REFUSED;
+}
+
+
+gboolean
+gst_xviddec_plugin_init (GModule *module,
+ GstPlugin *plugin)
+{
+ GstElementFactory *factory;
+
+ /* create an elementfactory for the v4lmjpegsrcparse element */
+ factory = gst_element_factory_new("xviddec", GST_TYPE_XVIDDEC,
+ &gst_xviddec_details);
+ g_return_val_if_fail(factory != NULL, FALSE);
+
+ /* add pad templates */
+ gst_element_factory_add_pad_template(factory,
+ GST_PAD_TEMPLATE_GET(sink_template));
+ gst_element_factory_add_pad_template(factory,
+ GST_PAD_TEMPLATE_GET(src_template));
+
+ gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
+
+ return TRUE;
+}
diff --git a/ext/xvid/gstxviddec.h b/ext/xvid/gstxviddec.h
new file mode 100644
index 00000000..848ad261
--- /dev/null
+++ b/ext/xvid/gstxviddec.h
@@ -0,0 +1,72 @@
+/* GStreamer xvid decoder plugin
+ * Copyright (C) 2003 Ronald Bultje <rbultje@ronald.bitfreak.net>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Library General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Library General Public License for more details.
+ *
+ * You should have received a copy of the GNU Library General Public
+ * License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+#ifndef __GST_XVIDDEC_H__
+#define __GST_XVIDDEC_H__
+
+#include <gst/gst.h>
+#include <xvid.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+
+
+#define GST_TYPE_XVIDDEC \
+ (gst_xviddec_get_type())
+#define GST_XVIDDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_XVIDDEC, GstXvidDec))
+#define GST_XVIDDEC_CLASS(klass) \
+ (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_XVIDDEC, GstXvidDec))
+#define GST_IS_XVIDDEC(obj) \
+ (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_XVIDDEC))
+#define GST_IS_XVIDDEC_CLASS(obj) \
+ (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_XVIDDEC))
+
+typedef struct _GstXvidDec GstXvidDec;
+typedef struct _GstXvidDecClass GstXvidDecClass;
+
+struct _GstXvidDec {
+ GstElement element;
+
+ /* pads */
+ GstPad *sinkpad, *srcpad;
+
+ /* xvid handle */
+ void *handle;
+
+ /* video (output) settings */
+ int csp, bpp;
+ int width, height;
+};
+
+struct _GstXvidDecClass {
+ GstElementClass parent_class;
+};
+
+GType gst_xviddec_get_type(void);
+
+gboolean gst_xviddec_plugin_init (GModule *module,
+ GstPlugin *plugin);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* __GST_XVIDDEC_H__ */
diff --git a/ext/xvid/gstxvidenc.c b/ext/xvid/gstxvidenc.c
index e916bda1..7efe42f9 100644
--- a/ext/xvid/gstxvidenc.c
+++ b/ext/xvid/gstxvidenc.c
@@ -61,7 +61,7 @@ GST_PAD_TEMPLATE_FACTORY(src_template,
"src",
GST_PAD_SRC,
GST_PAD_ALWAYS,
- GST_CAPS_NEW("xvidenc_sink",
+ GST_CAPS_NEW("xvidenc_src",
"video/xvid",
NULL)
)
@@ -191,9 +191,9 @@ gst_xvidenc_init (GstXvidEnc *xvidenc)
gst_pad_set_link_function(xvidenc->sinkpad, gst_xvidenc_connect);
/* create the src pad */
- xvidenc->sinkpad = gst_pad_new_from_template(
- GST_PAD_TEMPLATE_GET(src_template),
- "src");
+ xvidenc->srcpad = gst_pad_new_from_template(
+ GST_PAD_TEMPLATE_GET(src_template),
+ "src");
gst_element_add_pad(GST_ELEMENT(xvidenc), xvidenc->srcpad);
/* bitrate, etc. */
@@ -460,9 +460,9 @@ gst_xvidenc_get_property (GObject *object,
}
-static gboolean
-plugin_init (GModule *module,
- GstPlugin *plugin)
+gboolean
+gst_xvidenc_plugin_init (GModule *module,
+ GstPlugin *plugin)
{
GstElementFactory *factory;
@@ -484,11 +484,3 @@ plugin_init (GModule *module,
return TRUE;
}
-
-
-GstPluginDesc plugin_desc = {
- GST_VERSION_MAJOR,
- GST_VERSION_MINOR,
- "xvidenc",
- plugin_init
-};
diff --git a/ext/xvid/gstxvidenc.h b/ext/xvid/gstxvidenc.h
index 24cf6a2a..198cadf3 100644
--- a/ext/xvid/gstxvidenc.h
+++ b/ext/xvid/gstxvidenc.h
@@ -71,6 +71,9 @@ struct _GstXvidEncClass {
GType gst_xvidenc_get_type(void);
+gboolean gst_xvidenc_plugin_init (GModule *module,
+ GstPlugin *plugin);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */