Writing gst plug-ins for Maemo

Ryan McGee ryan at mat.ucsb.edu
Tue Jul 19 17:14:25 PDT 2011


Hi, I am new to gstreamer, but have experience with desktop audio programming
on osx/win using PortAudio and JUCE.  I've been following the Plugin
Writer's Guide to learn how to write my own audio effect plugins for use on
a Maemo device.  I've been working off the latest gst-template git module: 
shell $ git clone git://anongit.freedesktop.org/gstreamer/gst-template.git

I was successful in using the provided "make element" tool to create the C
and header files (based off of gstplugin.c/h), compile and deploy using Qt
Creator, and use the template plug-in on my phone.

Now, I'm trying to understand how to modify the audio buffers correctly.

The template code has the following function where the processing occurs:

/* chain function
 * this function does the actual processing
 */
static GstFlowReturn
gst_plugin_template_chain (GstPad * pad, GstBuffer * buf)
{
  GstPluginTemplate *filter;

  filter = GST_PLUGIN_TEMPLATE (GST_OBJECT_PARENT (pad));

  if (filter->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in.\n");

  /* just push out the incoming buffer without touching it */
  return gst_pad_push (filter->srcpad, buf);
}

The above works as promised- it just passes the audio straight through
without modification.

So, as a test, I tried to simply zero the buffer so no sound would pass
through:

/* chain function
 * this function does the actual processing
 */
static GstFlowReturn
gst_ryanfilter_chain (GstPad * pad, GstBuffer * buf)
{
  Gstryanfilter *filter;

  filter = GST_RYANFILTER (GST_OBJECT_PARENT (pad));

  if (filter->silent == FALSE)
    g_print ("I'm plugged, therefore I'm in.\n");

  guint8 *in = GST_BUFFER_DATA(buf);
  guint8 length = GST_BUFFER_SIZE(buf);

  int i;
  for(i = 0; i < length; i++){
      *in++ = 0; // in[i] = 0;
  }

  return gst_pad_push (filter->srcpad, buf);
}

This results in some clicks in the audio stream, but the incoming audio is
still passing through.  Why is this?  Is there somewhere else writing to the
output of the plug-in?  My graph is pulsesrc ! ryanfilter ! pulsesink

I also noticed that the template folder provides a gstaudiofilter.c example. 
This compiles and deploys in Qt, but I get assertion failures on the device
when I try to use this.  Any ideas?

Thank you!
Ryan


--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Writing-gst-plug-ins-for-Maemo-tp3679695p3679695.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list