summaryrefslogtreecommitdiff
path: root/src/libreal/real_common.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/libreal/real_common.c')
-rw-r--r--src/libreal/real_common.c37
1 files changed, 36 insertions, 1 deletions
diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c
index f1f47fb6b..d2fccd28d 100644
--- a/src/libreal/real_common.c
+++ b/src/libreal/real_common.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: real_common.c,v 1.3 2007/03/16 20:45:21 dgp85 Exp $
+ * $Id: real_common.c,v 1.4 2007/03/16 21:37:58 dgp85 Exp $
*
* Common function for the thin layer to use Real binary-only codecs in xine
*/
@@ -28,7 +28,11 @@
#define LOG
*/
+#include "config.h"
+
#include <sys/stat.h>
+#include <string.h>
+#include <dlfcn.h>
#include "real_common.h"
@@ -105,3 +109,34 @@ void _x_real_codecs_init(xine_t *const xine) {
lprintf ("real codecs path : %s\n", real_codec_path);
}
+
+void *_x_real_codec_open(xine_stream_t *const stream, const char *const path,
+ const char *const codec_name) {
+ char *codecpath = NULL;
+ void *codecmodule = NULL;
+
+ asprintf(&codecpath, "%s/%s.6.0", path, codec_name);
+ if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) {
+ free(codecpath);
+ return codecmodule;
+ }
+
+ xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
+ LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror());
+
+ free(codecpath);
+ asprintf(&codecpath, "%s/%s", path, codec_name);
+ if ( (codecmodule = dlopen(codecpath, RTLD_NOW)) ) {
+ free(codecpath);
+ return codecmodule;
+ }
+
+ xprintf (stream->xine, XINE_VERBOSITY_DEBUG,
+ LOG_MODULE ": error loading %s: %s\n", codecpath, dlerror());
+
+ free(codecpath);
+
+ _x_message(stream, XINE_MSG_LIBRARY_LOAD_ERROR, codec_name, NULL);
+
+ return NULL;
+}