• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) 2009 David A. Schleef <ds@schleef.org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef _GST_SMPTE_TIME_CODE_H_
21 #define _GST_SMPTE_TIME_CODE_H_
22 
23 #include <gst/gst.h>
24 
25 G_BEGIN_DECLS
26 
27 typedef struct _GstSMPTETimeCode GstSMPTETimeCode;
28 
29 /**
30  * GstSMPTETimeCode:
31  * @GST_SMPTE_TIME_CODE_SYSTEM_30: 29.97 frame per second system (NTSC)
32  * @GST_SMPTE_TIME_CODE_SYSTEM_25: 25 frame per second system (PAL)
33  * @GST_SMPTE_TIME_CODE_SYSTEM_24: 24 frame per second system
34  *
35  * Enum value representing SMPTE Time Code system.
36  */
37 typedef enum {
38   GST_SMPTE_TIME_CODE_SYSTEM_30 = 0,
39   GST_SMPTE_TIME_CODE_SYSTEM_25,
40   GST_SMPTE_TIME_CODE_SYSTEM_24
41 } GstSMPTETimeCodeSystem;
42 
43 struct _GstSMPTETimeCode {
44   int hours;
45   int minutes;
46   int seconds;
47   int frames;
48 };
49 
50 #define GST_SMPTE_TIME_CODE_SYSTEM_IS_VALID(x) \
51   ((x) >= GST_SMPTE_TIME_CODE_SYSTEM_30 && (x) <= GST_SMPTE_TIME_CODE_SYSTEM_24)
52 
53 #define GST_SMPTE_TIME_CODE_FORMAT "02d:%02d:%02d:%02d"
54 #define GST_SMPTE_TIME_CODE_ARGS(timecode) \
55   (timecode)->hours, (timecode)->minutes, \
56   (timecode)->seconds, (timecode)->frames
57 
58 gboolean gst_smpte_time_code_is_valid (GstSMPTETimeCodeSystem system,
59     GstSMPTETimeCode *time_code);
60 gboolean gst_smpte_time_code_from_frame_number (GstSMPTETimeCodeSystem system,
61     GstSMPTETimeCode *time_code, int frame_number);
62 gboolean gst_smpte_time_code_get_frame_number (GstSMPTETimeCodeSystem system,
63     int *frame_number, GstSMPTETimeCode *time_code);
64 GstClockTime gst_smpte_time_code_get_timestamp (GstSMPTETimeCodeSystem system,
65     GstSMPTETimeCode *time_code);
66 
67 G_END_DECLS
68 
69 #endif
70 
71