aboutsummaryrefslogtreecommitdiffstats
path: root/ffmpeg_opt.c
diff options
context:
space:
mode:
authorTimothy Gu <timothygu99@gmail.com>2014-02-24 02:19:55 +0000
committerMichael Niedermayer <michaelni@gmx.at>2014-02-25 00:05:37 +0100
commit774239be717150909219ad2c0696bfb6a50cf2cb (patch)
tree4161edcb8f6290850481093dfe76d1e1ae97dacf /ffmpeg_opt.c
parent75f6ed8dc2321d34a0c0b3b9ec7705e7ce7dc0ea (diff)
downloadffmpeg-774239be717150909219ad2c0696bfb6a50cf2cb.tar.gz
ffmpeg_opt: get_preset_file_2(): fix avio_open2() return code check
avio_open2() only return < 0 when error. Signed-off-by: Timothy Gu <timothygu99@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg_opt.c')
-rw-r--r--ffmpeg_opt.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 7b4630fb25..7bd0817c29 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -978,14 +978,14 @@ static uint8_t *get_line(AVIOContext *s)
static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s)
{
- int i, ret = 1;
+ int i, ret = -1;
char filename[1000];
const char *base[3] = { getenv("AVCONV_DATADIR"),
getenv("HOME"),
AVCONV_DATADIR,
};
- for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) {
+ for (i = 0; i < FF_ARRAY_ELEMS(base) && ret < 0; i++) {
if (!base[i])
continue;
if (codec_name) {
@@ -993,7 +993,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV
i != 1 ? "" : "/.avconv", codec_name, preset_name);
ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);
}
- if (ret) {
+ if (ret < 0) {
snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i],
i != 1 ? "" : "/.avconv", preset_name);
ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL);