[gst-devel] [gstreamer] Problem with pulling data from a sink pad

Ronald Bultje rbultje at ronald.bitfreak.net
Tue Dec 23 01:00:01 CET 2003


On Mon, 2003-12-22 at 18:56, Quan Nguyen wrote:
>  By the way, I may not have been clear before.  What I want to do is
> to get the raw audio data from a decoder so that I can manipulate it
> with standard C++ code.  I don't want to have to hook the decoder up
> to another element.  Thanks.

First a note: this is a *really* bad idea. GStreamer is intended for
elements that can be used by each application. By using such 'hacks',
the whole idea of GStreamer has little use.

How:

#include <gst/gst.h>

static void
cb_manipulate (GstElement *element,
	       GstData    *data)
{
  GstBuffer *buffer;

  /* no events */
  if (!GST_IS_BUFFER (data))
    return;
  buffer = GST_BUFFER (data);

  /* manipulate your data here */
[..]
}

int
main ()
{
  GstElement *listener;
[..]
  listener = gst_element_factory_make ("identity", 
				       "listener");
  g_signal_connect (G_OBJECT (listener), "handoff",
		    G_CALLBACK (cb_manipulate), NULL);
[..]
  /* example pipeline... */
  gst_element_link_many (audiosource, decoder, listener,
			 audiosink, NULL);
}

But again, this is a really bad idea. It's nice as a quick hack, but
nothing more than that. Rethink your application if it requires this.

Ronald

-- 
Ronald Bultje <rbultje at ronald.bitfreak.net>
Linux Video/Multimedia developer





More information about the gstreamer-devel mailing list