annotate TOOLS/realcodecs/14_4.c @ 24992:5701e23ebcb4

Better handling of win32 GUI thread: 1. Use _beginthreadex to create the GUI thread to avoid possible memory leak when linked to MS CRT. 2. Terminate the GUI thread in an cleaner way using PostThreadMessage() rather than the unrecommended TerminateThread().
author zuxy
date Sun, 11 Nov 2007 08:14:57 +0000
parents 29fe677d8a19
children 9e13376e0daa
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>
24208
3b80b74b6813 Fix "incompatible implicit declaration of built-in function 'exit'" warnings.
diego
parents: 10123
diff changeset
14 #include <stdlib.h>
10123
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
15 #include <dlfcn.h>
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
16 #include <sys/time.h>
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
17
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
18 typedef unsigned long ulong;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
19
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
20 ulong (*raCloseCodec)(ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
21 ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
22 ulong (*raFreeDecoder)(ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
23 ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
24 ulong (*raGetNumberOfFlavors)(void);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
25 ulong (*raInitDecoder)(ulong,ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
26 ulong (*raOpenCodec2)(ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
27 ulong (*raSetFlavor)(ulong);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
28
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
29 int b_dlOpened=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
30 void *handle=NULL;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
31
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
32 /* exits program when failure */
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
33 void loadSyms() {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
34 fputs("loadSyms()\n", stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
35 if (!b_dlOpened) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
36 char *error;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
37
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
38 // fputs("opening dll...\n");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
39 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
40 if (!handle) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
41 fputs (dlerror(), stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
42 exit(1);
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
45 raCloseCodec = dlsym(handle, "RACloseCodec");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
46 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
47 fprintf (stderr, "dlsym(RACloseCodec): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
48 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
49 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
50 raDecode = dlsym(handle, "RADecode");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
51 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
52 fprintf (stderr, "dlsym(RADecode): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
53 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
54 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
55 raFreeDecoder = dlsym(handle, "RAFreeDecoder");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
56 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
57 fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
58 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
59 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
60 raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
61 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
62 fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
63 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
64 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
65 raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
66 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
67 fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
68 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
69 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
70 raInitDecoder = dlsym(handle, "RAInitDecoder");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
71 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
72 fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
73 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
74 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
75 raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
76 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
77 fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
78 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
79 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
80 raSetFlavor = dlsym(handle, "RASetFlavor");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
81 if ((error = dlerror()) != NULL) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
82 fprintf (stderr, "dlsym(RASetFlavor): %s\n", error);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
83 exit(1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
84 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
85 b_dlOpened=1;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
89 void closeDll() {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
90 if (handle) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
91 b_dlOpened=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
92 dlclose(handle);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
93 handle=NULL;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
97 void _init(void) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
98 loadSyms();
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
101 struct timezone tz;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
102 struct timeval tv1, tv2;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
103
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
104 void tic() {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
105 gettimeofday(&tv1, &tz);
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
108 void toc() {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
109 long secs, usecs;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
110 gettimeofday(&tv2, &tz);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
111 secs=tv2.tv_sec-tv1.tv_sec;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
112 usecs=tv2.tv_usec-tv1.tv_usec;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
113 if (usecs<0) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
114 usecs+=1000000;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
115 --secs;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
116 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
117 fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
121 void hexdump(void *pos, int len) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
122 unsigned char *cpos=pos, *cpos1;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
123 int lines=(len+15)>>4;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
124 while(lines--) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
125 int len1=len, i;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
126 fprintf(stderr, "%0x ", cpos);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
127 cpos1=cpos;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
128 for (i=0;i<16;i++) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
129 if (len1>0) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
130 fprintf(stderr, "%02x ", *(cpos++));
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
131 } else {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
132 fprintf(stderr, " ");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
133 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
134 len1--;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
135 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
136 fputs(" ", stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
137 cpos=cpos1;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
138 for (i=0;i<16;i++) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
139 if (len>0) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
140 unsigned char ch=(*(cpos++));
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
141 if ((ch<32)||(ch>127)) ch='.';
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
142 fputc(ch, stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
143 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
144 len--;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
145 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
146 fputs("\n", stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
147 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
148 fputc('\n', stderr);
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
152 ulong RACloseCodec(ulong p1) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
153 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
154 fprintf(stderr, "RACloseCodec(ulong p1=0x%0x(%d))\n", p1, p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
155 result=(*raCloseCodec)(p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
156 // closeDll();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
157 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
158 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
161 static int pkno=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
162
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
163 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
164 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
165 int x,y;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
166
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
167 fprintf(stderr, "RADecode(ulong ctx=0x%0x, ", p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
168 fprintf(stderr, "ulong src=0x%0x,\n", p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
169 fprintf(stderr, "ulong len=0x%0x,", p3);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
170 fprintf(stderr, "ulong dst=0x%0x,\n", p4);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
171 fprintf(stderr, "ulong dstcnt=0x%0x, ",p5);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
172 fprintf(stderr, "ulong p6=%d)\n", p6);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
173 // hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
174 hexdump((void*)p2, p3);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
175 // hexdump((void*)p4, 80);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
176 // hexdump((void*)p5, 16);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
177 // tic();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
178
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
179 fprintf(stderr,"\n#CRC[%3d]",pkno++);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
180 for(y=0;y<10;y++){
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
181 unsigned short crc=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
182 unsigned char* p=p2;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
183 p+=60*y;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
184 for(x=0;x<60;x++){
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
185 crc+=p[x]<<(x&7);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
186 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
187 fprintf(stderr," %04X",crc);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
188 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
189 fprintf(stderr,"\n");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
190
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
191 result=(*raDecode)(p1,p2,p3,p4,p5,p6);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
192 // toc();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
193 // hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
194 // hexdump((void*)p4, 80);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
195 // hexdump((void*)p5, 16);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
196 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
197 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
200 ulong RAFreeDecoder(ulong p1) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
201 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
202 fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0x(%d))\n", p1, p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
203 hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
204 result=(*raFreeDecoder)(p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
205 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
206 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
209 ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
210 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
211 fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0x(%d), ", p1, p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
212 fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
213 fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
214 fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
215 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
216 hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
217 tic();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
218 result=(*raGetFlavorProperty)(p1,p2,p3,p4);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
219 toc();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
220 fprintf(stderr, "*p4=0x%0x\n", *((ulong*)p4));
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
221 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
222 hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
223 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
224 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
227 ulong RAGetNumberOfFlavors(void) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
228 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
229 fprintf(stderr, "RAGetNumberOfFlavors(void)\n");
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
230 result=(*raGetNumberOfFlavors)();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
231 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
232 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
235 ulong RAInitDecoder(ulong p1,ulong p2) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
236 ulong result;
24213
29fe677d8a19 warning fixes:
diego
parents: 24208
diff changeset
237 // int temp[256];
29fe677d8a19 warning fixes:
diego
parents: 24208
diff changeset
238 // unsigned char temp2[256];
10123
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
239 fprintf(stderr, "RAInitDecoder(ulong p1=0x%0x(%d), ", p1, p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
240 fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
241 hexdump((void*)p2, 4*7);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
242 // hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
243 // memset(temp,0x77,256*4);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
244 // memcpy(temp,p2,4*7);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
245 // hexdump((void*)temp[6], 32);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
246
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
247 // memset(temp2,0x77,256);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
248 // memcpy(temp2,temp[6],16);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
249 // temp[6]=temp2;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
250
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
251 result=(*raInitDecoder)(p1,/*temp*/p2);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
252 // hexdump((void*)temp[6], 32);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
253 // memcpy(p2,temp,4*11);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
254 // hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
255 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
256 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
259 ulong RAOpenCodec2(ulong p1) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
260 ulong result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
261 // loadSyms();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
262 fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0x(%d)\n", p1, p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
263 hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
264 result=(*raOpenCodec2)(p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
265 hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
266 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
267 return result;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
270 ulong RASetFlavor(ulong p1) {
24213
29fe677d8a19 warning fixes:
diego
parents: 24208
diff changeset
271 ulong result;
29fe677d8a19 warning fixes:
diego
parents: 24208
diff changeset
272 // ulong numflavors, flavor, numprop=0, result1=0;
29fe677d8a19 warning fixes:
diego
parents: 24208
diff changeset
273 // unsigned short property;
10123
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
274 fprintf(stderr, "RASetFlavor(ulong p1=0x%0x(%d))\n", p1, p1);
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 // hexdump((void*)p1, 44);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
277 result=(*raSetFlavor)(p1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
278 fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
279
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
280 #if 0
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
281 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
282 numflavors=raGetNumberOfFlavors2();
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
283 flavor=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
284 while (flavor<numflavors) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
285 fprintf(stderr, "************ Flavor %d *************\n\n", flavor);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
286 numprop=0;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
287 while (numprop<32) {
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
288 result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
289 fprintf(stderr, "property %d=%d, result=0x%0x\n\n",
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
290 numprop, property, result1);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
291 hexdump((void*)result1, property);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
292 numprop++;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
293 }
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
294 flavor++;
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
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
297 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
298 #endif
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
299
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
300 return result;
8bf6c57c5bbd wrappers for 14.4 and 28.8 codecs
rtognimp
parents:
diff changeset
301 }