summaryrefslogtreecommitdiff
path: root/src/rharchive.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rharchive.c')
-rw-r--r--src/rharchive.c33
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);