changeset 6361:433bc1becbb6

freebsd support (hack) by Nexus (f)printf->mp_msg, also needed to avoid use of stderr...
author arpi
date Sun, 09 Jun 2002 19:53:13 +0000
parents 1acda8182b14
children 1d592c2fb5c5
files libmpcodecs/vd_real.c
diffstat 1 files changed, 20 insertions(+), 26 deletions(-) [+]
line wrap: on
line diff
--- a/libmpcodecs/vd_real.c	Sun Jun 09 18:20:27 2002 +0000
+++ b/libmpcodecs/vd_real.c	Sun Jun 09 19:53:13 2002 +0000
@@ -44,10 +44,16 @@
 }
 
 void __pure_virtual(void) {
-	fprintf(stderr, "I'm outa here!\n");
-	exit(1);
+	printf("FATAL: __pure_virtual() called!\n");
+//	exit(1);
 }
 
+#ifdef __FreeBSD__
+void ___brk_addr(void) {exit(0);}
+char** __environ={NULL};
+#undef stderr
+FILE* stderr=NULL;
+#endif
 
 // to set/get/query special features/parameters
 static int control(sh_video_t *sh,int cmd,void* arg,...){
@@ -68,40 +74,28 @@
 		void *handle;
 		char *error;
 
-		fprintf(stderr, "opening dll %s\n", path);
+		mp_msg(MSGT_DECVIDEO,MSGL_INFO, "opening shared obj '%s'\n", path);
 		rv_handle = dlopen (path, RTLD_LAZY);
 		handle=rv_handle;
 		if (!handle) {
-			fputs (dlerror(), stderr);
+			mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error: %s\n",dlerror());
 			return 0;
 		}
 
 		rvyuv_custom_message = dlsym(handle, "RV20toYUV420CustomMessage");
-		if ((error = dlerror()) != NULL)  {
-			fprintf (stderr, "dlsym(rvyuvCustomMessage): %s\n", error);
-			return 0;
-		}
 		rvyuv_free = dlsym(handle, "RV20toYUV420Free");
-		if ((error = dlerror()) != NULL)  {
-			fprintf (stderr, "dlsym(rvyuvFree): %s\n", error);
-			return 0;
-		}
 		rvyuv_hive_message = dlsym(handle, "RV20toYUV420HiveMessage");
-		if ((error = dlerror()) != NULL)  {
-			fprintf (stderr, "dlsym(rvyuvHiveMessage): %s\n", error);
-			return 0;
-		}
 		rvyuv_init = dlsym(handle, "RV20toYUV420Init");
-		if ((error = dlerror()) != NULL)  {
-			fprintf (stderr, "dlsym(rvyuvInit): %s\n", error);
-			return 0;
-		}
 		rvyuv_transform = dlsym(handle, "RV20toYUV420Transform");
-		if ((error = dlerror()) != NULL)  {
-			fprintf (stderr, "dlsym(rvyuvTransform): %s\n", error);
-			return 0;
-		}
-	return 1;
+
+    if(rvyuv_custom_message &&
+       rvyuv_free &&
+       rvyuv_hive_message &&
+       rvyuv_init &&
+       rvyuv_transform) return 1;
+
+    mp_msg(MSGT_DECVIDEO,MSGL_WARN,"Error resolving symbols! (version incompatibility?)\n");
+    return 0;
 }
 
 #else
@@ -110,7 +104,7 @@
     void *handle;
     Setup_LDT_Keeper();
     rv_handle = handle = LoadLibraryA(path);
-    printf("win32 real codec handle=%p  \n",handle);
+    mp_msg(MSGT_DECVIDEO,MSGL_V,"win32 real codec handle=%p  \n",handle);
 
     rvyuv_custom_message = GetProcAddress(handle, "RV20toYUV420CustomMessage");
     rvyuv_free = GetProcAddress(handle, "RV20toYUV420Free");