Mercurial > mplayer.hg
annotate TOOLS/realcodecs/14_4.c @ 36795:7ee92e6f4d61
hwac3: Remove unused code.
author | reimar |
---|---|
date | Wed, 19 Feb 2014 23:01:09 +0000 |
parents | cef5275fc11f |
children |
rev | line source |
---|---|
10123 | 1 /* |
28195
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
2 * This is a small DLL that works as a wrapper for the actual real14_4.so.6.0 |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
3 * DLL from RealPlayer 8.0. |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
4 * |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
5 * This file is part of MPlayer. |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
6 * |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
7 * MPlayer is free software; you can redistribute it and/or modify |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
8 * it under the terms of the GNU General Public License as published by |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
9 * the Free Software Foundation; either version 2 of the License, or |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
10 * (at your option) any later version. |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
11 * |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
12 * MPlayer is distributed in the hope that it will be useful, |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
15 * GNU General Public License for more details. |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
16 * |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
17 * You should have received a copy of the GNU General Public License along |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
18 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
3f3f00ce912e
Relicense to GPLv2 or later with the author's permission.
diego
parents:
28193
diff
changeset
|
20 */ |
10123 | 21 |
22 /* | |
23 Assuming that RACloseCodec is the last call. | |
24 */ | |
25 | |
26 #include <stddef.h> | |
27 #include <stdio.h> | |
24208
3b80b74b6813
Fix "incompatible implicit declaration of built-in function 'exit'" warnings.
diego
parents:
10123
diff
changeset
|
28 #include <stdlib.h> |
10123 | 29 #include <dlfcn.h> |
30 #include <sys/time.h> | |
31 | |
32 typedef unsigned long ulong; | |
33 | |
34 ulong (*raCloseCodec)(ulong); | |
35 ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong); | |
36 ulong (*raFreeDecoder)(ulong); | |
37 ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong); | |
38 ulong (*raGetNumberOfFlavors)(void); | |
39 ulong (*raInitDecoder)(ulong,ulong); | |
40 ulong (*raOpenCodec2)(ulong); | |
41 ulong (*raSetFlavor)(ulong); | |
42 | |
43 int b_dlOpened=0; | |
44 void *handle=NULL; | |
45 | |
46 /* exits program when failure */ | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28195
diff
changeset
|
47 void loadSyms(void) { |
10123 | 48 fputs("loadSyms()\n", stderr); |
49 if (!b_dlOpened) { | |
50 char *error; | |
51 | |
52 // fputs("opening dll...\n"); | |
53 handle = dlopen ("/home/r/RealPlayer8/Codecs/real14_4.so.6.0", RTLD_LAZY); | |
54 if (!handle) { | |
55 fputs (dlerror(), stderr); | |
56 exit(1); | |
57 } | |
58 | |
59 raCloseCodec = dlsym(handle, "RACloseCodec"); | |
60 if ((error = dlerror()) != NULL) { | |
61 fprintf (stderr, "dlsym(RACloseCodec): %s\n", error); | |
62 exit(1); | |
63 } | |
64 raDecode = dlsym(handle, "RADecode"); | |
65 if ((error = dlerror()) != NULL) { | |
66 fprintf (stderr, "dlsym(RADecode): %s\n", error); | |
67 exit(1); | |
68 } | |
69 raFreeDecoder = dlsym(handle, "RAFreeDecoder"); | |
70 if ((error = dlerror()) != NULL) { | |
71 fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error); | |
72 exit(1); | |
73 } | |
74 raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty"); | |
75 if ((error = dlerror()) != NULL) { | |
76 fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error); | |
77 exit(1); | |
78 } | |
79 raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors"); | |
80 if ((error = dlerror()) != NULL) { | |
81 fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error); | |
82 exit(1); | |
83 } | |
84 raInitDecoder = dlsym(handle, "RAInitDecoder"); | |
85 if ((error = dlerror()) != NULL) { | |
86 fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error); | |
87 exit(1); | |
88 } | |
89 raOpenCodec2 = dlsym(handle, "RAOpenCodec2"); | |
90 if ((error = dlerror()) != NULL) { | |
91 fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error); | |
92 exit(1); | |
93 } | |
94 raSetFlavor = dlsym(handle, "RASetFlavor"); | |
95 if ((error = dlerror()) != NULL) { | |
96 fprintf (stderr, "dlsym(RASetFlavor): %s\n", error); | |
97 exit(1); | |
98 } | |
99 b_dlOpened=1; | |
100 } | |
101 } | |
102 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28195
diff
changeset
|
103 void closeDll(void) { |
10123 | 104 if (handle) { |
105 b_dlOpened=0; | |
106 dlclose(handle); | |
107 handle=NULL; | |
108 } | |
109 } | |
110 | |
111 void _init(void) { | |
112 loadSyms(); | |
113 } | |
114 | |
115 struct timeval tv1, tv2; | |
116 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28195
diff
changeset
|
117 void tic(void) { |
35904
cef5275fc11f
Avoid usage of obsolete and BSD-specific "struct timezone".
diego
parents:
29263
diff
changeset
|
118 gettimeofday(&tv1, NULL); |
10123 | 119 } |
120 | |
28232
8df85ad26746
Add missing 'void' keyword to parameterless function declarations.
diego
parents:
28195
diff
changeset
|
121 void toc(void) { |
10123 | 122 long secs, usecs; |
35904
cef5275fc11f
Avoid usage of obsolete and BSD-specific "struct timezone".
diego
parents:
29263
diff
changeset
|
123 gettimeofday(&tv2, NULL); |
10123 | 124 secs=tv2.tv_sec-tv1.tv_sec; |
125 usecs=tv2.tv_usec-tv1.tv_usec; | |
126 if (usecs<0) { | |
127 usecs+=1000000; | |
128 --secs; | |
129 } | |
26449
105de0884218
Remove pointless '0' flag from fprintf call, fixes the warning:
diego
parents:
25313
diff
changeset
|
130 fprintf(stderr, "Duration: %ld.%.6lds\n", secs, usecs); |
10123 | 131 } |
132 | |
133 | |
134 void hexdump(void *pos, int len) { | |
135 unsigned char *cpos=pos, *cpos1; | |
136 int lines=(len+15)>>4; | |
137 while(lines--) { | |
138 int len1=len, i; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
139 fprintf(stderr, "%0x ", cpos); |
10123 | 140 cpos1=cpos; |
141 for (i=0;i<16;i++) { | |
142 if (len1>0) { | |
143 fprintf(stderr, "%02x ", *(cpos++)); | |
144 } else { | |
145 fprintf(stderr, " "); | |
146 } | |
147 len1--; | |
148 } | |
149 fputs(" ", stderr); | |
150 cpos=cpos1; | |
151 for (i=0;i<16;i++) { | |
152 if (len>0) { | |
153 unsigned char ch=(*(cpos++)); | |
154 if ((ch<32)||(ch>127)) ch='.'; | |
155 fputc(ch, stderr); | |
156 } | |
157 len--; | |
158 } | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
159 fputs("\n", stderr); |
10123 | 160 } |
161 fputc('\n', stderr); | |
162 } | |
163 | |
164 | |
165 ulong RACloseCodec(ulong p1) { | |
166 ulong result; | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
167 fprintf(stderr, "RACloseCodec(ulong p1=0x%0lx(%ld))\n", p1, p1); |
10123 | 168 result=(*raCloseCodec)(p1); |
169 // closeDll(); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
170 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 171 return result; |
172 } | |
173 | |
174 static int pkno=0; | |
175 | |
176 ulong RADecode(ulong p1,ulong p2,ulong p3,ulong p4,ulong* p5,ulong p6) { | |
177 ulong result; | |
178 int x,y; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
179 |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
180 fprintf(stderr, "RADecode(ulong ctx=0x%0lx, ", p1); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
181 fprintf(stderr, "ulong src=0x%0lx,\n", p2); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
182 fprintf(stderr, "ulong len=0x%0lx,", p3); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
183 fprintf(stderr, "ulong dst=0x%0lx,\n", p4); |
10123 | 184 fprintf(stderr, "ulong dstcnt=0x%0x, ",p5); |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
185 fprintf(stderr, "ulong p6=%ld)\n", p6); |
10123 | 186 // hexdump((void*)p1, 44); |
187 hexdump((void*)p2, p3); | |
188 // hexdump((void*)p4, 80); | |
189 // hexdump((void*)p5, 16); | |
190 // tic(); | |
191 | |
192 fprintf(stderr,"\n#CRC[%3d]",pkno++); | |
193 for(y=0;y<10;y++){ | |
194 unsigned short crc=0; | |
195 unsigned char* p=p2; | |
196 p+=60*y; | |
197 for(x=0;x<60;x++){ | |
198 crc+=p[x]<<(x&7); | |
199 } | |
200 fprintf(stderr," %04X",crc); | |
201 } | |
202 fprintf(stderr,"\n"); | |
203 | |
204 result=(*raDecode)(p1,p2,p3,p4,p5,p6); | |
205 // toc(); | |
206 // hexdump((void*)p1, 44); | |
207 // hexdump((void*)p4, 80); | |
208 // hexdump((void*)p5, 16); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
209 fprintf(stderr, "--> 0x%0lx(%ld) decoded: %ld \n\n\n", result, result, p5[0]); |
10123 | 210 return result; |
211 } | |
212 | |
213 ulong RAFreeDecoder(ulong p1) { | |
214 ulong result; | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
215 fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0lx(%ld))\n", p1, p1); |
10123 | 216 hexdump((void*)p1, 44); |
217 result=(*raFreeDecoder)(p1); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
218 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 219 return result; |
220 } | |
221 | |
222 ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) { | |
223 ulong result; | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
224 fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0lx(%ld), ", p1, p1); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
225 fprintf(stderr, "ulong p2=0x%0lx(%ld),\n", p2, p2); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
226 fprintf(stderr, "ulong p3=0x%0lx(%ld), ", p3, p3); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
227 fprintf(stderr, "ulong p4=0x%0lx(%ld))\n", p4, p4); |
10123 | 228 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2); |
229 hexdump((void*)p1, 44); | |
230 tic(); | |
231 result=(*raGetFlavorProperty)(p1,p2,p3,p4); | |
232 toc(); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
233 fprintf(stderr, "*p4=0x%0lx\n", *((ulong*)p4)); |
10123 | 234 hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2); |
235 hexdump((void*)p1, 44); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
236 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 237 return result; |
238 } | |
239 | |
240 ulong RAGetNumberOfFlavors(void) { | |
241 ulong result; | |
242 fprintf(stderr, "RAGetNumberOfFlavors(void)\n"); | |
243 result=(*raGetNumberOfFlavors)(); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
244 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 245 return result; |
246 } | |
247 | |
248 ulong RAInitDecoder(ulong p1,ulong p2) { | |
249 ulong result; | |
24213 | 250 // int temp[256]; |
251 // unsigned char temp2[256]; | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
252 fprintf(stderr, "RAInitDecoder(ulong p1=0x%0lx(%ld), ", p1, p1); |
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
253 fprintf(stderr, "ulong p2=0x%0lx(%ld))\n", p2, p2); |
10123 | 254 hexdump((void*)p2, 4*7); |
255 // hexdump((void*)p1, 44); | |
256 // memset(temp,0x77,256*4); | |
257 // memcpy(temp,p2,4*7); | |
258 // hexdump((void*)temp[6], 32); | |
259 | |
260 // memset(temp2,0x77,256); | |
261 // memcpy(temp2,temp[6],16); | |
262 // temp[6]=temp2; | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
263 |
10123 | 264 result=(*raInitDecoder)(p1,/*temp*/p2); |
265 // hexdump((void*)temp[6], 32); | |
266 // memcpy(p2,temp,4*11); | |
267 // hexdump((void*)p1, 44); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
268 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 269 return result; |
270 } | |
271 | |
272 ulong RAOpenCodec2(ulong p1) { | |
273 ulong result; | |
274 // loadSyms(); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
275 fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0lx(%ld)\n", p1, p1); |
10123 | 276 hexdump((void*)p1, 44); |
277 result=(*raOpenCodec2)(p1); | |
278 hexdump((void*)p1, 44); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
279 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 280 return result; |
281 } | |
282 | |
283 ulong RASetFlavor(ulong p1) { | |
24213 | 284 ulong result; |
285 // ulong numflavors, flavor, numprop=0, result1=0; | |
286 // unsigned short property; | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
287 fprintf(stderr, "RASetFlavor(ulong p1=0x%0lx(%ld))\n", p1, p1); |
10123 | 288 hexdump((void*)p1, 44); |
289 // hexdump((void*)p1, 44); | |
290 result=(*raSetFlavor)(p1); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
291 fprintf(stderr, "--> 0x%0lx(%ld)\n\n\n", result, result); |
10123 | 292 |
293 #if 0 | |
294 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr); | |
295 numflavors=raGetNumberOfFlavors2(); | |
296 flavor=0; | |
297 while (flavor<numflavors) { | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
298 fprintf(stderr, "************ Flavor %ld *************\n\n", flavor); |
10123 | 299 numprop=0; |
300 while (numprop<32) { | |
301 result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property); | |
25313
9e13376e0daa
Fix printf format string length modifiers, removes about a trillion warnings.
diego
parents:
24213
diff
changeset
|
302 fprintf(stderr, "property %ld=%d, result=0x%0lx\n\n", |
10123 | 303 numprop, property, result1); |
304 hexdump((void*)result1, property); | |
305 numprop++; | |
306 } | |
307 flavor++; | |
308 } | |
309 | |
310 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr); | |
311 #endif | |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
28232
diff
changeset
|
312 |
10123 | 313 return result; |
314 } |