diff options
author | Christian Pointner <equinox@helsinki.at> | 2011-04-17 16:21:15 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2011-04-17 16:21:15 (GMT) |
commit | c83d06888770040c638f65bd4186dc79542ed7cf (patch) | |
tree | a73d76baf11e7d5b6bcb12876d5e09eb703e00e3 /src | |
parent | 5fc7650ff53942e22b4bd29b6496b01dd70c3b5d (diff) |
calculating next boundary (not tested yet)
Diffstat (limited to 'src')
-rw-r--r-- | src/writer.c | 21 | ||||
-rw-r--r-- | src/writer.h | 1 |
2 files changed, 18 insertions, 4 deletions
diff --git a/src/writer.c b/src/writer.c index f45422c..f89adfb 100644 --- a/src/writer.c +++ b/src/writer.c @@ -167,12 +167,25 @@ static int check_boundaries(writer_t* writer) int ret = open_file(&(writer->next_)); // if(ret) return ret; // TODO: stop writer on open_file error ??? - // - add new file - // - remove old file + // - add new file + // - remove old file - // - calculate next filename and boundary + writer->old_ = writer->current_; + writer->current_ = writer->next_; + + writer->next_boundary_.tv_sec += 3600; + struct tm bd_time; + localtime_r(&(writer->next_boundary_.tv_sec), &bd_time); - // - call post processing script from fd_removed callback + ret = compute_filname(&bd_time, "next", &(writer->next_), writer->name_format_, writer->output_dir_, writer->mode_); + if(ret) return ret; + + + // - call post processing script from fd_removed callback + if(writer->old_.fd_ > 0) + close(writer->old_.fd_); + if(writer->old_.path_) + free(writer->old_.path_); } return 0; diff --git a/src/writer.h b/src/writer.h index 1e1b236..93eff85 100644 --- a/src/writer.h +++ b/src/writer.h @@ -51,6 +51,7 @@ struct writer_struct { mode_t mode_; GstClockTime interval_; GstClockTime offset_; + file_t old_; file_t current_; file_t next_; struct timespec next_boundary_; |