Ported GSM Encoder to GStreamer 0.9

Original commit message from CVS:
Ported GSM Encoder to GStreamer 0.9
This commit is contained in:
Flavio Oliveira 2005-09-02 20:21:17 +00:00
parent 741afd1f75
commit 36634356e6
7 changed files with 55 additions and 34 deletions

View file

@ -1,3 +1,12 @@
2005-09-02 Flavio Oliveira <flavio.oliveira@indt.org.br>
* configure.ac:
* ext/Makefile.am:
* ext/gsm/Makefile.am:
* ext/gsm/gstgsm.c:
* ext/gsm/gstgsmenc.c: Ported GSM Encoder to GStreamer 0.9.
* PORTED_09:
2005-08-31 Flavio Oliveira <flavio.oliveira@indt.org.br>
* configure.ac:

View file

@ -1,8 +1,9 @@
When porting a plugin start with 0.8 CVS head, not the old code in this module. There are many bugfixes which have gone into 0.8 which you want to keep.
List of ported plugins (update when you commit a ported plugin):
faac (fcarvalho)
wavenc (fcarvalho)
gsmenc (fcarvalho)
faac (fcarvalho)
wavenc (fcarvalho)
effectv (wim)
mad (wim)
videofilter (wim)

View file

@ -363,6 +363,19 @@ return 0;
AC_SUBST(FAAD_LIBS)
])
dnl *** gsm ***
translit(dnm, m, l) AM_CONDITIONAL(USE_GSM, true)
GST_CHECK_FEATURE(GSM, [GSM library], gsmenc gsmdec, [
GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm.h, GSM_LIBS="-lgsm")
if test $HAVE_GSM != "yes"; then
GST_CHECK_LIBHEADER(GSM, gsm, gsm_create, , gsm/gsm.h, GSM_LIBS="-lgsm")
if test $HAVE_GSM = "yes"; then
AC_DEFINE(GSM_HEADER_IN_SUBDIR, 1, [Define if GSM header in gsm/ subdir])
fi
fi
AC_SUBST(GSM_LIBS)
])
dnl also add builddir include for enumtypes and marshal
GST_CFLAGS="-I\$(top_srcdir)/gst-libs -I\$(top_builddir)/gst-libs $GST_CFLAGS $GST_ERROR"
@ -424,6 +437,7 @@ sys/Makefile
ext/Makefile
ext/faac/Makefile
ext/faad/Makefile
ext/gsm/Makefile
common/Makefile
common/m4/Makefile
m4/Makefile

View file

@ -76,11 +76,11 @@ endif
## FESTIVAL_DIR=
## endif
# if USE_GSM
# GSM_DIR=gsm
# else
if USE_GSM
GSM_DIR=gsm
else
GSM_DIR=
# endif
endif
# if USE_HERMES
# HERMES_DIR=hermes
@ -261,6 +261,7 @@ DIST_SUBDIRS=\
amrnb \
faac \
faad \
gsm \
lame \
mad \
mpeg2dec \

View file

@ -1,15 +1,9 @@
plugin_LTLIBRARIES = libgstgsm.la
libgstgsm_la_SOURCES = gstgsm.c gstgsmdec.c gstgsmenc.c
libgstgsm_la_CFLAGS = $(GST_CFLAGS)
libgstgsm_la_LIBADD = $(GSM_LIBS)
libgstgsm_la_SOURCES = gstgsm.c gstgsmenc.c
libgstgsm_la_CFLAGS = $(GST_CFLAGS) $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstgsm_la_LIBADD = $(GSM_LIBS) $(GST_PLUGINS_BASE_LIBS) \
-lgstaudio-@GST_MAJORMINOR@
libgstgsm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstgsmenc.h gstgsmdec.h
#check_PROGRAMS = test
#test_CFLAGS = $(GSM_CFLAGS)
#test_LDADD = $(GSM_LIBS) $(top_srcdir)/gst/libgst.la
#test_SOURCES = test.c
noinst_HEADERS = gstgsmenc.h

View file

@ -29,10 +29,11 @@ plugin_init (GstPlugin * plugin)
{
if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC))
return FALSE;
/*
if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY,
GST_TYPE_GSMDEC))
return FALSE;
*/
return TRUE;
}

View file

@ -51,7 +51,7 @@ static void gst_gsmenc_base_init (gpointer g_class);
static void gst_gsmenc_class_init (GstGSMEnc * klass);
static void gst_gsmenc_init (GstGSMEnc * gsmenc);
static void gst_gsmenc_chain (GstPad * pad, GstData * _data);
static GstFlowReturn gst_gsmenc_chain (GstPad * pad, GstBuffer * buf);
static GstElementClass *parent_class = NULL;
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
@ -148,27 +148,28 @@ gst_gsmenc_init (GstGSMEnc * gsmenc)
gsmenc->next_ts = 0;
}
static void
gst_gsmenc_chain (GstPad * pad, GstData * _data)
static GstFlowReturn
gst_gsmenc_chain (GstPad * pad, GstBuffer * buf)
{
GstGSMEnc *gsmenc;
/*
g_return_if_fail (pad != NULL);
g_return_if_fail (GST_IS_PAD (pad));
g_return_if_fail (_data != NULL);
*/
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
if (GST_IS_EVENT (_data)) {
GstEvent *event = GST_EVENT (_data);
if (GST_IS_EVENT (buf)) {
GstEvent *event = GST_EVENT (buf);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:{
gst_element_set_eos (GST_ELEMENT (gsmenc));
gst_pad_push (gsmenc->srcpad, _data);
gst_pad_push_event (gsmenc->srcpad, gst_event_new_eos ());
gst_pad_push (gsmenc->srcpad, buf);
break;
}
case GST_EVENT_DISCONTINUOUS:{
case GST_EVENT_NEWSEGMENT:{
/* drop the discontinuity */
break;
}
@ -177,9 +178,8 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
break;
}
}
return;
} else if (GST_IS_BUFFER (_data)) {
GstBuffer *buf = GST_BUFFER (_data);
return GST_FLOW_OK;
} else if (GST_IS_BUFFER (buf)) {
gsm_signal *data;
guint size;
@ -200,7 +200,7 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
gsm_encode (gsmenc->state, gsmenc->buffer,
(gsm_byte *) GST_BUFFER_DATA (outbuf));
gst_pad_push (gsmenc->srcpad, GST_DATA (outbuf));
gst_pad_push (gsmenc->srcpad, outbuf);
size -= (160 - gsmenc->bufsize);
data += (160 - gsmenc->bufsize);
@ -217,7 +217,7 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
gsm_encode (gsmenc->state, data, (gsm_byte *) GST_BUFFER_DATA (outbuf));
gst_pad_push (gsmenc->srcpad, GST_DATA (outbuf));
gst_pad_push (gsmenc->srcpad, outbuf);
size -= 160;
data += 160;
@ -229,7 +229,8 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
gsmenc->bufsize += size;
}
gst_buffer_unref (buf);
return;
/*gst_buffer_unref (buf); */
return GST_FLOW_OK;
}
return GST_FLOW_OK;
}