You've already forked FFmpeg
							
							
				mirror of
				https://github.com/FFmpeg/FFmpeg.git
				synced 2025-10-30 23:18:11 +02:00 
			
		
		
		
	lavfi: add avfilter_get_video_buffer_ref_from_frame to avcodec.h
Simplify passing AVFrame data to av_vsrc_buffer_add_video_buffer_ref().
This commit is contained in:
		| @@ -13,6 +13,9 @@ libavutil:   2011-04-18 | ||||
|  | ||||
| API changes, most recent first: | ||||
|  | ||||
| 2011-05-XX - XXXXXX - lavfi 2.6.0 - avcodec.h | ||||
|   Add avfilter_get_video_buffer_ref_from_frame() to libavfilter/avcodec.h. | ||||
|  | ||||
| 2011-05-18 - 64150ff - lavc 53.4.0 - AVCodecContext.request_sample_fmt | ||||
|   Add request_sample_fmt field to AVCodecContext. | ||||
|  | ||||
|   | ||||
							
								
								
									
										8
									
								
								ffmpeg.c
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								ffmpeg.c
									
									
									
									
									
								
							| @@ -1650,11 +1650,9 @@ static int output_packet(AVInputStream *ist, int ist_index, | ||||
|                         picture.sample_aspect_ratio = ist->st->sample_aspect_ratio; | ||||
|                     picture.pts = ist->pts; | ||||
|  | ||||
|                     picref = avfilter_get_video_buffer_ref_from_arrays( | ||||
|                         picture.data, picture.linesize, AV_PERM_WRITE, | ||||
|                         picture.width, picture.height, picture.format); | ||||
|                     avfilter_copy_frame_props(picref, &picture); | ||||
|                     av_vsrc_buffer_add_video_buffer_ref2(ost->input_video_filter, picref, ""); //TODO user setable params | ||||
|                     picref = | ||||
|                         avfilter_get_video_buffer_ref_from_frame(&picture, AV_PERM_WRITE); | ||||
|                     av_vsrc_buffer_add_video_buffer_ref(ost->input_video_filter, picref, ""); //TODO user setable params | ||||
|                     picref->buf->data[0] = NULL; | ||||
|                     avfilter_unref_buffer(picref); | ||||
|                 } | ||||
|   | ||||
| @@ -40,3 +40,16 @@ void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src) | ||||
|         dst->video->pict_type           = src->pict_type; | ||||
|     } | ||||
| } | ||||
|  | ||||
| AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, | ||||
|                                                             int perms) | ||||
| { | ||||
|     AVFilterBufferRef *picref = | ||||
|         avfilter_get_video_buffer_ref_from_arrays(frame->data, frame->linesize, perms, | ||||
|                                                   frame->width, frame->height, | ||||
|                                                   frame->format); | ||||
|     if (!picref) | ||||
|         return NULL; | ||||
|     avfilter_copy_frame_props(picref, frame); | ||||
|     return picref; | ||||
| } | ||||
|   | ||||
| @@ -37,4 +37,12 @@ | ||||
|  */ | ||||
| void avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src); | ||||
|  | ||||
| /** | ||||
|  * Create and return a picref reference from the data and properties | ||||
|  * contained in frame. | ||||
|  * | ||||
|  * @param perms permissions to assign to the new buffer reference | ||||
|  */ | ||||
| AVFilterBufferRef *avfilter_get_video_buffer_ref_from_frame(const AVFrame *frame, int perms); | ||||
|  | ||||
| #endif /* AVFILTER_AVCODEC_H */ | ||||
|   | ||||
| @@ -26,7 +26,7 @@ | ||||
| #include "libavutil/samplefmt.h" | ||||
|  | ||||
| #define LIBAVFILTER_VERSION_MAJOR  2 | ||||
| #define LIBAVFILTER_VERSION_MINOR  5 | ||||
| #define LIBAVFILTER_VERSION_MINOR  6 | ||||
| #define LIBAVFILTER_VERSION_MICRO  0 | ||||
|  | ||||
| #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user