Writing gst plug-ins for Maemo

Stefan Kost ensonic at hora-obscura.de
Wed Jul 20 04:28:17 PDT 2011


On 07/20/11 02:14, Ryan McGee wrote:
> 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
FYI. gst-plugin-bad now has the new element-maker, with a lot more
templates. Just clone gst-plugin-bad from git to get it - no need to
build it, the tool is a shell-script.
> 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
try:
  audiotestsrc ! pulsesink
and
  audiotestsrc ! ryanfilter ! pulsesink

to narrow it down (to exclude the the mic-in to monitored on the
speakers in addition).

Stefan
> 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.
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



More information about the gstreamer-devel mailing list