1
2 #include "config.h"
3
4 #include "gstsmptetimecode.h"
5
6 #include <glib.h>
7
8 #define NTSC_FRAMES_PER_10_MINS (10*60*30 - 10*2 + 2)
9 #define NTSC_FRAMES_PER_HOUR (6*NTSC_FRAMES_PER_10_MINS)
10
11
12 int
main(int argc,char * argv[])13 main (int argc, char *argv[])
14 {
15 GstSMPTETimeCode tc;
16 int i;
17 int min;
18
19 for (min = 0; min < 3; min++) {
20 g_print ("--- minute %d ---\n", min);
21 for (i = min * 60 * 30 - 5; i <= min * 60 * 30 + 5; i++) {
22 gst_smpte_time_code_from_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30, &tc,
23 i);
24 g_print ("%d %02d:%02d:%02d:%02d\n", i, tc.hours, tc.minutes, tc.seconds,
25 tc.frames);
26 }
27 }
28
29 for (min = 9; min < 12; min++) {
30 g_print ("--- minute %d ---\n", min);
31 for (i = min * 60 * 30 - 5 - 18; i <= min * 60 * 30 + 5 - 18; i++) {
32 gst_smpte_time_code_from_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30, &tc,
33 i);
34 g_print ("%d %02d:%02d:%02d:%02d\n", i, tc.hours, tc.minutes, tc.seconds,
35 tc.frames);
36 }
37 }
38
39 for (min = -1; min < 2; min++) {
40 int offset = NTSC_FRAMES_PER_HOUR;
41
42 g_print ("--- minute %d ---\n", min);
43 for (i = offset + min * 60 * 30 - 5; i <= offset + min * 60 * 30 + 5; i++) {
44 gst_smpte_time_code_from_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30, &tc,
45 i);
46 g_print ("%d %02d:%02d:%02d:%02d\n", i, tc.hours, tc.minutes, tc.seconds,
47 tc.frames);
48 }
49 }
50
51 for (min = 0; min < 1; min++) {
52 int offset = NTSC_FRAMES_PER_HOUR;
53
54 g_print ("--- minute %d ---\n", min);
55 for (i = 24 * offset - 5; i <= 24 * offset + 5; i++) {
56 gst_smpte_time_code_from_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30, &tc,
57 i);
58 g_print ("%d %02d:%02d:%02d:%02d\n", i, tc.hours, tc.minutes, tc.seconds,
59 tc.frames);
60 }
61 }
62
63 for (i = 0; i < 24 * NTSC_FRAMES_PER_HOUR; i++) {
64 int fn;
65 int ret;
66
67 gst_smpte_time_code_from_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30, &tc,
68 i);
69
70 ret = gst_smpte_time_code_get_frame_number (GST_SMPTE_TIME_CODE_SYSTEM_30,
71 &fn, &tc);
72 if (!ret) {
73 g_print ("bad valid at %d\n", i);
74 }
75 if (fn != i) {
76 g_print ("index mismatch %d != %d\n", fn, i);
77 }
78 }
79
80 return 0;
81 }
82