[FFmpeg-devel] [PATCH 1/2] ffmpeg_opt/get_preset_file_2(): de-avconv-ize
Timothy Gu
timothygu99 at gmail.com
Tue Feb 25 05:56:14 CET 2014
Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---
ffmpeg_opt.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 7bd0817..91d42e4 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -980,22 +980,34 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
{
int i, ret = -1;
char filename[1000];
- const char *base[3] = { getenv("AVCONV_DATADIR"),
+ const char *base[4] = { getenv("FFMPEG_DATADIR"),
+ getenv("AVCONV_DATADIR"),
getenv("HOME"),
- AVCONV_DATADIR,
+ FFMPEG_DATADIR,
};
for (i = 0; i < FF_ARRAY_ELEMS(base) && ret < 0; i++) {
if (!base[i])
continue;
if (codec_name) {
+ snprintf(filename, sizeof(filename), "%s%s/%s-%s.ffpreset", base[i],
+ i != 2 ? "" : "/.ffmpeg", codec_name, preset_name);
+ ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
+ }
+ if (ret < 0) {
+ snprintf(filename, sizeof(filename), "%s%s/%s.ffpreset", base[i],
+ i != 2 ? "" : "/.ffmpeg", preset_name);
+ ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
+ }
+ // FIXME: get rid of this compatibility crap
+ if (codec_name && ret < 0) {
snprintf(filename, sizeof(filename), "%s%s/%s-%s.avpreset", base[i],
- i != 1 ? "" : "/.avconv", codec_name, preset_name);
+ i != 2 ? "" : "/.avconv", codec_name, preset_name);
ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
}
if (ret < 0) {
snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
- i != 1 ? "" : "/.avconv", preset_name);
+ i != 2 ? "" : "/.avconv", preset_name);
ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
}
}
--
1.8.3.2
More information about the ffmpeg-devel
mailing list