summaryrefslogtreecommitdiff
path: root/src/libreal/real_common.c
diff options
context:
space:
mode:
authorDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-16 21:37:58 +0000
committerDiego 'Flameeyes' Pettenò <flameeyes@gmail.com>2007-03-16 21:37:58 +0000
commit92e7af754617240646c35482f62a34603e6c50e2 (patch)
tree6a06309169d72ab2655eb705501e181c7b081855 /src/libreal/real_common.c
parentf39902b9cf71081aa1701e9c7a857f1215982199 (diff)
downloadxine-lib-92e7af754617240646c35482f62a34603e6c50e2.tar.gz
xine-lib-92e7af754617240646c35482f62a34603e6c50e2.tar.bz2
Move the wrapper to open the real codecs in the common unit, and assume that the alternative name is always the same with .6.0 at the end. Prefer the full name to the reduced one.
CVS patchset: 8683 CVS date: 2007/03/16 21:37:58
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;
+}