From 170fdd55a128164b019d8fdf5355b14c6ddd67ad Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Mon, 5 Nov 2007 01:29:58 +0000 Subject: Add another RealPlayer codecs path. --- src/libreal/real_common.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/libreal/real_common.c') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 371ffd246..bcc62122e 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -91,6 +91,7 @@ void _x_real_codecs_init(xine_t *const xine) { else try_real_subpath("lib/codecs") else try_real_subpath("lib64/real") else try_real_subpath("lib/real") + else try_real_path("/opt/real/RealPlayer/codecs") else try_real_subpath("lib/RealPlayer10GOLD/codecs") else try_real_subpath("lib64/RealPlayer10/codecs") else try_real_subpath("lib/RealPlayer10/codecs") -- cgit v1.2.3 From 81b2bbc48c154adefd51b49cd09fdc97fdf9f1a1 Mon Sep 17 00:00:00 2001 From: Darren Salt Date: Tue, 6 Nov 2007 14:07:47 +0000 Subject: Change how the RealPlayer codecs are detected. * Use arrays and loops instead of chained if()s. This reduces code size a little. * Try to dlopen drvc.so instead of just checking for its existence. The old code could, for example, try to use a dir containing 32-bit libs on a 64-bit system. (Not that I'd expect this to happen, of course...) --- src/libreal/real_common.c | 84 ++++++++++++++++++++++++++++++++--------------- 1 file changed, 57 insertions(+), 27 deletions(-) (limited to 'src/libreal/real_common.c') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index bcc62122e..9641cd4ac 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -75,33 +75,63 @@ void _x_real_codecs_init(xine_t *const xine) { #ifdef REAL_CODEC_PATH const char *const default_real_codecs_path = REAL_CODEC_PATH; #else - const char *default_real_codecs_path = ""; - struct stat s; - -#define try_real_path(path) \ - if (!stat (path "/drvc.so", &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/real") - else try_real_subpath("lib/real") - else try_real_path("/opt/real/RealPlayer/codecs") - else try_real_subpath("lib/RealPlayer10GOLD/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 + char default_real_codecs_path[256]; + + default_real_codecs_path[0] = 0; + +#define UL64 0x05 /* /usr/{,local/}lib64 */ +#define UL 0x0A /* /usr/{,local/}lib */ +#define O 0x10 /* /opt */ +#define OL64 0x20 /* /opt/lib64 */ +#define OL 0x40 /* /opt/lib */ + + static const char *const prefix[] = { + "/usr/lib64", "/usr/local/lib64", + "/usr/lib", "/usr/local/lib", + "/opt", "/opt/lib64", "/opt/lib", + }; + + static const struct { + int prefix; + const char *path; + } paths[] = { + { O | UL, "win32" }, + { O | UL, "codecs" }, + { O | UL | UL64, "real" }, + { O, "real/RealPlayer/codecs" }, + { OL | OL64 | UL | UL64, "RealPlayer10GOLD/codecs" }, + { OL | OL64 | UL | UL64, "RealPlayer10/codecs" }, + { OL | OL64 | UL | UL64, "RealPlayer9/users/Real/Codecs" }, + { O | OL | UL, "RealPlayer8/Codecs" }, + {} + }; + + int i; + for (i = 0; paths[i].prefix; ++i) + { + int p; + for (p = 0; p < sizeof (prefix) / sizeof (prefix[0]); ++p) + { + if (paths[i].prefix & (1 << p)) + { + void *handle; + snprintf (default_real_codecs_path, sizeof (default_real_codecs_path), "%s/%s/drvc.so", prefix[p], paths[i].path); + handle = dlopen (default_real_codecs_path, RTLD_NOW); + if (handle) + { + dlclose (handle); + snprintf (default_real_codecs_path, sizeof (default_real_codecs_path), "%s/%s", prefix[p], paths[i].path); + goto found; + } + } + } + } + + /* if this is reached, no valid path was found */ + default_real_codecs_path[0] = 0; + + found:; + #endif real_codecs_path = -- cgit v1.2.3 From c8f3cd1faf678b64920ad62f1275b03aae0157a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Fri, 9 Nov 2007 18:11:05 +0100 Subject: Update FSF address on non-contributed code and COPYING files. For contributed code, leave whatever the version we last synced for is using to make simpler future syncs. --- src/libreal/real_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/libreal/real_common.c') diff --git a/src/libreal/real_common.c b/src/libreal/real_common.c index 9641cd4ac..88036f169 100644 --- a/src/libreal/real_common.c +++ b/src/libreal/real_common.c @@ -15,7 +15,7 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA * * $Id: real_common.c,v 1.12 2007/03/17 15:45:41 dgp85 Exp $ * -- cgit v1.2.3