Lumiera  0.pre.03
»edit your freedom«
time.h
Go to the documentation of this file.
1 /*
2  time.h - Utilities for handling time
3 
4  Copyright (C)
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7   **Lumiera** is free software; you can redistribute it and/or modify it
8   under the terms of the GNU General Public License as published by the
9   Free Software Foundation; either version 2 of the License, or (at your
10   option) any later version. See the file COPYING for further details.
11 */
12 
42 #ifndef LUMIERA_TIME_H
43 #define LUMIERA_TIME_H
44 
45 #include <inttypes.h>
46 #include <gavl/gavl.h>
47 
48 #ifdef __cplusplus /*=================== C++ facilities ===================== */
49 #include "lib/time/timevalue.hpp"
50 
51 
59 gavl_time_t
60 lumiera_rational_to_time (lib::time::FSecs const& fractionalSeconds);
61 
62 
69 gavl_time_t
70 lumiera_framecount_to_time (uint64_t frameCount, lib::time::FrameRate const& fps);
71 
72 
78 gavl_time_t
80 
81 
82 
83 
84 
85 extern "C" { /* ===================== C interface ======================== */
86 #endif
87 
88 
98 int64_t
99 lumiera_quantise_frames (gavl_time_t time, gavl_time_t origin, gavl_time_t grid);
100 
101 int64_t
102 lumiera_quantise_frames_fps (gavl_time_t time, gavl_time_t origin, uint framerate);
103 
113 gavl_time_t
114 lumiera_quantise_time (gavl_time_t time, gavl_time_t origin, gavl_time_t grid);
115 
122 gavl_time_t
123 lumiera_time_of_gridpoint (int64_t nr, gavl_time_t origin, gavl_time_t grid);
124 
132 gavl_time_t
133 lumiera_build_time (long millis, uint secs, uint mins, uint hours);
134 
143 gavl_time_t
144 lumiera_build_time_fps (uint fps, uint frames, uint secs, uint mins, uint hours);
145 
151 gavl_time_t
152 lumiera_build_time_ntsc_drop (uint frames, uint secs, uint mins, uint hours);
153 
154 
156 int
157 lumiera_time_hours (gavl_time_t time);
158 
159 
161 int
162 lumiera_time_minutes (gavl_time_t time);
163 
164 
166 int
167 lumiera_time_seconds (gavl_time_t time);
168 
169 
171 int
172 lumiera_time_millis (gavl_time_t time);
173 
178 int
179 lumiera_time_frames (gavl_time_t time, uint fps);
180 
184 int
185 lumiera_time_ntsc_drop_frames (gavl_time_t time);
186 
190 int
192 
196 int
198 
202 int
203 lumiera_time_ntsc_drop_hours (gavl_time_t time);
204 
205 
212 char*
213 lumiera_tmpbuf_print_time (gavl_time_t time);
214 
215 
216 
217 #ifdef __cplusplus
218 }//extern "C"
219 #endif
220 #endif
221 
int lumiera_time_ntsc_drop_hours(gavl_time_t time)
Extract the hour part of given time, using NTSC drop-frame timecode.
Definition: time.cpp:620
gavl_time_t lumiera_build_time(long millis, uint secs, uint mins, uint hours)
Build a time value by summing up the given components.
Definition: time.cpp:513
Framerate specified as frames per second.
Definition: timevalue.hpp:655
int lumiera_time_ntsc_drop_frames(gavl_time_t time)
Extract the frame part of given time, using NTSC drop-frame timecode.
Definition: time.cpp:602
int lumiera_time_ntsc_drop_seconds(gavl_time_t time)
Extract the second part of given time, using NTSC drop-frame timecode.
Definition: time.cpp:608
int lumiera_time_minutes(gavl_time_t time)
Extract the minute part of given time.
Definition: time.cpp:541
gavl_time_t lumiera_framecount_to_time(uint64_t frameCount, lib::time::FrameRate const &fps)
Converts a frame count into Lumiera&#39;s internal time scale.
Definition: time.cpp:427
int lumiera_time_millis(gavl_time_t time)
Extract the milliseconds part of given time.
Definition: time.cpp:553
char * lumiera_tmpbuf_print_time(gavl_time_t time)
Definition: time.cpp:386
int lumiera_time_seconds(gavl_time_t time)
Extract the seconds part of given time.
Definition: time.cpp:547
gavl_time_t lumiera_time_of_gridpoint(int64_t nr, gavl_time_t origin, gavl_time_t grid)
Calculate time of a grid point (frame start)
Definition: time.cpp:505
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:220
gavl_time_t lumiera_build_time_ntsc_drop(uint frames, uint secs, uint mins, uint hours)
Builds a time value by summing up the given components.
Definition: time.cpp:626
gavl_time_t lumiera_frame_duration(lib::time::FrameRate const &fps)
Calculates the duration of one frame in Lumiera time units.
Definition: time.cpp:436
gavl_time_t lumiera_rational_to_time(lib::time::FSecs const &fractionalSeconds)
Converts a fraction of seconds to Lumiera&#39;s internal opaque time scale.
int64_t lumiera_quantise_frames(gavl_time_t time, gavl_time_t origin, gavl_time_t grid)
Quantise the given time into a fixed grid, relative to the origin.
Definition: time.cpp:485
gavl_time_t lumiera_build_time_fps(uint fps, uint frames, uint secs, uint mins, uint hours)
Builds a time value by summing up the given components.
Definition: time.cpp:524
int lumiera_time_hours(gavl_time_t time)
Extract the hour part of given time.
Definition: time.cpp:535
int lumiera_time_ntsc_drop_minutes(gavl_time_t time)
Extract the minute part of given time, using NTSC drop-frame timecode.
Definition: time.cpp:614
a family of time value like entities and their relationships.
gavl_time_t lumiera_quantise_time(gavl_time_t time, gavl_time_t origin, gavl_time_t grid)
Similar to lumiera_quantise_frames, but returns a grid aligned relative time.
Definition: time.cpp:497
int lumiera_time_frames(gavl_time_t time, uint fps)
Extract the remaining frame part of given time.
Definition: time.cpp:559