annotate TOOLS/realcodecs/28_8.c @ 19725:7ef3354f723d

Outdated file synced with r19589
author voroshil
date Thu, 07 Sep 2006 08:10:21 +0000
parents 5ea24082eaaa
children 3b80b74b6813
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
10122
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
1 /*
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
2 GPL v2 blah blah
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
3
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
4 This is a small dll that works as a wrapper for the actual 14_4.so.6.0
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
5 dll from real player 8.0.
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
6 */
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
7
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
8 /*
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
9 Assuming that RACloseCodec is the last call.
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
10 */
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
11
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
12 #include <stddef.h>
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
13 #include <stdio.h>
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
14 #include <dlfcn.h>
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
15 #include <sys/time.h>
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
16
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
17 typedef unsigned long ulong;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
18
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
19 ulong (*raCloseCodec)(ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
20 ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
21 ulong (*raFreeDecoder)(ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
22 ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
23 ulong (*raGetNumberOfFlavors)(void);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
24 ulong (*raInitDecoder)(ulong,ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
25 ulong (*raOpenCodec2)(ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
26 ulong (*raSetFlavor)(ulong);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
27
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
28 int b_dlOpened=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
29 void *handle=NULL;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
30
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
31 /* exits program when failure */
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
32 void loadSyms() {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
33 fputs("loadSyms()\n", stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
34 if (!b_dlOpened) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
35 char *error;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
36
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
37 // fputs("opening dll...\n");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
38 handle = dlopen ("/home/r/RealPlayer8/Codecs/real28_8.so.6.0", RTLD_LAZY);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
39 if (!handle) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
40 fputs (dlerror(), stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
41 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
42 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
43
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
44 raCloseCodec = dlsym(handle, "RACloseCodec");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
45 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
46 fprintf (stderr, "dlsym(RACloseCodec): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
47 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
48 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
49 raDecode = dlsym(handle, "RADecode");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
50 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
51 fprintf (stderr, "dlsym(RADecode): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
52 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
53 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
54 raFreeDecoder = dlsym(handle, "RAFreeDecoder");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
55 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
56 fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
57 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
58 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
59 raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
60 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
61 fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
62 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
63 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
64 raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
65 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
66 fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
67 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
68 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
69 raInitDecoder = dlsym(handle, "RAInitDecoder");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
70 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
71 fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
72 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
73 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
74 raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
75 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
76 fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
77 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
78 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
79 raSetFlavor = dlsym(handle, "RASetFlavor");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
80 if ((error = dlerror()) != NULL) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
81 fprintf (stderr, "dlsym(RASetFlavor): %s\n", error);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
82 exit(1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
83 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
84 b_dlOpened=1;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
85 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
86 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
87
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
88 void closeDll() {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
89 if (handle) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
90 b_dlOpened=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
91 dlclose(handle);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
92 handle=NULL;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
93 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
94 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
95
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
96 void _init(void) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
97 loadSyms();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
98 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
99
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
100 struct timezone tz;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
101 struct timeval tv1, tv2;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
102
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
103 void tic() {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
104 gettimeofday(&tv1, &tz);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
105 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
106
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
107 void toc() {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
108 long secs, usecs;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
109 gettimeofday(&tv2, &tz);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
110 secs=tv2.tv_sec-tv1.tv_sec;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
111 usecs=tv2.tv_usec-tv1.tv_usec;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
112 if (usecs<0) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
113 usecs+=1000000;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
114 --secs;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
115 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
116 fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
117 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
118
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
119
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
120 void hexdump(void *pos, int len) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
121 unsigned char *cpos=pos, *cpos1;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
122 int lines=(len+15)>>4;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
123 while(lines--) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
124 int len1=len, i;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
125 fprintf(stderr, "%0x ", cpos);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
126 cpos1=cpos;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
127 for (i=0;i<16;i++) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
128 if (len1>0) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
129 fprintf(stderr, "%02x ", *(cpos++));
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
130 } else {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
131 fprintf(stderr, " ");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
132 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
133 len1--;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
134 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
135 fputs(" ", stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
136 cpos=cpos1;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
137 for (i=0;i<16;i++) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
138 if (len>0) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
139 unsigned char ch=(*(cpos++));
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
140 if ((ch<32)||(ch>127)) ch='.';
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
141 fputc(ch, stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
142 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
143 len--;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
144 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
145 fputs("\n", stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
146 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
147 fputc('\n', stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
148 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
149
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
150
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
151 ulong RACloseCodec(ulong p1) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
152 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
153 fprintf(stderr, "RACloseCodec(ulong p1=0x%0x(%d))\n", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
154 result=(*raCloseCodec)(p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
155 // closeDll();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
156 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
157 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
158 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
159
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
160 static int pkno=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
161
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
162 ulong RADecode(ulong p1,ulong p2,ulong p3,ulong p4,ulong* p5,ulong p6) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
163 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
164 int x,y;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
165
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
166 fprintf(stderr, "RADecode(ulong ctx=0x%0x, ", p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
167 fprintf(stderr, "ulong src=0x%0x,\n", p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
168 fprintf(stderr, "ulong len=0x%0x,", p3);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
169 fprintf(stderr, "ulong dst=0x%0x,\n", p4);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
170 fprintf(stderr, "ulong dstcnt=0x%0x, ",p5);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
171 fprintf(stderr, "ulong p6=%d)\n", p6);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
172 // hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
173 hexdump((void*)p2, p3);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
174 // hexdump((void*)p4, 80);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
175 // hexdump((void*)p5, 16);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
176 // tic();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
177
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
178 fprintf(stderr,"\n#CRC[%3d]",pkno++);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
179 for(y=0;y<10;y++){
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
180 unsigned short crc=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
181 unsigned char* p=p2;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
182 p+=60*y;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
183 for(x=0;x<60;x++){
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
184 crc+=p[x]<<(x&7);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
185 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
186 fprintf(stderr," %04X",crc);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
187 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
188 fprintf(stderr,"\n");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
189
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
190 result=(*raDecode)(p1,p2,p3,p4,p5,p6);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
191 // toc();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
192 // hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
193 // hexdump((void*)p4, 80);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
194 // hexdump((void*)p5, 16);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
195 fprintf(stderr, "--> 0x%0x(%d) decoded: %d \n\n\n", result, result, p5[0]);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
196 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
197 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
198
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
199 ulong RAFreeDecoder(ulong p1) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
200 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
201 fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0x(%d))\n", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
202 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
203 result=(*raFreeDecoder)(p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
204 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
205 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
206 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
207
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
208 ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
209 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
210 fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0x(%d), ", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
211 fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
212 fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
213 fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
214 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
215 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
216 tic();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
217 result=(*raGetFlavorProperty)(p1,p2,p3,p4);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
218 toc();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
219 fprintf(stderr, "*p4=0x%0x\n", *((ulong*)p4));
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
220 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
221 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
222 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
223 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
224 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
225
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
226 ulong RAGetNumberOfFlavors(void) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
227 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
228 fprintf(stderr, "RAGetNumberOfFlavors(void)\n");
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
229 result=(*raGetNumberOfFlavors)();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
230 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
231 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
232 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
233
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
234 ulong RAInitDecoder(ulong p1,ulong p2) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
235 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
236 int temp[256];
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
237 unsigned char temp2[256];
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
238 fprintf(stderr, "RAInitDecoder(ulong p1=0x%0x(%d), ", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
239 fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
240 hexdump((void*)p2, 4*7);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
241 // hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
242 // memset(temp,0x77,256*4);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
243 // memcpy(temp,p2,4*7);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
244 // hexdump((void*)temp[6], 32);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
245
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
246 // memset(temp2,0x77,256);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
247 // memcpy(temp2,temp[6],16);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
248 // temp[6]=temp2;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
249
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
250 result=(*raInitDecoder)(p1,/*temp*/p2);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
251 // hexdump((void*)temp[6], 32);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
252 // memcpy(p2,temp,4*11);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
253 // hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
254 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
255 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
256 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
257
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
258 ulong RAOpenCodec2(ulong p1) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
259 ulong result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
260 // loadSyms();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
261 fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0x(%d)\n", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
262 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
263 result=(*raOpenCodec2)(p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
264 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
265 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
266 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
267 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
268
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
269 ulong RASetFlavor(ulong p1) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
270 ulong result, numprop=0, result1=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
271 ulong numflavors, flavor;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
272 unsigned short property;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
273 fprintf(stderr, "RASetFlavor(ulong p1=0x%0x(%d))\n", p1, p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
274 hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
275 // hexdump((void*)p1, 44);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
276 result=(*raSetFlavor)(p1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
277 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
278
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
279 #if 0
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
280 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
281 numflavors=raGetNumberOfFlavors2();
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
282 flavor=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
283 while (flavor<numflavors) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
284 fprintf(stderr, "************ Flavor %d *************\n\n", flavor);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
285 numprop=0;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
286 while (numprop<32) {
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
287 result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
288 fprintf(stderr, "property %d=%d, result=0x%0x\n\n",
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
289 numprop, property, result1);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
290 hexdump((void*)result1, property);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
291 numprop++;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
292 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
293 flavor++;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
294 }
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
295
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
296 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
297 #endif
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
298
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
299 return result;
5ea24082eaaa wrappers for 14.4 and 28.8 codecs14_4.c
rtognimp
parents:
diff changeset
300 }