|
|
2010-04-13
, 13:42
|
|
|
Posts: 3,203 |
Thanked: 1,391 times |
Joined on Nov 2009
@ Worthing, England
|
#2
|
| The Following 3 Users Say Thank You to noobmonkey For This Useful Post: | ||
|
|
2010-04-13
, 14:12
|
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#3
|
|
|
2010-04-17
, 10:51
|
|
|
Posts: 1,637 |
Thanked: 4,424 times |
Joined on Apr 2009
@ Germany
|
#4
|
#include <stdlib.h>
#include <gst/gst.h>
// build with gcc -o sound_player sound_player.c $(pkg-config --cflags --libs gstreamer-base-0.10)
int
main (int argc, char *argv[])
{
gst_init (&argc,&argv);
GstElement *player;
GMainLoop* loop;
loop = g_main_loop_new (NULL, FALSE);
if (argc != 2) {
g_print ("usage: %s <audio filename-uri (file:///fullpath/name.mp3)>\n", argv[0]);
exit (-1);
}
player = gst_element_factory_make ("playbin2", "Multimedia Player");
g_object_set (G_OBJECT (player), "uri", argv[1], NULL);
g_assert (player != NULL);
gdouble v = 0.5;
g_object_set(player, "volume", v);
int ret = gst_element_set_state (player, GST_STATE_PLAYING);
g_main_loop_run(loop);
exit (0);
}
| The Following 6 Users Say Thank You to nicolai For This Useful Post: | ||
|
|
2012-08-24
, 10:27
|
|
|
Posts: 528 |
Thanked: 345 times |
Joined on Aug 2010
@ MLB.AU
|
#5
|
is there a simple API to play a short part of a sound file.
I need this to play a sound preview, the user sees a list
of sound files and everytime he selects another file, I want
to play some seconds from this file.
(Just like the ringtone selector in the profiles settings dialog)
regards nicolai