You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	lavu/parseutils: rework rational reduction logic in av_parse_ratio()
Avoid to divide num and den by gcd in case of a parsed expression, since that is already done in av_d2q(), and force reduction in case of "a:b" form, allowing to honour the max parameter. The latter change is consistent with the a/b case, and with the documentation.
This commit is contained in:
		| @@ -57,12 +57,8 @@ int av_parse_ratio(AVRational *q, const char *str, int max, | ||||
|         if (ret < 0) | ||||
|             return ret; | ||||
|         *q = av_d2q(d, max); | ||||
|     } | ||||
|  | ||||
|     gcd = av_gcd(FFABS(q->num), FFABS(q->den)); | ||||
|     if (gcd) { | ||||
|         q->num /= gcd; | ||||
|         q->den /= gcd; | ||||
|     } else { | ||||
|         av_reduce(&q->num, &q->den, q->num, q->den, max); | ||||
|     } | ||||
|  | ||||
|     return 0; | ||||
|   | ||||
| @@ -76,7 +76,7 @@ | ||||
|  | ||||
| #define LIBAVUTIL_VERSION_MAJOR 51 | ||||
| #define LIBAVUTIL_VERSION_MINOR 76 | ||||
| #define LIBAVUTIL_VERSION_MICRO 100 | ||||
| #define LIBAVUTIL_VERSION_MICRO 101 | ||||
|  | ||||
| #define LIBAVUTIL_VERSION_INT   AV_VERSION_INT(LIBAVUTIL_VERSION_MAJOR, \ | ||||
|                                                LIBAVUTIL_VERSION_MINOR, \ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user