mirror of
				https://git.ffmpeg.org/ffmpeg.git
				synced 2025-10-30 23:30:55 +00:00 
			
		
		
		
	Rename functions and fields:
avfilter_(un)ref_pic -> avfilter_(un)ref_buffer avfilter_copy_picref_props -> avfilter_copy_buffer_ref_props AVFilterBufferRef.pic -> AVFilterBufferRef.buffer They have been renamed to allow sharing with audio. Patch by S.N. Hemanth Meenakshisundaram $smeenaks$ucsd$edu$. Originally committed as revision 24731 to svn://svn.ffmpeg.org/ffmpeg/trunk
This commit is contained in:
		
							parent
							
								
									ecc8dada37
								
							
						
					
					
						commit
						7fce481a69
					
				
					 11 changed files with 49 additions and 49 deletions
				
			
		
							
								
								
									
										2
									
								
								ffmpeg.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								ffmpeg.c
									
										
									
									
									
								
							|  | @ -1777,7 +1777,7 @@ static int output_packet(AVInputStream *ist, int ist_index, | |||
|             frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) && | ||||
|                               ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]); | ||||
|             if(ist->picref) | ||||
|                 avfilter_unref_pic(ist->picref); | ||||
|                 avfilter_unref_buffer(ist->picref); | ||||
|         } | ||||
| #endif | ||||
|         av_free(buffer_to_free); | ||||
|  |  | |||
							
								
								
									
										10
									
								
								ffplay.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								ffplay.c
									
										
									
									
									
								
							|  | @ -1304,7 +1304,7 @@ static void alloc_picture(void *opaque) | |||
| 
 | ||||
| #if CONFIG_AVFILTER | ||||
|     if (vp->picref) | ||||
|         avfilter_unref_pic(vp->picref); | ||||
|         avfilter_unref_buffer(vp->picref); | ||||
|     vp->picref = NULL; | ||||
| 
 | ||||
|     vp->width   = is->out_video_filter->inputs[0]->w; | ||||
|  | @ -1389,7 +1389,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts, int64_t | |||
|         AVPicture pict; | ||||
| #if CONFIG_AVFILTER | ||||
|         if(vp->picref) | ||||
|             avfilter_unref_pic(vp->picref); | ||||
|             avfilter_unref_buffer(vp->picref); | ||||
|         vp->picref = src_frame->opaque; | ||||
| #endif | ||||
| 
 | ||||
|  | @ -1604,7 +1604,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) | |||
| static void input_release_buffer(AVCodecContext *codec, AVFrame *pic) | ||||
| { | ||||
|     memset(pic->data, 0, sizeof(pic->data)); | ||||
|     avfilter_unref_pic(pic->opaque); | ||||
|     avfilter_unref_buffer(pic->opaque); | ||||
| } | ||||
| 
 | ||||
| static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic) | ||||
|  | @ -1667,7 +1667,7 @@ static int input_request_frame(AVFilterLink *link) | |||
|         return -1; | ||||
| 
 | ||||
|     if(priv->use_dr1) { | ||||
|         picref = avfilter_ref_pic(priv->frame->opaque, ~0); | ||||
|         picref = avfilter_ref_buffer(priv->frame->opaque, ~0); | ||||
|     } else { | ||||
|         picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h); | ||||
|         av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame, | ||||
|  | @ -2672,7 +2672,7 @@ static void stream_close(VideoState *is) | |||
|         vp = &is->pictq[i]; | ||||
| #if CONFIG_AVFILTER | ||||
|         if (vp->picref) { | ||||
|             avfilter_unref_pic(vp->picref); | ||||
|             avfilter_unref_buffer(vp->picref); | ||||
|             vp->picref = NULL; | ||||
|         } | ||||
| #endif | ||||
|  |  | |||
|  | @ -45,19 +45,19 @@ const char *avfilter_license(void) | |||
| #define link_dpad(link)     link->dst-> input_pads[link->dstpad] | ||||
| #define link_spad(link)     link->src->output_pads[link->srcpad] | ||||
| 
 | ||||
| AVFilterBufferRef *avfilter_ref_pic(AVFilterBufferRef *ref, int pmask) | ||||
| AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) | ||||
| { | ||||
|     AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef)); | ||||
|     *ret = *ref; | ||||
|     ret->perms &= pmask; | ||||
|     ret->pic->refcount ++; | ||||
|     ret->buf->refcount ++; | ||||
|     return ret; | ||||
| } | ||||
| 
 | ||||
| void avfilter_unref_pic(AVFilterBufferRef *ref) | ||||
| void avfilter_unref_buffer(AVFilterBufferRef *ref) | ||||
| { | ||||
|     if(!(--ref->pic->refcount)) | ||||
|         ref->pic->free(ref->pic); | ||||
|     if(!(--ref->buf->refcount)) | ||||
|         ref->buf->free(ref->buf); | ||||
|     av_free(ref); | ||||
| } | ||||
| 
 | ||||
|  | @ -264,7 +264,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||
| 
 | ||||
|         link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h); | ||||
|         link->srcpic = picref; | ||||
|         avfilter_copy_picref_props(link->cur_pic, link->srcpic); | ||||
|         avfilter_copy_buffer_ref_props(link->cur_pic, link->srcpic); | ||||
|     } | ||||
|     else | ||||
|         link->cur_pic = picref; | ||||
|  | @ -284,7 +284,7 @@ void avfilter_end_frame(AVFilterLink *link) | |||
|     /* unreference the source picture if we're feeding the destination filter
 | ||||
|      * a copied version dues to permission issues */ | ||||
|     if(link->srcpic) { | ||||
|         avfilter_unref_pic(link->srcpic); | ||||
|         avfilter_unref_buffer(link->srcpic); | ||||
|         link->srcpic = NULL; | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
|  | @ -25,7 +25,7 @@ | |||
| #include "libavutil/avutil.h" | ||||
| 
 | ||||
| #define LIBAVFILTER_VERSION_MAJOR  1 | ||||
| #define LIBAVFILTER_VERSION_MINOR 29 | ||||
| #define LIBAVFILTER_VERSION_MINOR 30 | ||||
| #define LIBAVFILTER_VERSION_MICRO  0 | ||||
| 
 | ||||
| #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ | ||||
|  | @ -90,7 +90,7 @@ typedef struct AVFilterBuffer | |||
| 
 | ||||
| /**
 | ||||
|  * A reference to an AVFilterBuffer. Since filters can manipulate the origin of | ||||
|  * a picture to, for example, crop image without any memcpy, the picture origin | ||||
|  * a buffer to, for example, crop image without any memcpy, the buffer origin | ||||
|  * and dimensions are per-reference properties. Linesize is also useful for | ||||
|  * image flipping, frame to field filters, etc, and so is also per-reference. | ||||
|  * | ||||
|  | @ -98,7 +98,7 @@ typedef struct AVFilterBuffer | |||
|  */ | ||||
| typedef struct AVFilterBufferRef | ||||
| { | ||||
|     AVFilterBuffer *pic;        ///< the picture that this is a reference to
 | ||||
|     AVFilterBuffer *buf;        ///< the buffer that this is a reference to
 | ||||
|     uint8_t *data[4];           ///< picture data for each plane
 | ||||
|     int linesize[4];            ///< number of bytes per line
 | ||||
|     int w;                      ///< image width
 | ||||
|  | @ -120,7 +120,7 @@ typedef struct AVFilterBufferRef | |||
|  * Copy properties of src to dst, without copying the actual video | ||||
|  * data. | ||||
|  */ | ||||
| static inline void avfilter_copy_picref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | ||||
| static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src) | ||||
| { | ||||
|     dst->pts             = src->pts; | ||||
|     dst->pos             = src->pos; | ||||
|  | @ -132,21 +132,21 @@ static inline void avfilter_copy_picref_props(AVFilterBufferRef *dst, AVFilterBu | |||
| } | ||||
| 
 | ||||
| /**
 | ||||
|  * Add a new reference to a picture. | ||||
|  * @param ref   an existing reference to the picture | ||||
|  * Add a new reference to a buffer. | ||||
|  * @param ref   an existing reference to the buffer | ||||
|  * @param pmask a bitmask containing the allowable permissions in the new | ||||
|  *              reference | ||||
|  * @return      a new reference to the picture with the same properties as the | ||||
|  * @return      a new reference to the buffer with the same properties as the | ||||
|  *              old, excluding any permissions denied by pmask | ||||
|  */ | ||||
| AVFilterBufferRef *avfilter_ref_pic(AVFilterBufferRef *ref, int pmask); | ||||
| AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask); | ||||
| 
 | ||||
| /**
 | ||||
|  * Remove a reference to a picture. If this is the last reference to the | ||||
|  * picture, the picture itself is also automatically freed. | ||||
|  * @param ref reference to the picture | ||||
|  * Remove a reference to a buffer. If this is the last reference to the | ||||
|  * buffer, the buffer itself is also automatically freed. | ||||
|  * @param ref reference to the buffer | ||||
|  */ | ||||
| void avfilter_unref_pic(AVFilterBufferRef *ref); | ||||
| void avfilter_unref_buffer(AVFilterBufferRef *ref); | ||||
| 
 | ||||
| /**
 | ||||
|  * A list of supported formats for one end of a filter link. This is used | ||||
|  | @ -442,7 +442,7 @@ typedef struct AVFilter | |||
| 
 | ||||
|     /**
 | ||||
|      * Filter uninitialization function. Should deallocate any memory held | ||||
|      * by the filter, release any picture references, etc. This does not need | ||||
|      * by the filter, release any buffer references, etc. This does not need | ||||
|      * to deallocate the AVFilterContext->priv memory itself. | ||||
|      */ | ||||
|     void (*uninit)(AVFilterContext *ctx); | ||||
|  | @ -524,9 +524,9 @@ struct AVFilterLink | |||
|     AVFilterFormats *out_formats; | ||||
| 
 | ||||
|     /**
 | ||||
|      * The picture reference currently being sent across the link by the source | ||||
|      * The buffer reference currently being sent across the link by the source | ||||
|      * filter. This is used internally by the filter system to allow | ||||
|      * automatic copying of pictures which do not have sufficient permissions | ||||
|      * automatic copying of buffers which do not have sufficient permissions | ||||
|      * for the destination. This should not be accessed directly by the | ||||
|      * filters. | ||||
|      */ | ||||
|  | @ -556,13 +556,13 @@ int avfilter_config_links(AVFilterContext *filter); | |||
| 
 | ||||
| /**
 | ||||
|  * Request a picture buffer with a specific set of permissions. | ||||
|  * @param link  the output link to the filter from which the picture will | ||||
|  * @param link  the output link to the filter from which the buffer will | ||||
|  *              be requested | ||||
|  * @param perms the required access permissions | ||||
|  * @param w     the minimum width of the buffer to allocate | ||||
|  * @param h     the minimum height of the buffer to allocate | ||||
|  * @return      A reference to the picture. This must be unreferenced with | ||||
|  *              avfilter_unref_pic when you are finished with it. | ||||
|  * @return      A reference to the buffer. This must be unreferenced with | ||||
|  *              avfilter_unref_buffer when you are finished with it. | ||||
|  */ | ||||
| AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, | ||||
|                                           int w, int h); | ||||
|  |  | |||
|  | @ -39,7 +39,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per | |||
|     int i, tempsize; | ||||
|     char *buf; | ||||
| 
 | ||||
|     ref->pic   = pic; | ||||
|     ref->buf   = pic; | ||||
|     ref->w     = w; | ||||
|     ref->h     = h; | ||||
| 
 | ||||
|  | @ -74,8 +74,8 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||
| 
 | ||||
|     if(out) { | ||||
|         out->outpic      = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h); | ||||
|         avfilter_copy_picref_props(out->outpic, picref); | ||||
|         avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0)); | ||||
|         avfilter_copy_buffer_ref_props(out->outpic, picref); | ||||
|         avfilter_start_frame(out, avfilter_ref_buffer(out->outpic, ~0)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
|  | @ -97,12 +97,12 @@ void avfilter_default_end_frame(AVFilterLink *link) | |||
|     if(link->dst->output_count) | ||||
|         out = link->dst->outputs[0]; | ||||
| 
 | ||||
|     avfilter_unref_pic(link->cur_pic); | ||||
|     avfilter_unref_buffer(link->cur_pic); | ||||
|     link->cur_pic = NULL; | ||||
| 
 | ||||
|     if(out) { | ||||
|         if(out->outpic) { | ||||
|             avfilter_unref_pic(out->outpic); | ||||
|             avfilter_unref_buffer(out->outpic); | ||||
|             out->outpic = NULL; | ||||
|         } | ||||
|         avfilter_end_frame(out); | ||||
|  |  | |||
|  | @ -132,7 +132,7 @@ static int config_output(AVFilterLink *link) | |||
| static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | ||||
| { | ||||
|     CropContext *crop = link->dst->priv; | ||||
|     AVFilterBufferRef *ref2 = avfilter_ref_pic(picref, ~0); | ||||
|     AVFilterBufferRef *ref2 = avfilter_ref_buffer(picref, ~0); | ||||
|     int i; | ||||
| 
 | ||||
|     ref2->w        = crop->w; | ||||
|  |  | |||
|  | @ -244,7 +244,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int | |||
| static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) | ||||
| { | ||||
|     PadContext *pad = inlink->dst->priv; | ||||
|     AVFilterBufferRef *outpicref = avfilter_ref_pic(inpicref, ~0); | ||||
|     AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0); | ||||
|     int plane; | ||||
| 
 | ||||
|     inlink->dst->outputs[0]->outpic = outpicref; | ||||
|  | @ -263,7 +263,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) | |||
| static void end_frame(AVFilterLink *link) | ||||
| { | ||||
|     avfilter_end_frame(link->dst->outputs[0]); | ||||
|     avfilter_unref_pic(link->cur_pic); | ||||
|     avfilter_unref_buffer(link->cur_pic); | ||||
| } | ||||
| 
 | ||||
| static void draw_send_bar_slice(AVFilterLink *link, int y, int h, int slice_dir, int before_slice) | ||||
|  | @ -432,13 +432,13 @@ static int color_request_frame(AVFilterLink *link) | |||
|     picref->pts          = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q); | ||||
|     picref->pos          = 0; | ||||
| 
 | ||||
|     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0)); | ||||
|     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); | ||||
|     draw_rectangle(picref, | ||||
|                    color->line, color->line_step, color->hsub, color->vsub, | ||||
|                    0, 0, color->w, color->h); | ||||
|     avfilter_draw_slice(link, 0, color->h, 1); | ||||
|     avfilter_end_frame(link); | ||||
|     avfilter_unref_pic(picref); | ||||
|     avfilter_unref_buffer(picref); | ||||
| 
 | ||||
|     return 0; | ||||
| } | ||||
|  |  | |||
|  | @ -58,7 +58,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) | |||
|     outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, | ||||
|                                                 outlink->w, outlink->h); | ||||
|     outpicref = outlink->outpic; | ||||
|     avfilter_copy_picref_props(outpicref, picref); | ||||
|     avfilter_copy_buffer_ref_props(outpicref, picref); | ||||
| 
 | ||||
|     for (i = 0; i < 4; i++) { | ||||
|         int h = outlink->h; | ||||
|  | @ -74,7 +74,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) | |||
|     if (priv->pix_desc->flags & PIX_FMT_PAL) | ||||
|         memcpy(outpicref->data[1], outpicref->data[1], 256*4); | ||||
| 
 | ||||
|     avfilter_start_frame(outlink, avfilter_ref_pic(outpicref, ~0)); | ||||
|     avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); | ||||
| } | ||||
| 
 | ||||
| static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir) | ||||
|  |  | |||
|  | @ -152,7 +152,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||
|     scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h; | ||||
| 
 | ||||
|     outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h); | ||||
|     avfilter_copy_picref_props(outpicref, picref); | ||||
|     avfilter_copy_buffer_ref_props(outpicref, picref); | ||||
| 
 | ||||
|     outlink->outpic = outpicref; | ||||
| 
 | ||||
|  | @ -162,7 +162,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) | |||
|               INT_MAX); | ||||
| 
 | ||||
|     scale->slice_y = 0; | ||||
|     avfilter_start_frame(outlink, avfilter_ref_pic(outpicref, ~0)); | ||||
|     avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0)); | ||||
| } | ||||
| 
 | ||||
| static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) | ||||
|  |  | |||
|  | @ -202,10 +202,10 @@ static void end_frame(AVFilterLink *link) | |||
|     unsharpen(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); | ||||
|     unsharpen(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma); | ||||
| 
 | ||||
|     avfilter_unref_pic(in); | ||||
|     avfilter_unref_buffer(in); | ||||
|     avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1); | ||||
|     avfilter_end_frame(link->dst->outputs[0]); | ||||
|     avfilter_unref_pic(out); | ||||
|     avfilter_unref_buffer(out); | ||||
| } | ||||
| 
 | ||||
| static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir) | ||||
|  |  | |||
|  | @ -126,10 +126,10 @@ static int request_frame(AVFilterLink *link) | |||
|     picref->pixel_aspect    = c->pixel_aspect; | ||||
|     picref->interlaced      = c->frame.interlaced_frame; | ||||
|     picref->top_field_first = c->frame.top_field_first; | ||||
|     avfilter_start_frame(link, avfilter_ref_pic(picref, ~0)); | ||||
|     avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0)); | ||||
|     avfilter_draw_slice(link, 0, link->h, 1); | ||||
|     avfilter_end_frame(link); | ||||
|     avfilter_unref_pic(picref); | ||||
|     avfilter_unref_buffer(picref); | ||||
| 
 | ||||
|     c->has_frame = 0; | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 S.N. Hemanth Meenakshisundaram
						S.N. Hemanth Meenakshisundaram