[gst-devel] speed filter

Adam Wiggins hiro at dusk.org
Sun Jan 4 12:36:01 CET 2004


Hi folks,

I'm just getting started with gstreamer, and I am very impressed so
far with the power and flexibility of the toolkit.

I'm messing around with creating a little DJ app by playing two audio
streams together, with a speed adjustment filten on each stream.
However, as soon as I insert the speed element (between the decoder and
the audio sink), the app simply exits as soon as it starts.  No error
message or anything, just no audio at all.

Doing a web search I have been unable to find a single example of the
speed filter being used in any code.  My program is below, can someone
tell me what I'm doing wrong?  This code is taken almost exactly from
the hello-world.c example in the application handbook.  It works just
fine if you remove the speed parameter from the bin_add_many and
element_link_many calls.

Thanks!
-Adam

------------------------------------------------

#include <gst/gst.h>

void play_audio(GstElement *pipeline, const char *fname)
{
  GstElement *filesrc, *decoder, *speed, *audiosink;
  char buf[256];

  sprintf(buf, "disk_source-%s", fname);
  filesrc = gst_element_factory_make ("filesrc", buf);
  g_object_set (G_OBJECT (filesrc), "location", fname, NULL);

  sprintf(buf, "decoder-%s", fname);
  decoder = gst_element_factory_make ("wavparse", buf);
  
  sprintf(buf, "speed-%s", fname);
  speed = gst_element_factory_make ("speed", buf);
  
  sprintf(buf, "play_audio-%s", fname);
  audiosink = gst_element_factory_make ("osssink", buf);

  gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, speed, audiosink, NULL);
  gst_element_link_many (filesrc, decoder, speed, audiosink, NULL);
}

int main(int argc, char *argv[]) 
{
  GstElement *pipeline;

  gst_init(&argc, &argv);

  if (argc != 3) {
    g_print ("usage: %s <1.wav> <2.wav>\n", argv[0]);
    exit (-1);
  }

  pipeline = gst_pipeline_new ("pipeline");

  play_audio(pipeline, argv[1]);
  play_audio(pipeline, argv[2]);

  gst_element_set_state (pipeline, GST_STATE_PLAYING);

  while (gst_bin_iterate (GST_BIN (pipeline)));

  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (GST_OBJECT (pipeline));
}





More information about the gstreamer-devel mailing list