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) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6 
7  This program is free software; you can redistribute it and/or
8  modify it under the terms of the GNU General Public License as
9  published by the Free Software Foundation; either version 2 of
10  the License, or (at your option) any later version.
11 
12  This program is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  GNU General Public License for more details.
16 
17  You should have received a copy of the GNU General Public License
18  along with this program; if not, write to the Free Software
19  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */
21 
51 #ifndef LUMIERA_TIME_H
52 #define LUMIERA_TIME_H
53 
54 #include <inttypes.h>
55 #include <gavl/gavl.h>
56 
57 #ifdef __cplusplus /*=================== C++ facilities ===================== */
58 #include "lib/time/timevalue.hpp"
59 
60 
68 gavl_time_t
69 lumiera_rational_to_time (lib::time::FSecs const& fractionalSeconds);
70 
71 
78 gavl_time_t
79 lumiera_framecount_to_time (uint64_t frameCount, lib::time::FrameRate const& fps);
80 
81 
87 gavl_time_t
89 
90 
91 
92 
93 
94 extern "C" { /* ===================== C interface ======================== */
95 #endif
96 
97 
107 int64_t
108 lumiera_quantise_frames (gavl_time_t time, gavl_time_t origin, gavl_time_t grid);
109 
110 int64_t
111 lumiera_quantise_frames_fps (gavl_time_t time, gavl_time_t origin, uint framerate);
112 
122 gavl_time_t
123 lumiera_quantise_time (gavl_time_t time, gavl_time_t origin, gavl_time_t grid);
124 
131 gavl_time_t
132 lumiera_time_of_gridpoint (int64_t nr, gavl_time_t origin, gavl_time_t grid);
133 
141 gavl_time_t
142 lumiera_build_time (long millis, uint secs, uint mins, uint hours);
143 
152 gavl_time_t
153 lumiera_build_time_fps (uint fps, uint frames, uint secs, uint mins, uint hours);
154 
160 gavl_time_t
161 lumiera_build_time_ntsc_drop (uint frames, uint secs, uint mins, uint hours);
162 
163 
165 int
166 lumiera_time_hours (gavl_time_t time);
167 
168 
170 int
171 lumiera_time_minutes (gavl_time_t time);
172 
173 
175 int
176 lumiera_time_seconds (gavl_time_t time);
177 
178 
180 int
181 lumiera_time_millis (gavl_time_t time);
182 
187 int
188 lumiera_time_frames (gavl_time_t time, uint fps);
189 
193 int
194 lumiera_time_ntsc_drop_frames (gavl_time_t time);
195 
199 int
201 
205 int
207 
211 int
212 lumiera_time_ntsc_drop_hours (gavl_time_t time);
213 
214 
221 char*
222 lumiera_tmpbuf_print_time (gavl_time_t time);
223 
224 
225 
226 #ifdef __cplusplus
227 }//extern "C"
228 #endif
229 #endif
230 
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:629
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:522
Framerate specified as frames per second.
Definition: timevalue.hpp:664
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:611
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:617
int lumiera_time_minutes(gavl_time_t time)
Extract the minute part of given time.
Definition: time.cpp:550
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:436
int lumiera_time_millis(gavl_time_t time)
Extract the milliseconds part of given time.
Definition: time.cpp:562
char * lumiera_tmpbuf_print_time(gavl_time_t time)
Definition: time.cpp:395
int lumiera_time_seconds(gavl_time_t time)
Extract the seconds part of given time.
Definition: time.cpp:556
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:514
boost::rational< int64_t > FSecs
rational representation of fractional seconds
Definition: timevalue.hpp:229
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:635
gavl_time_t lumiera_frame_duration(lib::time::FrameRate const &fps)
Calculates the duration of one frame in Lumiera time units.
Definition: time.cpp:445
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:494
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:533
int lumiera_time_hours(gavl_time_t time)
Extract the hour part of given time.
Definition: time.cpp:544
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:623
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:506
int lumiera_time_frames(gavl_time_t time, uint fps)
Extract the remaining frame part of given time.
Definition: time.cpp:568