gavl

- Main Page
- Modules
- Data Structures
- Files
- Directories

- File List
- Globals

# timecode.h

    00001 /*****************************************************************
    00002  * gavl - a general purpose audio/video processing library
    00003  *
    00004  * Copyright (c) 2001 - 2011 Members of the Gmerlin project
    00005  * gmerlin-general@lists.sourceforge.net
    00006  * http://gmerlin.sourceforge.net
    00007  *
    00008  * This program is free software: you can redistribute it and/or modify
    00009  * it under the terms of the GNU General Public License as published by
    00010  * the Free Software Foundation, either version 2 of the License, or
    00011  * (at your option) any later version.
    00012  *
    00013  * This program is distributed in the hope that it will be useful,
    00014  * but WITHOUT ANY WARRANTY; without even the implied warranty of
    00015  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    00016  * GNU General Public License for more details.
    00017  *
    00018  * You should have received a copy of the GNU General Public License
    00019  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
    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) //!< If 1, timecode is negative
    00046 #define GAVL_TIMECODE_INVALID_MASK  (0x1LL<<63) //!< If 1, timecode is invalid
    00047
    00048 #define GAVL_TIMECODE_DROP_FRAME (1<<0) //!< NTSC drop frame is used
    00049
    00050 #define GAVL_TIMECODE_UNDEFINED GAVL_TIMECODE_INVALID_MASK //!< Convenience macro
    00051
    00059 typedef struct
    00060   {
    00061   int int_framerate;
    00062   int flags;
    00063   } gavl_timecode_format_t;
    00064
    00071 GAVL_PUBLIC
    00072 void gavl_timecode_format_copy(gavl_timecode_format_t * dst,
    00073                                const gavl_timecode_format_t * src);
    00074
    00075
    00084 GAVL_PUBLIC
    00085 void gavl_timecode_to_hmsf(gavl_timecode_t tc,
    00086                            int * hours,
    00087                            int * minutes,
    00088                            int * seconds,
    00089                            int * frames);
    00090
    00098 GAVL_PUBLIC
    00099 void gavl_timecode_to_ymd(gavl_timecode_t tc,
    00100                           int * year,
    00101                           int * month,
    00102                           int * day);
    00103
    00112 GAVL_PUBLIC
    00113 void gavl_timecode_from_hmsf(gavl_timecode_t * tc,
    00114                             int hours,
    00115                             int minutes,
    00116                             int seconds,
    00117                             int frames);
    00118
    00126 GAVL_PUBLIC
    00127 void gavl_timecode_from_ymd(gavl_timecode_t * tc,
    00128                             int year,
    00129                             int month,
    00130                             int day);
    00131
    00141 GAVL_PUBLIC
    00142 int64_t gavl_timecode_to_framecount(const gavl_timecode_format_t * tf,
    00143                                     gavl_timecode_t tc);
    00144
    00154 GAVL_PUBLIC
    00155 gavl_timecode_t gavl_timecode_from_framecount(const gavl_timecode_format_t * tf,
    00156                                               int64_t fc);
    00157
    00165 GAVL_PUBLIC
    00166 void gavl_timecode_dump(const gavl_timecode_format_t * tf,
    00167                         gavl_timecode_t tc);
    00168
    00169
    00170 /* -YYYY-MM-DD-HH:MM:SS.FFFF */
    00171
    00172 #define GAVL_TIMECODE_STRING_LEN 26
    00185 GAVL_PUBLIC
    00186 void gavl_timecode_prettyprint(const gavl_timecode_format_t * tf,
    00187                                gavl_timecode_t tc,
    00188                                char str[GAVL_TIMECODE_STRING_LEN]);
    00189
    00190 /* -HH:MM:SS:FF */
    00191
    00192 #define GAVL_TIMECODE_STRING_LEN_SHORT 13
    00202 GAVL_PUBLIC
    00203 void gavl_timecode_prettyprint_short(gavl_timecode_t tc,
    00204                                      char str[GAVL_TIMECODE_STRING_LEN_SHORT]);
    00205
    00206
    00207 /*
    00208  * @}
    00209  */
    00210
    00211 #ifdef __cplusplus
    00212 }
    00213 #endif
    00214
    00215 #endif /* TIMECODE_H_INCLUDED */
    00216