{
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: {
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 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);
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);