aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2016-02-10 11:47:52 +0100
committerPaul B Mahol <onemda@gmail.com>2016-02-10 11:47:52 +0100
commit408ea50ca6bcc666babc8b8e654eb135164480af (patch)
tree9bcd0aa01b140e82217c02e8a667d5672b23b408
parent5f1aad68c4f5d3b04cd686bc61fbbcf722e31d35 (diff)
downloadffmpeg-408ea50ca6bcc666babc8b8e654eb135164480af.tar.gz
avfilter/f_metadata: fix few logic errors
Signed-off-by: Paul B Mahol <onemda@gmail.com>
-rw-r--r--doc/filters.texi4
-rw-r--r--libavfilter/f_metadata.c12
2 files changed, 8 insertions, 8 deletions
diff --git a/doc/filters.texi b/doc/filters.texi
index 56de876dca..6c5003f207 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -8501,13 +8501,13 @@ Values are interpreted as strings, returns true if @code{value} is same as metad
to N chars as set in @code{length} option.
@item less
-Values are interpreted as floats, returns true if @code{value} is less than metadata value.
+Values are interpreted as floats, returns true if metadata value is less than @code{value}.
@item equal
Values are interpreted as floats, returns true if @code{value} is equal with metadata value.
@item greater
-Values are interpreted as floats, returns true if @code{value} is greater than metadata value.
+Values are interpreted as floats, returns true if metadata value is greater than @code{value}.
@item expr
Values are interpreted as floats, returns true if expression from option @code{expr}
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 1969cb5e30..40ab6bb174 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -127,7 +127,7 @@ static int less(MetadataContext *s, const char *value1, const char *value2, size
if (sscanf(value1, "%f", &f1) + sscanf(value2, "%f", &f2) != 2)
return 0;
- return f1 > f2;
+ return f1 < f2;
}
static int greater(MetadataContext *s, const char *value1, const char *value2, size_t length)
@@ -137,7 +137,7 @@ static int greater(MetadataContext *s, const char *value1, const char *value2, s
if (sscanf(value1, "%f", &f1) + sscanf(value2, "%f", &f2) != 2)
return 0;
- return f1 < f2;
+ return f1 > f2;
}
static int parse_expr(MetadataContext *s, const char *value1, const char *value2, size_t length)
@@ -148,7 +148,7 @@ static int parse_expr(MetadataContext *s, const char *value1, const char *value2
return 0;
s->var_values[VAR_VALUE1] = f1;
- s->var_values[VAR_VALUE1] = f2;
+ s->var_values[VAR_VALUE2] = f2;
return av_expr_eval(s->expr, s->var_values, NULL);
}
@@ -223,7 +223,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
if (!s->value && e && e->value) {
return ff_filter_frame(outlink, frame);
} else if (s->value && e && e->value &&
- s->compare(s, s->value, e->value, s->length)) {
+ s->compare(s, e->value, s->value, s->length)) {
return ff_filter_frame(outlink, frame);
}
break;
@@ -248,14 +248,14 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
while ((e = av_dict_get(metadata, "", e, AV_DICT_IGNORE_SUFFIX)) != NULL) {
av_log(ctx, AV_LOG_INFO, "%s=%s\n", e->key, e->value);
}
- } else if (e && e->value && (!s->value || (e->value && s->compare(s, s->value, e->value, s->length)))) {
+ } else if (e && e->value && (!s->value || (e->value && s->compare(s, e->value, s->value, s->length)))) {
av_log(ctx, AV_LOG_INFO, "frame %"PRId64" pts %"PRId64"\n", inlink->frame_count, frame->pts);
av_log(ctx, AV_LOG_INFO, "%s=%s\n", s->key, e->value);
}
return ff_filter_frame(outlink, frame);
break;
case METADATA_DELETE:
- if (e && e->value && s->value && s->compare(s, s->value, e->value, s->length)) {
+ if (e && e->value && s->value && s->compare(s, e->value, s->value, s->length)) {
av_dict_set(&metadata, s->key, NULL, 0);
} else if (e && e->value) {
av_dict_set(&metadata, s->key, NULL, 0);