mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
Ported GSM Encoder to GStreamer 0.9
Original commit message from CVS: Ported GSM Encoder to GStreamer 0.9
This commit is contained in:
parent
741afd1f75
commit
36634356e6
7 changed files with 55 additions and 34 deletions
|
@ -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>
|
2005-08-31 Flavio Oliveira <flavio.oliveira@indt.org.br>
|
||||||
|
|
||||||
* configure.ac:
|
* configure.ac:
|
||||||
|
|
|
@ -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.
|
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):
|
List of ported plugins (update when you commit a ported plugin):
|
||||||
faac (fcarvalho)
|
gsmenc (fcarvalho)
|
||||||
wavenc (fcarvalho)
|
faac (fcarvalho)
|
||||||
|
wavenc (fcarvalho)
|
||||||
effectv (wim)
|
effectv (wim)
|
||||||
mad (wim)
|
mad (wim)
|
||||||
videofilter (wim)
|
videofilter (wim)
|
||||||
|
|
14
configure.ac
14
configure.ac
|
@ -363,6 +363,19 @@ return 0;
|
||||||
AC_SUBST(FAAD_LIBS)
|
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
|
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"
|
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/Makefile
|
||||||
ext/faac/Makefile
|
ext/faac/Makefile
|
||||||
ext/faad/Makefile
|
ext/faad/Makefile
|
||||||
|
ext/gsm/Makefile
|
||||||
common/Makefile
|
common/Makefile
|
||||||
common/m4/Makefile
|
common/m4/Makefile
|
||||||
m4/Makefile
|
m4/Makefile
|
||||||
|
|
|
@ -76,11 +76,11 @@ endif
|
||||||
## FESTIVAL_DIR=
|
## FESTIVAL_DIR=
|
||||||
## endif
|
## endif
|
||||||
|
|
||||||
# if USE_GSM
|
if USE_GSM
|
||||||
# GSM_DIR=gsm
|
GSM_DIR=gsm
|
||||||
# else
|
else
|
||||||
GSM_DIR=
|
GSM_DIR=
|
||||||
# endif
|
endif
|
||||||
|
|
||||||
# if USE_HERMES
|
# if USE_HERMES
|
||||||
# HERMES_DIR=hermes
|
# HERMES_DIR=hermes
|
||||||
|
@ -261,6 +261,7 @@ DIST_SUBDIRS=\
|
||||||
amrnb \
|
amrnb \
|
||||||
faac \
|
faac \
|
||||||
faad \
|
faad \
|
||||||
|
gsm \
|
||||||
lame \
|
lame \
|
||||||
mad \
|
mad \
|
||||||
mpeg2dec \
|
mpeg2dec \
|
||||||
|
|
|
@ -1,15 +1,9 @@
|
||||||
|
|
||||||
plugin_LTLIBRARIES = libgstgsm.la
|
plugin_LTLIBRARIES = libgstgsm.la
|
||||||
|
|
||||||
libgstgsm_la_SOURCES = gstgsm.c gstgsmdec.c gstgsmenc.c
|
libgstgsm_la_SOURCES = gstgsm.c gstgsmenc.c
|
||||||
libgstgsm_la_CFLAGS = $(GST_CFLAGS)
|
libgstgsm_la_CFLAGS = $(GST_CFLAGS) $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
|
||||||
libgstgsm_la_LIBADD = $(GSM_LIBS)
|
libgstgsm_la_LIBADD = $(GSM_LIBS) $(GST_PLUGINS_BASE_LIBS) \
|
||||||
|
-lgstaudio-@GST_MAJORMINOR@
|
||||||
libgstgsm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
libgstgsm_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
|
||||||
|
|
||||||
noinst_HEADERS = gstgsmenc.h gstgsmdec.h
|
noinst_HEADERS = gstgsmenc.h
|
||||||
|
|
||||||
#check_PROGRAMS = test
|
|
||||||
|
|
||||||
#test_CFLAGS = $(GSM_CFLAGS)
|
|
||||||
#test_LDADD = $(GSM_LIBS) $(top_srcdir)/gst/libgst.la
|
|
||||||
#test_SOURCES = test.c
|
|
||||||
|
|
|
@ -29,10 +29,11 @@ plugin_init (GstPlugin * plugin)
|
||||||
{
|
{
|
||||||
if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC))
|
if (!gst_element_register (plugin, "gsmenc", GST_RANK_NONE, GST_TYPE_GSMENC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
/*
|
||||||
if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY,
|
if (!gst_element_register (plugin, "gsmdec", GST_RANK_PRIMARY,
|
||||||
GST_TYPE_GSMDEC))
|
GST_TYPE_GSMDEC))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
*/
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_class_init (GstGSMEnc * klass);
|
||||||
static void gst_gsmenc_init (GstGSMEnc * gsmenc);
|
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 GstElementClass *parent_class = NULL;
|
||||||
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
|
static guint gst_gsmenc_signals[LAST_SIGNAL] = { 0 };
|
||||||
|
@ -148,27 +148,28 @@ gst_gsmenc_init (GstGSMEnc * gsmenc)
|
||||||
gsmenc->next_ts = 0;
|
gsmenc->next_ts = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static GstFlowReturn
|
||||||
gst_gsmenc_chain (GstPad * pad, GstData * _data)
|
gst_gsmenc_chain (GstPad * pad, GstBuffer * buf)
|
||||||
{
|
{
|
||||||
GstGSMEnc *gsmenc;
|
GstGSMEnc *gsmenc;
|
||||||
|
|
||||||
|
/*
|
||||||
g_return_if_fail (pad != NULL);
|
g_return_if_fail (pad != NULL);
|
||||||
g_return_if_fail (GST_IS_PAD (pad));
|
g_return_if_fail (GST_IS_PAD (pad));
|
||||||
g_return_if_fail (_data != NULL);
|
g_return_if_fail (_data != NULL);
|
||||||
|
*/
|
||||||
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
|
gsmenc = GST_GSMENC (GST_OBJECT_PARENT (pad));
|
||||||
|
|
||||||
if (GST_IS_EVENT (_data)) {
|
if (GST_IS_EVENT (buf)) {
|
||||||
GstEvent *event = GST_EVENT (_data);
|
GstEvent *event = GST_EVENT (buf);
|
||||||
|
|
||||||
switch (GST_EVENT_TYPE (event)) {
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
case GST_EVENT_EOS:{
|
case GST_EVENT_EOS:{
|
||||||
gst_element_set_eos (GST_ELEMENT (gsmenc));
|
gst_pad_push_event (gsmenc->srcpad, gst_event_new_eos ());
|
||||||
gst_pad_push (gsmenc->srcpad, _data);
|
gst_pad_push (gsmenc->srcpad, buf);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case GST_EVENT_DISCONTINUOUS:{
|
case GST_EVENT_NEWSEGMENT:{
|
||||||
/* drop the discontinuity */
|
/* drop the discontinuity */
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -177,9 +178,8 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return GST_FLOW_OK;
|
||||||
} else if (GST_IS_BUFFER (_data)) {
|
} else if (GST_IS_BUFFER (buf)) {
|
||||||
GstBuffer *buf = GST_BUFFER (_data);
|
|
||||||
gsm_signal *data;
|
gsm_signal *data;
|
||||||
guint size;
|
guint size;
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
|
||||||
gsm_encode (gsmenc->state, gsmenc->buffer,
|
gsm_encode (gsmenc->state, gsmenc->buffer,
|
||||||
(gsm_byte *) GST_BUFFER_DATA (outbuf));
|
(gsm_byte *) GST_BUFFER_DATA (outbuf));
|
||||||
|
|
||||||
gst_pad_push (gsmenc->srcpad, GST_DATA (outbuf));
|
gst_pad_push (gsmenc->srcpad, outbuf);
|
||||||
|
|
||||||
size -= (160 - gsmenc->bufsize);
|
size -= (160 - gsmenc->bufsize);
|
||||||
data += (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));
|
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;
|
size -= 160;
|
||||||
data += 160;
|
data += 160;
|
||||||
|
@ -229,7 +229,8 @@ gst_gsmenc_chain (GstPad * pad, GstData * _data)
|
||||||
gsmenc->bufsize += size;
|
gsmenc->bufsize += size;
|
||||||
}
|
}
|
||||||
|
|
||||||
gst_buffer_unref (buf);
|
/*gst_buffer_unref (buf); */
|
||||||
return;
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
return GST_FLOW_OK;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue