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 #include <gavl/gavldefs.h>
00030
00043 typedef uint64_t gavl_timecode_t;
00044
00045 #define GAVL_TIMECODE_SIGN_MASK (0x1LL<<62)
00046 #define GAVL_TIMECODE_INVALID_MASK (0x1LL<<63)
00047
00048 #define GAVL_TIMECODE_DROP_FRAME (1<<0)
00049
00050 #define GAVL_TIMECODE_UNDEFINED GAVL_TIMECODE_INVALID_MASK
00051
00052
00059 typedef struct
00060 {
00061 int int_framerate;
00062 int flags;
00063 } gavl_timecode_format_t;
00064
00073 GAVL_PUBLIC
00074 void gavl_timecode_to_hmsf(gavl_timecode_t tc,
00075 int * hours,
00076 int * minutes,
00077 int * seconds,
00078 int * frames);
00079
00087 GAVL_PUBLIC
00088 void gavl_timecode_to_ymd(gavl_timecode_t tc,
00089 int * year,
00090 int * month,
00091 int * day);
00092
00101 GAVL_PUBLIC
00102 void gavl_timecode_from_hmsf(gavl_timecode_t * tc,
00103 int hours,
00104 int minutes,
00105 int seconds,
00106 int frames);
00107
00115 GAVL_PUBLIC
00116 void gavl_timecode_from_ymd(gavl_timecode_t * tc,
00117 int year,
00118 int month,
00119 int day);
00120
00131 GAVL_PUBLIC
00132 int64_t gavl_timecode_to_framecount(const gavl_timecode_format_t * tf,
00133 gavl_timecode_t tc);
00134
00145 GAVL_PUBLIC
00146 gavl_timecode_t gavl_timecode_from_framecount(const gavl_timecode_format_t * tf,
00147 int64_t fc);
00148
00156 GAVL_PUBLIC
00157 void gavl_timecode_dump(const gavl_timecode_format_t * tf,
00158 gavl_timecode_t tc);
00159
00160
00161
00162
00163 #define GAVL_TIMECODE_STRING_LEN 26
00176 GAVL_PUBLIC
00177 void gavl_timecode_prettyprint(const gavl_timecode_format_t * tf,
00178 gavl_timecode_t tc,
00179 char str[GAVL_TIMECODE_STRING_LEN]);
00180
00181
00182
00183 #define GAVL_TIMECODE_STRING_LEN_SHORT 13
00193 GAVL_PUBLIC
00194 void gavl_timecode_prettyprint_short(gavl_timecode_t tc,
00195 char str[GAVL_TIMECODE_STRING_LEN_SHORT]);
00196
00197
00198
00199
00200
00201
00202 #ifdef __cplusplus
00203 }
00204 #endif
00205
00206 #endif
00207