projects
/
svn42.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
b3b7218
)
added GIOChannel for stdin
author
Christian Pointner
<equinox@realraum.at>
Thu, 30 Jun 2011 23:48:05 +0000
(23:48 +0000)
committer
Christian Pointner
<equinox@realraum.at>
Thu, 30 Jun 2011 23:48:05 +0000
(23:48 +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
075ca75
..
6d11df8
100644
(file)
--- a/
dart-sounds/src/dart-sounds.c
+++ b/
dart-sounds/src/dart-sounds.c
@@
-32,7
+32,7
@@
static gboolean bus_call(GstBus *bus, GstMessage *msg, gpointer data)
{
case GST_MESSAGE_EOS:
g_print("End of stream\n");
{
case GST_MESSAGE_EOS:
g_print("End of stream\n");
- g_main_loop_quit(loop);
+// g_main_loop_quit(loop);
break;
case GST_MESSAGE_ERROR: {
break;
case GST_MESSAGE_ERROR: {
@@
-75,7
+75,7
@@
GstElement* init(GMainLoop *loop, int pipe_out)
GstElement *sink = gst_element_factory_make("autoaudiosink", "sink");
if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
GstElement *sink = gst_element_factory_make("autoaudiosink", "sink");
if (!pipeline || !source || !demuxer || !decoder || !conv || !sink) {
- g_printerr ("One element could not be created. Exiting.\n");
+ g_printerr("One element could not be created. Exiting.\n");
return NULL;
}
return NULL;
}
@@
-96,6
+96,13
@@
GstElement* init(GMainLoop *loop, int pipe_out)
return pipeline;
}
return pipeline;
}
+static void stdin_read(gpointer data)
+{
+ u_int8_t buf[100];
+ int len = read(0, buf, sizeof(buf));
+ g_print("read %d bytes from stdin\n", len);
+}
+
int main(int argc, char *argv[])
{
gst_init(&argc, &argv);
int main(int argc, char *argv[])
{
gst_init(&argc, &argv);
@@
-107,6
+114,17
@@
int main(int argc, char *argv[])
GMainContext *ctx = g_main_loop_get_context(loop);
GMainContext *ctx = g_main_loop_get_context(loop);
+ GIOChannel* chan = g_io_channel_unix_new(0);
+ if(!chan) {
+ g_printerr("IO Channel could not be created.\n");
+ return 1;
+ }
+
+ GSource* src = g_io_create_watch(chan, G_IO_IN);
+
+ g_source_set_callback(src, (GSourceFunc)stdin_read, (gpointer)pipeline, NULL);
+ g_source_attach(src, ctx);
+
g_print("Running...\n");
g_main_loop_run(loop);
g_print("Running...\n");
g_main_loop_run(loop);