| 
				
				
					
				
				
				 | 
			
			 | 
			@@ -23,6 +23,7 @@ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "parseutils.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/avutil.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			#include "libavutil/eval.h" | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			typedef struct { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    const char *abbr; | 
		
		
	
	
		
			
				| 
				
					
				
				
					
				
				
				 | 
			
			 | 
			@@ -115,9 +116,9 @@ int av_parse_video_size(int *width_ptr, int *height_ptr, const char *str) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			int av_parse_video_rate(AVRational *rate, const char *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			{ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int i; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int i, ret; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    int n = FF_ARRAY_ELEMS(video_rate_abbrs); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    char *cp; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    double res; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    /* First, we check our abbreviation table */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    for (i = 0; i < n; ++i) | 
		
		
	
	
		
			
				| 
				
				
				
					
				
				 | 
			
			 | 
			@@ -127,20 +128,10 @@ int av_parse_video_rate(AVRational *rate, const char *arg) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			
  | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    /* Then, we try to parse it as fraction */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    cp = strchr(arg, '/'); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (!cp) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        cp = strchr(arg, ':'); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (cp) { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        char *cpp; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        rate->num = strtol(arg, &cpp, 10); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        if (cpp != arg || cpp == cp) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            rate->den = strtol(cp+1, &cpp, 10); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        else | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			            rate->num = 0; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } else { | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        /* Finally we give up and parse it as double */ | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        *rate = av_d2q(strtod(arg, 0), 1001000); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    } | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if ((ret = av_parse_and_eval_expr(&res, arg, NULL, NULL, NULL, NULL, NULL, NULL, | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			                                      NULL, 0, NULL)) < 0) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        return ret; | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    *rate = av_d2q(res, 1001000); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    if (rate->num <= 0 || rate->den <= 0) | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			        return AVERROR(EINVAL); | 
		
		
	
		
			
			 | 
			 | 
			
			 | 
			    return 0; | 
		
		
	
	
		
			
				| 
				
				
				
				 | 
			
			 | 
			
  |