00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef TIMECODE_H_INCLUDED
00023 #define TIMECODE_H_INCLUDED
00024
00025 #ifdef __cplusplus
00026 extern "C" {
00027 #endif
00028
00029 #pragma GCC visibility push(default)
00030
00031
00044 typedef uint64_t gavl_timecode_t;
00045
00046 #define GAVL_TIMECODE_SIGN_MASK (0x1LL<<62)
00047 #define GAVL_TIMECODE_INVALID_MASK (0x1LL<<63)
00048
00049 #define GAVL_TIMECODE_DROP_FRAME (1<<0)
00050
00051 #define GAVL_TIMECODE_UNDEFINED GAVL_TIMECODE_INVALID_MASK
00052
00053
00060 typedef struct
00061 {
00062 int int_framerate;
00063 int flags;
00064 } gavl_timecode_format_t;
00065
00074 void gavl_timecode_to_hmsf(gavl_timecode_t tc,
00075 int * hours,
00076 int * minutes,
00077 int * seconds,
00078 int * frames);
00079
00087 void gavl_timecode_to_ymd(gavl_timecode_t tc,
00088 int * year,
00089 int * month,
00090 int * day);
00091
00100 void gavl_timecode_from_hmsf(gavl_timecode_t * tc,
00101 int hours,
00102 int minutes,
00103 int seconds,
00104 int frames);
00105
00113 void gavl_timecode_from_ymd(gavl_timecode_t * tc,
00114 int year,
00115 int month,
00116 int day);
00117
00128 int64_t gavl_timecode_to_framecount(const gavl_timecode_format_t * tf,
00129 gavl_timecode_t tc);
00130
00141 gavl_timecode_t gavl_timecode_from_framecount(const gavl_timecode_format_t * tf,
00142 int64_t fc);
00143
00151 void gavl_timecode_dump(const gavl_timecode_format_t * tf,
00152 gavl_timecode_t tc);
00153
00154
00155
00156
00157 #define GAVL_TIMECODE_STRING_LEN 26
00161 void gavl_timecode_prettyprint(const gavl_timecode_format_t * tf,
00162 gavl_timecode_t tc,
00163 char str[GAVL_TIMECODE_STRING_LEN]);
00164
00165
00166
00167
00168
00169
00170
00171 #pragma GCC visibility pop
00172
00173 #ifdef __cplusplus
00174 }
00175 #endif
00176
00177 #endif
00178