diff options
-rw-r--r-- | src/writer.c | 26 |
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"); |