diff options
author | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-16 20:45:21 +0000 |
---|---|---|
committer | Diego 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2007-03-16 20:45:21 +0000 |
commit | f39902b9cf71081aa1701e9c7a857f1215982199 (patch) | |
tree | 6feaa160244011be6066ad7801a6b78b23afcdfb /src/libreal/real_common.c | |
parent | 066220e7145c94fd6751c0631374ef3b34dc983c (diff) | |
download | xine-lib-f39902b9cf71081aa1701e9c7a857f1215982199.tar.gz xine-lib-f39902b9cf71081aa1701e9c7a857f1215982199.tar.bz2 |
Move autodetection of Real codecs path to the common code unit, and rewrite to
a) minimise the number of stat() calls happening;
b) support FreeBSD paths.
CVS patchset: 8682
CVS date: 2007/03/16 20:45:21
Diffstat (limited to 'src/libreal/real_common.c')
-rw-r--r-- | src/libreal/real_common.c | 47 |
1 files changed, 46 insertions, 1 deletions
diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index c4afcbeea..f1f47fb6b 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.2 2007/03/16 20:21:40 dgp85 Exp $ + * $Id: real_common.c,v 1.3 2007/03/16 20:45:21 dgp85 Exp $ * * Common function for the thin layer to use Real binary-only codecs in xine */ @@ -28,6 +28,8 @@ #define LOG */ +#include <sys/stat.h> + #include "real_common.h" #ifdef __alpha__ @@ -60,3 +62,46 @@ void __pure_virtual(void) { void ___brk_addr(void) { exit(0); } void __ctype_b(void) { exit(0); } #endif + +void _x_real_codecs_init(xine_t *const xine) { + const char *default_real_codecs_path = ""; + const char *real_codecs_path = NULL; + struct stat s; + +#define try_real_path(path) \ + if (!stat (path "/dvr3.so.6.0", &s)) \ + default_real_codecs_path = path; +#define try_real_subpath(path) \ + try_real_path("/usr/" path) \ + else try_real_path("/usr/local" path) \ + else try_real_path("/opt" path) + + /* The priority is for the first found */ + try_real_subpath("lib/win32") + else try_real_subpath("lib/codecs") + else try_real_subpath("lib64/RealPlayer10/codecs") + else try_real_subpath("lib/RealPlayer10/codecs") + else try_real_subpath("lib64/RealPlayer9/users/Real/Codecs") + else try_real_subpath("lib/RealPlayer9/users/Real/Codecs") + else try_real_subpath("lib/RealPlayer8/Codecs") + else try_real_subpath("RealPlayer8/Codecs"); + +#undef try_real_path +#undef try_real_subpath + + real_codecs_path = + xine->config->register_filename (xine->config, "decoder.external.real_codecs_path", + default_real_codecs_path, + XINE_CONFIG_STRING_IS_DIRECTORY_NAME, + _("path to RealPlayer codecs"), + _("If you have RealPlayer installed, specify the path " + "to its codec directory here. You can easily find " + "the codec directory by looking for a file named " + "\"drv3.so.6.0\" in it. If xine can find the RealPlayer " + "codecs, it will use them to decode RealPlayer content " + "for you. Consult the xine FAQ for more information on " + "how to install the codecs."), + 10, NULL, NULL); + + lprintf ("real codecs path : %s\n", real_codec_path); +} |