All pastes #1204281 Raw Edit

fer

public text v1 · immutable
#1204281 ·published 2008-09-16 13:22 UTC
rendered paste body
Index: pipeline.cpp
===================================================================
--- pipeline.cpp	(revision 113082)
+++ pipeline.cpp	(working copy)
@@ -22,6 +22,8 @@
 #include <pthread.h>
 #include <sched.h>
 
+#include <dlfcn.h>
+
 #include "pipeline.h"
 #include "pipeline-ffmpeg.h"
 #include "mp3.h"
@@ -38,6 +40,33 @@
 #define LOG_PIPELINE_ERROR_CONDITIONAL(x, ...) if (x) printf (__VA_ARGS__);
 #define LOG_FRAMEREADERLOOP(...)// printf (__VA_ARGS__);
 
+void
+register_mscodecs (void)
+{
+	void (*reg) (void);
+	//void *dl = dlopen ("/opt/mono/lib/moon/libmscodecs.so", RTLD_NOW);
+	void *dl = dlopen ("/opt/mono/lib/moon/libmscodecs.so", RTLD_LAZY);
+	if (dl == NULL)
+		goto dl_error;
+
+	//*(void **) (&reg) = dlsym (dl, "register_mswma");
+	*(void **) (&reg) = dlsym (dl, "_Z14register_mswmav");
+	if (reg == NULL)
+		goto dl_error;
+
+	(*reg)();
+	return;
+
+dl_error:
+	char *error_str = dlerror();
+	g_print ("Cannot load libmscodecs.so: %s\n", error_str);
+	return;
+}
+
+
+
+	
+
 class MediaNode : public List::Node {
 public:
 	Media *media;
@@ -241,6 +270,7 @@
 
 	// decoders
 	Media::RegisterDecoder (new ASFMarkerDecoderInfo ());
+	register_mscodecs ();
 #ifdef INCLUDE_FFMPEG
 	register_ffmpeg ();
 #else