configure.ac: Enable libvisual plugin.

Original commit message from CVS:
* configure.ac: Enable libvisual plugin.
* ext/libvisual/Makefile.am:
* ext/libvisual/visual.c: Fixes to make it compile.
This commit is contained in:
David Schleef 2005-09-06 22:29:00 +00:00
parent 79e25443db
commit f50da006ec
4 changed files with 28 additions and 20 deletions

View file

@ -1,3 +1,9 @@
2005-09-06 David Schleef <ds@schleef.org>
* configure.ac: Enable libvisual plugin.
* ext/libvisual/Makefile.am:
* ext/libvisual/visual.c: Fixes to make it compile.
=== release 0.9.2 === === release 0.9.2 ===
2005-09-06 Thomas Vander Stichele <thomas at apestaart dot org> 2005-09-06 Thomas Vander Stichele <thomas at apestaart dot org>

View file

@ -566,7 +566,6 @@ GST_CHECK_FEATURE(GNOME_VFS, [Gnome VFS], gnomevfssrc, [
]) ])
dnl *** libvisual *** dnl *** libvisual ***
USE_LIBVISUAL=no
translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true) translit(dnm, m, l) AM_CONDITIONAL(USE_LIBVISUAL, true)
GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [ GST_CHECK_FEATURE(LIBVISUAL, [libvisual visualization plugins], libvisual, [
PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no") PKG_CHECK_MODULES(LIBVISUAL, libvisual = 0.2.0, HAVE_LIBVISUAL="yes", HAVE_LIBVISUAL="no")

View file

@ -4,5 +4,4 @@ libgstlibvisual_la_SOURCES = visual.c
libgstlibvisual_la_CFLAGS = $(GST_CFLAGS) $(LIBVISUAL_CFLAGS) libgstlibvisual_la_CFLAGS = $(GST_CFLAGS) $(LIBVISUAL_CFLAGS)
libgstlibvisual_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS) libgstlibvisual_la_LDFLAGS = $(GST_PLUGIN_LDFLAGS)
libgstlibvisual_la_LIBADD = \ libgstlibvisual_la_LIBADD = \
libgstbytestream-$(GST_MAJORMINOR).la \
$(LIBVISUAL_LIBS) $(LIBVISUAL_LIBS)

View file

@ -22,7 +22,7 @@
#endif #endif
#include <gst/gst.h> #include <gst/gst.h>
#include <gst/bytestream/adapter.h> #include <gst/base/gstadapter.h>
#include <gst/video/video.h> #include <gst/video/video.h>
#include <gst/audio/audio.h> #include <gst/audio/audio.h>
#include <libvisual/libvisual.h> #include <libvisual/libvisual.h>
@ -104,11 +104,10 @@ static void gst_visual_dispose (GObject * object);
static GstStateChangeReturn gst_visual_change_state (GstElement * element, static GstStateChangeReturn gst_visual_change_state (GstElement * element,
GstStateChange transition); GstStateChange transition);
static void gst_visual_chain (GstPad * pad, GstData * _data); static GstFlowReturn gst_visual_chain (GstPad * pad, GstBuffer * buffer);
static GstPadLinkReturn gst_visual_sinklink (GstPad * pad, static GstPadLinkReturn gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps);
const GstCaps * caps); static GstPadLinkReturn gst_visual_src_setcaps (GstPad * pad, GstCaps * caps);
static GstPadLinkReturn gst_visual_srclink (GstPad * pad, const GstCaps * caps);
static GstCaps *gst_visual_getcaps (GstPad * pad); static GstCaps *gst_visual_getcaps (GstPad * pad);
static void libvisual_log_handler (const char *message, const char *funcname, static void libvisual_log_handler (const char *message, const char *funcname,
void *priv); void *priv);
@ -200,14 +199,14 @@ gst_visual_init (GstVisual * visual)
visual->sinkpad = visual->sinkpad =
gst_pad_new_from_template (gst_static_pad_template_get (&sink_template), gst_pad_new_from_template (gst_static_pad_template_get (&sink_template),
"sink"); "sink");
gst_pad_set_link_function (visual->sinkpad, gst_visual_sinklink); gst_pad_set_setcaps_function (visual->sinkpad, gst_visual_sink_setcaps);
gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain); gst_pad_set_chain_function (visual->sinkpad, gst_visual_chain);
gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad); gst_element_add_pad (GST_ELEMENT (visual), visual->sinkpad);
visual->srcpad = visual->srcpad =
gst_pad_new_from_template (gst_static_pad_template_get (&src_template), gst_pad_new_from_template (gst_static_pad_template_get (&src_template),
"src"); "src");
gst_pad_set_link_function (visual->srcpad, gst_visual_srclink); gst_pad_set_setcaps_function (visual->srcpad, gst_visual_src_setcaps);
gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps); gst_pad_set_getcaps_function (visual->srcpad, gst_visual_getcaps);
gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad); gst_element_add_pad (GST_ELEMENT (visual), visual->srcpad);
@ -265,7 +264,7 @@ gst_visual_getcaps (GstPad * pad)
} }
static GstPadLinkReturn static GstPadLinkReturn
gst_visual_srclink (GstPad * pad, const GstCaps * caps) gst_visual_src_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad)); GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
GstStructure *structure; GstStructure *structure;
@ -295,7 +294,7 @@ gst_visual_srclink (GstPad * pad, const GstCaps * caps)
} }
static GstPadLinkReturn static GstPadLinkReturn
gst_visual_sinklink (GstPad * pad, const GstCaps * caps) gst_visual_sink_setcaps (GstPad * pad, GstCaps * caps)
{ {
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad)); GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
GstStructure *structure; GstStructure *structure;
@ -307,36 +306,41 @@ gst_visual_sinklink (GstPad * pad, const GstCaps * caps)
return GST_PAD_LINK_OK; return GST_PAD_LINK_OK;
} }
static void static GstFlowReturn
gst_visual_chain (GstPad * pad, GstData * _data) gst_visual_chain (GstPad * pad, GstBuffer * buffer)
{ {
GstBuffer *ret; GstBuffer *outbuf;
guint i; guint i;
GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad)); GstVisual *visual = GST_VISUAL (gst_pad_get_parent (pad));
/* spf = samples per frame */ /* spf = samples per frame */
guint spf = visual->rate / visual->fps; guint spf = visual->rate / visual->fps;
gst_adapter_push (visual->adapter, GST_BUFFER (_data)); gst_adapter_push (visual->adapter, buffer);
while (gst_adapter_available (visual->adapter) > MAX (512, spf) * 4) { while (gst_adapter_available (visual->adapter) > MAX (512, spf) * 4) {
const guint16 *data = const guint16 *data =
(const guint16 *) gst_adapter_peek (visual->adapter, 512); (const guint16 *) gst_adapter_peek (visual->adapter, 512);
int ret;
for (i = 0; i < 512; i++) { for (i = 0; i < 512; i++) {
visual->audio.plugpcm[0][i] = *data++; visual->audio.plugpcm[0][i] = *data++;
visual->audio.plugpcm[1][i] = *data++; visual->audio.plugpcm[1][i] = *data++;
} }
ret = gst_pad_alloc_buffer (visual->srcpad, GST_BUFFER_OFFSET_NONE, ret = gst_pad_alloc_buffer (visual->srcpad, GST_BUFFER_OFFSET_NONE,
visual->video->width * visual->video->width * visual->video->bpp); visual->video->width * visual->video->width * visual->video->bpp,
visual_video_set_buffer (visual->video, GST_BUFFER_DATA (ret)); visual->srcpad->caps, &outbuf);
visual_video_set_buffer (visual->video, GST_BUFFER_DATA (outbuf));
visual_audio_analyze (&visual->audio); visual_audio_analyze (&visual->audio);
visual_actor_run (visual->actor, &visual->audio); visual_actor_run (visual->actor, &visual->audio);
GST_BUFFER_TIMESTAMP (ret) = GST_SECOND * visual->count++ / visual->fps; GST_BUFFER_TIMESTAMP (outbuf) = GST_SECOND * visual->count++ / visual->fps;
GST_BUFFER_DURATION (ret) = GST_SECOND / visual->fps; GST_BUFFER_DURATION (outbuf) = GST_SECOND / visual->fps;
gst_pad_push (visual->srcpad, GST_DATA (ret)); gst_pad_push (visual->srcpad, outbuf);
gst_adapter_flush (visual->adapter, spf * 4); gst_adapter_flush (visual->adapter, spf * 4);
} }
/* so we're on the safe side */ /* so we're on the safe side */
visual_video_set_buffer (visual->video, NULL); visual_video_set_buffer (visual->video, NULL);
return GST_FLOW_OK;
} }
static GstStateChangeReturn static GstStateChangeReturn