2 * This is a small DLL that works as a wrapper for the actual realrv30.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.
32 typedef unsigned long ulong
;
34 ulong (*pncOpen
)(ulong
,ulong
);
35 ulong (*pncClose
)(ulong
);
36 ulong (*pncGetUIName
)(ulong
,ulong
);
37 ulong (*pncGetVersion
)(ulong
,ulong
);
38 ulong (*pncQueryMediaFormat
)(ulong
,ulong
,ulong
,ulong
);
39 ulong (*pncPreferredMediaFormat
)(ulong
,ulong
,ulong
,ulong
);
40 ulong (*pncGetMediaFormats
)(ulong
,ulong
,ulong
,ulong
);
41 ulong (*pncStreamOpen
)(ulong
,ulong
,ulong
);
43 ulong (*pnsOpenSettingsBox
)(ulong
,ulong
);
44 ulong (*pnsGetIPNUnknown
)(ulong
);
45 ulong (*pnsSetDataCallback
)(ulong
,ulong
,ulong
,ulong
);
46 ulong (*pnsSetProperty
)(ulong
,ulong
,ulong
);
47 ulong (*pnsGetProperty
)(ulong
,ulong
,ulong
);
48 ulong (*pnsClose
)(ulong
);
49 ulong (*pnsGetStreamHeaderSize
)(ulong
,ulong
);
50 ulong (*pnsGetStreamHeader
)(ulong
,ulong
);
51 ulong (*pnsInput
)(ulong
,ulong
,ulong
);
52 ulong (*pnsSetOutputPacketSize
)(ulong
,ulong
,ulong
,ulong
);
53 ulong (*pnsGetInputBufferSize
)(ulong
,ulong
);
55 void (*setDLLAccessPath
)(ulong
);
60 /* exits program when failure */
62 fputs("loadSyms()\n", stderr
);
66 fputs("opening dll...\n", stderr
);
67 handle
= dlopen ("/usr/local/RealPlayer8/Codecs/realrv30.so.6.0", RTLD_LAZY
);
69 fputs (dlerror(), stderr
);
73 pncOpen
= dlsym(handle
, "PNCodec_Open");
74 if ((error
= dlerror()) != NULL
) {
75 fprintf (stderr
, "dlsym(pncOpen): %s\n", error
);
78 pncClose
= dlsym(handle
, "PNCodec_Close");
79 if ((error
= dlerror()) != NULL
) {
80 fprintf (stderr
, "dlsym(pncClose): %s\n", error
);
83 pncGetUIName
= dlsym(handle
, "PNCodec_GetUIName");
84 if ((error
= dlerror()) != NULL
) {
85 fprintf (stderr
, "dlsym(pncGetUIName): %s\n", error
);
88 pncGetVersion
= dlsym(handle
, "PNCodec_GetVersion");
89 if ((error
= dlerror()) != NULL
) {
90 fprintf (stderr
, "dlsym(pncGetVersion): %s\n", error
);
93 pncQueryMediaFormat
= dlsym(handle
, "PNCodec_QueryMediaFormat");
94 if ((error
= dlerror()) != NULL
) {
95 fprintf (stderr
, "dlsym(pncQueryMediaFormat): %s\n", error
);
98 pncPreferredMediaFormat
= dlsym(handle
, "PNCodec_PreferredMediaFormat");
99 if ((error
= dlerror()) != NULL
) {
100 fprintf (stderr
, "dlsym(pncPreferredMediaFormat): %s\n", error
);
103 pncGetMediaFormats
= dlsym(handle
, "PNCodec_GetMediaFormats");
104 if ((error
= dlerror()) != NULL
) {
105 fprintf (stderr
, "dlsym(pncGetMediaFormats): %s\n", error
);
108 pncStreamOpen
= dlsym(handle
, "PNCodec_StreamOpen");
109 if ((error
= dlerror()) != NULL
) {
110 fprintf (stderr
, "dlsym(pncStreamOpen): %s\n", error
);
114 pnsOpenSettingsBox
= dlsym(handle
, "PNStream_OpenSettingsBox");
115 if ((error
= dlerror()) != NULL
) {
116 fprintf (stderr
, "dlsym(pnsOpenSettingsBox): %s\n", error
);
119 pnsGetIPNUnknown
= dlsym(handle
, "PNStream_GetIPNUnknown");
120 if ((error
= dlerror()) != NULL
) {
121 fprintf (stderr
, "dlsym(pnsGetIPNUnknown): %s\n", error
);
124 pnsSetDataCallback
= dlsym(handle
, "PNStream_SetDataCallback");
125 if ((error
= dlerror()) != NULL
) {
126 fprintf (stderr
, "dlsym(pnsSetDataCallback): %s\n", error
);
129 pnsSetProperty
= dlsym(handle
, "PNStream_SetProperty");
130 if ((error
= dlerror()) != NULL
) {
131 fprintf (stderr
, "dlsym(pnsSetProperty): %s\n", error
);
134 pnsGetProperty
= dlsym(handle
, "PNStream_GetProperty");
135 if ((error
= dlerror()) != NULL
) {
136 fprintf (stderr
, "dlsym(pnsGetProperty): %s\n", error
);
139 pnsClose
= dlsym(handle
, "PNStream_Close");
140 if ((error
= dlerror()) != NULL
) {
141 fprintf (stderr
, "dlsym(pnsClose): %s\n", error
);
144 pnsGetStreamHeaderSize
= dlsym(handle
, "PNStream_GetStreamHeaderSize");
145 if ((error
= dlerror()) != NULL
) {
146 fprintf (stderr
, "dlsym(pnsGetStreamHeaderSize): %s\n", error
);
149 pnsGetStreamHeader
= dlsym(handle
, "PNStream_GetStreamHeader");
150 if ((error
= dlerror()) != NULL
) {
151 fprintf (stderr
, "dlsym(pnsGetStreamHeader): %s\n", error
);
154 pnsInput
= dlsym(handle
, "PNStream_Input");
155 if ((error
= dlerror()) != NULL
) {
156 fprintf (stderr
, "dlsym(pnsInput): %s\n", error
);
159 pnsSetOutputPacketSize
= dlsym(handle
, "PNStream_SetOutputPacketSize");
160 if ((error
= dlerror()) != NULL
) {
161 fprintf (stderr
, "dlsym(pnsSetOutputPacketSize): %s\n", error
);
164 pnsGetInputBufferSize
= dlsym(handle
, "PNStream_GetInputBufferSize");
165 if ((error
= dlerror()) != NULL
) {
166 fprintf (stderr
, "dlsym(pnsGetInputBufferSize): %s\n", error
);
169 setDLLAccessPath
= dlsym(handle
, "SetDLLAccessPath");
170 if ((error
= dlerror()) != NULL
) {
171 fprintf (stderr
, "dlsym(SetDLLAccessPath): %s\n", error
);
178 void closeDll(void) {
191 struct timeval tv1
, tv2
;
194 gettimeofday(&tv1
, &tz
);
199 gettimeofday(&tv2
, &tz
);
200 secs
=tv2
.tv_sec
-tv1
.tv_sec
;
201 usecs
=tv2
.tv_usec
-tv1
.tv_usec
;
206 fprintf(stderr
, "Duration: %ld.%.6lds\n", secs
, usecs
);
210 void hexdump(void *pos
, int len
) {
211 unsigned char *cpos
=pos
, *cpos1
;
212 int lines
=(len
+15)>>4;
215 fprintf(stderr
, "%0x ", cpos
);
219 fprintf(stderr
, "%02x ", *(cpos
++));
221 fprintf(stderr
, " ");
229 unsigned char ch
=(*(cpos
++));
230 if ((ch
<32)||(ch
>127)) ch
='.';
241 ulong
PNCodec_Open(ulong p1
,ulong p2
) {
243 fprintf(stderr
, "PNCodec_Open(ulong fourcc=0x%0lx(%ld), ", p1
, p1
);
244 fprintf(stderr
, "PNCMain **pncMain=0x%0lx(%ld))\n", p2
, p2
);
245 // hexdump((void*)p1, 44);
247 result
=(*pncOpen
)(p1
,p2
);
249 hexdump((void*)p2
, 4);
250 // hexdump(*((void**)p2), 0x1278);
251 fprintf(stderr
, "PNCodec_Open --> 0x%0lx(%ld)\n\n\n", result
, result
);
255 ulong
PNCodec_Close(ulong p1
) {
257 fprintf(stderr
, "PNCodec_Close(PNCMain *pncMain=0x%0lx(%ld))\n", p1
, p1
);
258 // hexdump((void*)p1, 44);
260 result
=(*pncClose
)(p1
);
262 // hexdump((void*)p1, 44);
263 fprintf(stderr
, "PNCodec_Close --> 0x%0lx(%ld)\n\n\n", result
, result
);
267 ulong
PNCodec_GetUIName(ulong p1
,ulong p2
) {
269 fprintf(stderr
, "PNCodec_GetUIName(PNCMain *pncMain=0x%0lx(%ld), ", p1
, p1
);
270 fprintf(stderr
, "char **appname=0x%0lx(%ld))\n", p2
, p2
);
271 // hexdump((void*)p1, 0x1278);
272 // hexdump((void*)p2, 128);
274 result
=(*pncGetUIName
)(p1
,p2
);
276 // hexdump((void*)p1, 0x1278);
277 // hexdump((void*)p2, 128);
278 fprintf(stderr
, "PNCodec_GetUIName --> 0x%0lx(%ld)\n\n\n", result
, result
);
282 ulong
PNCodec_GetVersion(ulong p1
,ulong p2
) {
284 fprintf(stderr
, "PNCodec_GetVersion(ulong p1=0x%0lx(%ld), ", p1
, p1
);
285 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
286 // hexdump((void*)p1, 44);
288 result
=(*pncGetVersion
)(p1
,p2
);
290 // hexdump((void*)p1, 44);
291 fprintf(stderr
, "PNCodec_GetVersion --> 0x%0lx(%ld)\n\n\n", result
, result
);
295 ulong
PNCodec_QueryMediaFormat(ulong p1
,ulong p2
,ulong p3
,ulong p4
) {
297 fprintf(stderr
, "PNCodec_QueryMediaFormat(ulong p1=0x%0lx(%ld), ", p1
, p1
);
298 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
299 fprintf(stderr
, "ulong p3=0x%0lx(%ld),", p3
, p3
);
300 fprintf(stderr
, "ulong p4=0x%0lx(%ld),\n", p4
, p4
);
301 // hexdump((void*)p1, 44);
303 result
=(*pncQueryMediaFormat
)(p1
,p2
,p3
,p4
);
305 // hexdump((void*)p1, 44);
306 fprintf(stderr
, "PNCodec_QueryMediaFormat --> 0x%0lx(%ld)\n\n\n", result
, result
);
310 ulong
PNCodec_PreferredMediaFormat(ulong p1
,ulong p2
,ulong p3
,ulong p4
) {
312 fprintf(stderr
, "PNCodec_PreferredMediaFormat(ulong p1=0x%0lx(%ld), ", p1
, p1
);
313 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
314 fprintf(stderr
, "ulong p3=0x%0lx(%ld),", p3
, p3
);
315 fprintf(stderr
, "ulong p4=0x%0lx(%ld),\n", p4
, p4
);
316 // hexdump((void*)p1, 44);
318 result
=(*pncPreferredMediaFormat
)(p1
,p2
,p3
,p4
);
320 // hexdump((void*)p1, 44);
321 fprintf(stderr
, "PNCodec_PreferredMediaFormat --> 0x%0lx(%ld)\n\n\n", result
, result
);
325 ulong
PNCodec_GetMediaFormats(ulong p1
,ulong p2
,ulong p3
,ulong p4
) {
327 fprintf(stderr
, "PNCodec_GetMediaFormats(ulong p1=0x%0lx(%ld), ", p1
, p1
);
328 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
329 fprintf(stderr
, "ulong p3=0x%0lx(%ld),", p3
, p3
);
330 fprintf(stderr
, "ulong p4=0x%0lx(%ld),\n", p4
, p4
);
331 // hexdump((void*)p1, 44);
333 result
=(*pncGetMediaFormats
)(p1
,p2
,p3
,p4
);
335 // hexdump((void*)p1, 44);
336 fprintf(stderr
, "PNCodec_GetMediaFormats --> 0x%0lx(%ld)\n\n\n", result
, result
);
340 ulong
PNCodec_StreamOpen(ulong p1
,ulong p2
,ulong p3
) {
342 fprintf(stderr
, "PNCodec_StreamOpen(PNCMain *pncMain=0x%0lx(%ld), ", p1
, p1
);
343 fprintf(stderr
, "PNSMain **pnsMain=0x%0lx(%ld),\n\t", p2
, p2
);
344 fprintf(stderr
, "ulong **p3=0x%0lx(%ld),\n", p3
, p3
);
345 // hexdump((void*)p1, 0x1278);
346 // hexdump((void*)p2, 128);
347 // hexdump((void*)p3, 4);
348 hexdump(*((void**)p3
), 4);
350 result
=(*pncStreamOpen
)(p1
,p2
,p3
);
352 // hexdump((void*)p1, 0x1278);
353 hexdump((void*)p2
, 4);
354 // hexdump((void*)p3, 128);
355 hexdump(*((void**)p2
), 128);
356 hexdump(**((void***)p2
), 128);
357 fprintf(stderr
, "PNCodec_StreamOpen --> 0x%0lx(%ld)\n\n\n", result
, result
);
361 ulong
PNStream_OpenSettingsBox(ulong p1
,ulong p2
) {
363 fprintf(stderr
, "PNStream_OpenSettingsBox(ulong p1=0x%0lx(%ld), ", p1
, p1
);
364 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
365 // hexdump((void*)p1, 44);
367 result
=(*pnsOpenSettingsBox
)(p1
,p2
);
369 // hexdump((void*)p1, 44);
370 fprintf(stderr
, "PNStream_OpenSettingsBox --> 0x%0lx(%ld)\n\n\n", result
, result
);
374 ulong
PNStream_GetIPNUnknown(ulong p1
) {
376 fprintf(stderr
, "PNStream_GetIPNUnknown(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
377 // hexdump((void*)p1, 44);
379 result
=(*pnsGetIPNUnknown
)(p1
);
381 // hexdump((void*)p1, 44);
382 fprintf(stderr
, "PNStream_GetIPNUnknown --> 0x%0lx(%ld)\n\n\n", result
, result
);
386 ulong
PNStream_SetDataCallback(ulong p1
,ulong p2
,ulong p3
,ulong p4
) {
390 fprintf(stderr
, "PNStream_SetDataCallback(ulong p1=0x%0lx(%ld), ", p1
, p1
);
391 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
392 fprintf(stderr
, "ulong p3=0x%0lx(%ld),", p3
, p3
);
393 fprintf(stderr
, "ulong p4=0x%0lx(%ld))\n", p4
, p4
);
394 hexdump((void*)p1
, 0x24);
395 hexdump((void*)p2
, 32);
396 hexdump((void*)p3
, 4);
397 hexdump((void*)p4
, 32);
398 fprintf(stderr
, "content of the callback functions:\n\n");
400 hexdump(*((void**)p2
+i
), (i
==0)?32*4:16);
405 fprintf(stderr
, "content of the callback functions (first entry):\n\n");
407 hexdump(*((void**)pp
+i
), 32);
412 result
=(*pnsSetDataCallback
)(p1
,p2
,p3
,p4
);
414 hexdump((void*)p1
, 0x24);
415 // hexdump((void*)p2, 256);
416 // hexdump((void*)p3, 4);
417 hexdump(*((void**)p3
), 256);
418 fprintf(stderr
, "PNStream_SetDataCallback --> 0x%0lx(%ld)\n\n\n", result
, result
);
422 ulong
PNStream_SetProperty(ulong p1
,ulong p2
,ulong p3
) {
424 fprintf(stderr
, "PNStream_SetProperty(ulong p1=0x%0lx(%ld), ", p1
, p1
);
425 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
426 fprintf(stderr
, "ulong p3=0x%0lx(%ld))\n", p3
, p3
);
427 hexdump((void*)p3
, 4);
429 result
=(*pnsSetProperty
)(p1
,p2
,p3
);
431 // hexdump((void*)p3, 44);
432 fprintf(stderr
, "PNStream_SetProperty --> 0x%0lx(%ld)\n\n\n", result
, result
);
436 ulong
PNStream_GetProperty(ulong p1
,ulong p2
,ulong p3
) {
438 fprintf(stderr
, "PNStream_GetProperty(ulong p1=0x%0lx(%ld), ", p1
, p1
);
439 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
440 fprintf(stderr
, "ulong p3=0x%0lx(%ld))\n", p3
, p3
);
441 // hexdump((void*)p3, 44);
443 result
=(*pnsGetProperty
)(p1
,p2
,p3
);
445 hexdump((void*)p3
, 4);
446 fprintf(stderr
, "PNStream_GetProperty --> 0x%0lx(%ld)\n\n\n", result
, result
);
450 ulong
PNStream_Close(ulong p1
) {
452 fprintf(stderr
, "PNStream_Close(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
453 // hexdump((void*)p1, 44);
455 result
=(*pnsClose
)(p1
);
457 // hexdump((void*)p1, 44);
458 fprintf(stderr
, "PNStream_Close --> 0x%0lx(%ld)\n\n\n", result
, result
);
462 ulong streamHeaderSize
=0;
464 ulong
PNStream_GetStreamHeaderSize(ulong p1
,ulong p2
) {
466 fprintf(stderr
, "PNStream_GetStreamHeaderSize(ulong p1=0x%0lx(%ld), ", p1
, p1
);
467 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
468 // hexdump((void*)p2, 44);
470 result
=(*pnsGetStreamHeaderSize
)(p1
,p2
);
472 hexdump((void*)p2
, 4);
473 streamHeaderSize
=*((ulong
*)p2
);
474 fprintf(stderr
, "PNStream_GetStreamHeaderSize --> 0x%0lx(%ld)\n\n\n", result
, result
);
478 ulong
PNStream_GetStreamHeader(ulong p1
,ulong p2
) {
480 fprintf(stderr
, "PNStream_GetStreamHeader(ulong p1=0x%0lx(%ld), ", p1
, p1
);
481 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
482 // hexdump((void*)p2, 44);
484 result
=(*pnsGetStreamHeader
)(p1
,p2
);
486 hexdump((void*)p2
, streamHeaderSize
);
487 fprintf(stderr
, "PNStream_GetStreamHeader --> 0x%0lx(%ld)\n\n\n", result
, result
);
491 ulong
PNStream_Input(ulong p1
,ulong p2
,ulong p3
) {
493 fprintf(stderr
, "PNStream_Input(ulong p1=0x%0lx(%ld), ", p1
, p1
);
494 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
495 fprintf(stderr
, "ulong p3=0x%0lx(%ld))\n", p3
, p3
);
496 hexdump((void*)p3
, 4);
498 result
=(*pnsInput
)(p1
,p2
,p3
);
500 // hexdump((void*)p3, 44);
501 fprintf(stderr
, "PNStream_Input --> 0x%0lx(%ld)\n\n\n", result
, result
);
505 ulong
PNStream_SetOutputPacketSize(ulong p1
,ulong p2
,ulong p3
,ulong p4
) {
507 fprintf(stderr
, "PNStream_SetOutputPacketSize(ulong p1=0x%0lx(%ld), ", p1
, p1
);
508 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n\t", p2
, p2
);
509 fprintf(stderr
, "ulong p3=0x%0lx(%ld),", p3
, p3
);
510 fprintf(stderr
, "ulong p4=0x%0lx(%ld))\n", p4
, p4
);
511 // hexdump((void*)p1, 44);
513 result
=(*pnsSetOutputPacketSize
)(p1
,p2
,p3
,p4
);
515 // hexdump((void*)p1, 44);
516 fprintf(stderr
, "PNStream_SetOutputPacketSize --> 0x%0lx(%ld)\n\n\n", result
, result
);
520 ulong
PNStream_GetInputBufferSize(ulong p1
,ulong p2
) {
522 fprintf(stderr
, "PNStream_GetInputBufferSize(ulong p1=0x%0lx(%ld), ", p1
, p1
);
523 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
524 // hexdump((void*)p1, 44);
526 result
=(*pnsGetInputBufferSize
)(p1
,p2
);
528 // hexdump((void*)p1, 44);
529 fprintf(stderr
, "PNStream_GetInputBufferSize --> 0x%0lx(%ld)\n\n\n", result
, result
);
533 void SetDLLAccessPath(ulong p1
) {
534 fprintf(stderr
, "SetDLLAccessPath(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
535 // hexdump((void*)p1, 44);
536 (*setDLLAccessPath
)(p1
);
537 // hexdump((void*)p1, 44);
538 fprintf(stderr
, "--> void\n\n\n");