2 * This is a small DLL that works as a wrapper for the actual realsipr.so.6.0
3 * DLL from RealPlayer 8.0.
5 * This file is part of MPlayer.
7 * MPlayer is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * MPlayer is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License along
18 * with MPlayer; if not, write to the Free Software Foundation, Inc.,
19 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 Assuming that RACloseCodec is the last call.
25 0000000000001b8c g DF .text 000000000000002b G2 RASetPwd
26 0000000000001c6c g DF .text 000000000000003e G2 RAInitEncoder
27 0000000000001a8c g DF .text 0000000000000039 G2 RAOpenCodec2
28 0000000000001a50 g DF .text 0000000000000039 G2 RAOpenCodec
29 0000000000001ac8 g DF .text 000000000000002c G2 RACloseCodec
30 0000000000001af4 g DF .text 000000000000000a G2 RAGetNumberOfFlavors
31 0000000000001bdc g DF .text 0000000000000032 G2 RADecode
32 0000000000001cac g DF .text 0000000000000029 G2 RAEncode
33 0000000000001cd8 g DF .text 0000000000000023 G2 RAFreeEncoder
34 000000000000138c g DF .text 0000000000000029 G2 SetDLLAccessPath
35 0000000000001c48 g DF .text 0000000000000023 G2 RAFreeDecoder
36 0000000000001c10 g DF .text 0000000000000035 G2 RAFlush
37 0000000000001b00 g DF .text 0000000000000052 G2 RAGetFlavorProperty
38 0000000000001b54 g DF .text 0000000000000038 G2 RASetFlavor
39 0000000000001bb8 g DF .text 0000000000000023 G2 RAInitDecoder
50 typedef unsigned long ulong
;
52 ulong (*raCloseCodec
)(ulong
);
53 ulong (*raDecode
)(ulong
,ulong
,ulong
,ulong
,ulong
,ulong
);
54 ulong (*raEncode
)(ulong
,ulong
,ulong
);
55 ulong (*raFlush
)(ulong
,ulong
,ulong
);
56 ulong (*raFreeDecoder
)(ulong
);
57 ulong (*raFreeEncoder
)(ulong
);
58 ulong (*raGetFlavorProperty
)(ulong
,ulong
,ulong
,ulong
);
59 ulong (*raGetNumberOfFlavors
)(void);
60 ulong (*raGetNumberOfFlavors2
)(void);
61 ulong (*raInitDecoder
)(ulong
,ulong
);
62 ulong (*raInitEncoder
)(ulong
,ulong
);
63 ulong (*raOpenCodec
)(ulong
);
64 ulong (*raOpenCodec2
)(ulong
);
65 ulong (*raSetFlavor
)(ulong
,ulong
,ulong
);
66 void (*raSetDLLAccessPath
)(ulong
);
67 /* the following symbol will be _dlsym()ed by rarender.so,
68 but at least doesn't exist in cook.so
70 ulong (*raSetPwd
)(ulong
,ulong
);
75 /* exits program when failure */
77 fputs("loadSyms()\n", stderr
);
81 // fputs("opening dll...\n");
82 handle
= dlopen ("/usr/local/RealPlayer8/Codecs/realsipr.so.6.0", RTLD_LAZY
);
84 fputs (dlerror(), stderr
);
88 raCloseCodec
= dlsym(handle
, "RACloseCodec");
89 if ((error
= dlerror()) != NULL
) {
90 fprintf (stderr
, "dlsym(RACloseCodec): %s\n", error
);
93 raDecode
= dlsym(handle
, "RADecode");
94 if ((error
= dlerror()) != NULL
) {
95 fprintf (stderr
, "dlsym(RADecode): %s\n", error
);
98 raEncode
= dlsym(handle
, "RAEncode");
99 if ((error
= dlerror()) != NULL
) {
100 fprintf (stderr
, "dlsym(RAEncode): %s\n", error
);
103 raFlush
= dlsym(handle
, "RAFlush");
104 if ((error
= dlerror()) != NULL
) {
105 fprintf (stderr
, "dlsym(RAFlush): %s\n", error
);
108 raFreeDecoder
= dlsym(handle
, "RAFreeDecoder");
109 if ((error
= dlerror()) != NULL
) {
110 fprintf (stderr
, "dlsym(RAFreeDecoder): %s\n", error
);
113 raFreeEncoder
= dlsym(handle
, "RAFreeEncoder");
114 if ((error
= dlerror()) != NULL
) {
115 fprintf (stderr
, "dlsym(RAFreeEncoder): %s\n", error
);
118 raGetFlavorProperty
= dlsym(handle
, "RAGetFlavorProperty");
119 if ((error
= dlerror()) != NULL
) {
120 fprintf (stderr
, "dlsym(RAGetFlavorProperty): %s\n", error
);
123 raGetNumberOfFlavors
= dlsym(handle
, "RAGetNumberOfFlavors");
124 if ((error
= dlerror()) != NULL
) {
125 fprintf (stderr
, "dlsym(RAGetNumberOfFlavors): %s\n", error
);
128 // raGetNumberOfFlavors2 = dlsym(handle, "RAGetNumberOfFlavors2");
129 // if ((error = dlerror()) != NULL) {
130 // fprintf (stderr, "dlsym(RAGetNumberOfFlavors2): %s\n", error);
133 raInitDecoder
= dlsym(handle
, "RAInitDecoder");
134 if ((error
= dlerror()) != NULL
) {
135 fprintf (stderr
, "dlsym(RAInitDecoder): %s\n", error
);
138 raInitEncoder
= dlsym(handle
, "RAInitEncoder");
139 if ((error
= dlerror()) != NULL
) {
140 fprintf (stderr
, "dlsym(RAInitEncoder): %s\n", error
);
143 raOpenCodec
= dlsym(handle
, "RAOpenCodec");
144 if ((error
= dlerror()) != NULL
) {
145 fprintf (stderr
, "dlsym(RAOpenCodec): %s\n", error
);
148 raOpenCodec2
= dlsym(handle
, "RAOpenCodec2");
149 if ((error
= dlerror()) != NULL
) {
150 fprintf (stderr
, "dlsym(RAOpenCodec2): %s\n", error
);
153 raSetFlavor
= dlsym(handle
, "RASetFlavor");
154 if ((error
= dlerror()) != NULL
) {
155 fprintf (stderr
, "dlsym(RASetFlavor): %s\n", error
);
158 raSetDLLAccessPath
= dlsym(handle
, "SetDLLAccessPath");
159 if ((error
= dlerror()) != NULL
) {
160 fprintf (stderr
, "dlsym(SetDLLAccessPath): %s\n", error
);
163 raSetPwd
= dlsym(handle
, "RASetPwd");
164 if ((error
= dlerror()) != NULL
) {
165 fprintf (stderr
, "dlsym(RASetPwd): %s\n", error
);
172 void closeDll(void) {
185 struct timeval tv1
, tv2
;
188 gettimeofday(&tv1
, &tz
);
193 gettimeofday(&tv2
, &tz
);
194 secs
=tv2
.tv_sec
-tv1
.tv_sec
;
195 usecs
=tv2
.tv_usec
-tv1
.tv_usec
;
200 fprintf(stderr
, "Duration: %ld.%0.6lds\n", secs
, usecs
);
204 void hexdump(void *pos
, int len
) {
205 unsigned char *cpos
=pos
, *cpos1
;
206 int lines
=(len
+15)>>4;
209 fprintf(stderr
, "%0x ", cpos
);
213 fprintf(stderr
, "%02x ", *(cpos
++));
215 fprintf(stderr
, " ");
223 unsigned char ch
=(*(cpos
++));
224 if ((ch
<32)||(ch
>127)) ch
='.';
235 ulong
RACloseCodec(ulong p1
) {
237 fprintf(stderr
, "RACloseCodec(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
238 result
=(*raCloseCodec
)(p1
);
240 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
246 ulong
RADecode(ulong p1
,ulong p2
,ulong p3
,ulong p4
,ulong
* p5
,ulong p6
) {
250 fprintf(stderr
, "RADecode(ulong ctx=0x%0lx, ", p1
);
251 fprintf(stderr
, "ulong src=0x%0lx,\n", p2
);
252 fprintf(stderr
, "ulong len=0x%0lx,", p3
);
253 fprintf(stderr
, "ulong dst=0x%0lx,\n", p4
);
254 fprintf(stderr
, "ulong dstcnt=0x%0x, ",p5
);
255 fprintf(stderr
, "ulong p6=%ld)\n", p6
);
256 // hexdump((void*)p1, 44);
257 // hexdump((void*)p2, p3);
258 // hexdump((void*)p4, 80);
259 // hexdump((void*)p5, 16);
265 fprintf(stderr
,"\n#CRC[%3d]",pkno
++);
266 for(y
=0;y
<(0x128*2);y
+=37){
267 unsigned short crc
=0;
273 if(i
&1) ib
>>=4; else ib
&=15;
276 fprintf(stderr
," %04X",crc
);
277 // fprintf(stderr," %02X",p[0]);
279 fprintf(stderr
,"\n");
282 { FILE *f
=fopen("sipr.dump","a");
287 result
=(*raDecode
)(p1
,p2
,p3
,p4
,p5
,p6
);
289 // hexdump((void*)p1, 44);
290 // hexdump((void*)p4, 80);
291 // hexdump((void*)p5, 16);
292 fprintf(stderr
, "--> 0x%0lx(%ld) decoded: %ld \n\n\n", result
, result
, p5
[0]);
296 ulong
RAEncode(ulong p1
,ulong p2
,ulong p3
) {
298 fprintf(stderr
, "RAEncode(ulong p1=0x%0lx(%ld), ", p1
, p1
);
299 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
300 fprintf(stderr
, "ulong p3=0x%0lx(%ld))\n", p3
, p3
);
301 result
=(*raEncode
)(p1
,p2
,p3
);
302 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
306 ulong
RAFlush(ulong p1
,ulong p2
,ulong p3
) {
308 fprintf(stderr
, "RAFlush(ulong p1=0x%0lx(%ld), ", p1
, p1
);
309 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
310 fprintf(stderr
, "ulong p3=0x%0lx(%ld))\n", p3
, p3
);
311 result
=(*raFlush
)(p1
,p2
,p3
);
312 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
316 ulong
RAFreeDecoder(ulong p1
) {
318 fprintf(stderr
, "RAFreeDecoder(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
319 hexdump((void*)p1
, 44);
320 result
=(*raFreeDecoder
)(p1
);
321 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
325 ulong
RAFreeEncoder(ulong p1
) {
327 fprintf(stderr
, "RAFreeEncoder(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
328 result
=(*raFreeEncoder
)(p1
);
329 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
333 ulong
RAGetFlavorProperty(ulong p1
,ulong p2
,ulong p3
, ulong p4
) {
335 fprintf(stderr
, "RAGetFlavorProperty(ulong p1=0x%0lx(%ld), ", p1
, p1
);
336 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
337 fprintf(stderr
, "ulong p3=0x%0lx(%ld), ", p3
, p3
);
338 fprintf(stderr
, "ulong p4=0x%0lx(%ld))\n", p4
, p4
);
339 hexdump((void*)p4
/*(void*)(*((void**)p4))*/,p2
);
340 hexdump((void*)p1
, 44);
342 result
=(*raGetFlavorProperty
)(p1
,p2
,p3
,p4
);
344 fprintf(stderr
, "*p4=0x%0lx\n", *((ulong
*)p4
));
345 hexdump((void*)p4
/*(void*)(*((void**)p4))*/,p2
);
346 hexdump((void*)p1
, 44);
347 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
351 ulong
RAGetNumberOfFlavors(void) {
353 fprintf(stderr
, "RAGetNumberOfFlavors(void)\n");
354 result
=(*raGetNumberOfFlavors
)();
355 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
359 ulong
RAInitDecoder(ulong p1
,ulong p2
) {
362 // unsigned char temp2[256];
363 fprintf(stderr
, "RAInitDecoder(ulong p1=0x%0lx(%ld), ", p1
, p1
);
364 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
365 hexdump((void*)p2
, 4*7);
366 // hexdump((void*)p1, 44);
369 result
=(*raInitDecoder
)(p1
,p2
);
371 memset(temp
,0x77,256*4);
373 hexdump((void*)temp
[6], 32);
375 memset(temp2
,0x77,256);
376 memcpy(temp2
,temp
[6],16);
379 result
=(*raInitDecoder
)(p1
,temp
);
380 hexdump((void*)temp
[6], 32);
383 // memcpy(p2,temp,4*11);
384 // hexdump((void*)p1, 44);
385 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
389 ulong
RAInitEncoder(ulong p1
,ulong p2
) {
391 fprintf(stderr
, "RAInitEncoder(ulong p1=0x%0lx(%ld), ", p1
, p1
);
392 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
393 result
=(*raInitEncoder
)(p1
,p2
);
394 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
398 ulong
RAOpenCodec(ulong p1
) {
401 fprintf(stderr
, "RAOpenCodec(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
402 result
=(*raOpenCodec
)(p1
);
403 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
407 ulong
RAOpenCodec2(ulong p1
) {
410 fprintf(stderr
, "RAOpenCodec2(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
411 hexdump((void*)p1
, 44);
412 result
=(*raOpenCodec2
)(p1
);
413 hexdump((void*)p1
, 44);
414 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
418 ulong
RASetFlavor(ulong p1
,ulong p2
,ulong p3
) {
419 ulong result
, numprop
=0, result1
=0;
420 ulong numflavors
, flavor
;
421 unsigned short property
;
422 fprintf(stderr
, "RASetFlavor(ulong p1=0x%0lx(%ld), ", p1
, p1
);
423 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
424 // hexdump((void*)p1, 44);
425 // hexdump((void*)p1, 44);
426 result
=(*raSetFlavor
)(p1
,p2
,p3
);
427 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
429 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr
);
430 numflavors
=3;//raGetNumberOfFlavors();
432 while (flavor
<numflavors
) {
433 fprintf(stderr
, "************ Flavor %ld *************\n\n", flavor
);
436 result1
=raGetFlavorProperty(p1
, flavor
, numprop
, (ulong
)&property
);
437 fprintf(stderr
, "property %ld=%d, result=0x%0lx\n\n",
438 numprop
, property
, result1
);
439 hexdump((void*)result1
, property
);
445 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr
);
450 void SetDLLAccessPath(ulong p1
,ulong p2
) {
453 fprintf(stderr
, "SetDLLAccessPath(ulong p1=0x%0lx(%ld) p2=%p)\n", p1
, p1
,p2
);
455 fprintf(stderr
,"%s\n",ize
);
458 //hexdump((void*)p1, 244);
459 (*raSetDLLAccessPath
)(p1
);
460 // hexdump((void*)p1, 44);
461 fprintf(stderr
, "--> void\n\n\n");
464 static char pwdtemp
[1000];
466 void RASetPwd(ulong p1
,ulong p2
) {
468 fprintf(stderr
, "RASetPwd(ulong p1=0x%0lx(%ld),ulong p2=0x%0lx(%ld))\n", p1
, p1
, p2
, p2
);
469 // hexdump((void*)p1, 44);
470 // hexdump((void*)p2, 44);
471 memset(pwdtemp
,0x77,1000);
472 hexdump((void*)pwdtemp
, 44);
473 (*raSetPwd
)(pwdtemp
,"Ardubancel Quazanga"); // set password... lol.
474 hexdump((void*)pwdtemp
, 1000);
476 // hexdump((void*)p1, 44);
477 // hexdump((void*)p2, 44);
478 // hexdump((void*)p1, 44);
479 fprintf(stderr
, "--> void\n\n\n");