annotate TOOLS/realcodecs/14_4.c @ 21525:329b03d67891

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