From 7882ea9badf366fbb6f06b17ea6321c54c7c8466 Mon Sep 17 00:00:00 2001 From: arpi Date: Fri, 20 Jul 2001 00:01:09 +0000 Subject: [PATCH] Applied DATADIR patch by Vladimir Kushnir git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@1354 b3059339-0415-0410-9bf9-f77b7e298cf2 --- configure | 10 ++++++++++ libvo/font_load.c | 39 +++++++++++++++++++-------------------- libvo/font_load.h | 1 + mplayer.c | 6 +++++- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/configure b/configure index 850ec83e4d..fc45f95a7e 100755 --- a/configure +++ b/configure @@ -116,6 +116,8 @@ usage: $0 [options] params: --cc use this C compiler to build MPlayer [gcc] --prefix=DIR use this prefix for installing mplayer [/usr/local] + --datadir=DIR use this prefix for installing machine independent + data [/usr/local/share/mplayer] --enable-debug[=1-3] compile debugging information into mplayer [disable] --enable-profile compile profiling information into mplayer [disable] --enable-mmx build with mmx support [autodetect] @@ -915,6 +917,7 @@ $_cc $_extraincdir $_extralibdir -o $TMPO -lesd $TMPC 2> /dev/null || { _esd=no; # check for the parameters. _prefix="/usr/local" +_datadir=$_prefix"/share/mplayer" for ac_option do @@ -1141,6 +1144,9 @@ do --prefix=*) _prefix=`echo $ac_option | cut -d '=' -f 2` ;; + --datadir=*) + _datadir=`echo $ac_option | cut -d '=' -f 2` + ;; --cc=*) ;; --as=*) @@ -1249,6 +1255,7 @@ fi # to screen. echo "Install prefix: $_prefix" +echo "Data directory: $_datadir" if [ "$host_arch" = i386 ]; then echo "Checking for cpu vendor ... $pvendor ( $pfamily:$pmodel:$pstepping )" echo "Checking for cpu type ... $pname" @@ -1722,6 +1729,9 @@ cat > $CCONF << EOF /* -------- Generated by ./configure ----------- */ +/* Common data directory (for fonts, etc) */ +#define DATADIR "$_datadir" + /* Define for using new DivX4Linux library, instead of open-source OpenDivX */ /* You have to change DECORE_LIBS in config.mak too! */ #undef NEW_DECORE diff --git a/libvo/font_load.c b/libvo/font_load.c index 466882ec71..ed7463d945 100644 --- a/libvo/font_load.c +++ b/libvo/font_load.c @@ -110,41 +110,40 @@ while(fgets(sor,1020,f)){ } } + if(strcmp(section,"[fpath]")==0){ + if(pdb==1){ + desc->fpath=strdup(p[0]); + continue; + } + } else + if(strcmp(section,"[files]")==0){ if(pdb==2 && strcmp(p[0],"alpha")==0){ - char *cp,*cp2; - if (!(cp=get_path("font/"))) return NULL; - if (!(cp2=malloc(strlen(cp)+strlen(p[1])+1))) { - free(cp); - return NULL; - } - sprintf(cp2,"%s%s",cp,p[1]); - if(!((desc->pic_a[fontdb]=load_raw(cp2,verbose)))){ + char *cp; + if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) return NULL; + + snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", + desc->fpath,p[1]); + if(!((desc->pic_a[fontdb]=load_raw(cp,verbose)))){ printf("Can't load font bitmap: %s\n",p[1]); free(cp); - free(cp2); return NULL; } free(cp); - free(cp2); continue; } if(pdb==2 && strcmp(p[0],"bitmap")==0){ - char *cp,*cp2; - if (!(cp=get_path("font/"))) return NULL; - if (!(cp2=malloc(strlen(cp)+strlen(p[1])+1))) { - free(cp); - return NULL; - } - sprintf(cp2,"%s%s",cp,p[1]); - if(!((desc->pic_b[fontdb]=load_raw(cp2,verbose)))){ + char *cp; + if (!(cp=malloc(strlen(desc->fpath)+strlen(p[1])+2))) return NULL; + + snprintf(cp,strlen(desc->fpath)+strlen(p[1])+2,"%s/%s", + desc->fpath,p[1]); + if(!((desc->pic_b[fontdb]=load_raw(cp,verbose)))){ printf("Can't load font bitmap: %s\n",p[1]); free(cp); - free(cp2); return NULL; } free(cp); - free(cp2); continue; } } else diff --git a/libvo/font_load.h b/libvo/font_load.h index 1b425ffc1e..ea98b46ca9 100644 --- a/libvo/font_load.h +++ b/libvo/font_load.h @@ -7,6 +7,7 @@ typedef struct { typedef struct { char *name; + char *fpath; int spacewidth; int charspace; int height; diff --git a/mplayer.c b/mplayer.c index 396c05196f..b4390f64dc 100644 --- a/mplayer.c +++ b/mplayer.c @@ -568,9 +568,11 @@ if(!filename){ // check codec.conf if(!parse_codec_cfg(get_path("codecs.conf"))){ - fprintf(stderr,"(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n"); + if(!parse_codec_cfg(DATADIR"/codecs.conf")){ + printf("(copy/link DOCS/codecs.conf to ~/.mplayer/codecs.conf)\n"); GUI_MSG( mplCodecConfNotFound ) exit(1); + } } // check font @@ -580,6 +582,8 @@ if(!parse_codec_cfg(get_path("codecs.conf"))){ } else { // try default: vo_font=read_font_desc(get_path("font/font.desc"),font_factor,verbose>1); + if(!vo_font) + vo_font=read_font_desc(DATADIR"/font/font.desc",font_factor,verbose>1); } // check .sub