amrwbenc: Switch to the free vo-amrwbenc library

And rename everything to voamrwbenc instead of amrwbenc.
This commit is contained in:
Sebastian Dröge 2011-04-19 10:07:23 +02:00
parent 31d408e22e
commit f085fa8a97
13 changed files with 123 additions and 176 deletions

View file

@ -577,17 +577,13 @@ AG_GST_CHECK_FEATURE(ASSRENDER, [ASS/SSA renderer], assrender, [
AC_SUBST(ASSRENDER_CFLAGS) AC_SUBST(ASSRENDER_CFLAGS)
AC_SUBST(ASSRENDER_LIBS) AC_SUBST(ASSRENDER_LIBS)
dnl *** amrwb *** dnl *** vo-amrwbenc ***
translit(dnm, m, l) AM_CONDITIONAL(USE_AMRWB, true) translit(dnm, m, l) AM_CONDITIONAL(USE_VOAMRWBENC, true)
AG_GST_CHECK_FEATURE(AMRWB, [amrwb library], amrwbenc, [ AG_GST_CHECK_FEATURE(VOAMRWBENC, [vo-amrwbenc library], vo-amrwbenc, [
AG_GST_CHECK_LIBHEADER(AMRWB, amrwb, AG_GST_PKG_CHECK_MODULES(VOAMRWBENC, vo-amrwbenc >= 0.1.0)
GP3E_IF_encode, ,
amrwb/enc.h,
AMRWB_LIBS="-lamrwb"
AC_SUBST(AMRWB_LIBS))
]) ])
dnl *** aac-enc *** dnl *** vo-aacenc ***
translit(dnm, m, l) AM_CONDITIONAL(USE_VOAACENC, true) translit(dnm, m, l) AM_CONDITIONAL(USE_VOAACENC, true)
AG_GST_CHECK_FEATURE(VOAACENC, [vo-aacenc library], vo-aacenc, [ AG_GST_CHECK_FEATURE(VOAACENC, [vo-aacenc library], vo-aacenc, [
AG_GST_PKG_CHECK_MODULES(VOAACENC, vo-aacenc >= 0.1.0) AG_GST_PKG_CHECK_MODULES(VOAACENC, vo-aacenc >= 0.1.0)
@ -1627,7 +1623,7 @@ dnl not building plugins with external dependencies,
dnl but we still need to set the conditionals dnl but we still need to set the conditionals
AM_CONDITIONAL(USE_ASSRENDER, false) AM_CONDITIONAL(USE_ASSRENDER, false)
AM_CONDITIONAL(USE_AMRWB, false) AM_CONDITIONAL(USE_VOAMRWBENC, false)
AM_CONDITIONAL(USE_VOAACENC, false) AM_CONDITIONAL(USE_VOAACENC, false)
AM_CONDITIONAL(USE_APEXSINK, false) AM_CONDITIONAL(USE_APEXSINK, false)
AM_CONDITIONAL(USE_BZ2, false) AM_CONDITIONAL(USE_BZ2, false)
@ -1869,7 +1865,7 @@ tests/examples/directfb/Makefile
tests/examples/mxf/Makefile tests/examples/mxf/Makefile
tests/examples/scaletempo/Makefile tests/examples/scaletempo/Makefile
tests/icles/Makefile tests/icles/Makefile
ext/amrwbenc/Makefile ext/voamrwbenc/Makefile
ext/voaacenc/Makefile ext/voaacenc/Makefile
ext/assrender/Makefile ext/assrender/Makefile
ext/apexsink/Makefile ext/apexsink/Makefile

View file

@ -91,7 +91,6 @@ EXAMPLE_CFILES = \
EXTRA_HFILES = \ EXTRA_HFILES = \
$(top_srcdir)/ext/assrender/gstassrender.h \ $(top_srcdir)/ext/assrender/gstassrender.h \
$(top_srcdir)/ext/amrwbenc/gstamrwbenc.h \
$(top_srcdir)/ext/celt/gstceltdec.h \ $(top_srcdir)/ext/celt/gstceltdec.h \
$(top_srcdir)/ext/celt/gstceltenc.h \ $(top_srcdir)/ext/celt/gstceltenc.h \
$(top_srcdir)/ext/curl/gstcurlsink.h \ $(top_srcdir)/ext/curl/gstcurlsink.h \
@ -131,6 +130,7 @@ EXTRA_HFILES = \
$(top_srcdir)/ext/sdl/sdlvideosink.h \ $(top_srcdir)/ext/sdl/sdlvideosink.h \
$(top_srcdir)/ext/timidity/gsttimidity.h \ $(top_srcdir)/ext/timidity/gsttimidity.h \
$(top_srcdir)/ext/timidity/gstwildmidi.h \ $(top_srcdir)/ext/timidity/gstwildmidi.h \
$(top_srcdir)/ext/voamrwbenc/gstvoamrwbenc.h \
$(top_srcdir)/ext/vp8/gstvp8enc.h \ $(top_srcdir)/ext/vp8/gstvp8enc.h \
$(top_srcdir)/ext/vp8/gstvp8dec.h \ $(top_srcdir)/ext/vp8/gstvp8dec.h \
$(top_srcdir)/ext/zbar/gstzbar.h \ $(top_srcdir)/ext/zbar/gstzbar.h \

View file

@ -19,7 +19,6 @@
<title>gst-plugins-bad Elements</title> <title>gst-plugins-bad Elements</title>
<xi:include href="xml/element-aiffparse.xml" /> <xi:include href="xml/element-aiffparse.xml" />
<xi:include href="xml/element-aiffmux.xml" /> <xi:include href="xml/element-aiffmux.xml" />
<xi:include href="xml/element-amrwbenc.xml" />
<xi:include href="xml/element-assrender.xml" /> <xi:include href="xml/element-assrender.xml" />
<xi:include href="xml/element-autoconvert.xml" /> <xi:include href="xml/element-autoconvert.xml" />
<xi:include href="xml/element-bulge.xml" /> <xi:include href="xml/element-bulge.xml" />
@ -121,6 +120,7 @@
<xi:include href="xml/element-waterripple.xml" /> <xi:include href="xml/element-waterripple.xml" />
<xi:include href="xml/element-wildmidi.xml" /> <xi:include href="xml/element-wildmidi.xml" />
<xi:include href="xml/element-zbar.xml" /> <xi:include href="xml/element-zbar.xml" />
<xi:include href="xml/element-voamrwbenc.xml" />
<xi:include href="xml/element-vp8dec.xml" /> <xi:include href="xml/element-vp8dec.xml" />
<xi:include href="xml/element-vp8enc.xml" /> <xi:include href="xml/element-vp8enc.xml" />
</chapter> </chapter>
@ -130,7 +130,6 @@
<xi:include href="xml/plugin-aiff.xml" /> <xi:include href="xml/plugin-aiff.xml" />
<xi:include href="xml/plugin-autoconvert.xml" /> <xi:include href="xml/plugin-autoconvert.xml" />
<xi:include href="xml/plugin-legacyresample.xml" /> <xi:include href="xml/plugin-legacyresample.xml" />
<xi:include href="xml/plugin-amrwbenc.xml" />
<xi:include href="xml/plugin-assrender.xml" /> <xi:include href="xml/plugin-assrender.xml" />
<xi:include href="xml/plugin-bayer.xml" /> <xi:include href="xml/plugin-bayer.xml" />
<xi:include href="xml/plugin-bz2.xml" /> <xi:include href="xml/plugin-bz2.xml" />
@ -210,6 +209,7 @@
<xi:include href="xml/plugin-vmnc.xml" /> <xi:include href="xml/plugin-vmnc.xml" />
<xi:include href="xml/plugin-wildmidi.xml" /> <xi:include href="xml/plugin-wildmidi.xml" />
<xi:include href="xml/plugin-xvid.xml" /> <xi:include href="xml/plugin-xvid.xml" />
<xi:include href="xml/plugin-voamrwbenc.xml" />
<xi:include href="xml/plugin-vp8.xml" /> <xi:include href="xml/plugin-vp8.xml" />
<xi:include href="xml/plugin-zbar.xml" /> <xi:include href="xml/plugin-zbar.xml" />
</chapter> </chapter>

View file

@ -28,17 +28,17 @@ gst_aiff_parse_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>
<FILE>element-amrwbenc</FILE> <FILE>element-voamrwbenc</FILE>
<TITLE>amrwbenc</TITLE> <TITLE>voamrwbenc</TITLE>
GstAmrwbEnc GstVoAmrwbEnc
<SUBSECTION Standard> <SUBSECTION Standard>
GstAmrwbEncClass GstVoAmrwbEncClass
GST_AMRWBENC GST_VOAMRWBENC
GST_AMRWBENC_CLASS GST_VOAMRWBENC_CLASS
GST_IS_AMRWBENC GST_IS_VOAMRWBENC
GST_IS_AMRWBENC_CLASS GST_IS_VOAMRWBENC_CLASS
GST_TYPE_AMRWBENC GST_TYPE_VOAMRWBENC
gst_amrwbenc_get_type gst_voamrwbenc_get_type
</SECTION> </SECTION>
<SECTION> <SECTION>

View file

@ -1,34 +0,0 @@
<plugin>
<name>amrwbenc</name>
<description>Adaptive Multi-Rate Wide-Band Encoder</description>
<filename>../../ext/amrwbenc/.libs/libgstamrwbenc.so</filename>
<basename>libgstamrwbenc.so</basename>
<version>0.10.22.1</version>
<license>unknown</license>
<source>gst-plugins-bad</source>
<package>GStreamer Bad Plug-ins git</package>
<origin>Unknown package origin</origin>
<elements>
<element>
<name>amrwbenc</name>
<longname>AMR-WB audio encoder</longname>
<class>Codec/Encoder/Audio</class>
<description>Adaptive Multi-Rate Wideband audio encoder</description>
<author>Renato Araujo &lt;renato.filho@indt.org.br&gt;</author>
<pads>
<caps>
<name>sink</name>
<direction>sink</direction>
<presence>always</presence>
<details>audio/x-raw-int, width=(int)16, depth=(int)16, signed=(boolean)true, endianness=(int)1234, rate=(int)16000, channels=(int)1</details>
</caps>
<caps>
<name>src</name>
<direction>source</direction>
<presence>always</presence>
<details>audio/AMR-WB, rate=(int)16000, channels=(int)1</details>
</caps>
</pads>
</element>
</elements>
</plugin>

View file

@ -4,10 +4,10 @@ else
ASSRENDER_DIR = ASSRENDER_DIR =
endif endif
if USE_AMRWB if USE_VOAMRWBENC
AMRWB_DIR = amrwbenc VOAMRWBENC_DIR = voamrwbenc
else else
AMRWB_DIR = VOAMRWBENC_DIR =
endif endif
if USE_APEXSINK if USE_APEXSINK
@ -364,7 +364,7 @@ endif
SUBDIRS=\ SUBDIRS=\
$(VOAACENC_DIR) \ $(VOAACENC_DIR) \
$(ASSRENDER_DIR) \ $(ASSRENDER_DIR) \
$(AMRWB_DIR) \ $(VOAMRWBENC_DIR) \
$(APEXSINK_DIR) \ $(APEXSINK_DIR) \
$(ARTS_DIR) \ $(ARTS_DIR) \
$(ARTSC_DIR) \ $(ARTSC_DIR) \
@ -423,7 +423,6 @@ SUBDIRS=\
$(RTMP_DIR) $(RTMP_DIR)
DIST_SUBDIRS = \ DIST_SUBDIRS = \
amrwbenc \
assrender \ assrender \
apexsink \ apexsink \
bz2 \ bz2 \
@ -467,6 +466,8 @@ DIST_SUBDIRS = \
gme \ gme \
swfdec \ swfdec \
timidity \ timidity \
voaacenc \
voamrwbenc \
vp8 \ vp8 \
xvid \ xvid \
zbar \ zbar \

View file

@ -1,19 +0,0 @@
plugin_LTLIBRARIES = libgstamrwbenc.la
libgstamrwbenc_la_SOURCES = \
gstamrwb.c \
gstamrwbenc.c
libgstamrwbenc_la_CFLAGS = $(GST_CFLAGS) $(AMRWB_CFLAGS)
libgstamrwbenc_la_LIBADD = $(GST_BASE_LIBS) $(AMRWB_LIBS)
libgstamrwbenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstamrwbenc_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstamrwbenc.h
presetdir = $(datadir)/gstreamer-$(GST_MAJORMINOR)/presets
preset_DATA = GstAmrwbEnc.prs
EXTRA_DIST = $(preset_DATA)

View file

@ -1,12 +0,0 @@
Compiling AMRWB encoder:
========================
To compile the amrwb encoder, you need to download the source code from
"http://www.3gpp.org/ftp/Specs/html-info/26204.htm" and uncompress the
files inside an amrwb-code directory;
or execute this commands:
$cd amrwb-code
$sh ./run.sh
and run the "autogen" script again.

View file

@ -1,6 +1,6 @@
[_presets_] [_presets_]
version=0.10 version=0.10
element-name=GstAmrwbEnc element-name=GstVoAmrwbEnc
[enhance-size] [enhance-size]
_meta/comment=Maximize compression, lowest bitrate _meta/comment=Maximize compression, lowest bitrate

View file

@ -0,0 +1,19 @@
plugin_LTLIBRARIES = libgstvoamrwbenc.la
libgstvoamrwbenc_la_SOURCES = \
gstvoamrwb.c \
gstvoamrwbenc.c
libgstvoamrwbenc_la_CFLAGS = $(GST_CFLAGS) $(VOAMRWBENC_CFLAGS)
libgstvoamrwbenc_la_LIBADD = $(GST_BASE_LIBS) $(VOAMRWBENC_LIBS)
libgstvoamrwbenc_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstvoamrwbenc_la_LIBTOOLFLAGS = --tag=disable-static
noinst_HEADERS = \
gstvoamrwbenc.h
presetdir = $(datadir)/gstreamer-$(GST_MAJORMINOR)/presets
preset_DATA = GstVoAmrwbEnc.prs
EXTRA_DIST = $(preset_DATA)

View file

@ -21,19 +21,19 @@
#include "config.h" #include "config.h"
#endif #endif
#include "gstamrwbenc.h" #include "gstvoamrwbenc.h"
static gboolean static gboolean
plugin_init (GstPlugin * plugin) plugin_init (GstPlugin * plugin)
{ {
return gst_element_register (plugin, "amrwbenc", return gst_element_register (plugin, "voamrwbenc",
GST_RANK_SECONDARY, GST_TYPE_AMRWBENC); GST_RANK_SECONDARY, GST_TYPE_VOAMRWBENC);
} }
GST_PLUGIN_DEFINE (GST_VERSION_MAJOR, GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
GST_VERSION_MINOR, GST_VERSION_MINOR,
"amrwbenc", "voamrwbenc",
"Adaptive Multi-Rate Wide-Band Encoder", "Adaptive Multi-Rate Wide-Band Encoder",
plugin_init, VERSION, GST_LICENSE_UNKNOWN, GST_PACKAGE_NAME, plugin_init, VERSION, GST_LICENSE_UNKNOWN, GST_PACKAGE_NAME,
GST_PACKAGE_ORIGIN); GST_PACKAGE_ORIGIN);

View file

@ -18,8 +18,8 @@
*/ */
/** /**
* SECTION:element-amrwbenc * SECTION:element-voamrwbenc
* @see_also: #GstAmrwbDec, #GstAmrwbParse * @see_also: #GstAmrWbDec, #GstAmrWbParse
* *
* AMR wideband encoder based on the * AMR wideband encoder based on the
* <ulink url="http://www.penguin.cz/~utx/amr">reference codec implementation</ulink>. * <ulink url="http://www.penguin.cz/~utx/amr">reference codec implementation</ulink>.
@ -27,9 +27,9 @@
* <refsect2> * <refsect2>
* <title>Example launch line</title> * <title>Example launch line</title>
* |[ * |[
* gst-launch filesrc location=abc.wav ! wavparse ! audioresample ! audioconvert ! amrwbenc ! filesink location=abc.amr * gst-launch filesrc location=abc.wav ! wavparse ! audioresample ! audioconvert ! voamrwbenc ! filesink location=abc.amr
* ]| * ]|
* Please not that the above stream misses the header, that is needed to play * Please note that the above stream misses the header, that is needed to play
* the stream. * the stream.
* </refsect2> * </refsect2>
*/ */
@ -38,10 +38,8 @@
#include "config.h" #include "config.h"
#endif #endif
#include "gstamrwbenc.h" #include "gstvoamrwbenc.h"
/* these defines are not in all .h files */
#ifndef MR660
#define MR660 0 #define MR660 0
#define MR885 1 #define MR885 1
#define MR1265 2 #define MR1265 2
@ -52,13 +50,14 @@
#define MR2305 6 #define MR2305 6
#define MR2385 7 #define MR2385 7
#define MRDTX 8 #define MRDTX 8
#endif
#define L_FRAME16k 320 /* Frame size at 16kHz */
static GType static GType
gst_amrwbenc_bandmode_get_type (void) gst_voamrwbenc_bandmode_get_type (void)
{ {
static GType gst_amrwbenc_bandmode_type = 0; static GType gst_voamrwbenc_bandmode_type = 0;
static GEnumValue gst_amrwbenc_bandmode[] = { static GEnumValue gst_voamrwbenc_bandmode[] = {
{MR660, "MR660", "MR660"}, {MR660, "MR660", "MR660"},
{MR885, "MR885", "MR885"}, {MR885, "MR885", "MR885"},
{MR1265, "MR1265", "MR1265"}, {MR1265, "MR1265", "MR1265"},
@ -71,14 +70,15 @@ gst_amrwbenc_bandmode_get_type (void)
{MRDTX, "MRDTX", "MRDTX"}, {MRDTX, "MRDTX", "MRDTX"},
{0, NULL, NULL}, {0, NULL, NULL},
}; };
if (!gst_amrwbenc_bandmode_type) { if (!gst_voamrwbenc_bandmode_type) {
gst_amrwbenc_bandmode_type = gst_voamrwbenc_bandmode_type =
g_enum_register_static ("GstAmrWbEncBandMode", gst_amrwbenc_bandmode); g_enum_register_static ("GstVoAmrWbEncBandMode",
gst_voamrwbenc_bandmode);
} }
return gst_amrwbenc_bandmode_type; return gst_voamrwbenc_bandmode_type;
} }
#define GST_AMRWBENC_BANDMODE_TYPE (gst_amrwbenc_bandmode_get_type()) #define GST_VOAMRWBENC_BANDMODE_TYPE (gst_voamrwbenc_bandmode_get_type())
#define BANDMODE_DEFAULT MR660 #define BANDMODE_DEFAULT MR660
@ -106,14 +106,14 @@ static GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE ("src",
"rate = (int) 16000, " "channels = (int) 1") "rate = (int) 16000, " "channels = (int) 1")
); );
GST_DEBUG_CATEGORY_STATIC (gst_amrwbenc_debug); GST_DEBUG_CATEGORY_STATIC (gst_voamrwbenc_debug);
#define GST_CAT_DEFAULT gst_amrwbenc_debug #define GST_CAT_DEFAULT gst_voamrwbenc_debug
static void gst_amrwbenc_finalize (GObject * object); static void gst_voamrwbenc_finalize (GObject * object);
static GstFlowReturn gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer); static GstFlowReturn gst_voamrwbenc_chain (GstPad * pad, GstBuffer * buffer);
static gboolean gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps); static gboolean gst_voamrwbenc_setcaps (GstPad * pad, GstCaps * caps);
static GstStateChangeReturn gst_amrwbenc_state_change (GstElement * element, static GstStateChangeReturn gst_voamrwbenc_state_change (GstElement * element,
GstStateChange transition); GstStateChange transition);
static void static void
@ -128,21 +128,18 @@ _do_init (GType object_type)
g_type_add_interface_static (object_type, GST_TYPE_PRESET, g_type_add_interface_static (object_type, GST_TYPE_PRESET,
&preset_interface_info); &preset_interface_info);
GST_DEBUG_CATEGORY_INIT (gst_amrwbenc_debug, "amrwbenc", 0, GST_DEBUG_CATEGORY_INIT (gst_voamrwbenc_debug, "amrwbenc", 0,
"AMR-WB audio encoder"); "AMR-WB audio encoder");
} }
#define GstAmrWbEnc GstAmrwbEnc GST_BOILERPLATE_FULL (GstVoAmrWbEnc, gst_voamrwbenc, GstElement,
#define GstAmrWbEncClass GstAmrwbEncClass GST_TYPE_ELEMENT, _do_init);
GST_BOILERPLATE_FULL (GstAmrWbEnc, gst_amrwbenc, GstElement, GST_TYPE_ELEMENT,
_do_init);
static void static void
gst_amrwbenc_set_property (GObject * object, guint prop_id, gst_voamrwbenc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstAmrwbEnc *self = GST_AMRWBENC (object); GstVoAmrWbEnc *self = GST_VOAMRWBENC (object);
switch (prop_id) { switch (prop_id) {
case PROP_BANDMODE: case PROP_BANDMODE:
@ -157,10 +154,10 @@ gst_amrwbenc_set_property (GObject * object, guint prop_id,
} }
static void static void
gst_amrwbenc_get_property (GObject * object, guint prop_id, gst_voamrwbenc_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec) GValue * value, GParamSpec * pspec)
{ {
GstAmrwbEnc *self = GST_AMRWBENC (object); GstVoAmrWbEnc *self = GST_VOAMRWBENC (object);
switch (prop_id) { switch (prop_id) {
case PROP_BANDMODE: case PROP_BANDMODE:
@ -175,7 +172,7 @@ gst_amrwbenc_get_property (GObject * object, guint prop_id,
} }
static void static void
gst_amrwbenc_base_init (gpointer klass) gst_voamrwbenc_base_init (gpointer klass)
{ {
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
@ -191,31 +188,31 @@ gst_amrwbenc_base_init (gpointer klass)
} }
static void static void
gst_amrwbenc_class_init (GstAmrwbEncClass * klass) gst_voamrwbenc_class_init (GstVoAmrWbEncClass * klass)
{ {
GObjectClass *object_class = G_OBJECT_CLASS (klass); GObjectClass *object_class = G_OBJECT_CLASS (klass);
GstElementClass *element_class = GST_ELEMENT_CLASS (klass); GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
object_class->finalize = gst_amrwbenc_finalize; object_class->finalize = gst_voamrwbenc_finalize;
object_class->set_property = gst_amrwbenc_set_property; object_class->set_property = gst_voamrwbenc_set_property;
object_class->get_property = gst_amrwbenc_get_property; object_class->get_property = gst_voamrwbenc_get_property;
g_object_class_install_property (object_class, PROP_BANDMODE, g_object_class_install_property (object_class, PROP_BANDMODE,
g_param_spec_enum ("band-mode", "Band Mode", g_param_spec_enum ("band-mode", "Band Mode",
"Encoding Band Mode (Kbps)", GST_AMRWBENC_BANDMODE_TYPE, "Encoding Band Mode (Kbps)", GST_VOAMRWBENC_BANDMODE_TYPE,
BANDMODE_DEFAULT, BANDMODE_DEFAULT,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT | G_PARAM_STATIC_STRINGS));
element_class->change_state = GST_DEBUG_FUNCPTR (gst_amrwbenc_state_change); element_class->change_state = GST_DEBUG_FUNCPTR (gst_voamrwbenc_state_change);
} }
static void static void
gst_amrwbenc_init (GstAmrwbEnc * amrwbenc, GstAmrwbEncClass * klass) gst_voamrwbenc_init (GstVoAmrWbEnc * amrwbenc, GstVoAmrWbEncClass * klass)
{ {
/* create the sink pad */ /* create the sink pad */
amrwbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink"); amrwbenc->sinkpad = gst_pad_new_from_static_template (&sink_template, "sink");
gst_pad_set_setcaps_function (amrwbenc->sinkpad, gst_amrwbenc_setcaps); gst_pad_set_setcaps_function (amrwbenc->sinkpad, gst_voamrwbenc_setcaps);
gst_pad_set_chain_function (amrwbenc->sinkpad, gst_amrwbenc_chain); gst_pad_set_chain_function (amrwbenc->sinkpad, gst_voamrwbenc_chain);
gst_element_add_pad (GST_ELEMENT (amrwbenc), amrwbenc->sinkpad); gst_element_add_pad (GST_ELEMENT (amrwbenc), amrwbenc->sinkpad);
/* create the src pad */ /* create the src pad */
@ -233,11 +230,11 @@ gst_amrwbenc_init (GstAmrwbEnc * amrwbenc, GstAmrwbEncClass * klass)
} }
static void static void
gst_amrwbenc_finalize (GObject * object) gst_voamrwbenc_finalize (GObject * object)
{ {
GstAmrwbEnc *amrwbenc; GstVoAmrWbEnc *amrwbenc;
amrwbenc = GST_AMRWBENC (object); amrwbenc = GST_VOAMRWBENC (object);
g_object_unref (G_OBJECT (amrwbenc->adapter)); g_object_unref (G_OBJECT (amrwbenc->adapter));
amrwbenc->adapter = NULL; amrwbenc->adapter = NULL;
@ -246,13 +243,13 @@ gst_amrwbenc_finalize (GObject * object)
} }
static gboolean static gboolean
gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps) gst_voamrwbenc_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstStructure *structure; GstStructure *structure;
GstAmrwbEnc *amrwbenc; GstVoAmrWbEnc *amrwbenc;
GstCaps *copy; GstCaps *copy;
amrwbenc = GST_AMRWBENC (GST_PAD_PARENT (pad)); amrwbenc = GST_VOAMRWBENC (GST_PAD_PARENT (pad));
structure = gst_caps_get_structure (caps, 0); structure = gst_caps_get_structure (caps, 0);
@ -280,13 +277,13 @@ gst_amrwbenc_setcaps (GstPad * pad, GstCaps * caps)
} }
static GstFlowReturn static GstFlowReturn
gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer) gst_voamrwbenc_chain (GstPad * pad, GstBuffer * buffer)
{ {
GstAmrwbEnc *amrwbenc; GstVoAmrWbEnc *amrwbenc;
GstFlowReturn ret = GST_FLOW_OK; GstFlowReturn ret = GST_FLOW_OK;
const int buffer_size = sizeof (Word16) * L_FRAME16k; const int buffer_size = sizeof (short) * L_FRAME16k;
amrwbenc = GST_AMRWBENC (gst_pad_get_parent (pad)); amrwbenc = GST_VOAMRWBENC (gst_pad_get_parent (pad));
g_return_val_if_fail (amrwbenc->handle, GST_FLOW_WRONG_STATE); g_return_val_if_fail (amrwbenc->handle, GST_FLOW_WRONG_STATE);
@ -332,8 +329,8 @@ gst_amrwbenc_chain (GstPad * pad, GstBuffer * buffer)
/* encode */ /* encode */
outsize = outsize =
E_IF_encode (amrwbenc->handle, amrwbenc->bandmode, (Word16 *) data, E_IF_encode (amrwbenc->handle, amrwbenc->bandmode, (const short *) data,
(UWord8 *) GST_BUFFER_DATA (out), 0); (unsigned char *) GST_BUFFER_DATA (out), 0);
gst_adapter_flush (amrwbenc->adapter, buffer_size); gst_adapter_flush (amrwbenc->adapter, buffer_size);
GST_BUFFER_SIZE (out) = outsize; GST_BUFFER_SIZE (out) = outsize;
@ -351,12 +348,12 @@ done:
} }
static GstStateChangeReturn static GstStateChangeReturn
gst_amrwbenc_state_change (GstElement * element, GstStateChange transition) gst_voamrwbenc_state_change (GstElement * element, GstStateChange transition)
{ {
GstAmrwbEnc *amrwbenc; GstVoAmrWbEnc *amrwbenc;
GstStateChangeReturn ret; GstStateChangeReturn ret;
amrwbenc = GST_AMRWBENC (element); amrwbenc = GST_VOAMRWBENC (element);
switch (transition) { switch (transition) {
case GST_STATE_CHANGE_NULL_TO_READY: case GST_STATE_CHANGE_NULL_TO_READY:

View file

@ -17,31 +17,30 @@
* Boston, MA 02111-1307, USA. * Boston, MA 02111-1307, USA.
*/ */
#ifndef __GST_AMRWBENC_H__ #ifndef __GST_VOAMRWBENC_H__
#define __GST_AMRWBENC_H__ #define __GST_VOAMRWBENC_H__
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <amrwb/enc_if.h> #include <vo-amrwbenc/enc_if.h>
#include <amrwb/typedef.h>
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_AMRWBENC \ #define GST_TYPE_VOAMRWBENC \
(gst_amrwbenc_get_type()) (gst_voamrwbenc_get_type())
#define GST_AMRWBENC(obj) \ #define GST_VOAMRWBENC(obj) \
(G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_AMRWBENC, GstAmrwbEnc)) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_VOAMRWBENC, GstVoAmrWbEnc))
#define GST_AMRWBENC_CLASS(klass) \ #define GST_VOAMRWBENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_AMRWBENC, GstAmrwbEncClass)) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_VOAMRWBENC, GstVoAmrWbEncClass))
#define GST_IS_AMRWBENC(obj) \ #define GST_IS_VOAMRWBENC(obj) \
(G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_AMRWBENC)) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_VOAMRWBENC))
#define GST_IS_AMRWBENC_CLASS(klass) \ #define GST_IS_VOAMRWBENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_AMRWBENC)) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_VOAMRWBENC))
typedef struct _GstAmrwbEnc GstAmrwbEnc; typedef struct _GstVoAmrWbEnc GstVoAmrWbEnc;
typedef struct _GstAmrwbEncClass GstAmrwbEncClass; typedef struct _GstVoAmrWbEncClass GstVoAmrWbEncClass;
struct _GstAmrwbEnc { struct _GstVoAmrWbEnc {
GstElement element; GstElement element;
/* pads */ /* pads */
@ -59,12 +58,12 @@ struct _GstAmrwbEnc {
gint channels, rate; gint channels, rate;
}; };
struct _GstAmrwbEncClass { struct _GstVoAmrWbEncClass {
GstElementClass parent_class; GstElementClass parent_class;
}; };
GType gst_amrwbenc_get_type (void); GType gst_voamrwbenc_get_type (void);
G_END_DECLS G_END_DECLS
#endif /* __GST_AMRWBENC_H__ */ #endif /* __GST_VOAMRWBENC_H__ */