[FFmpeg-devel] [PATCH 2/3] ffmpeg_opt/get_preset_file_2(): de-avconv-ize
Timothy Gu
timothygu99 at gmail.com
Sat Feb 22 22:50:38 CET 2014
Signed-off-by: Timothy Gu <timothygu99 at gmail.com>
---
Unrelated:
Currently the -pre and the -{v,a,s,d}pre options have separate
code to make them work. It looks like the latter is a bit more modern.
I assume this is another example of forkiness.
I didn't test whether these two options are compatible, but if they are
option -pre should be mapped like the latter.
ffmpeg_opt.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ac48d59..a5670ab 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -979,22 +979,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