aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorRobert Krüger <krueger@signal7.de>2010-04-20 17:37:06 +0000
committerRonald S. Bultje <rsbultje@gmail.com>2010-04-20 17:37:06 +0000
commit2328e5a289b1ab162450ae0a2c17619cd032aa05 (patch)
tree346821024593bfb81f5682337c16907e82bb6335 /ffmpeg.c
parentbf29cbc2cc771e544174f87c5563f85a060f93b9 (diff)
downloadffmpeg-2328e5a289b1ab162450ae0a2c17619cd032aa05.tar.gz
Allow setting the environment variable FFMPEG_DATADIR to locate preset files.
Patch by Robert Krüger <krueger signal7 de>. Originally committed as revision 22923 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index ba317c83bb..81b454f025 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -3890,19 +3890,22 @@ static int opt_preset(const char *opt, const char *arg)
FILE *f=NULL;
char filename[1000], tmp[1000], tmp2[1000], line[1000];
int i;
- const char *base[2]= { getenv("HOME"),
+ const char *base[3]= { getenv("FFMPEG_DATADIR"),
+ getenv("HOME"),
FFMPEG_DATADIR,
};
if (*opt != 'f') {
- for(i=!base[0]; i<2 && !f; i++){
- snprintf(filename, sizeof(filename), "%s%s/%s.ffpreset", base[i], i ? "" : "/.ffmpeg", arg);
+ for(i=0; i<3 && !f; i++){
+ if(!base[i])
+ continue;
+ snprintf(filename, sizeof(filename), "%s%s/%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", arg);
f= fopen(filename, "r");
if(!f){
char *codec_name= *opt == 'v' ? video_codec_name :
*opt == 'a' ? audio_codec_name :
subtitle_codec_name;
- snprintf(filename, sizeof(filename), "%s%s/%s-%s.ffpreset", base[i], i ? "" : "/.ffmpeg", codec_name, arg);
+ snprintf(filename, sizeof(filename), "%s%s/%s-%s.ffpreset", base[i], i != 1 ? "" : "/.ffmpeg", codec_name, arg);
f= fopen(filename, "r");
}
}