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
00041 typedef uint64_t gavl_timecode_t;
00042
00043 #define GAVL_TIMECODE_SIGN_MASK (0x1LL<<62)
00044 #define GAVL_TIMECODE_INVALID_MASK (0x1LL<<63)
00045
00046 #define GAVL_TIMECODE_DROP_FRAME (1<<0)
00047 #define GAVL_TIMECODE_COUNTER (1<<1)
00048
00049 #define GAVL_TIMECODE_UNDEFINED GAVL_TIMECODE_INVALID_MASK
00050
00051
00058 typedef struct
00059 {
00060 int int_framerate;
00061 int flags;
00062 } gavl_timecode_format_t;
00063
00072 void gavl_timecode_to_hmsf(gavl_timecode_t tc,
00073 int * hours,
00074 int * minutes,
00075 int * seconds,
00076 int * frames);
00077
00085 void gavl_timecode_to_ymd(gavl_timecode_t tc,
00086 int * year,
00087 int * month,
00088 int * day);
00089
00098 void gavl_timecode_from_hmsf(gavl_timecode_t * tc,
00099 int hours,
00100 int minutes,
00101 int seconds,
00102 int frames);
00103
00111 void gavl_timecode_from_ymd(gavl_timecode_t * tc,
00112 int year,
00113 int month,
00114 int day);
00115
00123 int64_t gavl_timecode_to_framecount(const gavl_timecode_format_t * tf,
00124 gavl_timecode_t tc);
00125
00133 gavl_timecode_t gavl_timecode_from_framecount(const gavl_timecode_format_t * tf,
00134 int64_t fc);
00135
00143 void gavl_timecode_dump(const gavl_timecode_format_t * tf,
00144 gavl_timecode_t tc);
00145
00146
00147
00148
00149 #define GAVL_TIMECODE_STRING_LEN 26
00153 void gavl_timecode_prettyprint(const gavl_timecode_format_t * tf,
00154 gavl_timecode_t tc,
00155 char str[GAVL_TIMECODE_STRING_LEN]);
00156
00157
00158
00159
00160
00161
00162
00163
00164 #ifdef __cplusplus
00165 }
00166 #endif
00167
00168 #endif
00169