xref: /haiku/src/tests/kits/media/TimeCodeTest.cpp (revision 2b76973fa2401f7a5edf68e6470f3d3210cbcff3)
1 
2 #include "TimeCode.h"
3 
4 #include <stdio.h>
5 
6 int main(int argc, char *argv[]) {
7 
8 BTimeCode *aBTimeCode;
9 int32 i,j,k;
10 char outStr[30];
11 
12 aBTimeCode = new BTimeCode();
13 
14 aBTimeCode->SetType(B_TIMECODE_30_DROP_2);
15 
16 // Test us -> TimeCode -> us
17 for (i=59000;i<=61000;i++) {
18 	aBTimeCode->SetMicroseconds(i);
19 	aBTimeCode->GetString(outStr);
20 	j = aBTimeCode->Microseconds();
21 	k = aBTimeCode->LinearFrames();
22 	printf("%ld = %s = %ld = %ld\n",i,outStr,j,k);
23 }
24 
25 // Test frames -> TimeCode -> frames
26 for (i=8990;i<=8995;i++) {
27 	aBTimeCode->SetLinearFrames(i);
28 	aBTimeCode->GetString(outStr);
29 	j = aBTimeCode->LinearFrames();
30 	printf("%ld = %s = %ld\n",i,outStr,j);
31 }
32 
33 for (i=17981;i<=17990;i++) {
34 	aBTimeCode->SetLinearFrames(i);
35 	aBTimeCode->GetString(outStr);
36 	j = aBTimeCode->LinearFrames();
37 	printf("%ld = %s = %ld\n",i,outStr,j);
38 }
39 
40 for (i=26971;i<=26980;i++) {
41 	aBTimeCode->SetLinearFrames(i);
42 	aBTimeCode->GetString(outStr);
43 	j = aBTimeCode->LinearFrames();
44 	printf("%ld = %s = %ld\n",i,outStr,j);
45 }
46 
47 }
48