projects
/
svn42.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
82e45e5
)
added parameter to dart-sounds
author
Christian Pointner
<equinox@realraum.at>
Fri, 1 Jul 2011 12:26:49 +0000
(12:26 +0000)
committer
Christian Pointner
<equinox@realraum.at>
Fri, 1 Jul 2011 12:26:49 +0000
(12:26 +0000)
dart-sounds/src/dart-sounds.c
patch
|
blob
|
history
diff --git
a/dart-sounds/src/dart-sounds.c
b/dart-sounds/src/dart-sounds.c
index
25482a7
..
254dc10
100644
(file)
--- a/
dart-sounds/src/dart-sounds.c
+++ b/
dart-sounds/src/dart-sounds.c
@@
-89,6
+89,7
@@
struct play_file_param
GCond* cond;
GMutex* mutex;
GAsyncQueue* queue;
GCond* cond;
GMutex* mutex;
GAsyncQueue* queue;
+ const char* media_d;
};
static gpointer player(gpointer data)
};
static gpointer player(gpointer data)
@@
-100,6
+101,7
@@
static gpointer player(gpointer data)
GCond* cond = p->cond;
GMutex* mutex = p->mutex;
GAsyncQueue* queue = p->queue;
GCond* cond = p->cond;
GMutex* mutex = p->mutex;
GAsyncQueue* queue = p->queue;
+ const char* media_d = p->media_d;
free(p);
g_printf("Player thread started\n");
free(p);
g_printf("Player thread started\n");
@@
-117,13
+119,13
@@
static gpointer player(gpointer data)
gst_element_set_state(pipeline, GST_STATE_READY);
gst_element_set_state(pipeline, GST_STATE_READY);
- g_print("playing '../media/%s.ogg'\n", name);
char* path;
char* path;
- asprintf(&path, "../media/%s.ogg", name);
+ asprintf(&path, "%s/%s.ogg", media_d, name);
free(name);
if(!path)
return NULL;
free(name);
if(!path)
return NULL;
-
+
+ g_print("playing '%s'\n", path);
g_object_set(G_OBJECT(source), "location", path, NULL);
free(path);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
g_object_set(G_OBJECT(source), "location", path, NULL);
free(path);
gst_element_set_state(pipeline, GST_STATE_PLAYING);
@@
-132,7
+134,7
@@
static gpointer player(gpointer data)
return NULL;
}
return NULL;
}
-GstElement* init_pipeline(GMainLoop *loop, GAsyncQueue* queue, gint* sval)
+GstElement* init_pipeline(GMainLoop *loop, const char* media_d, GAsyncQueue* queue, gint* sval)
{
GCond* cond = g_cond_new();
if(!cond) {
{
GCond* cond = g_cond_new();
if(!cond) {
@@
-183,6
+185,7
@@
GstElement* init_pipeline(GMainLoop *loop, GAsyncQueue* queue, gint* sval)
datap->cond = cond;
datap->mutex = mutex;
datap->queue = queue;
datap->cond = cond;
datap->mutex = mutex;
datap->queue = queue;
+ datap->media_d = media_d;
g_thread_create(player, datap, 0, NULL);
} else {
g_printerr("Memory Error\n");
g_thread_create(player, datap, 0, NULL);
} else {
g_printerr("Memory Error\n");
@@
-239,7
+242,13
@@
static gboolean stdin_read(GIOChannel* src, GIOCondition cond, gpointer data)
int main(int argc, char *argv[])
{
int main(int argc, char *argv[])
{
- gst_init(&argc, &argv);
+ if(argc < 2) {
+ fprintf(stderr, "Please specify the path to the media directory");
+ return 2;
+ }
+ char* media_d = argv[1];
+
+ gst_init(NULL, NULL);
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
if(!loop) {
GMainLoop *loop = g_main_loop_new(NULL, FALSE);
if(!loop) {
@@
-254,7
+263,7
@@
int main(int argc, char *argv[])
}
gint sval = 1;
}
gint sval = 1;
- GstElement *pipeline = init_pipeline(loop, queue, &sval);
+ GstElement *pipeline = init_pipeline(loop, media_d, queue, &sval);
if(!pipeline) return 1;
if(!pipeline) return 1;