mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
divx: remove plugin that the world doesn't need any more
2002 called.
This commit is contained in:
parent
5ae01f10fd
commit
748d9f69ad
12 changed files with 0 additions and 1448 deletions
|
@ -120,7 +120,6 @@ mngdec/mngenc libmng (http://gjuyn.xs4all.nl/libmng)
|
||||||
- license PNG license
|
- license PNG license
|
||||||
|
|
||||||
Plugins using non-free libraries:
|
Plugins using non-free libraries:
|
||||||
divxdec, divxenc (http://www.divx.com/)
|
|
||||||
osxaudio (http://www.apple.com/macosx/)
|
osxaudio (http://www.apple.com/macosx/)
|
||||||
sunaudiosink (http://www.sun.com/)
|
sunaudiosink (http://www.sun.com/)
|
||||||
|
|
||||||
|
|
|
@ -49,8 +49,6 @@ swfdec (for the swfdec (flash) plugin)
|
||||||
http://www.schleef.org/swfdec/
|
http://www.schleef.org/swfdec/
|
||||||
dtsdec (for DTS audio decoding)
|
dtsdec (for DTS audio decoding)
|
||||||
http://www.videolan.org/libdca.html
|
http://www.videolan.org/libdca.html
|
||||||
divx (for divx decoding)
|
|
||||||
http://www.divx.com/divx/linux/
|
|
||||||
musepack (for musepack audio codec/format)
|
musepack (for musepack audio codec/format)
|
||||||
(http://www.musepack.net/)
|
(http://www.musepack.net/)
|
||||||
nas (for the NAS sound server sink)
|
nas (for the NAS sound server sink)
|
||||||
|
|
69
configure.ac
69
configure.ac
|
@ -902,73 +902,6 @@ AG_GST_CHECK_FEATURE(DTS, [dts library], dtsdec, [
|
||||||
AC_SUBST(DTS_LIBS)
|
AC_SUBST(DTS_LIBS)
|
||||||
])
|
])
|
||||||
|
|
||||||
dnl *** DIVX ***
|
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_DIVX, true)
|
|
||||||
AG_GST_CHECK_FEATURE(DIVX, [divx plugins], divx, [
|
|
||||||
HAVE_DIVX=yes
|
|
||||||
AC_CHECK_HEADER(encore2.h, , [
|
|
||||||
AC_MSG_WARN([Divx4linux encore headers not found])
|
|
||||||
HAVE_DIVX=no
|
|
||||||
])
|
|
||||||
if [ test x$HAVE_DIVX = xyes ]; then
|
|
||||||
AC_MSG_CHECKING([Checking for valid divx4linux encore version])
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <encore2.h>
|
|
||||||
#if ENCORE_VERSION != 20021024
|
|
||||||
#error Wrong version of divx encore libraries
|
|
||||||
#endif
|
|
||||||
], [
|
|
||||||
return 0;
|
|
||||||
], [
|
|
||||||
HAVE_DIVX=yes
|
|
||||||
], [
|
|
||||||
HAVE_DIVX=no
|
|
||||||
AC_MSG_WARN([Wrong version of divx4linux installed])
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
if [ test x$HAVE_DIVX = xyes ]; then
|
|
||||||
AC_CHECK_HEADER(decore.h, , [
|
|
||||||
AC_MSG_WARN([Divx4linux decoder headers not found])
|
|
||||||
HAVE_DIVX=no
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
if [ test x$HAVE_DIVX = xyes ]; then
|
|
||||||
AC_MSG_CHECKING([Checking for valid divx4linux decore version])
|
|
||||||
AC_TRY_COMPILE([
|
|
||||||
#include <decore.h>
|
|
||||||
#if DECORE_VERSION != 20021112
|
|
||||||
#error Wrong version of divx decore libraries
|
|
||||||
#endif
|
|
||||||
], [
|
|
||||||
return 0;
|
|
||||||
], [
|
|
||||||
HAVE_DIVX=yes
|
|
||||||
], [
|
|
||||||
HAVE_DIVX=no
|
|
||||||
AC_MSG_WARN([Wrong version of divx4linux installed])
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
LIBS="$LIBM"
|
|
||||||
if test x$HAVE_DIVX = xyes; then
|
|
||||||
AC_CHECK_LIB(divxencore, encore, , [
|
|
||||||
AC_MSG_WARN([Divx4linux encore libs not found])
|
|
||||||
HAVE_DIVX=no
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
if test x$HAVE_DIVX = xyes; then
|
|
||||||
AC_CHECK_LIB(divxdecore, decore, , [
|
|
||||||
AC_MSG_WARN([Divx4linux decore libs not found])
|
|
||||||
HAVE_DIVX=no
|
|
||||||
])
|
|
||||||
fi
|
|
||||||
if test x$HAVE_DIVX = xyes; then
|
|
||||||
DIVXENC_LIBS="-ldivxencore $LIBM"
|
|
||||||
DIVXDEC_LIBS="-ldivxdecore $LIBM"
|
|
||||||
AC_SUBST(DIVXENC_LIBS)
|
|
||||||
AC_SUBST(DIVXDEC_LIBS)
|
|
||||||
fi
|
|
||||||
])
|
|
||||||
|
|
||||||
dnl *** resindvd ***
|
dnl *** resindvd ***
|
||||||
translit(dnm, m, l) AM_CONDITIONAL(USE_RESINDVD, true)
|
translit(dnm, m, l) AM_CONDITIONAL(USE_RESINDVD, true)
|
||||||
AG_GST_CHECK_FEATURE(RESINDVD, [resindvd plugin], resindvd, [
|
AG_GST_CHECK_FEATURE(RESINDVD, [resindvd plugin], resindvd, [
|
||||||
|
@ -1877,7 +1810,6 @@ AM_CONDITIONAL(USE_DIRECTFB, false)
|
||||||
AM_CONDITIONAL(USE_WAYLAND, false)
|
AM_CONDITIONAL(USE_WAYLAND, false)
|
||||||
AM_CONDITIONAL(USE_DIRAC, false)
|
AM_CONDITIONAL(USE_DIRAC, false)
|
||||||
AM_CONDITIONAL(USE_DTS, false)
|
AM_CONDITIONAL(USE_DTS, false)
|
||||||
AM_CONDITIONAL(USE_DIVX, false)
|
|
||||||
AM_CONDITIONAL(USE_EXIF, false)
|
AM_CONDITIONAL(USE_EXIF, false)
|
||||||
AM_CONDITIONAL(USE_RESINDVD, false)
|
AM_CONDITIONAL(USE_RESINDVD, false)
|
||||||
AM_CONDITIONAL(USE_FAAC, false)
|
AM_CONDITIONAL(USE_FAAC, false)
|
||||||
|
@ -2136,7 +2068,6 @@ ext/dc1394/Makefile
|
||||||
ext/dirac/Makefile
|
ext/dirac/Makefile
|
||||||
ext/directfb/Makefile
|
ext/directfb/Makefile
|
||||||
ext/wayland/Makefile
|
ext/wayland/Makefile
|
||||||
ext/divx/Makefile
|
|
||||||
ext/dts/Makefile
|
ext/dts/Makefile
|
||||||
ext/faac/Makefile
|
ext/faac/Makefile
|
||||||
ext/faad/Makefile
|
ext/faad/Makefile
|
||||||
|
|
|
@ -40,13 +40,6 @@ gint64 arg2
|
||||||
gint64 arg3
|
gint64 arg3
|
||||||
</SIGNAL>
|
</SIGNAL>
|
||||||
|
|
||||||
<SIGNAL>
|
|
||||||
<NAME>GstDivxEnc::frame-encoded</NAME>
|
|
||||||
<RETURNS>void</RETURNS>
|
|
||||||
<FLAGS>l</FLAGS>
|
|
||||||
GstDivxEnc *gstdivxenc
|
|
||||||
</SIGNAL>
|
|
||||||
|
|
||||||
<SIGNAL>
|
<SIGNAL>
|
||||||
<NAME>GstDCCPClientSrc::connected</NAME>
|
<NAME>GstDCCPClientSrc::connected</NAME>
|
||||||
<RETURNS>void</RETURNS>
|
<RETURNS>void</RETURNS>
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
<plugin>
|
|
||||||
<name>divxdec</name>
|
|
||||||
<description>DivX decoder</description>
|
|
||||||
<filename>../../ext/divx/.libs/libgstdivxdec.so</filename>
|
|
||||||
<basename>libgstdivxdec.so</basename>
|
|
||||||
<version>5.03</version>
|
|
||||||
<license>unknown</license>
|
|
||||||
<source>gst-plugins-bad</source>
|
|
||||||
<package>divx4linux</package>
|
|
||||||
<origin>http://www.divx.com/</origin>
|
|
||||||
<elements>
|
|
||||||
<element>
|
|
||||||
<name>divxdec</name>
|
|
||||||
<longname>Divx4linux video decoder</longname>
|
|
||||||
<class>Codec/Decoder/Video</class>
|
|
||||||
<description>Divx decoder based on divxdecore</description>
|
|
||||||
<author>Ronald Bultje <rbultje@ronald.bitfreak.net></author>
|
|
||||||
<pads>
|
|
||||||
<caps>
|
|
||||||
<name>sink</name>
|
|
||||||
<direction>sink</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>video/x-divx, divxversion=(int)[ 3, 5 ], width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
|
|
||||||
</caps>
|
|
||||||
<caps>
|
|
||||||
<name>src</name>
|
|
||||||
<direction>source</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>video/x-raw-yuv, format=(fourcc){ I420, YUY2, YV12, UYVY }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
|
|
||||||
</caps>
|
|
||||||
</pads>
|
|
||||||
</element>
|
|
||||||
</elements>
|
|
||||||
</plugin>
|
|
|
@ -1,34 +0,0 @@
|
||||||
<plugin>
|
|
||||||
<name>divxenc</name>
|
|
||||||
<description>DivX encoder</description>
|
|
||||||
<filename>../../ext/divx/.libs/libgstdivxenc.so</filename>
|
|
||||||
<basename>libgstdivxenc.so</basename>
|
|
||||||
<version>5.03</version>
|
|
||||||
<license>unknown</license>
|
|
||||||
<source>gst-plugins-bad</source>
|
|
||||||
<package>divx4linux</package>
|
|
||||||
<origin>http://www.divx.com/</origin>
|
|
||||||
<elements>
|
|
||||||
<element>
|
|
||||||
<name>divxenc</name>
|
|
||||||
<longname>Divx4linux video encoder</longname>
|
|
||||||
<class>Codec/Encoder/Video</class>
|
|
||||||
<description>Divx encoder based on divxencore</description>
|
|
||||||
<author>Ronald Bultje <rbultje@ronald.bitfreak.net></author>
|
|
||||||
<pads>
|
|
||||||
<caps>
|
|
||||||
<name>sink</name>
|
|
||||||
<direction>sink</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>video/x-raw-yuv, format=(fourcc){ I420, YUY2, YV12, YVYU, UYVY }, width=(int)[ 1, 2147483647 ], height=(int)[ 1, 2147483647 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
|
|
||||||
</caps>
|
|
||||||
<caps>
|
|
||||||
<name>src</name>
|
|
||||||
<direction>source</direction>
|
|
||||||
<presence>always</presence>
|
|
||||||
<details>video/x-divx, divxversion=(int)5, width=(int)[ 16, 4096 ], height=(int)[ 16, 4096 ], framerate=(fraction)[ 0/1, 2147483647/1 ]</details>
|
|
||||||
</caps>
|
|
||||||
</pads>
|
|
||||||
</element>
|
|
||||||
</elements>
|
|
||||||
</plugin>
|
|
|
@ -100,12 +100,6 @@ else
|
||||||
WAYLAND_DIR=
|
WAYLAND_DIR=
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if USE_DIVX
|
|
||||||
DIVX_DIR=divx
|
|
||||||
else
|
|
||||||
DIVX_DIR=
|
|
||||||
endif
|
|
||||||
|
|
||||||
if USE_DTS
|
if USE_DTS
|
||||||
DTS_DIR=dts
|
DTS_DIR=dts
|
||||||
else
|
else
|
||||||
|
@ -422,7 +416,6 @@ SUBDIRS=\
|
||||||
$(DIRAC_DIR) \
|
$(DIRAC_DIR) \
|
||||||
$(DIRECTFB_DIR) \
|
$(DIRECTFB_DIR) \
|
||||||
$(WAYLAND_DIR) \
|
$(WAYLAND_DIR) \
|
||||||
$(DIVX_DIR) \
|
|
||||||
$(DTS_DIR) \
|
$(DTS_DIR) \
|
||||||
$(RESINDVD_DIR) \
|
$(RESINDVD_DIR) \
|
||||||
$(FAAC_DIR) \
|
$(FAAC_DIR) \
|
||||||
|
@ -495,7 +488,6 @@ DIST_SUBDIRS = \
|
||||||
libmms \
|
libmms \
|
||||||
lv2 \
|
lv2 \
|
||||||
dts \
|
dts \
|
||||||
divx \
|
|
||||||
modplug \
|
modplug \
|
||||||
mimic \
|
mimic \
|
||||||
mpeg2enc \
|
mpeg2enc \
|
||||||
|
|
|
@ -1,15 +0,0 @@
|
||||||
plugin_LTLIBRARIES = libgstdivxdec.la libgstdivxenc.la
|
|
||||||
|
|
||||||
AM_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) $(DIVX_CFLAGS)
|
|
||||||
|
|
||||||
libgstdivxenc_la_SOURCES = gstdivxenc.c
|
|
||||||
libgstdivxenc_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(DIVXENC_LIBS)
|
|
||||||
libgstdivxenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|
||||||
libgstdivxenc_la_LIBTOOLFLAGS = --tag=disable-static
|
|
||||||
|
|
||||||
libgstdivxdec_la_SOURCES = gstdivxdec.c
|
|
||||||
libgstdivxdec_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) $(DIVXDEC_LIBS)
|
|
||||||
libgstdivxdec_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
|
||||||
libgstdivxdec_la_LIBTOOLFLAGS = --tag=disable-static
|
|
||||||
|
|
||||||
noinst_HEADERS = gstdivxenc.h gstdivxdec.h
|
|
|
@ -1,577 +0,0 @@
|
||||||
/* 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>
|
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("video/x-divx, "
|
|
||||||
"divxversion = (int) [ 3, 5 ], "
|
|
||||||
"width = (int) [ 16, 4096 ], "
|
|
||||||
"height = (int) [ 16, 4096 ], " "framerate = (fraction) [0/1, MAX]")
|
|
||||||
);
|
|
||||||
|
|
||||||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, UYVY }")
|
|
||||||
/* FIXME: 15/16/24/32bpp RGB */
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/* DivxDec signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
/* FILL ME */
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0
|
|
||||||
/* FILL ME */
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void gst_divxdec_base_init (GstDivxDecClass * klass);
|
|
||||||
static void gst_divxdec_class_init (GstDivxDecClass * klass);
|
|
||||||
static void gst_divxdec_init (GstDivxDec * divxdec);
|
|
||||||
static void gst_divxdec_dispose (GObject * object);
|
|
||||||
static GstFlowReturn gst_divxdec_chain (GstPad * pad, GstBuffer * buf);
|
|
||||||
static gboolean gst_divxdec_connect (GstPad * pad, GstCaps * vscapslist);
|
|
||||||
static gboolean gst_divxdec_negotiate (GstDivxDec * divxdec);
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_divxdec_change_state (GstElement * element, GstStateChange transition);
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
|
|
||||||
/* static guint gst_divxdec_signals[LAST_SIGNAL] = { 0 }; */
|
|
||||||
|
|
||||||
|
|
||||||
static const gchar *
|
|
||||||
gst_divxdec_error (int errorcode)
|
|
||||||
{
|
|
||||||
const gchar *error;
|
|
||||||
|
|
||||||
switch (errorcode) {
|
|
||||||
case DEC_OK:
|
|
||||||
error = "No error";
|
|
||||||
break;
|
|
||||||
case DEC_MEMORY:
|
|
||||||
error = "Invalid memory";
|
|
||||||
break;
|
|
||||||
case DEC_BAD_FORMAT:
|
|
||||||
error = "Invalid format";
|
|
||||||
break;
|
|
||||||
case DEC_INVALID_ARGUMENT:
|
|
||||||
error = "Invalid argument";
|
|
||||||
break;
|
|
||||||
case DEC_NOT_IMPLEMENTED:
|
|
||||||
error = "Not implemented";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
error = "Unknown error";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_divxdec_get_type (void)
|
|
||||||
{
|
|
||||||
static GType divxdec_type = 0;
|
|
||||||
|
|
||||||
if (!divxdec_type) {
|
|
||||||
static const GTypeInfo divxdec_info = {
|
|
||||||
sizeof (GstDivxDecClass),
|
|
||||||
(GBaseInitFunc) gst_divxdec_base_init,
|
|
||||||
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_base_init (GstDivxDecClass * klass)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&sink_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&src_template));
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"Divx4linux video decoder", "Codec/Decoder/Video",
|
|
||||||
"Divx decoder based on divxdecore",
|
|
||||||
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxdec_class_init (GstDivxDecClass * klass)
|
|
||||||
{
|
|
||||||
GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
gstelement_class->change_state = gst_divxdec_change_state;
|
|
||||||
gobject_class->dispose = gst_divxdec_dispose;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxdec_init (GstDivxDec * divxdec)
|
|
||||||
{
|
|
||||||
/* create the sink pad */
|
|
||||||
divxdec->sinkpad = gst_pad_new_from_static_template (&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_setcaps_function (divxdec->sinkpad, gst_divxdec_connect);
|
|
||||||
|
|
||||||
/* create the src pad */
|
|
||||||
divxdec->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (divxdec), divxdec->srcpad);
|
|
||||||
gst_pad_use_fixed_caps (divxdec->srcpad);
|
|
||||||
|
|
||||||
/* bitrate, etc. */
|
|
||||||
divxdec->width = divxdec->height = divxdec->csp = divxdec->bitcnt = -1;
|
|
||||||
divxdec->version = 0;
|
|
||||||
|
|
||||||
/* set divx handle to NULL */
|
|
||||||
divxdec->handle = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxdec_unset (GstDivxDec * divxdec)
|
|
||||||
{
|
|
||||||
if (divxdec->handle) {
|
|
||||||
/* unref this instance */
|
|
||||||
decore (divxdec->handle, DEC_OPT_RELEASE, NULL, NULL);
|
|
||||||
divxdec->handle = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_divxdec_setup (GstDivxDec * divxdec)
|
|
||||||
{
|
|
||||||
void *handle;
|
|
||||||
DEC_INIT xinit;
|
|
||||||
DivXBitmapInfoHeader output;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* initialize the handle */
|
|
||||||
memset (&xinit, 0, sizeof (DEC_INIT));
|
|
||||||
xinit.smooth_playback = 0;
|
|
||||||
switch (divxdec->version) {
|
|
||||||
case 3:
|
|
||||||
xinit.codec_version = 311;
|
|
||||||
break;
|
|
||||||
case 4:
|
|
||||||
xinit.codec_version = 400;
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
xinit.codec_version = 500;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
xinit.codec_version = 0;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if ((ret = decore (&handle, DEC_OPT_INIT, &xinit, NULL)) != 0) {
|
|
||||||
GST_ELEMENT_ERROR (divxdec, LIBRARY, INIT, (NULL),
|
|
||||||
("divx library error: %s (%d)", gst_divxdec_error (ret), ret));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* we've got a handle now */
|
|
||||||
divxdec->handle = handle;
|
|
||||||
|
|
||||||
/* initialise parameters, see divx documentation */
|
|
||||||
memset (&output, 0, sizeof (DivXBitmapInfoHeader));
|
|
||||||
output.biSize = sizeof (DivXBitmapInfoHeader);
|
|
||||||
output.biWidth = divxdec->width;
|
|
||||||
output.biHeight = divxdec->height;
|
|
||||||
output.biBitCount = divxdec->bitcnt;
|
|
||||||
output.biCompression = divxdec->csp;
|
|
||||||
|
|
||||||
if ((ret = decore (divxdec->handle, DEC_OPT_SETOUT, &output, NULL)) != 0) {
|
|
||||||
GST_ELEMENT_ERROR (divxdec, LIBRARY, SETTINGS, (NULL),
|
|
||||||
("error setting output: %s (%d)", gst_divxdec_error (ret), ret));
|
|
||||||
gst_divxdec_unset (divxdec);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxdec_dispose (GObject * object)
|
|
||||||
{
|
|
||||||
GstDivxDec *divxdec = GST_DIVXDEC (object);
|
|
||||||
|
|
||||||
gst_divxdec_unset (divxdec);
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_divxdec_chain (GstPad * pad, GstBuffer * buf)
|
|
||||||
{
|
|
||||||
GstDivxDec *divxdec;
|
|
||||||
GstBuffer *outbuf;
|
|
||||||
DEC_FRAME xframe;
|
|
||||||
int res;
|
|
||||||
GstFlowReturn ret;
|
|
||||||
|
|
||||||
divxdec = GST_DIVXDEC (gst_pad_get_parent (pad));
|
|
||||||
if (!divxdec->handle) {
|
|
||||||
if (gst_divxdec_negotiate (divxdec) <= 0) {
|
|
||||||
goto not_negotiated;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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 = 0;
|
|
||||||
xframe.render_flag = 1;
|
|
||||||
|
|
||||||
if ((res = decore (divxdec->handle, DEC_OPT_FRAME, &xframe, NULL))) {
|
|
||||||
goto not_decoding;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (divxdec->srcpad));
|
|
||||||
ret = gst_pad_push (divxdec->srcpad, outbuf);
|
|
||||||
goto cleanup;
|
|
||||||
|
|
||||||
not_negotiated:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (divxdec, CORE, TOO_LAZY, (NULL),
|
|
||||||
("No format set - aborting"));
|
|
||||||
ret = GST_FLOW_NOT_NEGOTIATED;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
not_decoding:
|
|
||||||
{
|
|
||||||
GST_ELEMENT_ERROR (divxdec, STREAM, DECODE, (NULL),
|
|
||||||
("Error decoding divx frame: %s (%d)", gst_divxdec_error (res), res));
|
|
||||||
gst_buffer_unref (outbuf);
|
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
cleanup:
|
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
gst_object_unref (divxdec);
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* FIXME: moved all the bits out here that are broken so the syntax
|
|
||||||
* stays clear */
|
|
||||||
|
|
||||||
/*
|
|
||||||
{
|
|
||||||
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 32, 32,
|
|
||||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
|
||||||
GST_MAKE_FOURCC ('A', 'B', 'G', 'R'), 32}
|
|
||||||
|
|
||||||
,
|
|
||||||
#else
|
|
||||||
0, 32}
|
|
||||||
|
|
||||||
,
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 24, 24,
|
|
||||||
#if (G_BYTE_ORDER == G_BIG_ENDIAN)
|
|
||||||
GST_MAKE_FOURCC ('A', 'B', 'G', 'R'), 24}
|
|
||||||
|
|
||||||
,
|
|
||||||
#else
|
|
||||||
0, 24}
|
|
||||||
|
|
||||||
,
|
|
||||||
#endif
|
|
||||||
{
|
|
||||||
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 16, 16, 3, 16}
|
|
||||||
|
|
||||||
, {
|
|
||||||
GST_MAKE_FOURCC ('R', 'G', 'B', ' '), 15, 16, 0, 16}
|
|
||||||
|
|
||||||
,
|
|
||||||
#endif
|
|
||||||
if (fmt_list[i].fourcc == GST_MAKE_FOURCC ('R', 'G', 'B', ' ')) {
|
|
||||||
guint32 r_mask = 0, b_mask = 0, g_mask = 0;
|
|
||||||
gint endianness = 0;
|
|
||||||
|
|
||||||
switch (fmt_list[i].depth) {
|
|
||||||
case 15:
|
|
||||||
endianness = G_BYTE_ORDER;
|
|
||||||
r_mask = 0xf800;
|
|
||||||
g_mask = 0x07c0;
|
|
||||||
b_mask = 0x003e;
|
|
||||||
break;
|
|
||||||
case 16:
|
|
||||||
endianness = G_BYTE_ORDER;
|
|
||||||
r_mask = 0xf800;
|
|
||||||
g_mask = 0x07e0;
|
|
||||||
b_mask = 0x001f;
|
|
||||||
break;
|
|
||||||
case 24:
|
|
||||||
endianness = G_BIG_ENDIAN;
|
|
||||||
r_mask = GST_VIDEO_BYTE1_MASK_24_INT;
|
|
||||||
g_mask = GST_VIDEO_BYTE2_MASK_24_INT;
|
|
||||||
b_mask = GST_VIDEO_BYTE3_MASK_24_INT break;
|
|
||||||
case 32:
|
|
||||||
endianness = G_BIG_ENDIAN;
|
|
||||||
r_mask = GST_VIDEO_BYTE1_MASK_32_INT;
|
|
||||||
g_mask = GST_VIDEO_BYTE2_MASK_32_INT;
|
|
||||||
b_mask = GST_VIDEO_BYTE3_MASK_32_INT break;
|
|
||||||
}
|
|
||||||
caps = GST_CAPS_NEW ("divxdec_src_pad_rgb",
|
|
||||||
"video/x-raw-rgb",
|
|
||||||
"width", GST_PROPS_INT (divxdec->width),
|
|
||||||
"height", GST_PROPS_INT (divxdec->height),
|
|
||||||
"framerate", GST_PROPS_FLOAT (divxdec->fps),
|
|
||||||
"depth", GST_PROPS_INT (fmt_list[i].depth),
|
|
||||||
"bpp", GST_PROPS_INT (fmt_list[i].bpp),
|
|
||||||
"endianness", GST_PROPS_INT (endianness),
|
|
||||||
"red_mask", GST_PROPS_INT (r_mask),
|
|
||||||
"green_mask", GST_PROPS_INT (g_mask),
|
|
||||||
"blue_mask", GST_PROPS_INT (b_mask));
|
|
||||||
} else {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
||||||
*/
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_divxdec_negotiate (GstDivxDec * divxdec)
|
|
||||||
{
|
|
||||||
GstCaps *caps = NULL;
|
|
||||||
gint i;
|
|
||||||
gint par_num, par_den;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
struct
|
|
||||||
{
|
|
||||||
guint32 fourcc;
|
|
||||||
gint depth, bpp;
|
|
||||||
guint32 csp;
|
|
||||||
gint bitcnt;
|
|
||||||
}
|
|
||||||
|
|
||||||
fmt_list[] = {
|
|
||||||
{
|
|
||||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 16, 16,
|
|
||||||
GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'), 0}
|
|
||||||
, {
|
|
||||||
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 16, 16,
|
|
||||||
GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'), 0}
|
|
||||||
, {
|
|
||||||
GST_MAKE_FOURCC ('I', '4', '2', '0'), 12, 12,
|
|
||||||
GST_MAKE_FOURCC ('I', '4', '2', '0'), 0}
|
|
||||||
, {
|
|
||||||
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 12, 12,
|
|
||||||
GST_MAKE_FOURCC ('Y', 'V', '1', '2'), 0}
|
|
||||||
, {
|
|
||||||
0, 0, 0, 0, 0}
|
|
||||||
};
|
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (divxdec, "fps %d/%d, PAR %d/%d",
|
|
||||||
divxdec->fps_n, divxdec->fps_d, divxdec->par_n, divxdec->par_d);
|
|
||||||
|
|
||||||
/* calculate par
|
|
||||||
* the info.aspect_* values reflect PAR;
|
|
||||||
* 0:0 is allowed and can be interpreted as 1:1, so correct for it */
|
|
||||||
par_num = divxdec->par_n;
|
|
||||||
par_den = divxdec->par_d;
|
|
||||||
if (par_num == 0 && par_den == 0) {
|
|
||||||
par_num = par_den = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; fmt_list[i].fourcc != 0; i++) {
|
|
||||||
divxdec->csp = fmt_list[i].csp;
|
|
||||||
|
|
||||||
caps = gst_caps_new_simple ("video/x-raw-yuv",
|
|
||||||
"width", G_TYPE_INT, divxdec->width,
|
|
||||||
"height", G_TYPE_INT, divxdec->height,
|
|
||||||
"framerate", GST_TYPE_FRACTION, divxdec->fps_n, divxdec->fps_d,
|
|
||||||
"pixel-aspect-ratio", GST_TYPE_FRACTION, par_num, par_den,
|
|
||||||
"format", GST_TYPE_FOURCC, fmt_list[i].fourcc, NULL);
|
|
||||||
|
|
||||||
if (caps) {
|
|
||||||
|
|
||||||
if (gst_divxdec_setup (divxdec) &&
|
|
||||||
gst_pad_set_caps (divxdec->srcpad, caps)) {
|
|
||||||
divxdec->csp = fmt_list[i].csp;
|
|
||||||
divxdec->bpp = fmt_list[i].bpp;
|
|
||||||
divxdec->bitcnt = fmt_list[i].bitcnt;
|
|
||||||
ret = TRUE;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
caps = NULL;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we got here - it's not good */
|
|
||||||
|
|
||||||
done:
|
|
||||||
|
|
||||||
if (caps) {
|
|
||||||
gst_caps_unref (caps);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_divxdec_connect (GstPad * pad, GstCaps * caps)
|
|
||||||
{
|
|
||||||
GstDivxDec *divxdec;
|
|
||||||
const GValue *par;
|
|
||||||
const GValue *fps;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
|
||||||
|
|
||||||
divxdec = GST_DIVXDEC (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
/* if there's something old around, remove it */
|
|
||||||
if (divxdec->handle) {
|
|
||||||
gst_divxdec_unset (divxdec);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we get here, we know the input is divx. we
|
|
||||||
* only need to bother with the output colorspace */
|
|
||||||
gst_structure_get_int (structure, "width", &divxdec->width);
|
|
||||||
gst_structure_get_int (structure, "height", &divxdec->height);
|
|
||||||
gst_structure_get_int (structure, "divxversion", &divxdec->version);
|
|
||||||
|
|
||||||
/* get pixel aspect ratio if it's set */
|
|
||||||
par = gst_structure_get_value (structure, "pixel-aspect-ratio");
|
|
||||||
if (par) {
|
|
||||||
divxdec->par_n = gst_value_get_fraction_numerator (par),
|
|
||||||
divxdec->par_d = gst_value_get_fraction_denominator (par);
|
|
||||||
}
|
|
||||||
|
|
||||||
fps = gst_structure_get_value (structure, "framerate");
|
|
||||||
if (fps != NULL) {
|
|
||||||
divxdec->fps_n = gst_value_get_fraction_numerator (fps);
|
|
||||||
divxdec->fps_d = gst_value_get_fraction_denominator (fps);
|
|
||||||
} else {
|
|
||||||
divxdec->fps_n = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = gst_divxdec_negotiate (divxdec);
|
|
||||||
gst_object_unref (divxdec);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
static GstStateChangeReturn
|
|
||||||
gst_divxdec_change_state (GstElement * element, GstStateChange transition)
|
|
||||||
{
|
|
||||||
GstStateChangeReturn ret;
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
case GST_STATE_CHANGE_NULL_TO_READY:
|
|
||||||
break;
|
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_PLAYING:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = parent_class->change_state (element, transition);
|
|
||||||
|
|
||||||
switch (transition) {
|
|
||||||
case GST_STATE_CHANGE_PLAYING_TO_PAUSED:
|
|
||||||
break;
|
|
||||||
case GST_STATE_CHANGE_PAUSED_TO_READY:
|
|
||||||
break;
|
|
||||||
case GST_STATE_CHANGE_READY_TO_NULL:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
int lib_version;
|
|
||||||
|
|
||||||
lib_version = decore (NULL, DEC_OPT_VERSION, 0, 0);
|
|
||||||
if (lib_version != DECORE_VERSION) {
|
|
||||||
g_warning ("Version mismatch! This plugin was compiled for "
|
|
||||||
"DivX version %d, while your library has version %d!",
|
|
||||||
DECORE_VERSION, lib_version);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
return gst_element_register (plugin, "divxdec",
|
|
||||||
GST_RANK_SECONDARY, GST_TYPE_DIVXDEC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
divxdec,
|
|
||||||
"DivX decoder",
|
|
||||||
plugin_init,
|
|
||||||
"5.03", GST_LICENSE_UNKNOWN, "divx4linux", "http://www.divx.com/");
|
|
|
@ -1,74 +0,0 @@
|
||||||
/* 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, GstDivxDecClass))
|
|
||||||
#define GST_IS_DIVXDEC(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DIVXDEC))
|
|
||||||
#define GST_IS_DIVXDEC_CLASS(klass) \
|
|
||||||
(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;
|
|
||||||
|
|
||||||
/* video (output) settings */
|
|
||||||
guint32 csp;
|
|
||||||
int bitcnt, bpp;
|
|
||||||
int version;
|
|
||||||
int width, height;
|
|
||||||
|
|
||||||
gint fps_n, fps_d;
|
|
||||||
gint par_n, par_d;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstDivxDecClass {
|
|
||||||
GstElementClass parent_class;
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_divxdec_get_type(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* __GST_DIVXDEC_H__ */
|
|
|
@ -1,544 +0,0 @@
|
||||||
/* GStreamer divx encoder 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 "gstdivxenc.h"
|
|
||||||
#include <gst/video/video.h>
|
|
||||||
#include <encore2.h>
|
|
||||||
|
|
||||||
static GstStaticPadTemplate sink_template = GST_STATIC_PAD_TEMPLATE ("sink",
|
|
||||||
GST_PAD_SINK,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS (GST_VIDEO_CAPS_YUV ("{ I420, YUY2, YV12, YVYU, UYVY }")
|
|
||||||
/* FIXME: 15/16/24/32bpp RGB */
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
|
|
||||||
GST_PAD_SRC,
|
|
||||||
GST_PAD_ALWAYS,
|
|
||||||
GST_STATIC_CAPS ("video/x-divx, "
|
|
||||||
"divxversion = (int) 5, "
|
|
||||||
"width = (int) [ 16, 4096 ], "
|
|
||||||
"height = (int) [ 16, 4096 ], " "framerate = (fraction) [0/1, MAX]")
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
/* DivxEnc signals and args */
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
FRAME_ENCODED,
|
|
||||||
LAST_SIGNAL
|
|
||||||
};
|
|
||||||
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ARG_0,
|
|
||||||
ARG_BITRATE,
|
|
||||||
ARG_MAXKEYINTERVAL,
|
|
||||||
ARG_BUFSIZE,
|
|
||||||
ARG_QUALITY
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
static void gst_divxenc_class_init (GstDivxEncClass * klass);
|
|
||||||
static void gst_divxenc_base_init (GstDivxEncClass * klass);
|
|
||||||
static void gst_divxenc_init (GstDivxEnc * divxenc);
|
|
||||||
static void gst_divxenc_dispose (GObject * object);
|
|
||||||
static GstFlowReturn gst_divxenc_chain (GstPad * pad, GstBuffer * buf);
|
|
||||||
static gboolean gst_divxenc_setcaps (GstPad * pad, GstCaps * caps);
|
|
||||||
|
|
||||||
/* properties */
|
|
||||||
static void gst_divxenc_set_property (GObject * object,
|
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec);
|
|
||||||
static void gst_divxenc_get_property (GObject * object,
|
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec);
|
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
|
||||||
static guint gst_divxenc_signals[LAST_SIGNAL] = { 0 };
|
|
||||||
|
|
||||||
|
|
||||||
static const gchar *
|
|
||||||
gst_divxenc_error (int errorcode)
|
|
||||||
{
|
|
||||||
const gchar *error;
|
|
||||||
|
|
||||||
switch (errorcode) {
|
|
||||||
case ENC_BUFFER:
|
|
||||||
error = "Invalid buffer";
|
|
||||||
break;
|
|
||||||
case ENC_FAIL:
|
|
||||||
error = "Operation failed";
|
|
||||||
break;
|
|
||||||
case ENC_OK:
|
|
||||||
error = "No error";
|
|
||||||
break;
|
|
||||||
case ENC_MEMORY:
|
|
||||||
error = "Bad memory location";
|
|
||||||
break;
|
|
||||||
case ENC_BAD_FORMAT:
|
|
||||||
error = "Invalid format";
|
|
||||||
break;
|
|
||||||
case ENC_INTERNAL:
|
|
||||||
error = "Internal error";
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
error = "Unknown error";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return error;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GType
|
|
||||||
gst_divxenc_get_type (void)
|
|
||||||
{
|
|
||||||
static GType divxenc_type = 0;
|
|
||||||
|
|
||||||
if (!divxenc_type) {
|
|
||||||
static const GTypeInfo divxenc_info = {
|
|
||||||
sizeof (GstDivxEncClass),
|
|
||||||
(GBaseInitFunc) gst_divxenc_base_init,
|
|
||||||
NULL,
|
|
||||||
(GClassInitFunc) gst_divxenc_class_init,
|
|
||||||
NULL,
|
|
||||||
NULL,
|
|
||||||
sizeof (GstDivxEnc),
|
|
||||||
0,
|
|
||||||
(GInstanceInitFunc) gst_divxenc_init,
|
|
||||||
};
|
|
||||||
|
|
||||||
divxenc_type = g_type_register_static (GST_TYPE_ELEMENT,
|
|
||||||
"GstDivxEnc", &divxenc_info, 0);
|
|
||||||
}
|
|
||||||
return divxenc_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_base_init (GstDivxEncClass * klass)
|
|
||||||
{
|
|
||||||
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
|
|
||||||
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&sink_template));
|
|
||||||
gst_element_class_add_pad_template (element_class,
|
|
||||||
gst_static_pad_template_get (&src_template));
|
|
||||||
|
|
||||||
gst_element_class_set_details_simple (element_class,
|
|
||||||
"Divx4linux video encoder", "Codec/Encoder/Video",
|
|
||||||
"Divx encoder based on divxencore",
|
|
||||||
"Ronald Bultje <rbultje@ronald.bitfreak.net>");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_class_init (GstDivxEncClass * klass)
|
|
||||||
{
|
|
||||||
GObjectClass *gobject_class = (GObjectClass *) klass;
|
|
||||||
|
|
||||||
parent_class = g_type_class_peek_parent (klass);
|
|
||||||
|
|
||||||
gobject_class->set_property = gst_divxenc_set_property;
|
|
||||||
gobject_class->get_property = gst_divxenc_get_property;
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BITRATE,
|
|
||||||
g_param_spec_ulong ("bitrate", "Bitrate",
|
|
||||||
"Target video bitrate", 0, G_MAXULONG, 0,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_MAXKEYINTERVAL,
|
|
||||||
g_param_spec_int ("max-key-interval", "Max. Key Interval",
|
|
||||||
"Maximum number of frames between two keyframes",
|
|
||||||
-1, G_MAXINT, -1, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_BUFSIZE,
|
|
||||||
g_param_spec_ulong ("buffer-size", "Buffer Size",
|
|
||||||
"Size of the video buffers", 0, G_MAXULONG, 0,
|
|
||||||
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), ARG_QUALITY,
|
|
||||||
g_param_spec_int ("quality", "Quality",
|
|
||||||
"Amount of Motion Estimation", 1, 5, 3,
|
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
|
||||||
|
|
||||||
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,
|
|
||||||
G_STRUCT_OFFSET (GstDivxEncClass, frame_encoded),
|
|
||||||
NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_init (GstDivxEnc * divxenc)
|
|
||||||
{
|
|
||||||
/* create the sink pad */
|
|
||||||
divxenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
|
|
||||||
gst_element_add_pad (GST_ELEMENT (divxenc), divxenc->sinkpad);
|
|
||||||
|
|
||||||
gst_pad_set_chain_function (divxenc->sinkpad, gst_divxenc_chain);
|
|
||||||
gst_pad_set_setcaps_function (divxenc->sinkpad, gst_divxenc_setcaps);
|
|
||||||
|
|
||||||
/* create the src pad */
|
|
||||||
divxenc->srcpad = gst_pad_new_from_static_template (&src_template, "src");
|
|
||||||
gst_pad_use_fixed_caps (divxenc->srcpad);
|
|
||||||
gst_element_add_pad (GST_ELEMENT (divxenc), divxenc->srcpad);
|
|
||||||
|
|
||||||
/* bitrate, etc. */
|
|
||||||
divxenc->width = divxenc->height = divxenc->csp = divxenc->bitcnt = -1;
|
|
||||||
divxenc->bitrate = 512 * 1024;
|
|
||||||
divxenc->max_key_interval = -1; /* default - 2*fps */
|
|
||||||
divxenc->buffer_size = 512 * 1024;
|
|
||||||
divxenc->quality = 3;
|
|
||||||
|
|
||||||
/* set divx handle to NULL */
|
|
||||||
divxenc->handle = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_divxenc_setup (GstDivxEnc * divxenc)
|
|
||||||
{
|
|
||||||
void *handle = NULL;
|
|
||||||
SETTINGS output;
|
|
||||||
DivXBitmapInfoHeader input;
|
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* set it up */
|
|
||||||
memset (&input, 0, sizeof (DivXBitmapInfoHeader));
|
|
||||||
input.biSize = sizeof (DivXBitmapInfoHeader);
|
|
||||||
input.biWidth = divxenc->width;
|
|
||||||
input.biHeight = divxenc->height;
|
|
||||||
input.biBitCount = divxenc->bitcnt;
|
|
||||||
input.biCompression = divxenc->csp;
|
|
||||||
|
|
||||||
memset (&output, 0, sizeof (SETTINGS));
|
|
||||||
output.vbr_mode = RCMODE_VBV_1PASS;
|
|
||||||
output.bitrate = divxenc->bitrate;
|
|
||||||
output.quantizer = 0;
|
|
||||||
output.use_bidirect = 1;
|
|
||||||
output.input_clock = 0;
|
|
||||||
output.input_frame_period = 1000000;
|
|
||||||
output.internal_timescale = (divxenc->fps_n / divxenc->fps_d) * 1000000; /* FIX? */
|
|
||||||
output.max_key_interval = (divxenc->max_key_interval == -1) ?
|
|
||||||
150 : divxenc->max_key_interval;
|
|
||||||
output.key_frame_threshold = 50;
|
|
||||||
output.vbv_bitrate = 0;
|
|
||||||
output.vbv_size = 0;
|
|
||||||
output.vbv_occupancy = 0;
|
|
||||||
output.complexity_modulation = 0;
|
|
||||||
output.deinterlace = 0;
|
|
||||||
output.quality = divxenc->quality;
|
|
||||||
output.data_partitioning = 0;
|
|
||||||
output.quarter_pel = 1;
|
|
||||||
output.use_gmc = 1;
|
|
||||||
output.psychovisual = 0;
|
|
||||||
output.pv_strength_frame = 0;
|
|
||||||
output.pv_strength_MB = 0;
|
|
||||||
output.interlace_mode = 0;
|
|
||||||
output.enable_crop = 0;
|
|
||||||
output.enable_resize = 0;
|
|
||||||
output.temporal_enable = 1;
|
|
||||||
output.spatial_passes = 3;
|
|
||||||
output.spatial_level = 1.0;
|
|
||||||
output.temporal_level = 1.0;
|
|
||||||
|
|
||||||
if ((ret = encore (&handle, ENC_OPT_INIT, &input, &output))) {
|
|
||||||
GST_ELEMENT_ERROR (divxenc, LIBRARY, SETTINGS, (NULL),
|
|
||||||
("Error setting up divx encoder: %s (%d)",
|
|
||||||
gst_divxenc_error (ret), ret));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
divxenc->handle = handle;
|
|
||||||
|
|
||||||
/* set buffer size to theoretical limit (see docs on divx.com) */
|
|
||||||
divxenc->buffer_size = 6 * divxenc->width * divxenc->height;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_unset (GstDivxEnc * divxenc)
|
|
||||||
{
|
|
||||||
if (divxenc->handle) {
|
|
||||||
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);
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static GstFlowReturn
|
|
||||||
gst_divxenc_chain (GstPad * pad, GstBuffer * buf)
|
|
||||||
{
|
|
||||||
GstDivxEnc *divxenc;
|
|
||||||
GstBuffer *outbuf;
|
|
||||||
ENC_FRAME xframe;
|
|
||||||
ENC_RESULT xres;
|
|
||||||
int res;
|
|
||||||
GstFlowReturn ret = GST_FLOW_OK;
|
|
||||||
|
|
||||||
divxenc = GST_DIVXENC (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
outbuf = gst_buffer_new_and_alloc (divxenc->buffer_size);
|
|
||||||
GST_BUFFER_TIMESTAMP (outbuf) = GST_BUFFER_TIMESTAMP (buf);
|
|
||||||
|
|
||||||
/* encode and so ... */
|
|
||||||
xframe.image = GST_BUFFER_DATA (buf);
|
|
||||||
xframe.bitstream = (void *) GST_BUFFER_DATA (outbuf);
|
|
||||||
xframe.length = GST_BUFFER_SIZE (outbuf); /* GST_BUFFER_MAXSIZE */
|
|
||||||
xframe.produce_empty_frame = 0;
|
|
||||||
|
|
||||||
if ((res = encore (divxenc->handle, ENC_OPT_ENCODE, &xframe, &xres))) {
|
|
||||||
goto not_encoding;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_BUFFER_SIZE (outbuf) = xframe.length;
|
|
||||||
|
|
||||||
/* go out, multiply! */
|
|
||||||
gst_buffer_set_caps (outbuf, GST_PAD_CAPS (divxenc->srcpad));
|
|
||||||
gst_pad_push (divxenc->srcpad, outbuf);
|
|
||||||
|
|
||||||
/* proclaim destiny */
|
|
||||||
g_signal_emit (G_OBJECT (divxenc), gst_divxenc_signals[FRAME_ENCODED], 0);
|
|
||||||
|
|
||||||
/* until the final judgement */
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
not_encoding:
|
|
||||||
|
|
||||||
GST_ELEMENT_ERROR (divxenc, LIBRARY, ENCODE, (NULL),
|
|
||||||
("Error encoding divx frame: %s (%d)", gst_divxenc_error (res), res));
|
|
||||||
ret = GST_FLOW_ERROR;
|
|
||||||
gst_buffer_unref (outbuf);
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
done:
|
|
||||||
gst_buffer_unref (buf);
|
|
||||||
gst_object_unref (divxenc);
|
|
||||||
return ret;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* FIXME: moving broken bits here for others to fix */
|
|
||||||
/* someone fix RGB please */
|
|
||||||
/*
|
|
||||||
case GST_MAKE_FOURCC ('R', 'G', 'B', ' '):
|
|
||||||
gst_caps_get_int (caps, "depth", &d);
|
|
||||||
switch (d) {
|
|
||||||
case 24:
|
|
||||||
divx_cs = 0;
|
|
||||||
bitcnt = 24;
|
|
||||||
break;
|
|
||||||
case 32:
|
|
||||||
divx_cs = 0;
|
|
||||||
bitcnt = 32;
|
|
||||||
break;
|
|
||||||
*/
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
gst_divxenc_setcaps (GstPad * pad, GstCaps * caps)
|
|
||||||
{
|
|
||||||
GstDivxEnc *divxenc;
|
|
||||||
GstStructure *structure = gst_caps_get_structure (caps, 0);
|
|
||||||
gint w, h;
|
|
||||||
const GValue *fps;
|
|
||||||
guint32 fourcc;
|
|
||||||
guint32 divx_cs;
|
|
||||||
gint bitcnt = 0;
|
|
||||||
gboolean ret = FALSE;
|
|
||||||
|
|
||||||
divxenc = GST_DIVXENC (gst_pad_get_parent (pad));
|
|
||||||
|
|
||||||
/* if there's something old around, remove it */
|
|
||||||
gst_divxenc_unset (divxenc);
|
|
||||||
|
|
||||||
gst_structure_get_int (structure, "width", &w);
|
|
||||||
gst_structure_get_int (structure, "height", &h);
|
|
||||||
gst_structure_get_fourcc (structure, "format", &fourcc);
|
|
||||||
|
|
||||||
fps = gst_structure_get_value (structure, "framerate");
|
|
||||||
if (fps != NULL && GST_VALUE_HOLDS_FRACTION (fps)) {
|
|
||||||
divxenc->fps_n = gst_value_get_fraction_numerator (fps);
|
|
||||||
divxenc->fps_d = gst_value_get_fraction_denominator (fps);
|
|
||||||
} else {
|
|
||||||
divxenc->fps_n = -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (fourcc) {
|
|
||||||
case GST_MAKE_FOURCC ('I', '4', '2', '0'):
|
|
||||||
divx_cs = GST_MAKE_FOURCC ('I', '4', '2', '0');
|
|
||||||
break;
|
|
||||||
case GST_MAKE_FOURCC ('Y', 'U', 'Y', '2'):
|
|
||||||
divx_cs = GST_MAKE_FOURCC ('Y', 'U', 'Y', '2');
|
|
||||||
break;
|
|
||||||
case GST_MAKE_FOURCC ('Y', 'V', '1', '2'):
|
|
||||||
divx_cs = GST_MAKE_FOURCC ('Y', 'V', '1', '2');
|
|
||||||
break;
|
|
||||||
case GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U'):
|
|
||||||
divx_cs = GST_MAKE_FOURCC ('Y', 'V', 'Y', 'U');
|
|
||||||
break;
|
|
||||||
case GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y'):
|
|
||||||
divx_cs = GST_MAKE_FOURCC ('U', 'Y', 'V', 'Y');
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
ret = FALSE;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
|
|
||||||
divxenc->csp = divx_cs;
|
|
||||||
divxenc->bitcnt = bitcnt;
|
|
||||||
divxenc->width = w;
|
|
||||||
divxenc->height = h;
|
|
||||||
|
|
||||||
/* try it */
|
|
||||||
if (gst_divxenc_setup (divxenc)) {
|
|
||||||
GstCaps *new_caps = NULL;
|
|
||||||
|
|
||||||
new_caps = gst_caps_new_simple ("video/x-divx",
|
|
||||||
"divxversion", G_TYPE_INT, 5,
|
|
||||||
"width", G_TYPE_INT, w,
|
|
||||||
"height", G_TYPE_INT, h,
|
|
||||||
"framerate", GST_TYPE_FRACTION, divxenc->fps_n, divxenc->fps_d, NULL);
|
|
||||||
|
|
||||||
if (new_caps) {
|
|
||||||
|
|
||||||
if (!gst_pad_set_caps (divxenc->srcpad, new_caps)) {
|
|
||||||
gst_divxenc_unset (divxenc);
|
|
||||||
ret = FALSE;
|
|
||||||
goto done;
|
|
||||||
}
|
|
||||||
gst_caps_unref (new_caps);
|
|
||||||
ret = TRUE;
|
|
||||||
goto done;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
/* if we got here - it's not good */
|
|
||||||
|
|
||||||
ret = FALSE;
|
|
||||||
|
|
||||||
done:
|
|
||||||
gst_object_unref (divxenc);
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_set_property (GObject * object,
|
|
||||||
guint prop_id, const GValue * value, GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstDivxEnc *divxenc = GST_DIVXENC (object);
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (divxenc);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_BITRATE:
|
|
||||||
divxenc->bitrate = g_value_get_ulong (value);
|
|
||||||
break;
|
|
||||||
case ARG_MAXKEYINTERVAL:
|
|
||||||
divxenc->max_key_interval = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
case ARG_QUALITY:
|
|
||||||
divxenc->quality = g_value_get_int (value);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (divxenc);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
gst_divxenc_get_property (GObject * object,
|
|
||||||
guint prop_id, GValue * value, GParamSpec * pspec)
|
|
||||||
{
|
|
||||||
GstDivxEnc *divxenc = GST_DIVXENC (object);
|
|
||||||
|
|
||||||
GST_OBJECT_LOCK (divxenc);
|
|
||||||
|
|
||||||
switch (prop_id) {
|
|
||||||
case ARG_BITRATE:
|
|
||||||
g_value_set_ulong (value, divxenc->bitrate);
|
|
||||||
break;
|
|
||||||
case ARG_BUFSIZE:
|
|
||||||
g_value_set_ulong (value, divxenc->buffer_size);
|
|
||||||
break;
|
|
||||||
case ARG_MAXKEYINTERVAL:
|
|
||||||
g_value_set_int (value, divxenc->max_key_interval);
|
|
||||||
break;
|
|
||||||
case ARG_QUALITY:
|
|
||||||
g_value_set_int (value, divxenc->quality);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
GST_OBJECT_UNLOCK (divxenc);
|
|
||||||
}
|
|
||||||
|
|
||||||
static gboolean
|
|
||||||
plugin_init (GstPlugin * plugin)
|
|
||||||
{
|
|
||||||
int lib_version;
|
|
||||||
|
|
||||||
lib_version = encore (NULL, ENC_OPT_VERSION, 0, 0);
|
|
||||||
if (lib_version != ENCORE_VERSION) {
|
|
||||||
g_warning ("Version mismatch! This plugin was compiled for "
|
|
||||||
"DivX version %d, while your library has version %d!",
|
|
||||||
ENCORE_VERSION, lib_version);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* create an elementfactory for the v4lmjpegsrcparse element */
|
|
||||||
return gst_element_register (plugin, "divxenc",
|
|
||||||
GST_RANK_NONE, GST_TYPE_DIVXENC);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
|
|
||||||
GST_VERSION_MINOR,
|
|
||||||
divxenc,
|
|
||||||
"DivX encoder",
|
|
||||||
plugin_init,
|
|
||||||
"5.03", GST_LICENSE_UNKNOWN, "divx4linux", "http://www.divx.com/");
|
|
|
@ -1,83 +0,0 @@
|
||||||
/* GStreamer divx encoder 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_DIVXENC_H__
|
|
||||||
#define __GST_DIVXENC_H__
|
|
||||||
|
|
||||||
#include <gst/gst.h>
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
|
|
||||||
#define GST_TYPE_DIVXENC \
|
|
||||||
(gst_divxenc_get_type())
|
|
||||||
#define GST_DIVXENC(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_DIVXENC, GstDivxEnc))
|
|
||||||
#define GST_DIVXENC_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_DIVXENC, GstDivxEncClass))
|
|
||||||
#define GST_IS_DIVXENC(obj) \
|
|
||||||
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_DIVXENC))
|
|
||||||
#define GST_IS_DIVXENC_CLASS(klass) \
|
|
||||||
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_DIVXENC))
|
|
||||||
|
|
||||||
typedef struct _GstDivxEnc GstDivxEnc;
|
|
||||||
typedef struct _GstDivxEncClass GstDivxEncClass;
|
|
||||||
|
|
||||||
struct _GstDivxEnc {
|
|
||||||
GstElement element;
|
|
||||||
|
|
||||||
/* pads */
|
|
||||||
GstPad *sinkpad, *srcpad;
|
|
||||||
|
|
||||||
/* quality of encoded image */
|
|
||||||
gulong bitrate;
|
|
||||||
|
|
||||||
/* size of the buffers */
|
|
||||||
gulong buffer_size;
|
|
||||||
|
|
||||||
/* max key interval */
|
|
||||||
gint max_key_interval;
|
|
||||||
|
|
||||||
/* amount of motion estimation to do */
|
|
||||||
gint quality;
|
|
||||||
|
|
||||||
/* divx handle */
|
|
||||||
void *handle;
|
|
||||||
guint32 csp;
|
|
||||||
gint bitcnt;
|
|
||||||
gint width, height;
|
|
||||||
gint fps_n, fps_d;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct _GstDivxEncClass {
|
|
||||||
GstElementClass parent_class;
|
|
||||||
|
|
||||||
/* signals */
|
|
||||||
void (*frame_encoded) (GstElement *element);
|
|
||||||
};
|
|
||||||
|
|
||||||
GType gst_divxenc_get_type(void);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* __GST_DIVXENC_H__ */
|
|
Loading…
Reference in a new issue