Re: [FFmpeg-devel] [PATCH] avutil/opt: only skip evaluation for rational options

2020-05-01 Thread Marton Balint



On Wed, 29 Apr 2020, Marton Balint wrote:




On Sat, 18 Apr 2020, Marton Balint wrote:

Fixes problems when non-rational options were set using rational 

expressions,

causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint 
---
libavutil/opt.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index bf2562737b..b792dec01c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -229,13 +229,15 @@ static int set_string(void *obj, const AVOption *o, 

const char *val, uint8_t **d
static int set_string_number(void *obj, void *target_obj, const AVOption 

*o, const char *val, void *dst)

{
int ret = 0;
-int num, den;
-char c;

-if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
-if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
-return ret;
-ret = 0;
+if (o->type == AV_OPT_TYPE_RATIONAL || o->type == 

AV_OPT_TYPE_VIDEO_RATE) {

+int num, den;
+char c;
+if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
+if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
+return ret;
+ret = 0;
+}
}


Ping, will apply soon.


Applied.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

Re: [FFmpeg-devel] [PATCH] avutil/opt: only skip evaluation for rational options

2020-04-29 Thread Marton Balint



On Sat, 18 Apr 2020, Marton Balint wrote:


Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint 
---
libavutil/opt.c | 14 --
1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index bf2562737b..b792dec01c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -229,13 +229,15 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
static int set_string_number(void *obj, void *target_obj, const AVOption *o, 
const char *val, void *dst)
{
int ret = 0;
-int num, den;
-char c;

-if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
-if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
-return ret;
-ret = 0;
+if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
+int num, den;
+char c;
+if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
+if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
+return ret;
+ret = 0;
+}
}


Ping, will apply soon.

Regards,
Marton
___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".

[FFmpeg-devel] [PATCH] avutil/opt: only skip evaluation for rational options

2020-04-18 Thread Marton Balint
Fixes problems when non-rational options were set using rational expressions,
causing rounding errors and the option range limits not to be enforced
properly.

ffmpeg -f lavfi -i "sine=r=96000/2"

This caused an assertion failure with assert level 2.

Signed-off-by: Marton Balint 
---
 libavutil/opt.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/libavutil/opt.c b/libavutil/opt.c
index bf2562737b..b792dec01c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -229,13 +229,15 @@ static int set_string(void *obj, const AVOption *o, const 
char *val, uint8_t **d
 static int set_string_number(void *obj, void *target_obj, const AVOption *o, 
const char *val, void *dst)
 {
 int ret = 0;
-int num, den;
-char c;
 
-if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
-if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
-return ret;
-ret = 0;
+if (o->type == AV_OPT_TYPE_RATIONAL || o->type == AV_OPT_TYPE_VIDEO_RATE) {
+int num, den;
+char c;
+if (sscanf(val, "%d%*1[:/]%d%c", , , ) == 2) {
+if ((ret = write_number(obj, o, dst, 1, den, num)) >= 0)
+return ret;
+ret = 0;
+}
 }
 
 for (;;) {
-- 
2.16.4

___
ffmpeg-devel mailing list
ffmpeg-devel@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-devel

To unsubscribe, visit link above, or email
ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".