summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2011-04-16 13:59:11 (GMT)
committerChristian Pointner <equinox@helsinki.at>2011-04-16 13:59:11 (GMT)
commitc153935be4561f10a997bfea5f140dd8f160e080 (patch)
tree3ccc2196480fdf4338db8b8c74369daa66b1133d
parent96a2079927425894772dea9236420bf440064959 (diff)
minor refactoring
-rw-r--r--src/writer.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/src/writer.c b/src/writer.c
index fb99c96..361d43e 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -154,6 +154,18 @@ static int open_file(file_t* file)
return 0;
}
+static int check_boundaries(writer_t* writer)
+{
+ struct timespec now;
+ clock_gettime(CLOCK_REALTIME, &now);
+
+ struct tm now_bd;
+ localtime_r(&(now.tv_sec), &now_bd);
+ log_printf(DEBUG, "it's now: %02d:%02d:%02d on %d.%d.%d", now_bd.tm_hour, now_bd.tm_min, now_bd.tm_sec, now_bd.tm_mday, now_bd.tm_mon+1, now_bd.tm_year+1900);
+
+ return 0;
+}
+
static gpointer writer_thread_func(gpointer data)
{
writer_t *writer = (writer_t*)data;
@@ -161,18 +173,16 @@ static gpointer writer_thread_func(gpointer data)
GstBuffer* buf = NULL;
for(;;) {
- GstClockReturn ret = gst_clock_id_wait(writer->clock_id_, NULL);
- if(GST_CLOCK_UNSCHEDULED == ret)
+ GstClockReturn wret = gst_clock_id_wait(writer->clock_id_, NULL);
+ if(GST_CLOCK_UNSCHEDULED == wret)
break;
- if(GST_CLOCK_EARLY == ret)
+ if(GST_CLOCK_EARLY == wret)
continue;
- struct timespec now;
- clock_gettime(CLOCK_REALTIME, &now);
+ int ret = check_boundaries(writer);
+ if(ret) break;
- struct tm now_bd;
- localtime_r(&(now.tv_sec), &now_bd);
- log_printf(DEBUG, "it's now: %02d:%02d:%02d on %d.%d.%d", now_bd.tm_hour, now_bd.tm_min, now_bd.tm_sec, now_bd.tm_mday, now_bd.tm_mon+1, now_bd.tm_year+1900);
+ // TODO: children handling (waitpid)
}
log_printf(NOTICE, "writer thread stopped");