diff mbox series

[FFmpeg-devel] avfilter/metadata: add intuitive labels for metadata values

Message ID 20210514102331.1818-1-ffmpeg@gyani.pro
State Accepted
Commit f53414a0382701b9bc984f657939d4227c7c568a
Headers show
Series [FFmpeg-devel] avfilter/metadata: add intuitive labels for metadata values | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Gyan Doshi May 14, 2021, 10:23 a.m. UTC
---
 doc/filters.texi         | 4 ++--
 libavfilter/f_metadata.c | 8 ++++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

Comments

Gyan Doshi May 15, 2021, 7:03 a.m. UTC | #1
Plan to push tonight.

On 2021-05-14 15:53, Gyan Doshi wrote:
> ---
>   doc/filters.texi         | 4 ++--
>   libavfilter/f_metadata.c | 8 ++++++--
>   2 files changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/doc/filters.texi b/doc/filters.texi
> index ed0ffe91fc..1a8843fe4f 100644
> --- a/doc/filters.texi
> +++ b/doc/filters.texi
> @@ -25296,10 +25296,10 @@ The expression is evaluated through the eval API and can contain the following
>   constants:
>   
>   @table @option
> -@item VALUE1
> +@item VALUE1, FRAMEVAL
>   Float representation of @code{value} from metadata key.
>   
> -@item VALUE2
> +@item VALUE2, USERVAL
>   Float representation of @code{value} as supplied by user in @code{value} option.
>   @end table
>   
> diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
> index 5fec7c3c56..e7c7b00118 100644
> --- a/libavfilter/f_metadata.c
> +++ b/libavfilter/f_metadata.c
> @@ -61,12 +61,16 @@ enum MetadataFunction {
>   static const char *const var_names[] = {
>       "VALUE1",
>       "VALUE2",
> +    "FRAMEVAL",
> +    "USERVAL",
>       NULL
>   };
>   
>   enum var_name {
>       VAR_VALUE1,
>       VAR_VALUE2,
> +    VAR_FRAMEVAL,
> +    VAR_USERVAL,
>       VAR_VARS_NB
>   };
>   
> @@ -172,8 +176,8 @@ static int parse_expr(MetadataContext *s, const char *value1, const char *value2
>       if (sscanf(value1, "%lf", &f1) + sscanf(value2, "%lf", &f2) != 2)
>           return 0;
>   
> -    s->var_values[VAR_VALUE1] = f1;
> -    s->var_values[VAR_VALUE2] = f2;
> +    s->var_values[VAR_VALUE1] = s->var_values[VAR_FRAMEVAL] = f1;
> +    s->var_values[VAR_VALUE2] = s->var_values[VAR_USERVAL]  = f2;
>   
>       return av_expr_eval(s->expr, s->var_values, NULL);
>   }
Gyan Doshi May 16, 2021, 4:55 a.m. UTC | #2
Pushed as f53414a0382701b9bc984f657939d4227c7c568a

On 2021-05-15 12:33, Gyan Doshi wrote:
> Plan to push tonight.
>
> On 2021-05-14 15:53, Gyan Doshi wrote:
>> ---
>>   doc/filters.texi         | 4 ++--
>>   libavfilter/f_metadata.c | 8 ++++++--
>>   2 files changed, 8 insertions(+), 4 deletions(-)
>>
>> diff --git a/doc/filters.texi b/doc/filters.texi
>> index ed0ffe91fc..1a8843fe4f 100644
>> --- a/doc/filters.texi
>> +++ b/doc/filters.texi
>> @@ -25296,10 +25296,10 @@ The expression is evaluated through the 
>> eval API and can contain the following
>>   constants:
>>     @table @option
>> -@item VALUE1
>> +@item VALUE1, FRAMEVAL
>>   Float representation of @code{value} from metadata key.
>>   -@item VALUE2
>> +@item VALUE2, USERVAL
>>   Float representation of @code{value} as supplied by user in 
>> @code{value} option.
>>   @end table
>>   diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
>> index 5fec7c3c56..e7c7b00118 100644
>> --- a/libavfilter/f_metadata.c
>> +++ b/libavfilter/f_metadata.c
>> @@ -61,12 +61,16 @@ enum MetadataFunction {
>>   static const char *const var_names[] = {
>>       "VALUE1",
>>       "VALUE2",
>> +    "FRAMEVAL",
>> +    "USERVAL",
>>       NULL
>>   };
>>     enum var_name {
>>       VAR_VALUE1,
>>       VAR_VALUE2,
>> +    VAR_FRAMEVAL,
>> +    VAR_USERVAL,
>>       VAR_VARS_NB
>>   };
>>   @@ -172,8 +176,8 @@ static int parse_expr(MetadataContext *s, const 
>> char *value1, const char *value2
>>       if (sscanf(value1, "%lf", &f1) + sscanf(value2, "%lf", &f2) != 2)
>>           return 0;
>>   -    s->var_values[VAR_VALUE1] = f1;
>> -    s->var_values[VAR_VALUE2] = f2;
>> +    s->var_values[VAR_VALUE1] = s->var_values[VAR_FRAMEVAL] = f1;
>> +    s->var_values[VAR_VALUE2] = s->var_values[VAR_USERVAL]  = f2;
>>         return av_expr_eval(s->expr, s->var_values, NULL);
>>   }
>
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>
> To unsubscribe, visit link above, or email
> ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".
diff mbox series

Patch

diff --git a/doc/filters.texi b/doc/filters.texi
index ed0ffe91fc..1a8843fe4f 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -25296,10 +25296,10 @@  The expression is evaluated through the eval API and can contain the following
 constants:
 
 @table @option
-@item VALUE1
+@item VALUE1, FRAMEVAL
 Float representation of @code{value} from metadata key.
 
-@item VALUE2
+@item VALUE2, USERVAL
 Float representation of @code{value} as supplied by user in @code{value} option.
 @end table
 
diff --git a/libavfilter/f_metadata.c b/libavfilter/f_metadata.c
index 5fec7c3c56..e7c7b00118 100644
--- a/libavfilter/f_metadata.c
+++ b/libavfilter/f_metadata.c
@@ -61,12 +61,16 @@  enum MetadataFunction {
 static const char *const var_names[] = {
     "VALUE1",
     "VALUE2",
+    "FRAMEVAL",
+    "USERVAL",
     NULL
 };
 
 enum var_name {
     VAR_VALUE1,
     VAR_VALUE2,
+    VAR_FRAMEVAL,
+    VAR_USERVAL,
     VAR_VARS_NB
 };
 
@@ -172,8 +176,8 @@  static int parse_expr(MetadataContext *s, const char *value1, const char *value2
     if (sscanf(value1, "%lf", &f1) + sscanf(value2, "%lf", &f2) != 2)
         return 0;
 
-    s->var_values[VAR_VALUE1] = f1;
-    s->var_values[VAR_VALUE2] = f2;
+    s->var_values[VAR_VALUE1] = s->var_values[VAR_FRAMEVAL] = f1;
+    s->var_values[VAR_VALUE2] = s->var_values[VAR_USERVAL]  = f2;
 
     return av_expr_eval(s->expr, s->var_values, NULL);
 }