int checkenv() { int rc; unlink("tools/.chk"); system("gcc tools/chkenv.c -o tools/chkenv" DN); return checkcmp(); }
int checkipv6() { int rc; unlink("tools/.chk"); if(strstr(os,"SunOS")==os) { if(needsock) { if(needbind) system("gcc tools/chkipv6.c -o tools/chkipv6 -lsocket -lnsl -ldl -lbind -DSUNOS " DN); else system("gcc tools/chkipv6.c -o tools/chkipv6 -lsocket -lnsl -ldl -DSUNOS " DN); } else system("gcc tools/chkipv6.c -DSUNOS -o tools/chkipv6 " DN); } else { if(needsock) { if(needbind) system("gcc tools/chkipv6.c -o tools/chkipv6 -lsocket -lnsl -ldl -lbind " DN); else system("gcc tools/chkipv6.c -o tools/chkipv6 -lsocket -lnsl -ldl " DN); } else system("gcc tools/chkipv6.c -o tools/chkipv6 " DN); } return checkcmp(); }
int checkbind() { int rc; unlink("tools/.chk"); system("gcc tools/chkbind.c -lnsl -ldl -lsocket -o tools/chkbind" DN); return checkcmp(); }
int checktime() { int rc; unlink("tools/.chk"); system("gcc tools/chktime.c -o tools/chktime" DN); return checkcmp(); }
int checkresolve() { int rc; unlink("tools/.chk"); system("gcc tools/chkresolv.c -o tools/chkresolv -lresolv" DN); return checkcmp(); }
int checksocklib() { int rc; unlink("tools/.chk"); system("gcc tools/chksock.c -o tools/chksock" DN); return checkcmp(); }
int checkssl() { int rc; #ifdef SSLPATH char mbuf[300]; char sysbuf[1024+strlen(SSLPATH)]; #endif unlink("tools/.chk"); #ifdef SSLPATH strcpy(mbuf,SSLPATH); if(mbuf[strlen(mbuf)-1]!='/') strcat(mbuf,"/"); strcpy(sysbuf,"gcc tools/chkssl.c -I"); strcat(sysbuf,mbuf); strcat(sysbuf,"include -L"); strcat(sysbuf,mbuf); strcat(sysbuf,"lib -lssl -lcrypto -o tools/chkssl "); strcat(sysbuf,DN); system(sysbuf); #else system("gcc tools/chkssl.c -I/usr/local/ssl/include -L/usr/local/ssl/lib -lssl -lcrypto -o tools/chkssl" DN); #endif return checkcmp(); }
int checkipv6usable() { system("tools/chkipv6 >tools/.chk"); return checkcmp(); }
int main (int argc, char **argv) { int64_t magic = 964965602; // 05:34:43:11 @29.97ndf, 48kSPS //int64_t magic = 1601568888; // Timecode tc; memset(&tc, 0, sizeof(Timecode)); checkfps(259199740, TCFPS2997DF, 48000); checkfps(48048, TCFPS2997DF, 48000); checkfps(48047, TCFPS2997DF, 48000); /* test converter */ printf("test convert\n"); checkfps(magic, &tcfps23976, 48000); checkfps(magic, TCFPS24, 48000); checkfps(magic, TCFPS25, 48000); checkfps(magic, &tcfps2997ndf, 48000); checkfps(magic, TCFPS2997DF, 48000); checkfps(magic, TCFPS30, 48000); checkfps(magic, &tcfps30df, 48000); /* test parser */ printf("test parser\n"); TimecodeTime t; char tcs[64]; timecode_parse_time(&t, TCFPS25, "1:::-1"); timecode_time_to_string(tcs, &t); fprintf(stdout, "%s\n", tcs); timecode_parse_time(&tc.t, TCFPS25, ":::1.100"); timecode_copy_rate(&tc, TCFPSMS); timecode_strftimecode(tcs, 64, "%Z", &tc); fprintf(stdout, "%s\n", tcs); /* test add/sub */ printf("test addition/subtraction\n"); checkadd(TCFPS2997DF, 48000); checksub(TCFPS2997DF, 48000); checkadd(TCFPS30, 48000); checksub(TCFPS30, 48000); /* test add/sub */ printf("test compare\n"); checkcmp(); /* test inc/dec */ printf("test inc/dec\n"); tc.d.year = 2008; tc.d.month = 12; tc.d.day = 31; tc.d.timezone = 0; tc.t.hour = 23; tc.t.minute = 59; tc.t.second = 59; tc.t.frame = 29; tc.t.subframe = 29; memcpy(&tc.r, TCFPS30, sizeof(TimecodeRate)); timecode_datetime_increment(&tc); timecode_datetime_decrement(&tc); fprintf(stdout, "%02d/%02d/%02d %02d:%02d:%02d%c%02d\n", tc.d.month, tc.d.day, tc.d.year, tc.t.hour, tc.t.minute, tc.t.second, (TCFPS30->drop) ? '.' : ':', tc.t.frame ); tc.t.subframe = 0; timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @30fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS24, &tc.t, TCFPS30); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @24fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS25, &tc.t, TCFPS24); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @25fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS30, &tc.t, TCFPS25); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @30fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS25, &tc.t, TCFPS30); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @25fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS24, &tc.t, TCFPS25); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @24fps\n", tcs); timecode_convert_rate(&tc.t, TCFPS30, &tc.t, TCFPS24); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s @30fps\n", tcs); #if 1 timecode_convert_rate(&tc.t, &tcfpsUS, &tc.t, TCFPS30); timecode_time_to_string(tcs, &tc.t); fprintf(stdout, "%s\n", tcs); #endif printf(" to/from sec\n"); double sec = timecode_to_sec(&tc.t, &tcfpsUS); printf("%f\n", sec); timecode_seconds_to_time(&tc.t, TCFPSMS, sec); memcpy(&tc.r, TCFPSMS, sizeof(TimecodeRate)); #if 0 tc.t.frame = 5; tc.d.timezone = -90; #endif timecode_strftimecode(tcs, 64,"%Z", &tc); fprintf(stdout, "%s\n", tcs); printf(" check \n"); timecode_copy_rate(&tc, &tcfps2997df); timecode_parse_time(&tc.t, &tc.r, "05:35:03:15"); printf("%lld <> 964965602\n", timecode_to_sample(&tc.t, &tc.r, 48000)); timecode_copy_rate(&tc, &tcfps2997ndf); timecode_parse_time(&tc.t, &tc.r, "05:34:43:11"); printf("%lld <> 964965602\n", timecode_to_sample(&tc.t, &tc.r, 48000)); return 0; }