Commit 0582ab12 authored by Andy Wingo's avatar Andy Wingo

ext/ladspa/gstladspa.*: Halfway-ported. Doesn't compile yet.

Original commit message from CVS:
2005-08-25  Andy Wingo  <wingo@pobox.com>

* ext/ladspa/gstladspa.h:
* ext/ladspa/gstladspa.c: Halfway-ported. Doesn't compile yet.

* ext/ladspa/gstsignalprocessor.h:
* ext/ladspa/gstsignalprocessor.c: New files, the start of a base
class for DSP elements.

* configure.ac: Sort the external libs checks, add a ladspa check,
output the ladspa makefile.
parent 38d8867a
2005-08-25 Andy Wingo <wingo@pobox.com>
* ext/ladspa/gstladspa.h:
* ext/ladspa/gstladspa.c: Halfway-ported. Doesn't compile yet.
* ext/ladspa/gstsignalprocessor.h:
* ext/ladspa/gstsignalprocessor.c: New files, the start of a base
class for DSP elements.
* configure.ac: Sort the external libs checks, add a ladspa check,
output the ladspa makefile.
2005-08-25 Owen Fraser-Green <owen@discobabe.net>
* gst/realmedia/rmdemux.c (gst_rmdemux_loop, gst_rmdemux_chain):
......
......@@ -379,6 +379,19 @@ GST_CHECK_FEATURE(AMRNB, [AMR-NB], amrnbdec amrnbenc, [
AC_SUBST(AMRNB_LIBS))
])
dnl **** ESound ****
translit(dnm, m, l) AM_CONDITIONAL(USE_ESD, true)
GST_CHECK_FEATURE(ESD, [esound plug-ins], esdsink, [
PKG_CHECK_MODULES(ESD, esound >= 0.2.12, [
HAVE_ESD="yes"
AC_SUBST(ESD_CFLAGS)
AC_SUBST(ESD_LIBS)
], [
AM_PATH_ESD(0.2.12, HAVE_ESD="yes", HAVE_ESD="no")
AS_SCRUB_INCLUDE(ESD_CFLAGS)
])
])
dnl **** Free AAC Decoder (FAAD) ****
translit(dnm, m, l) AM_CONDITIONAL(USE_FAAD, true)
GST_CHECK_FEATURE(FAAD, [AAC decoder plug-in], faad, [
......@@ -426,6 +439,33 @@ GST_CHECK_FEATURE(FLAC, [FLAC lossless audio], flacenc flacdec, [
AC_SUBST(FLAC_LIBS)
])
dnl *** jpeg ***
dnl FIXME: we could use header checks here as well IMO
translit(dnm, m, l) AM_CONDITIONAL(USE_JPEG, true)
GST_CHECK_FEATURE(JPEG, [jpeg], jpegenc jpegdec, [
AC_ARG_WITH(jpeg-mmx,
[ --with-jpeg-mmx, path to MMX'ified JPEG library])
OLD_LIBS="$LIBS"
if test x$with_jpeg_mmx != x; then
LIBS="$LIBS -L$with_jpeg_mmx"
fi
AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
JPEG_LIBS="$LIBS -ljpeg-mmx"
LIBS="$OLD_LIBS"
if test x$HAVE_JPEG != xyes; then
AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
JPEG_LIBS="-ljpeg"
fi
AC_SUBST(JPEG_LIBS)
])
dnl *** ladspa ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LADSPA, true)
GST_CHECK_FEATURE(LADSPA, [ladspa], ladspa, [
AC_CHECK_HEADER(ladspa.h, HAVE_LADSPA="yes", HAVE_LADSPA="no")
])
dnl *** lame ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LAME, true)
GST_CHECK_FEATURE(LAME, [lame mp3 encoder library], lame, [
......@@ -467,47 +507,14 @@ GST_CHECK_FEATURE(LIBDV, [libdv DV/video decoder], dvdec, [
AC_SUBST(LIBDV_LIBS)
])
dnl *** shout2 ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT2, true)
GST_CHECK_FEATURE(SHOUT2, [shout2 plug-in], shout2send, [
PKG_CHECK_MODULES(SHOUT2, shout >= 2.0, [
HAVE_SHOUT2="yes"
AC_SUBST(SHOUT2_CFLAGS)
AC_SUBST(SHOUT2_LIBS)
], [
AM_PATH_SHOUT2(HAVE_SHOUT2="yes", HAVE_SHOUT2="no")
AC_SUBST(SHOUT2_CFLAGS)
AC_SUBST(SHOUT2_LIBS)
])
])
dnl *** sidplay : works with libsidplay 1.36.x (not 2.x.x) ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true)
GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [
GST_PATH_SIDPLAY()
])
dnl *** jpeg ***
dnl FIXME: we could use header checks here as well IMO
translit(dnm, m, l) AM_CONDITIONAL(USE_JPEG, true)
GST_CHECK_FEATURE(JPEG, [jpeg], jpegenc jpegdec, [
AC_ARG_WITH(jpeg-mmx,
[ --with-jpeg-mmx, path to MMX'ified JPEG library])
OLD_LIBS="$LIBS"
if test x$with_jpeg_mmx != x; then
LIBS="$LIBS -L$with_jpeg_mmx"
fi
AC_CHECK_LIB(jpeg-mmx, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
JPEG_LIBS="$LIBS -ljpeg-mmx"
LIBS="$OLD_LIBS"
if test x$HAVE_JPEG != xyes; then
AC_CHECK_LIB(jpeg, jpeg_set_defaults, HAVE_JPEG="yes", HAVE_JPEG="no")
JPEG_LIBS="-ljpeg"
fi
AC_SUBST(JPEG_LIBS)
dnl *** libpng ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBPNG, true)
GST_CHECK_FEATURE(LIBPNG, [libpng PNG encoder], pngenc, [
PKG_CHECK_MODULES(LIBPNG, libpng12, HAVE_LIBPNG="yes", HAVE_LIBPNG="no")
AC_SUBST(LIBPNG_CFLAGS)
AC_SUBST(LIBPNG_LIBS)
])
dnl *** mad ***
dnl FIXME: we could use header checks here as well IMO
translit(dnm, m, l) AM_CONDITIONAL(USE_MAD, true)
......@@ -563,25 +570,24 @@ GST_CHECK_FEATURE(DV1394, [raw1394 and avc1394 library], dv1394src, [
fi
])
dnl **** ESound ****
translit(dnm, m, l) AM_CONDITIONAL(USE_ESD, true)
GST_CHECK_FEATURE(ESD, [esound plug-ins], esdsink, [
PKG_CHECK_MODULES(ESD, esound >= 0.2.12, [
HAVE_ESD="yes"
AC_SUBST(ESD_CFLAGS)
AC_SUBST(ESD_LIBS)
dnl *** shout2 ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SHOUT2, true)
GST_CHECK_FEATURE(SHOUT2, [shout2 plug-in], shout2send, [
PKG_CHECK_MODULES(SHOUT2, shout >= 2.0, [
HAVE_SHOUT2="yes"
AC_SUBST(SHOUT2_CFLAGS)
AC_SUBST(SHOUT2_LIBS)
], [
AM_PATH_ESD(0.2.12, HAVE_ESD="yes", HAVE_ESD="no")
AS_SCRUB_INCLUDE(ESD_CFLAGS)
AM_PATH_SHOUT2(HAVE_SHOUT2="yes", HAVE_SHOUT2="no")
AC_SUBST(SHOUT2_CFLAGS)
AC_SUBST(SHOUT2_LIBS)
])
])
dnl *** libpng ***
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBPNG, true)
GST_CHECK_FEATURE(LIBPNG, [libpng PNG encoder], pngenc, [
PKG_CHECK_MODULES(LIBPNG, libpng12, HAVE_LIBPNG="yes", HAVE_LIBPNG="no")
AC_SUBST(LIBPNG_CFLAGS)
AC_SUBST(LIBPNG_LIBS)
dnl *** sidplay : works with libsidplay 1.36.x (not 2.x.x) ***
translit(dnm, m, l) AM_CONDITIONAL(USE_SIDPLAY, true)
GST_CHECK_FEATURE(SIDPLAY, [sidplay plug-in], sidplay, [
GST_PATH_SIDPLAY()
])
dnl *** speex >= 1.0.4 or >= 1.1.5 ***
......@@ -713,6 +719,7 @@ ext/aalib/Makefile
ext/dv/Makefile
ext/flac/Makefile
ext/gconf/Makefile
ext/ladspa/Makefile
ext/lame/Makefile
ext/libcaca/Makefile
ext/libpng/Makefile
......
......@@ -440,20 +440,21 @@ SUBDIRS=\
$(XVID_DIR)
DIST_SUBDIRS=\
mad \
gconf \
shout2 \
sidplay \
aalib \
libcaca \
amrnb \
esd \
raw1394 \
dv \
amrnb \
faad \
flac \
mpeg2dec \
gconf \
jpeg \
libpng \
ladspa \
lame \
libcaca \
libpng \
mad \
mpeg2dec \
raw1394 \
shout2 \
sidplay \
speex
plugin_LTLIBRARIES = libgstladspa.la
libgstladspa_la_SOURCES = gstladspa.c search.c load.c
libgstladspa_la_CFLAGS = $(GST_CFLAGS)
libgstladspa_la_LIBADD = $(GST_LIBS)
libgstladspa_la_SOURCES = gstsignalprocessor.c gstladspa.c search.c load.c
libgstladspa_la_CFLAGS = $(GST_CFLAGS) $(GST_PLUGINS_BASE_CFLAGS)
libgstladspa_la_LIBADD = $(GST_PLUGINS_BASE_LIBS) -lgstaudio-@GST_MAJORMINOR@
libgstladspa_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
noinst_HEADERS = gstladspa.h utils.h
noinst_HEADERS = gstsignalprocessor.h gstladspa.h utils.h
......@@ -36,50 +36,34 @@
#define LADSPA_VERSION "1.0"
#endif
static GstStaticCaps ladspa_pad_caps =
GST_STATIC_CAPS (GST_AUDIO_FLOAT_STANDARD_PAD_TEMPLATE_CAPS);
static void gst_ladspa_class_init (GstLADSPAClass * klass);
static void gst_ladspa_base_init (GstLADSPAClass * klass);
static void gst_ladspa_init (GstLADSPA * ladspa);
static void gst_ladspa_update_int (const GValue * value, gpointer data);
static GstPadLinkReturn gst_ladspa_link (GstPad * pad, const GstCaps * caps);
GST_BOILERPLATE (GstLADSPA, GST_TYPE_LADSPA, GstSignalProcessor,
GST_TYPE_SIGNAL_PROCESSOR);
static void gst_ladspa_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec);
static void gst_ladspa_get_property (GObject * object, guint prop_id,
GValue * value, GParamSpec * pspec);
static gboolean gst_ladspa_instantiate (GstLADSPA * ladspa);
static void gst_ladspa_activate (GstLADSPA * ladspa);
static void gst_ladspa_deactivate (GstLADSPA * ladspa);
static gboolean gst_ladspa_setup (GstSignalProcessor * sigproc,
guint sample_rate, guint buffer_frames);
static gboolean gst_ladspa_activate (GstSignalProcessor * sigproc);
static gboolean gst_ladspa_deactivate (GstSignalProcessor * sigproc);
static gboolean gst_ladspa_process (GstSignalProcessor * sigproc);
static GstElementStateReturn gst_ladspa_change_state (GstElement * element);
static void gst_ladspa_loop (GstElement * element);
static void gst_ladspa_chain (GstPad * pad, GstData * _data);
static GstData *gst_ladspa_get (GstPad * pad);
static GstElementClass *parent_class = NULL;
static GstPlugin *ladspa_plugin;
static GHashTable *ladspa_descriptors;
enum
{
ARG_0,
ARG_SAMPLERATE,
ARG_BUFFERSIZE,
ARG_LAST
};
GST_DEBUG_CATEGORY_STATIC (ladspa_debug);
#define GST_CAT_DEFAULT ladspa_debug
static void
gst_ladspa_base_init (GstLADSPAClass * klass)
{
GstElementClass *element_class = GST_ELEMENT_CLASS (klass);
GstSignalProcessorClass *gsp_class = GST_SIGNAL_PROCESSOR_CLASS (klass);
GstPadTemplate *templ;
GstElementDetails *details;
LADSPA_Descriptor *desc;
......@@ -92,27 +76,24 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
g_assert (desc);
/* pad templates */
klass->numports = desc->PortCount;
klass->numsinkpads = 0;
klass->numsrcpads = 0;
gsp_class->num_audio_in = 0;
gsp_class->num_audio_out = 0;
/* control gets set in the class init */
for (j = 0; j < desc->PortCount; j++) {
if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) {
LADSPA_PortDescriptor p = desc->PortDescriptors[j];
if (LADSPA_IS_PORT_AUDIO (p)) {
gchar *name = g_strdup ((gchar *) desc->PortNames[j]);
g_strcanon (name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
/* the factories take ownership of the name */
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j])) {
templ = gst_pad_template_new (name, GST_PAD_SINK, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsinkpads++;
} else {
templ = gst_pad_template_new (name, GST_PAD_SRC, GST_PAD_ALWAYS,
gst_caps_copy (gst_static_caps_get (&ladspa_pad_caps)));
klass->numsrcpads++;
}
gst_element_class_add_pad_template (element_class, templ);
if (LADSPA_IS_PORT_INPUT (p))
gst_signal_processor_class_add_pad_template (name, GST_PAD_SINK,
gsp_class->num_audio_in++);
else
gst_signal_processor_class_add_pad_template (name, GST_PAD_SRC,
gsp_class->num_audio_out++);
}
}
......@@ -125,28 +106,24 @@ gst_ladspa_base_init (GstLADSPAClass * klass)
details->author = g_locale_to_utf8 (desc->Maker, -1, NULL, NULL, NULL);
if (!details->author)
details->author = g_strdup ("no author available");
if ((klass->numsinkpads > 0) && (klass->numsrcpads > 0))
details->klass = "Filter/Effect/Audio/LADSPA";
else if ((klass->numsinkpads == 0) && (klass->numsrcpads > 0))
if (gsp_class->num_audio_in == 0)
details->klass = "Source/Audio/LADSPA";
else if ((klass->numsinkpads > 0) && (klass->numsrcpads == 0))
else if (gsp_class->num_audio_out == 0)
details->klass = "Sink/Audio/LADSPA";
else
details->klass = "Filter/Effect/Audio/LADSPA"; /* whatever this is */
details->klass = "Filter/Effect/Audio/LADSPA";
gst_element_class_set_details (element_class, details);
klass->srcpad_portnums = g_new0 (gint, klass->numsrcpads);
klass->sinkpad_portnums = g_new0 (gint, klass->numsinkpads);
sinkcount = 0;
srccount = 0;
klass->audio_in_portnums = g_new0 (gint, klass->num_audio_in);
klass->audio_out_portnums = g_new0 (gint, gsp_class->num_audio_out);
/* walk through the ports, note the portnums for srcpads, sinkpads */
sinkcount = srccount = 0;
for (j = 0; j < desc->PortCount; j++) {
if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) {
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j]))
klass->sinkpad_portnums[sinkcount++] = j;
klass->audio_in_portnums[sinkcount++] = j;
else
klass->srcpad_portnums[srccount++] = j;
klass->audio_out_portnums[srccount++] = j;
}
}
......@@ -158,6 +135,7 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
{
GObjectClass *gobject_class;
GstElementClass *gstelement_class;
GstSignalProcessorClass *gsp_class = GST_SIGNAL_PROCESSOR_CLASS (klass);
LADSPA_Descriptor *desc;
gint i, current_portnum, controlcount;
gint hintdesc;
......@@ -173,6 +151,58 @@ gst_ladspa_class_init (GstLADSPAClass * klass)
gstelement_class->change_state = gst_ladspa_change_state;
gsp_class->num_control_in = 0;
gsp_class->num_control_in = 0;
for (j = 0; j < desc->PortCount; j++) {
LADSPA_PortDescriptor p = desc->PortDescriptors[j];
if (LADSPA_IS_PORT_AUDIO (p)) {
gchar *name = g_strdup ((gchar *) desc->PortNames[j]);
g_strcanon (name, G_CSET_A_2_Z G_CSET_a_2_z G_CSET_DIGITS "-", '-');
if (LADSPA_IS_PORT_INPUT (p))
gst_signal_processor_class_add_pad_template (name, GST_PAD_SINK,
gsp_class->num_audio_in++);
else
gst_signal_processor_class_add_pad_template (name, GST_PAD_SRC,
gsp_class->num_audio_out++);
}
}
/* construct the element details struct */
details = g_new0 (GstElementDetails, 1);
details->longname = g_locale_to_utf8 (desc->Name, -1, NULL, NULL, NULL);
if (!details->longname)
details->longname = g_strdup ("no description available");
details->description = details->longname;
details->author = g_locale_to_utf8 (desc->Maker, -1, NULL, NULL, NULL);
if (!details->author)
details->author = g_strdup ("no author available");
if (gsp_class->num_audio_in == 0)
details->klass = "Source/Audio/LADSPA";
else if (gsp_class->num_audio_out == 0)
details->klass = "Sink/Audio/LADSPA";
else
details->klass = "Filter/Effect/Audio/LADSPA";
gst_element_class_set_details (element_class, details);
klass->audio_in_portnums = g_new0 (gint, klass->num_audio_in);
klass->audio_out_portnums = g_new0 (gint, gsp_class->num_audio_out);
sinkcount = srccount = 0;
for (j = 0; j < desc->PortCount; j++) {
if (LADSPA_IS_PORT_AUDIO (desc->PortDescriptors[j])) {
if (LADSPA_IS_PORT_INPUT (desc->PortDescriptors[j]))
klass->audio_in_portnums[sinkcount++] = j;
else
klass->audio_out_portnums[srccount++] = j;
}
}
klass->descriptor = desc;
/* look up and store the ladspa descriptor */
desc = g_hash_table_lookup (ladspa_descriptors,
GINT_TO_POINTER (G_TYPE_FROM_CLASS (klass)));
......
......@@ -24,15 +24,15 @@
#define __GST_LADSPA_H__
#include <ladspa.h>
#include <gst/gst.h>
#include <gst/bytestream/bytestream.h>
#include "ladspa.h"
#include "gstsignalprocessor.h"
G_BEGIN_DECLS
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
typedef struct _ladspa_control_info {
gchar *name;
......@@ -43,37 +43,26 @@ typedef struct _ladspa_control_info {
gboolean toggled, logarithmic, integer, writable;
} ladspa_control_info;
typedef struct _GstLADSPA GstLADSPA;
typedef struct _GstLADSPAClass GstLADSPAClass;
struct _GstLADSPA {
GstElement element;
GstSignalProcessor parent;
LADSPA_Descriptor *descriptor;
LADSPA_Handle *handle;
gfloat *controls;
GstPad **sinkpads,
**srcpads;
gboolean activated;
gint samplerate, buffer_frames;
gint64 timestamp;
gboolean inplace_broken;
};
struct _GstLADSPAClass {
GstElementClass parent_class;
GstSignalProcessorClass parent_class;
LADSPA_Descriptor *descriptor;
gint numports,
numsinkpads,
numsrcpads,
numcontrols;
gint *sinkpad_portnums,
*srcpad_portnums,
*control_portnums;
......@@ -82,9 +71,7 @@ struct _GstLADSPAClass {
};
#ifdef __cplusplus
}
#endif /* __cplusplus */
G_END_DECLS
#endif /* __GST_LADSPA_H__ */
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment