gavl
timecode.h
1/*****************************************************************
2 * gavl - a general purpose audio/video processing library
3 *
4 * Copyright (c) 2001 - 2011 Members of the Gmerlin project
5 * gmerlin-general@lists.sourceforge.net
6 * http://gmerlin.sourceforge.net
7 *
8 * This program is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * *****************************************************************/
21
22#ifndef TIMECODE_H_INCLUDED
23#define TIMECODE_H_INCLUDED
24
25#ifdef __cplusplus
26extern "C" {
27#endif
28
29#include <gavl/gavldefs.h>
30
43typedef uint64_t gavl_timecode_t;
44
45#define GAVL_TIMECODE_SIGN_MASK (0x1LL<<62)
46#define GAVL_TIMECODE_INVALID_MASK (0x1LL<<63)
47
48#define GAVL_TIMECODE_DROP_FRAME (1<<0)
49
50#define GAVL_TIMECODE_UNDEFINED GAVL_TIMECODE_INVALID_MASK
51
59typedef struct
60 {
62 int flags;
64
71GAVL_PUBLIC
73 const gavl_timecode_format_t * src);
74
75
84GAVL_PUBLIC
86 int * hours,
87 int * minutes,
88 int * seconds,
89 int * frames);
90
98GAVL_PUBLIC
100 int * year,
101 int * month,
102 int * day);
103
112GAVL_PUBLIC
114 int hours,
115 int minutes,
116 int seconds,
117 int frames);
118
126GAVL_PUBLIC
128 int year,
129 int month,
130 int day);
131
141GAVL_PUBLIC
143 gavl_timecode_t tc);
144
154GAVL_PUBLIC
156 int64_t fc);
157
165GAVL_PUBLIC
167 gavl_timecode_t tc);
168
169
170/* -YYYY-MM-DD-HH:MM:SS.FFFF */
171
172#define GAVL_TIMECODE_STRING_LEN 26
185GAVL_PUBLIC
188 char str[GAVL_TIMECODE_STRING_LEN]);
189
190/* -HH:MM:SS:FF */
191
192#define GAVL_TIMECODE_STRING_LEN_SHORT 13
202GAVL_PUBLIC
205
206
211#ifdef __cplusplus
212}
213#endif
214
215#endif /* TIMECODE_H_INCLUDED */
216
GAVL_PUBLIC void gavl_timecode_prettyprint_short(gavl_timecode_t tc, char str[GAVL_TIMECODE_STRING_LEN_SHORT])
Print a short timecode into a string.
GAVL_PUBLIC gavl_timecode_t gavl_timecode_from_framecount(const gavl_timecode_format_t *tf, int64_t fc)
Get a timecode from the frame count.
GAVL_PUBLIC void gavl_timecode_format_copy(gavl_timecode_format_t *dst, const gavl_timecode_format_t *src)
Copy one timecode format to another.
uint64_t gavl_timecode_t
Typedef for timecodes.
Definition: timecode.h:43
GAVL_PUBLIC void gavl_timecode_to_hmsf(gavl_timecode_t tc, int *hours, int *minutes, int *seconds, int *frames)
Extract the time part of the timecode.
GAVL_PUBLIC void gavl_timecode_from_hmsf(gavl_timecode_t *tc, int hours, int minutes, int seconds, int frames)
Set the time part of the timecode.
GAVL_PUBLIC void gavl_timecode_from_ymd(gavl_timecode_t *tc, int year, int month, int day)
Set the date part of the timecode.
GAVL_PUBLIC int64_t gavl_timecode_to_framecount(const gavl_timecode_format_t *tf, gavl_timecode_t tc)
Get the frame count from the timecode.
GAVL_PUBLIC void gavl_timecode_dump(const gavl_timecode_format_t *tf, gavl_timecode_t tc)
Dump a timecode to stderr.
GAVL_PUBLIC void gavl_timecode_prettyprint(const gavl_timecode_format_t *tf, gavl_timecode_t tc, char str[GAVL_TIMECODE_STRING_LEN])
Print a full timecode into a string.
#define GAVL_TIMECODE_STRING_LEN_SHORT
Definition: timecode.h:192
GAVL_PUBLIC void gavl_timecode_to_ymd(gavl_timecode_t tc, int *year, int *month, int *day)
Extract the date part of the timecode.
#define GAVL_TIMECODE_STRING_LEN
Definition: timecode.h:172
Timecode format.
Definition: timecode.h:60
int int_framerate
Integer framerate. A value of zero signals, that no timecodes are available.
Definition: timecode.h:61
int flags
Zero or more of the flags defined above.
Definition: timecode.h:62