2 * This is a small DLL that works as a wrapper for the actual real28_8.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 (*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
);
46 /* exits program when failure */
48 fputs("loadSyms()\n", stderr
);
52 // fputs("opening dll...\n");
53 handle
= dlopen ("/home/r/RealPlayer8/Codecs/real28_8.so.6.0", RTLD_LAZY
);
55 fputs (dlerror(), stderr
);
59 raCloseCodec
= dlsym(handle
, "RACloseCodec");
60 if ((error
= dlerror()) != NULL
) {
61 fprintf (stderr
, "dlsym(RACloseCodec): %s\n", error
);
64 raDecode
= dlsym(handle
, "RADecode");
65 if ((error
= dlerror()) != NULL
) {
66 fprintf (stderr
, "dlsym(RADecode): %s\n", error
);
69 raFreeDecoder
= dlsym(handle
, "RAFreeDecoder");
70 if ((error
= dlerror()) != NULL
) {
71 fprintf (stderr
, "dlsym(RAFreeDecoder): %s\n", error
);
74 raGetFlavorProperty
= dlsym(handle
, "RAGetFlavorProperty");
75 if ((error
= dlerror()) != NULL
) {
76 fprintf (stderr
, "dlsym(RAGetFlavorProperty): %s\n", error
);
79 raGetNumberOfFlavors
= dlsym(handle
, "RAGetNumberOfFlavors");
80 if ((error
= dlerror()) != NULL
) {
81 fprintf (stderr
, "dlsym(RAGetNumberOfFlavors): %s\n", error
);
84 raInitDecoder
= dlsym(handle
, "RAInitDecoder");
85 if ((error
= dlerror()) != NULL
) {
86 fprintf (stderr
, "dlsym(RAInitDecoder): %s\n", error
);
89 raOpenCodec2
= dlsym(handle
, "RAOpenCodec2");
90 if ((error
= dlerror()) != NULL
) {
91 fprintf (stderr
, "dlsym(RAOpenCodec2): %s\n", error
);
94 raSetFlavor
= dlsym(handle
, "RASetFlavor");
95 if ((error
= dlerror()) != NULL
) {
96 fprintf (stderr
, "dlsym(RASetFlavor): %s\n", error
);
103 void closeDll(void) {
116 struct timeval tv1
, tv2
;
119 gettimeofday(&tv1
, &tz
);
124 gettimeofday(&tv2
, &tz
);
125 secs
=tv2
.tv_sec
-tv1
.tv_sec
;
126 usecs
=tv2
.tv_usec
-tv1
.tv_usec
;
131 fprintf(stderr
, "Duration: %ld.%.6lds\n", secs
, usecs
);
135 void hexdump(void *pos
, int len
) {
136 unsigned char *cpos
=pos
, *cpos1
;
137 int lines
=(len
+15)>>4;
140 fprintf(stderr
, "%0x ", cpos
);
144 fprintf(stderr
, "%02x ", *(cpos
++));
146 fprintf(stderr
, " ");
154 unsigned char ch
=(*(cpos
++));
155 if ((ch
<32)||(ch
>127)) ch
='.';
166 ulong
RACloseCodec(ulong p1
) {
168 fprintf(stderr
, "RACloseCodec(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
169 result
=(*raCloseCodec
)(p1
);
171 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
177 ulong
RADecode(ulong p1
,ulong p2
,ulong p3
,ulong p4
,ulong
* p5
,ulong p6
) {
181 fprintf(stderr
, "RADecode(ulong ctx=0x%0lx, ", p1
);
182 fprintf(stderr
, "ulong src=0x%0lx,\n", p2
);
183 fprintf(stderr
, "ulong len=0x%0lx,", p3
);
184 fprintf(stderr
, "ulong dst=0x%0lx,\n", p4
);
185 fprintf(stderr
, "ulong dstcnt=0x%0x, ",p5
);
186 fprintf(stderr
, "ulong p6=%ld)\n", p6
);
187 // hexdump((void*)p1, 44);
188 hexdump((void*)p2
, p3
);
189 // hexdump((void*)p4, 80);
190 // hexdump((void*)p5, 16);
193 fprintf(stderr
,"\n#CRC[%3d]",pkno
++);
195 unsigned short crc
=0;
201 fprintf(stderr
," %04X",crc
);
203 fprintf(stderr
,"\n");
205 result
=(*raDecode
)(p1
,p2
,p3
,p4
,p5
,p6
);
207 // hexdump((void*)p1, 44);
208 // hexdump((void*)p4, 80);
209 // hexdump((void*)p5, 16);
210 fprintf(stderr
, "--> 0x%0lx(%ld) decoded: %ld \n\n\n", result
, result
, p5
[0]);
214 ulong
RAFreeDecoder(ulong p1
) {
216 fprintf(stderr
, "RAFreeDecoder(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
217 hexdump((void*)p1
, 44);
218 result
=(*raFreeDecoder
)(p1
);
219 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
223 ulong
RAGetFlavorProperty(ulong p1
,ulong p2
,ulong p3
, ulong p4
) {
225 fprintf(stderr
, "RAGetFlavorProperty(ulong p1=0x%0lx(%ld), ", p1
, p1
);
226 fprintf(stderr
, "ulong p2=0x%0lx(%ld),\n", p2
, p2
);
227 fprintf(stderr
, "ulong p3=0x%0lx(%ld), ", p3
, p3
);
228 fprintf(stderr
, "ulong p4=0x%0lx(%ld))\n", p4
, p4
);
229 hexdump((void*)p4
/*(void*)(*((void**)p4))*/,p2
);
230 hexdump((void*)p1
, 44);
232 result
=(*raGetFlavorProperty
)(p1
,p2
,p3
,p4
);
234 fprintf(stderr
, "*p4=0x%0lx\n", *((ulong
*)p4
));
235 hexdump((void*)p4
/*(void*)(*((void**)p4))*/,p2
);
236 hexdump((void*)p1
, 44);
237 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
241 ulong
RAGetNumberOfFlavors(void) {
243 fprintf(stderr
, "RAGetNumberOfFlavors(void)\n");
244 result
=(*raGetNumberOfFlavors
)();
245 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
249 ulong
RAInitDecoder(ulong p1
,ulong p2
) {
252 // unsigned char temp2[256];
253 fprintf(stderr
, "RAInitDecoder(ulong p1=0x%0lx(%ld), ", p1
, p1
);
254 fprintf(stderr
, "ulong p2=0x%0lx(%ld))\n", p2
, p2
);
255 hexdump((void*)p2
, 4*7);
256 // hexdump((void*)p1, 44);
257 // memset(temp,0x77,256*4);
258 // memcpy(temp,p2,4*7);
259 // hexdump((void*)temp[6], 32);
261 // memset(temp2,0x77,256);
262 // memcpy(temp2,temp[6],16);
265 result
=(*raInitDecoder
)(p1
,/*temp*/p2
);
266 // hexdump((void*)temp[6], 32);
267 // memcpy(p2,temp,4*11);
268 // hexdump((void*)p1, 44);
269 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
273 ulong
RAOpenCodec2(ulong p1
) {
276 fprintf(stderr
, "RAOpenCodec2(ulong p1=0x%0lx(%ld)\n", p1
, p1
);
277 hexdump((void*)p1
, 44);
278 result
=(*raOpenCodec2
)(p1
);
279 hexdump((void*)p1
, 44);
280 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
284 ulong
RASetFlavor(ulong p1
) {
286 // ulong numflavors, flavor, numprop=0, result1=0;
287 // unsigned short property;
288 fprintf(stderr
, "RASetFlavor(ulong p1=0x%0lx(%ld))\n", p1
, p1
);
289 hexdump((void*)p1
, 44);
290 // hexdump((void*)p1, 44);
291 result
=(*raSetFlavor
)(p1
);
292 fprintf(stderr
, "--> 0x%0lx(%ld)\n\n\n", result
, result
);
295 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr
);
296 numflavors
=raGetNumberOfFlavors2();
298 while (flavor
<numflavors
) {
299 fprintf(stderr
, "************ Flavor %ld *************\n\n", flavor
);
302 result1
=raGetFlavorProperty(p1
, flavor
, numprop
, (ulong
)&property
);
303 fprintf(stderr
, "property %ld=%d, result=0x%0lx\n\n",
304 numprop
, property
, result1
);
305 hexdump((void*)result1
, property
);
311 fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr
);