You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	ffmpeg_opt: get_preset_file_2(): fix avio_open2() return code check
avio_open2() only return < 0 when error. Signed-off-by: Timothy Gu <timothygu99@gmail.com> Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
		
				
					committed by
					
						 Michael Niedermayer
						Michael Niedermayer
					
				
			
			
				
	
			
			
			
						parent
						
							75f6ed8dc2
						
					
				
				
					commit
					774239be71
				
			| @@ -978,14 +978,14 @@ static uint8_t *get_line(AVIOContext *s) | ||||
|  | ||||
| static int get_preset_file_2(const char *preset_name, const char *codec_name, AVIOContext **s) | ||||
| { | ||||
|     int i, ret = 1; | ||||
|     int i, ret = -1; | ||||
|     char filename[1000]; | ||||
|     const char *base[3] = { getenv("AVCONV_DATADIR"), | ||||
|                             getenv("HOME"), | ||||
|                             AVCONV_DATADIR, | ||||
|                             }; | ||||
|  | ||||
|     for (i = 0; i < FF_ARRAY_ELEMS(base) && ret; i++) { | ||||
|     for (i = 0; i < FF_ARRAY_ELEMS(base) && ret < 0; i++) { | ||||
|         if (!base[i]) | ||||
|             continue; | ||||
|         if (codec_name) { | ||||
| @@ -993,7 +993,7 @@ static int get_preset_file_2(const char *preset_name, const char *codec_name, AV | ||||
|                      i != 1 ? "" : "/.avconv", codec_name, preset_name); | ||||
|             ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); | ||||
|         } | ||||
|         if (ret) { | ||||
|         if (ret < 0) { | ||||
|             snprintf(filename, sizeof(filename), "%s%s/%s.avpreset", base[i], | ||||
|                      i != 1 ? "" : "/.avconv", preset_name); | ||||
|             ret = avio_open2(s, filename, AVIO_FLAG_READ, &int_cb, NULL); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user