summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/writer.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/writer.c b/src/writer.c
index c767c5b..0f96eb9 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -74,7 +74,7 @@ int writer_init(writer_t* writer, GMainLoop *loop, const char* name_format, mode
return -1;
writer->loop_ = loop;
- writer->sink_ = gst_element_factory_make("fakesink", "writer");
+ writer->sink_ = gst_element_factory_make("fdsink", "writer");
if(!writer->sink_) {
log_printf(ERROR, "the writer object could not be created. Exiting.");
return -1;
@@ -111,10 +111,9 @@ static int check_boundaries(writer_t* writer)
log_printf(DEBUG, "boundary reached! it's now: %02d:%02d:%02d.%06d on %d.%d.%d", now_bd.tm_hour, now_bd.tm_min, now_bd.tm_sec, now.tv_nsec/1000, now_bd.tm_mday, now_bd.tm_mon+1, now_bd.tm_year+1900);
int ret = open_file(writer->next_);
-// if(ret) return ret; // TODO: stop writer on open_file error ???
+ if(ret) return ret; // TODO: stop writer on open_file error ???
- // - add new file
- // - remove old file
+ g_object_set(G_OBJECT(writer->sink_), "fd", writer->next_->fd_, NULL);
int old_fd = writer->current_->fd_;
writer->current_ = writer->next_;
@@ -126,7 +125,6 @@ static int check_boundaries(writer_t* writer)
writer->next_ = file_list_add(&(writer->files_), &bd_time, "next", writer->name_format_, writer->output_dir_, writer->mode_);
if(writer->next_ == NULL) return -2;
- // - call post processing script from fd_removed callback
file_list_remove(&(writer->files_), old_fd);
}
@@ -166,7 +164,7 @@ int writer_start(writer_t* writer)
if(ret)
return ret;
- // TODO: add fd to fdsink
+ g_object_set(G_OBJECT(writer->sink_), "fd", writer->current_->fd_, NULL);
writer->clock_id_ = gst_clock_new_periodic_id(writer->clock_, 0, writer->interval_);
if(!writer->clock_id_) {