diff options
author | Christian Pointner <equinox@helsinki.at> | 2011-02-17 00:31:49 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2011-02-17 00:31:49 (GMT) |
commit | 2fc9cc5d63c37c85f433bf309cbd3b92feec9e9c (patch) | |
tree | 457132766b7afabb309c6e534ce0af89192d5b7f /src/rharchive.c | |
parent | 28a240fa9728287c835ef475e0d8e4cafa05c36e (diff) |
the source bin can be configured now
Diffstat (limited to 'src/rharchive.c')
-rw-r--r-- | src/rharchive.c | 33 |
1 files changed, 21 insertions, 12 deletions
diff --git a/src/rharchive.c b/src/rharchive.c index 5893c37..a2ff037 100644 --- a/src/rharchive.c +++ b/src/rharchive.c @@ -85,29 +85,38 @@ int main_loop(options_t* opt) GMainLoop *loop; - GstElement *pipeline, *source, *encoder, *muxer, *sink; + GstElement *pipeline, *source, *writer; GstBus *bus; loop = g_main_loop_new(NULL, FALSE); pipeline = gst_pipeline_new("rharchive"); - source = gst_element_factory_make("audiotestsrc", "raw-source"); - encoder = gst_element_factory_make("vorbisenc", "encoder"); - muxer = gst_element_factory_make("oggmux", "muxer"); - sink = gst_element_factory_make("filesink", "sink"); - - if(!pipeline || !source || !encoder || !muxer || !sink) { - log_printf(ERROR, "One element could not be created. Exiting."); + if(!pipeline) { + log_printf(ERROR, "the pipeline object could not be created. Exiting."); return -1; } - g_object_set(G_OBJECT(sink), "location", "output.ogg", NULL); - bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline)); gst_bus_add_watch(bus, bus_call, loop); gst_object_unref(bus); - gst_bin_add_many(GST_BIN(pipeline), source, encoder, muxer, sink, NULL); - gst_element_link_many(source, encoder, muxer, sink, NULL); + + writer = gst_element_factory_make("filesink", "writer"); + if(!writer) { + log_printf(ERROR, "the writer object could not be created. Exiting."); + return -1; + } + g_object_set(G_OBJECT(writer), "location", "output.ogg", NULL); + + GError *error = NULL; + source = gst_parse_bin_from_description(opt->src_bin_desc_, TRUE, &error); + if(error) { + log_printf(ERROR, "Source Bin Description Parser Error: %s", error->message); + g_error_free(error); + return -1; + } + + gst_bin_add_many(GST_BIN(pipeline), source, writer, NULL); + gst_element_link_many(source, writer, NULL); log_printf(INFO, "Set State: Paused"); gst_element_set_state(pipeline, GST_STATE_PAUSED); |