summaryrefslogtreecommitdiff
path: root/src/rharchive.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/rharchive.c')
-rw-r--r--src/rharchive.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/rharchive.c b/src/rharchive.c
index 39ee0bc..699738b 100644
--- a/src/rharchive.c
+++ b/src/rharchive.c
@@ -87,19 +87,19 @@ int main_loop(options_t* opt)
GstBus *bus;
writer_t writer;
- int ret = writer_init(&writer, opt->name_format_, opt->output_dir_, opt->length_, opt->offset_);
- if(ret) return ret;
-
loop = g_main_loop_new(NULL, FALSE);
pipeline = gst_pipeline_new("rharchive");
if(!pipeline || !loop) {
log_printf(ERROR, "the pipeline/loop object could not be created. Exiting.");
- gst_object_unref(GST_OBJECT(writer.sink_));
return -1;
}
- bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
- gst_bus_add_watch(bus, bus_call, loop);
- gst_object_unref(bus);
+
+ int ret = writer_init(&writer, opt->name_format_, opt->output_dir_, opt->length_, opt->offset_);
+ if(ret) {
+ gst_object_unref(GST_OBJECT(pipeline));
+ gst_object_unref(GST_OBJECT(loop));
+ return ret;
+ }
GError *error = NULL;
source = gst_parse_bin_from_description(opt->src_bin_desc_, TRUE, &error);
@@ -114,6 +114,9 @@ int main_loop(options_t* opt)
gst_bin_add_many(GST_BIN(pipeline), source, writer.sink_, NULL);
gst_element_link_many(source, writer.sink_, NULL);
+ bus = gst_pipeline_get_bus(GST_PIPELINE(pipeline));
+ gst_bus_add_watch(bus, bus_call, loop);
+ gst_object_unref(bus);
log_printf(INFO, "Set State: Paused");
gst_element_set_state(pipeline, GST_STATE_PAUSED);