You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	avformat: do not use AVIO_FLAG_* with avio_alloc_context
The documentation states that here 0 should be used for read-only and 1 for a writable buffer. AVIO_FLAG_WRITE however is 2, while it works due to the way the flag is handled internally, it is still wrong according to the documentation. Additionally it makes it seem as if the AVIO_FLAG_* values could be used here, which is actually not true, as when AVIO_FLAG_READ would be used here it would create a writable buffer as AVIO_FLAG_READ is defined as 1. Signed-off-by: Anton Khirnov <anton@khirnov.net>
This commit is contained in:
		
				
					committed by
					
						 Anton Khirnov
						Anton Khirnov
					
				
			
			
				
	
			
			
			
						parent
						
							a7df966c82
						
					
				
				
					commit
					c6f4e10111
				
			| @@ -368,7 +368,7 @@ static int hds_write_header(AVFormatContext *s) | ||||
|             ctx->flags = s->flags; | ||||
|  | ||||
|             ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), | ||||
|                                          AVIO_FLAG_WRITE, os, | ||||
|                                          1, os, | ||||
|                                          NULL, hds_write, NULL); | ||||
|             if (!ctx->pb) { | ||||
|                 return AVERROR(ENOMEM); | ||||
|   | ||||
| @@ -569,7 +569,7 @@ static int open_null_ctx(AVIOContext **ctx) | ||||
|     uint8_t *buf = av_malloc(buf_size); | ||||
|     if (!buf) | ||||
|         return AVERROR(ENOMEM); | ||||
|     *ctx = avio_alloc_context(buf, buf_size, AVIO_FLAG_WRITE, NULL, NULL, NULL, NULL); | ||||
|     *ctx = avio_alloc_context(buf, buf_size, 1, NULL, NULL, NULL, NULL); | ||||
|     if (!*ctx) { | ||||
|         av_free(buf); | ||||
|         return AVERROR(ENOMEM); | ||||
|   | ||||
| @@ -335,7 +335,7 @@ static int ism_write_header(AVFormatContext *s) | ||||
|         st->sample_aspect_ratio = s->streams[i]->sample_aspect_ratio; | ||||
|         st->time_base = s->streams[i]->time_base; | ||||
|  | ||||
|         ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), AVIO_FLAG_WRITE, os, NULL, ism_write, ism_seek); | ||||
|         ctx->pb = avio_alloc_context(os->iobuf, sizeof(os->iobuf), 1, os, NULL, ism_write, ism_seek); | ||||
|         if (!ctx->pb) { | ||||
|             return AVERROR(ENOMEM); | ||||
|         } | ||||
|   | ||||
| @@ -186,7 +186,7 @@ static void init_fps(int bf, int audio_preroll, int fps) | ||||
|     ctx->oformat = av_guess_format(format, NULL, NULL); | ||||
|     if (!ctx->oformat) | ||||
|         exit(1); | ||||
|     ctx->pb = avio_alloc_context(iobuf, iobuf_size, AVIO_FLAG_WRITE, NULL, NULL, io_write, NULL); | ||||
|     ctx->pb = avio_alloc_context(iobuf, iobuf_size, 1, NULL, NULL, io_write, NULL); | ||||
|     if (!ctx->pb) | ||||
|         exit(1); | ||||
|     ctx->pb->write_data_type = io_write_data_type; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user