Here is a version that you can copy and paste:
#include <gst/gst.h>

gint
gnome_play_sound_background (
      gchar *uri)
{
  GMainLoop *loop;
  GstElement *play;
  GstBus *bus;

  /* init GStreamer */
  gst_init (0 ,NULL);
  loop = g_main_loop_new (NULL, FALSE);

  /* set up */
  play = gst_element_factory_make ("playbin", "play");
  g_object_set (G_OBJECT (play), "uri", uri, NULL);

  bus = gst_pipeline_get_bus (GST_PIPELINE (play));
  gst_object_unref (bus);

  gst_element_set_state (play, GST_STATE_PLAYING);

  /* now run */
  g_main_loop_run (loop);

  /* also clean up */
  gst_element_set_state (play, GST_STATE_NULL);
  gst_object_unref (GST_OBJECT (play));

  return 0;
}

int
main (int   argc,
      char *argv[])
{
  if (argc != 2) {
    g_print ("Usage: %s <URI>\n", argv[0]);
    return -1;
  }

  gnome_play_sound_background(argv[1]);

  return 0;
}

And it works

Olafur Arason

On 10/30/06, Richard Hughes <[EMAIL PROTECTED]> wrote:
> On Mon, 2006-10-30 at 20:05 +0000, Olafur Arason wrote:
> > Doesn't this work?
> > http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/chapter-components.html
>
> I'm sure it does, but it's a lot more complicated than the hypothetical:
>
> gnome_play_sound_background ("alert.wav");
>
> Richard.
>
>
>
_______________________________________________
desktop-devel-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/desktop-devel-list

Reply via email to