2 * Copyright (C) 2006 Smartjog S.A.S, Baptiste Coudurier <baptiste.coudurier@gmail.com>
3 * Copyright (C) 2011 Smartjog S.A.S, Clément Bœsch <clement.boesch@smartjog.com>
5 * This file is part of FFmpeg.
7 * FFmpeg is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public
9 * License as published by the Free Software Foundation;
10 * version 2 of the License.
12 * FFmpeg is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public
18 * License along with FFmpeg; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 * Timecode helpers header
27 #ifndef AVCODEC_TIMECODE_H
28 #define AVCODEC_TIMECODE_H
31 #include "libavutil/rational.h"
33 #define TIMECODE_OPT(ctx, flags) \
34 "timecode", "set timecode value following hh:mm:ss[:;.]ff format, " \
35 "use ';' or '.' before frame number for drop frame", \
36 offsetof(ctx, tc.str), \
37 FF_OPT_TYPE_STRING, {.str=NULL}, CHAR_MIN, CHAR_MAX, flags
40 char *str; ///< string following the hh:mm:ss[:;.]ff format
41 int start; ///< timecode frame start
42 int drop; ///< drop flag (1 if drop, else 0)
43 AVRational rate; ///< Frame rate in rationnal form
47 * @brief Adjust frame number for NTSC drop frame time code
48 * @param frame_num Actual frame number to adjust
49 * @return Adjusted frame number
50 * @warning Adjustment is only valid in NTSC 29.97
52 int ff_framenum_to_drop_timecode(int frame_num);
55 * Parse SMTPE 12M time representation (hh:mm:ss[:;.]ff). str and rate fields
56 * from tc struct must be set.
58 * @param avcl A pointer to an arbitrary struct of which the first field is a
59 * pointer to an AVClass struct (used for av_log).
60 * @param tc Timecode struct pointer
61 * @return 0 on success, negative value on failure
62 * @warning Adjustement is only valid in NTSC 29.97
64 int ff_init_smtpe_timecode(void *avcl, struct ff_timecode *tc);
66 #endif /* AVCODEC_TIMECODE_H */