changeset 7110:86c478bea7ce

realplayer codecs wrappers, originaly written by Florian Schneider, extended by A'rpi
author arpi
date Wed, 28 Aug 2002 14:17:06 +0000
parents 4c51b2ae28c7
children b65b78640d49
files TOOLS/realcodecs/HOWTO TOOLS/realcodecs/cook.c TOOLS/realcodecs/cook.sh TOOLS/realcodecs/drv2.c TOOLS/realcodecs/drv2.sh TOOLS/realcodecs/drv3.c TOOLS/realcodecs/drv3.sh TOOLS/realcodecs/drv4.c TOOLS/realcodecs/drv4.sh TOOLS/realcodecs/ra.c TOOLS/realcodecs/rv30.c TOOLS/realcodecs/rv30.sh TOOLS/realcodecs/sipr.c TOOLS/realcodecs/sipr.sh
diffstat 14 files changed, 3162 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/HOWTO	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,6 @@
+HOW TO get these capturers/wrappers to work:
+
+- set the path to the codecs in the C file
+- compile it with the script
+- the orig. codecs are prepended by a "real" -> e.g. realcook.so.6.0
+- the capturer get the old name, e.g. cook.so.6.0
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/cook.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,411 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*raCloseCodec)(ulong);
+ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
+ulong (*raEncode)(ulong,ulong,ulong);
+ulong (*raFlush)(ulong,ulong,ulong);
+ulong (*raFreeDecoder)(ulong);
+ulong (*raFreeEncoder)(ulong);
+ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
+ulong (*raGetNumberOfFlavors)(void);
+ulong (*raGetNumberOfFlavors2)(void);
+ulong (*raInitDecoder)(ulong,ulong);
+ulong (*raInitEncoder)(ulong,ulong);
+ulong (*raOpenCodec)(ulong);
+ulong (*raOpenCodec2)(ulong);
+ulong (*raSetFlavor)(ulong,ulong);
+void  (*raSetDLLAccessPath)(ulong);
+/* the following symbol will be _dlsym()ed by rarender.so,
+   but at least doesn't exist in cook.so
+ulong (raSetPwd*)(ulong);
+*/
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+//		fputs("opening dll...\n");
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realcook.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		raCloseCodec = dlsym(handle, "RACloseCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RACloseCodec): %s\n", error);
+			exit(1);
+		}
+		raDecode = dlsym(handle, "RADecode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RADecode): %s\n", error);
+			exit(1);
+		}
+		raEncode = dlsym(handle, "RAEncode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAEncode): %s\n", error);
+			exit(1);
+		}
+		raFlush = dlsym(handle, "RAFlush");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFlush): %s\n", error);
+			exit(1);
+		}
+		raFreeDecoder = dlsym(handle, "RAFreeDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error);
+			exit(1);
+		}
+		raFreeEncoder = dlsym(handle, "RAFreeEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeEncoder): %s\n", error);
+			exit(1);
+		}
+		raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error);
+			exit(1);
+		}
+		raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error);
+			exit(1);
+			}
+		raGetNumberOfFlavors2 = dlsym(handle, "RAGetNumberOfFlavors2");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetNumberOfFlavors2): %s\n", error);
+			exit(1);
+		}
+		raInitDecoder = dlsym(handle, "RAInitDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error);
+			exit(1);
+		}
+		raInitEncoder = dlsym(handle, "RAInitEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitEncoder): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec = dlsym(handle, "RAOpenCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error);
+			exit(1);
+		}
+		raSetFlavor = dlsym(handle, "RASetFlavor");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RASetFlavor): %s\n", error);
+			exit(1);
+		}
+		raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "%0x  ", cpos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RACloseCodec(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RACloseCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raCloseCodec)(p1);
+//	closeDll();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+static int pkno=0;
+
+ulong RADecode(ulong p1,ulong p2,ulong p3,ulong p4,ulong* p5,ulong p6) {
+	ulong result;
+	int x,y;
+	
+	fprintf(stderr, "RADecode(ulong ctx=0x%0x, ", p1);
+	fprintf(stderr, "ulong src=0x%0x,\n", p2);
+	fprintf(stderr, "ulong len=0x%0x,", p3);
+	fprintf(stderr, "ulong dst=0x%0x,\n", p4);
+	fprintf(stderr, "ulong dstcnt=0x%0x, ",p5);
+	fprintf(stderr, "ulong p6=%d)\n", p6);
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p2, p3);
+//	hexdump((void*)p4, 80);
+//	hexdump((void*)p5, 16);
+//	tic();
+
+	    fprintf(stderr,"\n#CRC[%3d]",pkno++);
+	for(y=0;y<10;y++){
+	    unsigned short crc=0;
+	    unsigned char* p=p2;
+	    p+=60*y;
+	    for(x=0;x<60;x++){
+		crc+=p[x]<<(x&7);
+	    }
+	    fprintf(stderr," %04X",crc);
+	}
+	    fprintf(stderr,"\n");
+
+	result=(*raDecode)(p1,p2,p3,p4,p5,p6);
+//	toc();
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p4, 80);
+//	hexdump((void*)p5, 16);
+	fprintf(stderr, "--> 0x%0x(%d)  decoded: %d  \n\n\n", result, result, p5[0]);
+	return result;
+}
+
+ulong RAEncode(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAEncode(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raEncode)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFlush(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAFlush(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raFlush)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeDecoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raFreeDecoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeEncoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeEncoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raFreeEncoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) {
+	ulong result;
+	fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	tic();
+	result=(*raGetFlavorProperty)(p1,p2,p3,p4);
+	toc();
+	fprintf(stderr, "*p4=0x%0x\n", *((ulong*)p4));
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetNumberOfFlavors(void) {
+	ulong result;
+	fprintf(stderr, "RAGetNumberOfFlavors(void)\n");
+	result=(*raGetNumberOfFlavors)();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetNumberOfFlavors2(void) {
+	ulong result;
+	fprintf(stderr, "RAGetNumberOfFlavors2(void)\n");
+	result=(*raGetNumberOfFlavors2)();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitDecoder(ulong p1,ulong p2) {
+	ulong result;
+	int temp[256];
+	unsigned char temp2[256];
+	fprintf(stderr, "RAInitDecoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	hexdump((void*)p2, 4*7);
+//	hexdump((void*)p1, 44);
+	memset(temp,0x77,256*4);
+	memcpy(temp,p2,4*7);
+	hexdump((void*)temp[6], 32);
+
+	memset(temp2,0x77,256);
+	memcpy(temp2,temp[6],16);
+	temp[6]=temp2;
+	
+	result=(*raInitDecoder)(p1,temp);
+	hexdump((void*)temp[6], 32);
+//	memcpy(p2,temp,4*11);
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitEncoder(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "RAInitEncoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	result=(*raInitEncoder)(p1,p2);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raOpenCodec)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec2(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raOpenCodec2)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RASetFlavor(ulong p1,ulong p2) {
+	ulong result, numprop=0, result1=0;
+	ulong numflavors, flavor;
+	unsigned short property;
+	fprintf(stderr, "RASetFlavor(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	hexdump((void*)p1, 44);
+	hexdump((void*)p1, 44);
+	result=(*raSetFlavor)(p1,p2);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+
+#if 0
+	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+	numflavors=raGetNumberOfFlavors2();
+	flavor=0;
+	while (flavor<numflavors) {
+		fprintf(stderr, "************ Flavor %d *************\n\n", flavor);
+		numprop=0;
+		while (numprop<32) {
+			result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property);
+			fprintf(stderr, "property %d=%d, result=0x%0x\n\n",
+				numprop, property, result1);
+			hexdump((void*)result1, property);
+			numprop++;
+		}
+		flavor++;
+	}
+
+	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+#endif
+	
+	return result;
+}
+
+void  SetDLLAccessPath(ulong p1) {
+//	loadSyms();
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	(*raSetDLLAccessPath)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/cook.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,4 @@
+rm cook.so.6.0
+gcc -c cook.c -g
+ld -shared -o cook.so.6.0 cook.o -ldl -lc
+ 
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv2.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,490 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*rvyuvCustomMessage)(ulong,ulong);
+ulong (*rvyuvFree)(ulong);
+ulong (*rvyuvHiveMessage)(ulong,ulong);
+ulong (*rvyuvInit)(ulong,ulong);
+ulong (*rvyuvTransform)(ulong,ulong,ulong,ulong,ulong);
+ulong (*rvyuvRNFRUFree)(ulong);
+ulong (*rvyuvRNFRUGetFrame)(ulong,ulong,ulong);
+ulong (*rvyuvRNFRUInit)(ulong,ulong,ulong);
+ulong (*rvyuvRNFRUSetup)(ulong,ulong,ulong,ulong,ulong,ulong,ulong,ulong);
+
+//void (*setDLLAccessPath)(ulong);
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+		fputs("opening dll...\n",stderr);
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realdrv2.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		rvyuvCustomMessage = dlsym(handle, "RV20toYUV420CustomMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvCustomMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420CustomMessage()=0x%0x\n", rvyuvCustomMessage);
+		rvyuvFree = dlsym(handle, "RV20toYUV420Free");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvFree): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Free()=0x%0x\n", rvyuvFree);
+		rvyuvHiveMessage = dlsym(handle, "RV20toYUV420HiveMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvHiveMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420HiveMessage()=0x%0x\n", rvyuvHiveMessage);
+		rvyuvInit = dlsym(handle, "RV20toYUV420Init");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvInit): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Init()=0x%0x\n", rvyuvInit);
+		rvyuvTransform = dlsym(handle, "RV20toYUV420Transform");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvTransform): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Transform()=0x%0x\n", rvyuvTransform);
+		rvyuvRNFRUFree = dlsym(handle, "RV20toYUV420_RN_FRU_Free");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUFree): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Free()=0x%0x\n", rvyuvRNFRUFree);
+		rvyuvRNFRUGetFrame = dlsym(handle, "RV20toYUV420_RN_FRU_GetFrame");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUGetFrame): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame()=0x%0x\n", rvyuvRNFRUGetFrame);
+		rvyuvRNFRUInit = dlsym(handle, "RV20toYUV420_RN_FRU_Init");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUInit): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Init()=0x%0x\n", rvyuvRNFRUInit);
+		rvyuvRNFRUSetup = dlsym(handle, "RV20toYUV420_RN_FRU_Setup");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUSetup): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Setup()=0x%0x\n", rvyuvRNFRUSetup);
+
+/*		setDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+*/		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+//	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+static void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "#R# %0x  ", (int)cpos-(int)pos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RV20toYUV420CustomMessage(ulong* p1,ulong p2) {
+	ulong result;
+	ulong *pp1=p1;
+	ulong temp[16];
+	fprintf(stderr, "#R# => RV20toYUV420CustomMessage(%p,%p) [%d,%d,%d] \n", p1, p2, p1[0],p1[1],p1[2]);
+
+/*
+	if(p1[0]!=17) return 0;
+	
+	if(p1[1]!=1) return 0;
+	
+	if(p1[0]==105) return 0;
+	if(p1[0]==3) return 0;
+	if(p1[0]==18) return 0;
+	if(p1[0]==30) return 0;
+*/
+	
+	if(p1[0]==0x24){
+	    hexdump(p1[2],64);
+	    memset(temp,0x77,16*4);
+	    memcpy(temp,p1[2],16);
+	    p1[2]=temp;
+	} else {
+//	    return 0;
+	}
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 12);
+//	if (pp1[0]==0x24) {
+//		hexdump((void*)(pp1[2]),128);
+//	}
+//	tic();
+	result=(*rvyuvCustomMessage)(p1,p2);
+//	toc();
+	fprintf(stderr, "#R# <= RV20toYUV420CustomMessage --> 0x%0x(%d)\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420Free(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RV20toYUV420Free(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvFree)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "RV20toYUV420Free --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+char h_temp[32768];
+
+ulong RV20toYUV420HiveMessage(ulong *p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage(%p,%p)\n", p1, p2);
+//	    p1->constant,p1->width,p1->height,p1->format1,p1->format2);
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, sizeof(struct init_data));
+
+	fprintf(stderr,">HIVE %d %p\n",p1[0],p1[1]);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memset(h_temp,0x77,1000);
+	memcpy(h_temp,p1,4);
+	fprintf(stderr,"COPY OK!\n");
+	
+//	tic();
+//	result=(*rvyuvHiveMessage)(p1,p2);
+	result=(*rvyuvHiveMessage)(h_temp,p2);
+//	toc();
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(p1,h_temp,8);
+	fprintf(stderr,"COPY OK!\n");
+
+	memset(h_temp,0x77,1000);
+
+//	p1[0]=0;
+//	p1[1]=0x20000000;
+	
+	fprintf(stderr,"<HIVE %d %p\n",p1[0],p1[1]);
+
+//	hexdump((void*)p1, sizeof(struct init_data));
+//	hexdump((void*)p1, 8);
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage --> 0x%0x(%d)\n\n", result, result);
+	return result;
+}
+
+struct init_data {
+	short constant; //=0xb;
+	short width, height;
+	short x1,x2,x3;
+	// 12
+	ulong format1;
+	long  x4;
+	ulong format2;
+//	long unknown[32];
+};
+
+static char i_temp[32768];
+
+ulong RV20toYUV420Init(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420Init(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(i_temp,p1,24);
+	p1=i_temp;
+	fprintf(stderr,"COPY OK!\n");
+
+	hexdump((void*)p1, 24);
+	tic();
+	result=(*rvyuvInit)(p1,p2);
+	toc();
+	hexdump((void*)p1, 24);
+
+	memset(i_temp,0x77,1000);
+
+//	hexdump(*((void**)p2), 512);
+	fprintf(stderr, "#R# RV20toYUV420Init --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+unsigned long build_crc(unsigned char *pch, unsigned long len) {
+	unsigned long crc=0, a, b;
+	// it's not the real crc function, but so what...
+	while (len--) {
+		a=*(pch++);
+//		a=a+(a<<6);
+//		a^=0x555;
+//		b=(crc>>29)&7;
+//		crc=((crc<<3)+b)^a;
+		crc^=a;
+	}
+	return crc;
+}
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+// p1=input data (stream)
+// p2=output buffer
+// p3=input struct
+// p4=output struct
+// p5=rvyuv_main
+ulong RV20toYUV420Transform(ulong p1,ulong p2,ulong p3,ulong p4,ulong p5) {
+
+//result=RV20toYUV420Transform(char *input_stream, char *output_data,
+//	struct transin *, struct transout *, struct rvyuvMain *);
+
+	ulong result;
+	ulong *pp3=p3;
+	ulong *pp4=p4;
+	void *v;
+	ulong temp[128];
+	int i;
+
+	unsigned long len,crc_src, crc0, crc1, crc2;
+	unsigned char *pch=(char *)p1;
+	fprintf(stderr, "#R# RV20toYUV420Transform(in=%p,out=%p,tin=%p,tout=%p,yuv=%p)\n",p1,p2,p3,p4,p5);
+	// input data, length=*p3
+//	hexdump((void*)p1, /*MIN(64,*/ *((ulong*)p3) /*)*/ );
+//	v=p5;
+//	v+=0x3c;
+//	v=*((void **)v);
+//	pp3=v;
+//	len=pp3[3]*pp3[4]*3/2;
+//	pch=p2;
+//	while(--len) *(pch++)=0;
+//	hexdump((char*)p2, 64);
+//	hexdump((void*)p3, 32);
+//	hexdump((void*)p5, 64);
+//	pp3=p3;
+//	if (pp3[3]>1024) {
+//		hexdump((void*)(pp3[3]),32);
+//		pp3=pp3[3];
+//	}
+
+	pp3=p3;
+	// it's not the real crc function, but so what...
+	pch=p1;
+	crc_src=build_crc(pch, pp3[0]);
+
+	pp4=pp3[3];	
+	fprintf(stderr,"transin1[%p]: {%d/%d} ",pp4,pp3[2],pp3[0]);
+//	pp4[0],pp4[1],pp4[2],pp4[3],
+//	pp4[4],pp4[5],pp4[6],pp4[7]);
+	
+	memset(temp,0x77,128*4);
+	
+	memcpy(temp,pp4,8*(pp3[2]+1));
+	for(i=0;i<=pp3[2];i++){
+	    fprintf(stderr," %p(%d)",temp[i*2],temp[i*2+1]);
+	}
+        fprintf(stderr,"\n");
+	
+
+	pp3[3]=pp4=temp;
+	
+//	pp4[2]=
+//	pp4[3]=
+//	pp4[4]=NULL;
+	
+	//pp4[6]=pp4[5];
+	
+	v=p5;
+/*	fprintf(stderr, "rvyuvMain=0x%0x\n", v);
+	v+=0x3c;
+	v=*((void **)v);
+	fprintf(stderr, "[$+3ch]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x60;
+	v=*((void **)v);
+	fprintf(stderr, "[$+60h]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x28;
+	v=*((void **)v);
+	fprintf(stderr, "[$+28h]=0x%0x\n", v);
+	hexdump(v, 512);
+*/
+/*	v+=0x178;
+	hexdump(v, 16);
+	v=*((void **)v);
+	if (v>0x8000000) {
+		fprintf(stderr, "[$+178h]=0x%0x\n", v);
+		hexdump(v, 128);
+	}
+*/	
+//	tic();
+	result=(*rvyuvTransform)(p1,p2,p3,p4,p5);
+//	toc();
+
+	crc0=build_crc(p2, 176*144);
+//	crc1=build_crc(p2+pp4[3]*pp4[4]/2, pp4[3]*pp4[4]/2);
+//	crc2=build_crc(p2+pp4[3]*pp4[4], pp4[3]*pp4[4]/2);
+
+//	pp3=p3;
+	// TRANSFORM: <timestamp> <numblocks> <len> <crc_src> <crc_dest> <p4[4]>
+//	fprintf(stderr, "TRAFO:\t%d\t%d\t%d\t%.8X\t%.8X\t%d\n",
+//		pp3[5], pp3[2], pp3[0], crc_src, crc0, pp3[4]);
+	fprintf(stderr, "#R# Decode: %d(%d) [%08X] pts=%d -> %d [%08X]\n",
+	    pp3[0],pp3[2],crc_src,pp3[5],
+	    result,crc0);
+
+	// output
+//	hexdump((char*)p2, /*64*/ pp4[3]*pp4[4]/2);
+//	hexdump((void*)p4, 20);
+//	hexdump((void*)p5, 512);
+//	fprintf(stderr, "RV20toYUV420Transform --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Free(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RV20toYUV420_RN_FRU_Free(ulong p1=0x%0x(%d))\n", p1, p1);
+	tic();
+	result=(*rvyuvRNFRUFree)(p1);
+	toc();
+	fprintf(stderr, "RV20toYUV420_RN_FRU_Free --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_GetFrame(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUGetFrame)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Init(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Init(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUInit)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Init --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Setup(ulong p1,ulong p2,ulong p3,ulong p4,
+	ulong p5,ulong p6,ulong p7,ulong p8) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Setup(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
+//	fprintf(stderr, "ulong p4=0x%0x(%d),\n\t", p4, p4);
+//	fprintf(stderr, "ulong p5=0x%0x(%d), ", p5, p5);
+//	fprintf(stderr, "ulong p6=0x%0x(%d),\n\t", p6, p6);
+//	fprintf(stderr, "ulong p7=0x%0x(%d), ", p7, p7);
+//	fprintf(stderr, "ulong p8=0x%0x(%d))\n", p8, p8);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUSetup)(p1,p2,p3,p4,p5,p6,p7,p8);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Setup --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+/*void  SetDLLAccessPath(ulong p1) {
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	(*setDLLAccessPath)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv2.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,3 @@
+rm drv2.so.6.0
+gcc -c drv2.c -g &&
+ld -shared -o drv2.so.6.0 drv2.o -ldl -lc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv3.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,481 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*rvyuvCustomMessage)(ulong,ulong);
+ulong (*rvyuvFree)(ulong);
+ulong (*rvyuvHiveMessage)(ulong,ulong);
+ulong (*rvyuvInit)(ulong,ulong);
+ulong (*rvyuvTransform)(ulong,ulong,ulong,ulong,ulong);
+ulong (*rvyuvRNFRUFree)(ulong);
+ulong (*rvyuvRNFRUGetFrame)(ulong,ulong,ulong);
+ulong (*rvyuvRNFRUInit)(ulong,ulong,ulong);
+ulong (*rvyuvRNFRUSetup)(ulong,ulong,ulong,ulong,ulong,ulong,ulong,ulong);
+
+//void (*setDLLAccessPath)(ulong);
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+		fputs("opening dll...\n",stderr);
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realdrv3.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		rvyuvCustomMessage = dlsym(handle, "RV20toYUV420CustomMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvCustomMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420CustomMessage()=0x%0x\n", rvyuvCustomMessage);
+		rvyuvFree = dlsym(handle, "RV20toYUV420Free");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvFree): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Free()=0x%0x\n", rvyuvFree);
+		rvyuvHiveMessage = dlsym(handle, "RV20toYUV420HiveMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvHiveMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420HiveMessage()=0x%0x\n", rvyuvHiveMessage);
+		rvyuvInit = dlsym(handle, "RV20toYUV420Init");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvInit): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Init()=0x%0x\n", rvyuvInit);
+		rvyuvTransform = dlsym(handle, "RV20toYUV420Transform");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvTransform): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Transform()=0x%0x\n", rvyuvTransform);
+		rvyuvRNFRUFree = dlsym(handle, "RV20toYUV420_RN_FRU_Free");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUFree): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Free()=0x%0x\n", rvyuvRNFRUFree);
+		rvyuvRNFRUGetFrame = dlsym(handle, "RV20toYUV420_RN_FRU_GetFrame");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUGetFrame): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame()=0x%0x\n", rvyuvRNFRUGetFrame);
+		rvyuvRNFRUInit = dlsym(handle, "RV20toYUV420_RN_FRU_Init");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUInit): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Init()=0x%0x\n", rvyuvRNFRUInit);
+		rvyuvRNFRUSetup = dlsym(handle, "RV20toYUV420_RN_FRU_Setup");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvRNFRUSetup): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420_RN_FRU_Setup()=0x%0x\n", rvyuvRNFRUSetup);
+
+/*		setDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+*/		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+//	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+static void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "#R# %0x  ", (int)cpos-(int)pos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RV20toYUV420CustomMessage(ulong* p1,ulong p2) {
+	ulong result;
+	ulong *pp1=p1;
+	ulong temp[16];
+	fprintf(stderr, "#R# => RV20toYUV420CustomMessage(%p,%p) [%d,%d,%d] \n", p1, p2, p1[0],p1[1],p1[2]);
+#if 0
+	if(p1[0]==0x24){
+	    hexdump(p1[2],64);
+	    memset(temp,0x77,16*4);
+	    memcpy(temp,p1[2],16);
+	    p1[2]=temp;
+	} else {
+	    return 0;
+	}
+#endif
+
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 12);
+//	if (pp1[0]==0x24) {
+//		hexdump((void*)(pp1[2]),128);
+//	}
+//	tic();
+	result=(*rvyuvCustomMessage)(p1,p2);
+//	toc();
+	fprintf(stderr, "#R# <= RV20toYUV420CustomMessage --> 0x%0x(%d)\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420Free(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RV20toYUV420Free(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvFree)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "RV20toYUV420Free --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+char h_temp[32768];
+
+ulong RV20toYUV420HiveMessage(ulong *p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage(%p,%p)\n", p1, p2);
+//	    p1->constant,p1->width,p1->height,p1->format1,p1->format2);
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, sizeof(struct init_data));
+
+	fprintf(stderr,">HIVE %d %p\n",p1[0],p1[1]);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memset(h_temp,0x77,1000);
+	memcpy(h_temp,p1,4);
+	fprintf(stderr,"COPY OK!\n");
+	
+//	tic();
+//	result=(*rvyuvHiveMessage)(p1,p2);
+	result=(*rvyuvHiveMessage)(h_temp,p2);
+//	toc();
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(p1,h_temp,8);
+	fprintf(stderr,"COPY OK!\n");
+
+	memset(h_temp,0x77,1000);
+
+//	p1[0]=0;
+//	p1[1]=0x20000000;
+	
+	fprintf(stderr,"<HIVE %d %p\n",p1[0],p1[1]);
+
+//	hexdump((void*)p1, sizeof(struct init_data));
+//	hexdump((void*)p1, 8);
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage --> 0x%0x(%d)\n\n", result, result);
+	return result;
+}
+
+struct init_data {
+	short constant; //=0xb;
+	short width, height;
+	short x1,x2,x3;
+	// 12
+	ulong format1;
+	long  x4;
+	ulong format2;
+//	long unknown[32];
+};
+
+static char i_temp[32768];
+
+ulong RV20toYUV420Init(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420Init(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(i_temp,p1,24);
+	p1=i_temp;
+	fprintf(stderr,"COPY OK!\n");
+
+	hexdump((void*)p1, 24);
+	tic();
+	result=(*rvyuvInit)(p1,p2);
+	toc();
+	hexdump((void*)p1, 24);
+
+	memset(i_temp,0x77,1000);
+
+//	hexdump(*((void**)p2), 512);
+	fprintf(stderr, "#R# RV20toYUV420Init --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+unsigned long build_crc(unsigned char *pch, unsigned long len) {
+	unsigned long crc=0, a, b;
+	// it's not the real crc function, but so what...
+	while (len--) {
+		a=*(pch++);
+//		a=a+(a<<6);
+//		a^=0x555;
+//		b=(crc>>29)&7;
+//		crc=((crc<<3)+b)^a;
+		crc^=a;
+	}
+	return crc;
+}
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+// p1=input data (stream)
+// p2=output buffer
+// p3=input struct
+// p4=output struct
+// p5=rvyuv_main
+ulong RV20toYUV420Transform(ulong p1,ulong p2,ulong p3,ulong p4,ulong p5) {
+
+//result=RV20toYUV420Transform(char *input_stream, char *output_data,
+//	struct transin *, struct transout *, struct rvyuvMain *);
+
+	ulong result;
+	ulong *pp3=p3;
+	ulong *pp4=p4;
+	void *v;
+	ulong temp[128];
+	int i;
+
+	unsigned long len,crc_src, crc0, crc1, crc2;
+	unsigned char *pch=(char *)p1;
+	fprintf(stderr, "#R# RV20toYUV420Transform(in=%p,out=%p,tin=%p,tout=%p,yuv=%p)\n",p1,p2,p3,p4,p5);
+	// input data, length=*p3
+//	hexdump((void*)p1, /*MIN(64,*/ *((ulong*)p3) /*)*/ );
+//	v=p5;
+//	v+=0x3c;
+//	v=*((void **)v);
+//	pp3=v;
+//	len=pp3[3]*pp3[4]*3/2;
+//	pch=p2;
+//	while(--len) *(pch++)=0;
+//	hexdump((char*)p2, 64);
+//	hexdump((void*)p3, 32);
+//	hexdump((void*)p5, 64);
+//	pp3=p3;
+//	if (pp3[3]>1024) {
+//		hexdump((void*)(pp3[3]),32);
+//		pp3=pp3[3];
+//	}
+
+	pp3=p3;
+	// it's not the real crc function, but so what...
+	pch=p1;
+	crc_src=build_crc(pch, pp3[0]);
+
+	pp4=pp3[3];	
+	fprintf(stderr,"transin1[%p]: {%d/%d} ",pp4,pp3[2],pp3[0]);
+//	pp4[0],pp4[1],pp4[2],pp4[3],
+//	pp4[4],pp4[5],pp4[6],pp4[7]);
+	
+	memset(temp,0x77,128*4);
+	
+	memcpy(temp,pp4,8*(pp3[2]+1));
+	for(i=0;i<=pp3[2];i++){
+	    fprintf(stderr," %p(%d)",temp[i*2],temp[i*2+1]);
+	}
+        fprintf(stderr,"\n");
+	
+
+	pp3[3]=pp4=temp;
+	
+//	pp4[2]=
+//	pp4[3]=
+//	pp4[4]=NULL;
+	
+	//pp4[6]=pp4[5];
+	
+	v=p5;
+/*	fprintf(stderr, "rvyuvMain=0x%0x\n", v);
+	v+=0x3c;
+	v=*((void **)v);
+	fprintf(stderr, "[$+3ch]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x60;
+	v=*((void **)v);
+	fprintf(stderr, "[$+60h]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x28;
+	v=*((void **)v);
+	fprintf(stderr, "[$+28h]=0x%0x\n", v);
+	hexdump(v, 512);
+*/
+/*	v+=0x178;
+	hexdump(v, 16);
+	v=*((void **)v);
+	if (v>0x8000000) {
+		fprintf(stderr, "[$+178h]=0x%0x\n", v);
+		hexdump(v, 128);
+	}
+*/	
+//	tic();
+	result=(*rvyuvTransform)(p1,p2,p3,p4,p5);
+//	toc();
+
+	crc0=build_crc(p2, 176*144);
+//	crc1=build_crc(p2+pp4[3]*pp4[4]/2, pp4[3]*pp4[4]/2);
+//	crc2=build_crc(p2+pp4[3]*pp4[4], pp4[3]*pp4[4]/2);
+
+//	pp3=p3;
+	// TRANSFORM: <timestamp> <numblocks> <len> <crc_src> <crc_dest> <p4[4]>
+//	fprintf(stderr, "TRAFO:\t%d\t%d\t%d\t%.8X\t%.8X\t%d\n",
+//		pp3[5], pp3[2], pp3[0], crc_src, crc0, pp3[4]);
+	fprintf(stderr, "#R# Decode: %d(%d) [%08X] pts=%d -> %d [%08X]\n",
+	    pp3[0],pp3[2],crc_src,pp3[5],
+	    result,crc0);
+
+	// output
+//	hexdump((char*)p2, /*64*/ pp4[3]*pp4[4]/2);
+//	hexdump((void*)p4, 20);
+//	hexdump((void*)p5, 512);
+//	fprintf(stderr, "RV20toYUV420Transform --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Free(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RV20toYUV420_RN_FRU_Free(ulong p1=0x%0x(%d))\n", p1, p1);
+	tic();
+	result=(*rvyuvRNFRUFree)(p1);
+	toc();
+	fprintf(stderr, "RV20toYUV420_RN_FRU_Free --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_GetFrame(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUGetFrame)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_GetFrame --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Init(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Init(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUInit)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Init --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420_RN_FRU_Setup(ulong p1,ulong p2,ulong p3,ulong p4,
+	ulong p5,ulong p6,ulong p7,ulong p8) {
+	ulong result;
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Setup(ulong p1=0x%0x(%d), ", p1, p1);
+//	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+//	fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
+//	fprintf(stderr, "ulong p4=0x%0x(%d),\n\t", p4, p4);
+//	fprintf(stderr, "ulong p5=0x%0x(%d), ", p5, p5);
+//	fprintf(stderr, "ulong p6=0x%0x(%d),\n\t", p6, p6);
+//	fprintf(stderr, "ulong p7=0x%0x(%d), ", p7, p7);
+//	fprintf(stderr, "ulong p8=0x%0x(%d))\n", p8, p8);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvRNFRUSetup)(p1,p2,p3,p4,p5,p6,p7,p8);
+	toc();
+//	hexdump((void*)p1, 44);
+//	fprintf(stderr, "RV20toYUV420_RN_FRU_Setup --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+/*void  SetDLLAccessPath(ulong p1) {
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	(*setDLLAccessPath)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+*/
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv3.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,3 @@
+rm drv3.so.6.0
+gcc -c drv3.c -g &&
+ld -shared -o drv3.so.6.0 drv3.o -ldl -lc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv4.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,387 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+//000000000000a410 g    DF .text  0000000000000043  G2          RV20toYUV420Free
+//000000000000a6c0 g    DF .text  0000000000000060  G2          RV20toYUV420CustomMessage
+//000000000000a200 g    DF .text  000000000000020c  G2          RV20toYUV420Init
+//000000000000a724 g    DF .text  0000000000000132  G2          RV20toYUV420HiveMessage
+//000000000000a458 g    DF .text  0000000000000262  G2          RV20toYUV420Transform
+
+ulong (*rvyuvCustomMessage)(ulong,ulong);
+ulong (*rvyuvFree)(ulong);
+ulong (*rvyuvHiveMessage)(ulong,ulong);
+ulong (*rvyuvInit)(ulong,ulong);
+ulong (*rvyuvTransform)(ulong,ulong,ulong,ulong,ulong);
+
+//void (*setDLLAccessPath)(ulong);
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+		fputs("opening dll...\n",stderr);
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realdrv4.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		rvyuvCustomMessage = dlsym(handle, "RV20toYUV420CustomMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvCustomMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420CustomMessage()=0x%0x\n", rvyuvCustomMessage);
+		rvyuvFree = dlsym(handle, "RV20toYUV420Free");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvFree): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Free()=0x%0x\n", rvyuvFree);
+		rvyuvHiveMessage = dlsym(handle, "RV20toYUV420HiveMessage");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvHiveMessage): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420HiveMessage()=0x%0x\n", rvyuvHiveMessage);
+		rvyuvInit = dlsym(handle, "RV20toYUV420Init");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvInit): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Init()=0x%0x\n", rvyuvInit);
+		rvyuvTransform = dlsym(handle, "RV20toYUV420Transform");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(rvyuvTransform): %s\n", error);
+			exit(1);
+		}
+		fprintf(stderr, "RV20toYUV420Transform()=0x%0x\n", rvyuvTransform);
+		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+//	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+static void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "#R# %0x  ", (int)cpos-(int)pos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RV20toYUV420CustomMessage(ulong* p1,ulong p2) {
+	ulong result;
+	ulong *pp1=p1;
+	ulong temp[16];
+	fprintf(stderr, "#R# => RV20toYUV420CustomMessage(%p,%p) [%d,%d,%d] \n", p1, p2, p1[0],p1[1],p1[2]);
+#if 0
+	if(p1[0]==0x24){
+	    hexdump(p1[2],64);
+	    memset(temp,0x77,16*4);
+	    memcpy(temp,p1[2],16);
+	    p1[2]=temp;
+	} else {
+	    return 0;
+	}
+#endif
+
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 12);
+//	if (pp1[0]==0x24) {
+//		hexdump((void*)(pp1[2]),128);
+//	}
+//	tic();
+	result=(*rvyuvCustomMessage)(p1,p2);
+//	toc();
+	fprintf(stderr, "#R# <= RV20toYUV420CustomMessage --> 0x%0x(%d)\n", result, result);
+	return result;
+}
+
+ulong RV20toYUV420Free(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RV20toYUV420Free(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*rvyuvFree)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "RV20toYUV420Free --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+char h_temp[32768];
+
+ulong RV20toYUV420HiveMessage(ulong *p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage(%p,%p)\n", p1, p2);
+//	    p1->constant,p1->width,p1->height,p1->format1,p1->format2);
+//	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, sizeof(struct init_data));
+
+	fprintf(stderr,">HIVE %d %p\n",p1[0],p1[1]);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memset(h_temp,0x77,1000);
+	memcpy(h_temp,p1,4);
+	fprintf(stderr,"COPY OK!\n");
+	
+//	tic();
+//	result=(*rvyuvHiveMessage)(p1,p2);
+	result=(*rvyuvHiveMessage)(h_temp,p2);
+//	toc();
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(p1,h_temp,8);
+	fprintf(stderr,"COPY OK!\n");
+
+	memset(h_temp,0x77,1000);
+
+//	p1[0]=0;
+//	p1[1]=0x20000000;
+	
+	fprintf(stderr,"<HIVE %d %p\n",p1[0],p1[1]);
+
+//	hexdump((void*)p1, sizeof(struct init_data));
+//	hexdump((void*)p1, 8);
+	fprintf(stderr, "#R# RV20toYUV420HiveMessage --> 0x%0x(%d)\n\n", result, result);
+	return result;
+}
+
+struct init_data {
+	short constant; //=0xb;
+	short width, height;
+	short x1,x2,x3;
+	// 12
+	ulong format1;
+	long  x4;
+	ulong format2;
+//	long unknown[32];
+};
+
+static char i_temp[32768];
+
+ulong RV20toYUV420Init(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "#R# RV20toYUV420Init(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+
+	fprintf(stderr,"COPY INIT DATA!\n");
+	memcpy(i_temp,p1,24);
+	p1=i_temp;
+	fprintf(stderr,"COPY OK!\n");
+
+	hexdump((void*)p1, 24);
+	tic();
+	result=(*rvyuvInit)(p1,p2);
+	toc();
+	hexdump((void*)p1, 24);
+
+	memset(i_temp,0x77,1000);
+
+//	hexdump(*((void**)p2), 512);
+	fprintf(stderr, "#R# RV20toYUV420Init --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+unsigned long build_crc(unsigned char *pch, unsigned long len) {
+	unsigned long crc=0, a, b;
+	// it's not the real crc function, but so what...
+	while (len--) {
+		a=*(pch++);
+//		a=a+(a<<6);
+//		a^=0x555;
+//		b=(crc>>29)&7;
+//		crc=((crc<<3)+b)^a;
+		crc^=a;
+	}
+	return crc;
+}
+
+#define MIN(a,b) ((a)<(b)?(a):(b))
+
+// p1=input data (stream)
+// p2=output buffer
+// p3=input struct
+// p4=output struct
+// p5=rvyuv_main
+ulong RV20toYUV420Transform(ulong p1,ulong p2,ulong p3,ulong p4,ulong p5) {
+
+//result=RV20toYUV420Transform(char *input_stream, char *output_data,
+//	struct transin *, struct transout *, struct rvyuvMain *);
+
+	ulong result;
+	ulong *pp3=p3;
+	ulong *pp4=p4;
+	void *v;
+	ulong temp[128];
+	int i;
+
+	unsigned long len,crc_src, crc0, crc1, crc2;
+	unsigned char *pch=(char *)p1;
+	fprintf(stderr, "#R# RV20toYUV420Transform(in=%p,out=%p,tin=%p,tout=%p,yuv=%p)\n",p1,p2,p3,p4,p5);
+	// input data, length=*p3
+//	hexdump((void*)p1, /*MIN(64,*/ *((ulong*)p3) /*)*/ );
+//	v=p5;
+//	v+=0x3c;
+//	v=*((void **)v);
+//	pp3=v;
+//	len=pp3[3]*pp3[4]*3/2;
+//	pch=p2;
+//	while(--len) *(pch++)=0;
+//	hexdump((char*)p2, 64);
+//	hexdump((void*)p3, 32);
+//	hexdump((void*)p5, 64);
+//	pp3=p3;
+//	if (pp3[3]>1024) {
+//		hexdump((void*)(pp3[3]),32);
+//		pp3=pp3[3];
+//	}
+
+	pp3=p3;
+	// it's not the real crc function, but so what...
+	pch=p1;
+	crc_src=build_crc(pch, pp3[0]);
+
+	pp4=pp3[3];	
+	fprintf(stderr,"transin1[%p]: {%d/%d} ",pp4,pp3[2],pp3[0]);
+//	pp4[0],pp4[1],pp4[2],pp4[3],
+//	pp4[4],pp4[5],pp4[6],pp4[7]);
+	
+	memset(temp,0x77,128*4);
+	
+	memcpy(temp,pp4,8*(pp3[2]+1));
+	for(i=0;i<=pp3[2];i++){
+	    fprintf(stderr," %p(%d)",temp[i*2],temp[i*2+1]);
+	}
+        fprintf(stderr,"\n");
+	
+
+	pp3[3]=pp4=temp;
+	
+//	pp4[2]=
+//	pp4[3]=
+//	pp4[4]=NULL;
+	
+	//pp4[6]=pp4[5];
+	
+	v=p5;
+/*	fprintf(stderr, "rvyuvMain=0x%0x\n", v);
+	v+=0x3c;
+	v=*((void **)v);
+	fprintf(stderr, "[$+3ch]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x60;
+	v=*((void **)v);
+	fprintf(stderr, "[$+60h]=0x%0x\n", v);
+	hexdump(v, 512);
+	v+=0x28;
+	v=*((void **)v);
+	fprintf(stderr, "[$+28h]=0x%0x\n", v);
+	hexdump(v, 512);
+*/
+/*	v+=0x178;
+	hexdump(v, 16);
+	v=*((void **)v);
+	if (v>0x8000000) {
+		fprintf(stderr, "[$+178h]=0x%0x\n", v);
+		hexdump(v, 128);
+	}
+*/	
+//	tic();
+	result=(*rvyuvTransform)(p1,p2,p3,p4,p5);
+//	toc();
+
+	crc0=build_crc(p2, 176*144);
+//	crc1=build_crc(p2+pp4[3]*pp4[4]/2, pp4[3]*pp4[4]/2);
+//	crc2=build_crc(p2+pp4[3]*pp4[4], pp4[3]*pp4[4]/2);
+
+//	pp3=p3;
+	// TRANSFORM: <timestamp> <numblocks> <len> <crc_src> <crc_dest> <p4[4]>
+//	fprintf(stderr, "TRAFO:\t%d\t%d\t%d\t%.8X\t%.8X\t%d\n",
+//		pp3[5], pp3[2], pp3[0], crc_src, crc0, pp3[4]);
+	fprintf(stderr, "#R# Decode: %d(%d) [%08X] pts=%d -> %d [%08X]\n",
+	    pp3[0],pp3[2],crc_src,pp3[5],
+	    result,crc0);
+
+	// output
+//	hexdump((char*)p2, /*64*/ pp4[3]*pp4[4]/2);
+//	hexdump((void*)p4, 20);
+//	hexdump((void*)p5, 512);
+//	fprintf(stderr, "RV20toYUV420Transform --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/drv4.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,3 @@
+rm drv4.so.6.0
+gcc -c drv4.c -g &&
+ld -shared -o drv4.so.6.0 drv4.o -ldl -lc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/ra.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,380 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*raCloseCodec)(ulong);
+ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
+ulong (*raEncode)(ulong,ulong,ulong);
+ulong (*raFlush)(ulong,ulong,ulong);
+ulong (*raFreeDecoder)(ulong);
+ulong (*raFreeEncoder)(ulong);
+ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
+ulong (*raGetNumberOfFlavors)(void);
+ulong (*raGetNumberOfFlavors2)(void);
+ulong (*raInitDecoder)(ulong,ulong);
+ulong (*raInitEncoder)(ulong,ulong);
+ulong (*raOpenCodec)(ulong);
+ulong (*raOpenCodec2)(ulong);
+ulong (*raSetFlavor)(ulong,ulong);
+void  (*raSetDLLAccessPath)(ulong);
+/* the following symbol will be _dlsym()ed by rarender.so,
+   but at least doesn't exist in cook.so
+ulong (raSetPwd*)(ulong);
+*/
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+		fputs("opening dll...\n");
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realcook.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		raCloseCodec = dlsym(handle, "RACloseCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RACloseCodec): %s\n", error);
+			exit(1);
+		}
+		raDecode = dlsym(handle, "RADecode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RADecode): %s\n", error);
+			exit(1);
+		}
+		raEncode = dlsym(handle, "RAEncode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAEncode): %s\n", error);
+			exit(1);
+		}
+		raFlush = dlsym(handle, "RAFlush");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFlush): %s\n", error);
+			exit(1);
+		}
+		raFreeDecoder = dlsym(handle, "RAFreeDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error);
+			exit(1);
+		}
+		raFreeEncoder = dlsym(handle, "RAFreeEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeEncoder): %s\n", error);
+			exit(1);
+		}
+		raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error);
+			exit(1);
+		}
+		raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error);
+			exit(1);
+			}
+		raGetNumberOfFlavors2 = dlsym(handle, "RAGetNumberOfFlavors2");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetNumberOfFlavors2): %s\n", error);
+			exit(1);
+		}
+		raInitDecoder = dlsym(handle, "RAInitDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error);
+			exit(1);
+		}
+		raInitEncoder = dlsym(handle, "RAInitEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitEncoder): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec = dlsym(handle, "RAOpenCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error);
+			exit(1);
+		}
+		raSetFlavor = dlsym(handle, "RASetFlavor");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RASetFlavor): %s\n", error);
+			exit(1);
+		}
+		raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "%0x  ", cpos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RACloseCodec(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RACloseCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raCloseCodec)(p1);
+//	closeDll();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RADecode(ulong p1,ulong p2,ulong p3,ulong p4,ulong p5,ulong p6) {
+	ulong result;
+	fprintf(stderr, "RADecode(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "\tulong p4=0x%0x(%d),\n", p4, p4);
+	fprintf(stderr, "ulong p5=0x%0x(%d), ", p5, p5);
+	fprintf(stderr, "ulong p6=0x%0x(%d))\n", p6, p6);
+	hexdump((void*)p1, 44);
+	hexdump((void*)p2, p3);
+	hexdump((void*)p4, 80);
+	hexdump((void*)p5, 16);
+	tic();
+	result=(*raDecode)(p1,p2,p3,p4,p5,p6);
+	toc();
+	hexdump((void*)p1, 44);
+	hexdump((void*)p4, 80);
+	hexdump((void*)p5, 16);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAEncode(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAEncode(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raEncode)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFlush(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAFlush(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raFlush)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeDecoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raFreeDecoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeEncoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeEncoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raFreeEncoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) {
+	ulong result;
+	fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	tic();
+	result=(*raGetFlavorProperty)(p1,p2,p3,p4);
+	toc();
+	fprintf(stderr, "*p4=0x%0x\n", *((ulong*)p4));
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetNumberOfFlavors(void) {
+	ulong result;
+	fprintf(stderr, "RAGetNumberOfFlavors(void)\n");
+	result=(*raGetNumberOfFlavors)();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetNumberOfFlavors2(void) {
+	ulong result;
+	fprintf(stderr, "RAGetNumberOfFlavors2(void)\n");
+	result=(*raGetNumberOfFlavors2)();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitDecoder(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "RAInitDecoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	hexdump((void*)p2, 44);
+	hexdump((void*)p1, 44);
+	result=(*raInitDecoder)(p1,p2);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitEncoder(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "RAInitEncoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	result=(*raInitEncoder)(p1,p2);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raOpenCodec)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec2(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raOpenCodec2)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RASetFlavor(ulong p1,ulong p2) {
+	ulong result, numprop=0, result1=0;
+	ulong numflavors, flavor;
+	unsigned short property;
+	fprintf(stderr, "RASetFlavor(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	hexdump((void*)p1, 44);
+	hexdump((void*)p1, 44);
+	result=(*raSetFlavor)(p1,p2);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+/*	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+
+	numflavors=raGetNumberOfFlavors2();
+	flavor=0;
+	while (flavor<numflavors) {
+		fprintf(stderr, "************ Flavor %d *************\n\n", flavor);
+		numprop=0;
+		while (numprop<32) {
+			result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property);
+			fprintf(stderr, "property %d=%d, result=0x%0x\n\n",
+				numprop, property, result1);
+			hexdump((void*)result1, property);
+			numprop++;
+		}
+		flavor++;
+	}
+
+	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+*/	
+	return result;
+}
+
+void  SetDLLAccessPath(ulong p1) {
+//	loadSyms();
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	(*raSetDLLAccessPath)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/rv30.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,525 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*pncOpen)(ulong,ulong);
+ulong (*pncClose)(ulong);
+ulong (*pncGetUIName)(ulong,ulong);
+ulong (*pncGetVersion)(ulong,ulong);
+ulong (*pncQueryMediaFormat)(ulong,ulong,ulong,ulong);
+ulong (*pncPreferredMediaFormat)(ulong,ulong,ulong,ulong);
+ulong (*pncGetMediaFormats)(ulong,ulong,ulong,ulong);
+ulong (*pncStreamOpen)(ulong,ulong,ulong);
+
+ulong (*pnsOpenSettingsBox)(ulong,ulong);
+ulong (*pnsGetIPNUnknown)(ulong);
+ulong (*pnsSetDataCallback)(ulong,ulong,ulong,ulong);
+ulong (*pnsSetProperty)(ulong,ulong,ulong);
+ulong (*pnsGetProperty)(ulong,ulong,ulong);
+ulong (*pnsClose)(ulong);
+ulong (*pnsGetStreamHeaderSize)(ulong,ulong);
+ulong (*pnsGetStreamHeader)(ulong,ulong);
+ulong (*pnsInput)(ulong,ulong,ulong);
+ulong (*pnsSetOutputPacketSize)(ulong,ulong,ulong,ulong);
+ulong (*pnsGetInputBufferSize)(ulong,ulong);
+
+void (*setDLLAccessPath)(ulong);
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+		fputs("opening dll...\n");
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realrv30.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		pncOpen = dlsym(handle, "PNCodec_Open");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncOpen): %s\n", error);
+			exit(1);
+		}
+		pncClose = dlsym(handle, "PNCodec_Close");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncClose): %s\n", error);
+			exit(1);
+		}
+		pncGetUIName = dlsym(handle, "PNCodec_GetUIName");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncGetUIName): %s\n", error);
+			exit(1);
+		}
+		pncGetVersion = dlsym(handle, "PNCodec_GetVersion");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncGetVersion): %s\n", error);
+			exit(1);
+		}
+		pncQueryMediaFormat = dlsym(handle, "PNCodec_QueryMediaFormat");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncQueryMediaFormat): %s\n", error);
+			exit(1);
+		}
+		pncPreferredMediaFormat = dlsym(handle, "PNCodec_PreferredMediaFormat");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncPreferredMediaFormat): %s\n", error);
+			exit(1);
+		}
+		pncGetMediaFormats = dlsym(handle, "PNCodec_GetMediaFormats");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncGetMediaFormats): %s\n", error);
+			exit(1);
+		}
+		pncStreamOpen = dlsym(handle, "PNCodec_StreamOpen");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pncStreamOpen): %s\n", error);
+			exit(1);
+		}
+
+		pnsOpenSettingsBox = dlsym(handle, "PNStream_OpenSettingsBox");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsOpenSettingsBox): %s\n", error);
+			exit(1);
+		}
+		pnsGetIPNUnknown = dlsym(handle, "PNStream_GetIPNUnknown");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsGetIPNUnknown): %s\n", error);
+			exit(1);
+		}
+		pnsSetDataCallback = dlsym(handle, "PNStream_SetDataCallback");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsSetDataCallback): %s\n", error);
+			exit(1);
+		}
+		pnsSetProperty = dlsym(handle, "PNStream_SetProperty");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsSetProperty): %s\n", error);
+			exit(1);
+		}
+		pnsGetProperty = dlsym(handle, "PNStream_GetProperty");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsGetProperty): %s\n", error);
+			exit(1);
+		}
+		pnsClose = dlsym(handle, "PNStream_Close");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsClose): %s\n", error);
+			exit(1);
+		}
+		pnsGetStreamHeaderSize = dlsym(handle, "PNStream_GetStreamHeaderSize");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsGetStreamHeaderSize): %s\n", error);
+			exit(1);
+		}
+		pnsGetStreamHeader = dlsym(handle, "PNStream_GetStreamHeader");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsGetStreamHeader): %s\n", error);
+			exit(1);
+		}
+		pnsInput = dlsym(handle, "PNStream_Input");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsInput): %s\n", error);
+			exit(1);
+		}
+		pnsSetOutputPacketSize = dlsym(handle, "PNStream_SetOutputPacketSize");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsSetOutputPacketSize): %s\n", error);
+			exit(1);
+		}
+		pnsGetInputBufferSize = dlsym(handle, "PNStream_GetInputBufferSize");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(pnsGetInputBufferSize): %s\n", error);
+			exit(1);
+		}
+		setDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "%0x  ", cpos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong PNCodec_Open(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNCodec_Open(ulong fourcc=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "PNCMain **pncMain=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncOpen)(p1,p2);
+	toc();
+	hexdump((void*)p2, 4);
+//	hexdump(*((void**)p2), 0x1278);
+	fprintf(stderr, "PNCodec_Open --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_Close(ulong p1) {
+	ulong result;
+	fprintf(stderr, "PNCodec_Close(PNCMain *pncMain=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncClose)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNCodec_Close --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_GetUIName(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNCodec_GetUIName(PNCMain *pncMain=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "char **appname=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 0x1278);
+//	hexdump((void*)p2, 128);
+	tic();
+	result=(*pncGetUIName)(p1,p2);
+	toc();
+//	hexdump((void*)p1, 0x1278);
+//	hexdump((void*)p2, 128);
+	fprintf(stderr, "PNCodec_GetUIName --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_GetVersion(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNCodec_GetVersion(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncGetVersion)(p1,p2);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNCodec_GetVersion --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_QueryMediaFormat(ulong p1,ulong p2,ulong p3,ulong p4) {
+	ulong result;
+	fprintf(stderr, "PNCodec_QueryMediaFormat(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d),\n", p4, p4);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncQueryMediaFormat)(p1,p2,p3,p4);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNCodec_QueryMediaFormat --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_PreferredMediaFormat(ulong p1,ulong p2,ulong p3,ulong p4) {
+	ulong result;
+	fprintf(stderr, "PNCodec_PreferredMediaFormat(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d),\n", p4, p4);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncPreferredMediaFormat)(p1,p2,p3,p4);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNCodec_PreferredMediaFormat --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_GetMediaFormats(ulong p1,ulong p2,ulong p3,ulong p4) {
+	ulong result;
+	fprintf(stderr, "PNCodec_GetMediaFormats(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d),\n", p4, p4);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pncGetMediaFormats)(p1,p2,p3,p4);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNCodec_GetMediaFormats --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNCodec_StreamOpen(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "PNCodec_StreamOpen(PNCMain *pncMain=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "PNSMain **pnsMain=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong **p3=0x%0x(%d),\n", p3, p3);
+//	hexdump((void*)p1, 0x1278);
+//	hexdump((void*)p2, 128);
+//	hexdump((void*)p3, 4);
+	hexdump(*((void**)p3), 4);
+	tic();
+	result=(*pncStreamOpen)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p1, 0x1278);
+	hexdump((void*)p2, 4);
+//	hexdump((void*)p3, 128);
+	hexdump(*((void**)p2), 128);
+	hexdump(**((void***)p2), 128);
+	fprintf(stderr, "PNCodec_StreamOpen --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_OpenSettingsBox(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNStream_OpenSettingsBox(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pnsOpenSettingsBox)(p1,p2);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNStream_OpenSettingsBox --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_GetIPNUnknown(ulong p1) {
+	ulong result;
+	fprintf(stderr, "PNStream_GetIPNUnknown(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pnsGetIPNUnknown)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNStream_GetIPNUnknown --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_SetDataCallback(ulong p1,ulong p2,ulong p3,ulong p4) {
+	ulong result;
+	int i=0;
+	void **pp;
+	fprintf(stderr, "PNStream_SetDataCallback(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
+	hexdump((void*)p1, 0x24);
+	hexdump((void*)p2, 32);
+	hexdump((void*)p3, 4);
+	hexdump((void*)p4, 32);
+	fprintf(stderr, "content of the callback functions:\n\n");
+	while(i<8) {
+		hexdump(*((void**)p2+i), (i==0)?32*4:16);
+		i++;
+	}
+	i=0;
+	pp=(*(void***)p2);
+	fprintf(stderr, "content of the callback functions (first entry):\n\n");
+	while(i<15) {
+		hexdump(*((void**)pp+i), 32);
+		i++;
+	}
+
+	tic();
+	result=(*pnsSetDataCallback)(p1,p2,p3,p4);
+	toc();
+	hexdump((void*)p1, 0x24);
+//	hexdump((void*)p2, 256);
+//	hexdump((void*)p3, 4);
+	hexdump(*((void**)p3), 256);
+	fprintf(stderr, "PNStream_SetDataCallback --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_SetProperty(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "PNStream_SetProperty(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	hexdump((void*)p3, 4);
+	tic();
+	result=(*pnsSetProperty)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p3, 44);
+	fprintf(stderr, "PNStream_SetProperty --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_GetProperty(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "PNStream_GetProperty(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+//	hexdump((void*)p3, 44);
+	tic();
+	result=(*pnsGetProperty)(p1,p2,p3);
+	toc();
+	hexdump((void*)p3, 4);
+	fprintf(stderr, "PNStream_GetProperty --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_Close(ulong p1) {
+	ulong result;
+	fprintf(stderr, "PNStream_Close(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pnsClose)(p1);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNStream_Close --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong streamHeaderSize=0;
+
+ulong PNStream_GetStreamHeaderSize(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNStream_GetStreamHeaderSize(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+//	hexdump((void*)p2, 44);
+	tic();
+	result=(*pnsGetStreamHeaderSize)(p1,p2);
+	toc();
+	hexdump((void*)p2, 4);
+	streamHeaderSize=*((ulong *)p2);
+	fprintf(stderr, "PNStream_GetStreamHeaderSize --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_GetStreamHeader(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNStream_GetStreamHeader(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+//	hexdump((void*)p2, 44);
+	tic();
+	result=(*pnsGetStreamHeader)(p1,p2);
+	toc();
+	hexdump((void*)p2, streamHeaderSize);
+	fprintf(stderr, "PNStream_GetStreamHeader --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_Input(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "PNStream_Input(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	hexdump((void*)p3, 4);
+	tic();
+	result=(*pnsInput)(p1,p2,p3);
+	toc();
+//	hexdump((void*)p3, 44);
+	fprintf(stderr, "PNStream_Input --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_SetOutputPacketSize(ulong p1,ulong p2,ulong p3,ulong p4) {
+	ulong result;
+	fprintf(stderr, "PNStream_SetOutputPacketSize(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n\t", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d),", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pnsSetOutputPacketSize)(p1,p2,p3,p4);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNStream_SetOutputPacketSize --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong PNStream_GetInputBufferSize(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "PNStream_GetInputBufferSize(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 44);
+	tic();
+	result=(*pnsGetInputBufferSize)(p1,p2);
+	toc();
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "PNStream_GetInputBufferSize --> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+void  SetDLLAccessPath(ulong p1) {
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+//	hexdump((void*)p1, 44);
+	(*setDLLAccessPath)(p1);
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/rv30.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,3 @@
+rm rv30.so.6.0
+gcc -c rv30.c -g
+ld -shared -o rv30.so.6.0 rv30.o -ldl -lc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/sipr.c	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,462 @@
+/*
+   GPL v2 blah blah
+   
+   This is a small dll that works as a wrapper for the actual cook.so.6.0
+   dll from real player 8.0. 
+*/
+
+/*
+   Assuming that RACloseCodec is the last call.
+
+0000000000001b8c g    DF .text	000000000000002b  G2          RASetPwd
+0000000000001c6c g    DF .text	000000000000003e  G2          RAInitEncoder
+0000000000001a8c g    DF .text	0000000000000039  G2          RAOpenCodec2
+0000000000001a50 g    DF .text	0000000000000039  G2          RAOpenCodec
+0000000000001ac8 g    DF .text	000000000000002c  G2          RACloseCodec
+0000000000001af4 g    DF .text	000000000000000a  G2          RAGetNumberOfFlavors
+0000000000001bdc g    DF .text	0000000000000032  G2          RADecode
+0000000000001cac g    DF .text	0000000000000029  G2          RAEncode
+0000000000001cd8 g    DF .text	0000000000000023  G2          RAFreeEncoder
+000000000000138c g    DF .text	0000000000000029  G2          SetDLLAccessPath
+0000000000001c48 g    DF .text	0000000000000023  G2          RAFreeDecoder
+0000000000001c10 g    DF .text	0000000000000035  G2          RAFlush
+0000000000001b00 g    DF .text	0000000000000052  G2          RAGetFlavorProperty
+0000000000001b54 g    DF .text	0000000000000038  G2          RASetFlavor
+0000000000001bb8 g    DF .text	0000000000000023  G2          RAInitDecoder
+
+*/
+
+#include <stddef.h>
+#include <stdio.h>
+#include <dlfcn.h>
+#include <sys/time.h>
+
+typedef unsigned long ulong;
+
+ulong (*raCloseCodec)(ulong);
+ulong (*raDecode)(ulong,ulong,ulong,ulong,ulong,ulong);
+ulong (*raEncode)(ulong,ulong,ulong);
+ulong (*raFlush)(ulong,ulong,ulong);
+ulong (*raFreeDecoder)(ulong);
+ulong (*raFreeEncoder)(ulong);
+ulong (*raGetFlavorProperty)(ulong,ulong,ulong,ulong);
+ulong (*raGetNumberOfFlavors)(void);
+ulong (*raGetNumberOfFlavors2)(void);
+ulong (*raInitDecoder)(ulong,ulong);
+ulong (*raInitEncoder)(ulong,ulong);
+ulong (*raOpenCodec)(ulong);
+ulong (*raOpenCodec2)(ulong);
+ulong (*raSetFlavor)(ulong,ulong,ulong);
+void  (*raSetDLLAccessPath)(ulong);
+/* the following symbol will be _dlsym()ed by rarender.so,
+   but at least doesn't exist in cook.so
+*/
+ulong (*raSetPwd)(ulong,ulong);
+
+int b_dlOpened=0;
+void *handle=NULL;
+
+/* exits program when failure */
+void loadSyms() {
+	fputs("loadSyms()\n", stderr);
+	if (!b_dlOpened) {
+		char *error;
+
+//		fputs("opening dll...\n");
+		handle = dlopen ("/usr/local/RealPlayer8/Codecs/realsipr.so.6.0", RTLD_LAZY);
+		if (!handle) {
+			fputs (dlerror(), stderr);
+			exit(1);
+		}
+
+		raCloseCodec = dlsym(handle, "RACloseCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RACloseCodec): %s\n", error);
+			exit(1);
+		}
+		raDecode = dlsym(handle, "RADecode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RADecode): %s\n", error);
+			exit(1);
+		}
+		raEncode = dlsym(handle, "RAEncode");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAEncode): %s\n", error);
+			exit(1);
+		}
+		raFlush = dlsym(handle, "RAFlush");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFlush): %s\n", error);
+			exit(1);
+		}
+		raFreeDecoder = dlsym(handle, "RAFreeDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeDecoder): %s\n", error);
+			exit(1);
+		}
+		raFreeEncoder = dlsym(handle, "RAFreeEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAFreeEncoder): %s\n", error);
+			exit(1);
+		}
+		raGetFlavorProperty = dlsym(handle, "RAGetFlavorProperty");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetFlavorProperty): %s\n", error);
+			exit(1);
+		}
+		raGetNumberOfFlavors = dlsym(handle, "RAGetNumberOfFlavors");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAGetNumberOfFlavors): %s\n", error);
+			exit(1);
+			}
+//		raGetNumberOfFlavors2 = dlsym(handle, "RAGetNumberOfFlavors2");
+//		if ((error = dlerror()) != NULL)  {
+//			fprintf (stderr, "dlsym(RAGetNumberOfFlavors2): %s\n", error);
+//			exit(1);
+//		}
+		raInitDecoder = dlsym(handle, "RAInitDecoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitDecoder): %s\n", error);
+			exit(1);
+		}
+		raInitEncoder = dlsym(handle, "RAInitEncoder");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAInitEncoder): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec = dlsym(handle, "RAOpenCodec");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec): %s\n", error);
+			exit(1);
+		}
+		raOpenCodec2 = dlsym(handle, "RAOpenCodec2");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RAOpenCodec2): %s\n", error);
+			exit(1);
+		}
+		raSetFlavor = dlsym(handle, "RASetFlavor");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RASetFlavor): %s\n", error);
+			exit(1);
+		}
+		raSetDLLAccessPath = dlsym(handle, "SetDLLAccessPath");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(SetDLLAccessPath): %s\n", error);
+			exit(1);
+		}
+		raSetPwd = dlsym(handle, "RASetPwd");
+		if ((error = dlerror()) != NULL)  {
+			fprintf (stderr, "dlsym(RASetPwd): %s\n", error);
+			exit(1);
+		}
+		b_dlOpened=1;
+	}
+}
+
+void closeDll() {
+	if (handle) {
+		b_dlOpened=0;
+		dlclose(handle);
+		handle=NULL;
+	}
+}
+
+void _init(void) {
+	loadSyms();
+}
+
+struct timezone tz;
+struct timeval tv1, tv2;
+
+void tic() {
+	gettimeofday(&tv1, &tz);
+}
+
+void toc() {
+	long secs, usecs;
+	gettimeofday(&tv2, &tz);
+	secs=tv2.tv_sec-tv1.tv_sec;
+	usecs=tv2.tv_usec-tv1.tv_usec;
+	if (usecs<0) {
+		usecs+=1000000;
+		--secs;
+	}
+	fprintf(stderr, "Duration: %d.%0.6ds\n", secs, usecs);
+}
+
+
+void hexdump(void *pos, int len) {
+	unsigned char *cpos=pos, *cpos1;
+	int lines=(len+15)>>4;
+	while(lines--) {
+		int len1=len, i;
+		fprintf(stderr, "%0x  ", cpos); 
+		cpos1=cpos;
+		for (i=0;i<16;i++) {
+			if (len1>0) {
+				fprintf(stderr, "%02x ", *(cpos++));
+			} else {
+				fprintf(stderr, "   ");
+			}
+			len1--;
+		}
+		fputs("  ", stderr);
+		cpos=cpos1;
+		for (i=0;i<16;i++) {
+			if (len>0) {
+				unsigned char ch=(*(cpos++));
+				if ((ch<32)||(ch>127)) ch='.';
+				fputc(ch, stderr);
+			}
+			len--;
+		}
+		fputs("\n", stderr);		
+	}
+	fputc('\n', stderr);
+}
+
+
+ulong RACloseCodec(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RACloseCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raCloseCodec)(p1);
+//	closeDll();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+static int pkno=0;
+
+ulong RADecode(ulong p1,ulong p2,ulong p3,ulong p4,ulong* p5,ulong p6) {
+	ulong result;
+	int x,y;
+	
+	fprintf(stderr, "RADecode(ulong ctx=0x%0x, ", p1);
+	fprintf(stderr, "ulong src=0x%0x,\n", p2);
+	fprintf(stderr, "ulong len=0x%0x,", p3);
+	fprintf(stderr, "ulong dst=0x%0x,\n", p4);
+	fprintf(stderr, "ulong dstcnt=0x%0x, ",p5);
+	fprintf(stderr, "ulong p6=%d)\n", p6);
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p2, p3);
+//	hexdump((void*)p4, 80);
+//	hexdump((void*)p5, 16);
+//	tic();
+
+#if 0
+	hexdump(p2, 0x128);
+#else
+	    fprintf(stderr,"\n#CRC[%3d]",pkno++);
+	for(y=0;y<(0x128*2);y+=37){
+	    unsigned short crc=0;
+	    unsigned char* p=p2;
+//	    p+=y;
+	    for(x=0;x<37;x++){
+		int i=y+x;
+		int ib=p[(i>>1)];
+		if(i&1) ib>>=4; else ib&=15;
+		crc+=ib<<(x&7);
+	    }
+	    fprintf(stderr," %04X",crc);
+//	    fprintf(stderr," %02X",p[0]);
+	}
+	    fprintf(stderr,"\n");
+#endif
+
+	{ FILE *f=fopen("sipr.dump","a");
+	  fwrite(p2,p3,1,f);
+	  fclose(f);
+	}
+
+	result=(*raDecode)(p1,p2,p3,p4,p5,p6);
+//	toc();
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p4, 80);
+//	hexdump((void*)p5, 16);
+	fprintf(stderr, "--> 0x%0x(%d)  decoded: %d  \n\n\n", result, result, p5[0]);
+	return result;
+}
+
+ulong RAEncode(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAEncode(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raEncode)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFlush(ulong p1,ulong p2,ulong p3) {
+	ulong result;
+	fprintf(stderr, "RAFlush(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d))\n", p3, p3);
+	result=(*raFlush)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeDecoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeDecoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raFreeDecoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAFreeEncoder(ulong p1) {
+	ulong result;
+	fprintf(stderr, "RAFreeEncoder(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raFreeEncoder)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetFlavorProperty(ulong p1,ulong p2,ulong p3, ulong p4) {
+	ulong result;
+	fprintf(stderr, "RAGetFlavorProperty(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d),\n", p2, p2);
+	fprintf(stderr, "ulong p3=0x%0x(%d), ", p3, p3);
+	fprintf(stderr, "ulong p4=0x%0x(%d))\n", p4, p4);
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	tic();
+	result=(*raGetFlavorProperty)(p1,p2,p3,p4);
+	toc();
+	fprintf(stderr, "*p4=0x%0x\n", *((ulong*)p4));
+	hexdump((void*)p4/*(void*)(*((void**)p4))*/,p2);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAGetNumberOfFlavors(void) {
+	ulong result;
+	fprintf(stderr, "RAGetNumberOfFlavors(void)\n");
+	result=(*raGetNumberOfFlavors)();
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitDecoder(ulong p1,ulong p2) {
+	ulong result;
+	int temp[256];
+	unsigned char temp2[256];
+	fprintf(stderr, "RAInitDecoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	hexdump((void*)p2, 4*7);
+//	hexdump((void*)p1, 44);
+
+#if 1
+	result=(*raInitDecoder)(p1,p2);
+#else
+	memset(temp,0x77,256*4);
+	memcpy(temp,p2,4*7);
+	hexdump((void*)temp[6], 32);
+
+	memset(temp2,0x77,256);
+	memcpy(temp2,temp[6],16);
+	temp[6]=temp2;
+	
+	result=(*raInitDecoder)(p1,temp);
+	hexdump((void*)temp[6], 32);
+#endif
+
+//	memcpy(p2,temp,4*11);
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAInitEncoder(ulong p1,ulong p2) {
+	ulong result;
+	fprintf(stderr, "RAInitEncoder(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+	result=(*raInitEncoder)(p1,p2);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec(ulong p1=0x%0x(%d))\n", p1, p1);
+	result=(*raOpenCodec)(p1);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RAOpenCodec2(ulong p1) {
+	ulong result;
+//	loadSyms();
+	fprintf(stderr, "RAOpenCodec2(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	result=(*raOpenCodec2)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+	return result;
+}
+
+ulong RASetFlavor(ulong p1,ulong p2,ulong p3) {
+	ulong result, numprop=0, result1=0;
+	ulong numflavors, flavor;
+	unsigned short property;
+	fprintf(stderr, "RASetFlavor(ulong p1=0x%0x(%d), ", p1, p1);
+	fprintf(stderr, "ulong p2=0x%0x(%d))\n", p2, p2);
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p1, 44);
+	result=(*raSetFlavor)(p1,p2,p3);
+	fprintf(stderr, "--> 0x%0x(%d)\n\n\n", result, result);
+
+#if 1
+	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+	numflavors=3;//raGetNumberOfFlavors();
+	flavor=0;
+	while (flavor<numflavors) {
+		fprintf(stderr, "************ Flavor %d *************\n\n", flavor);
+		numprop=0;
+		while (numprop<32) {
+			result1=raGetFlavorProperty(p1, flavor, numprop, (ulong)&property);
+			fprintf(stderr, "property %d=%d, result=0x%0x\n\n",
+				numprop, property, result1);
+			hexdump((void*)result1, property);
+			numprop++;
+		}
+		flavor++;
+	}
+
+	fputs("######################## FLAVOR PROPERTIES ###################\n\n", stderr);
+#endif
+	
+	return result;
+}
+
+void  SetDLLAccessPath(ulong p1) {
+//	loadSyms();
+	fprintf(stderr, "SetDLLAccessPath(ulong p1=0x%0x(%d))\n", p1, p1);
+	hexdump((void*)p1, 44);
+	(*raSetDLLAccessPath)(p1);
+	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+
+static char pwdtemp[1000];
+
+void  RASetPwd(ulong p1,ulong p2) {
+//	loadSyms();
+	fprintf(stderr, "RASetPwd(ulong p1=0x%0x(%d),ulong p2=0x%0x(%d))\n", p1, p1, p2, p2);
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p2, 44);
+	memset(pwdtemp,0x77,1000);
+	hexdump((void*)pwdtemp, 44);
+	(*raSetPwd)(pwdtemp,"Ardubancel Quazanga"); // set password... lol.
+	hexdump((void*)pwdtemp, 1000);
+	strcpy(p1,p2);
+//	hexdump((void*)p1, 44);
+//	hexdump((void*)p2, 44);
+//	hexdump((void*)p1, 44);
+	fprintf(stderr, "--> void\n\n\n");
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TOOLS/realcodecs/sipr.sh	Wed Aug 28 14:17:06 2002 +0000
@@ -0,0 +1,4 @@
+rm sipr.so.6.0
+gcc -c sipr.c -g
+ld -shared -o sipr.so.6.0 sipr.o -ldl -lc
+ 
\ No newline at end of file