[FFmpeg-cvslog] r24731 - in trunk: ffmpeg.c ffplay.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/defaults.c libavfilter/vf_crop.c libavfilter/vf_pad.c libavfilter/vf_pixdesctest.c libavfilter/vf_scal...

stefano subversion
Sat Aug 7 03:15:27 CEST 2010


Author: stefano
Date: Sat Aug  7 03:15:27 2010
New Revision: 24731

Log:
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$.

Modified:
   trunk/ffmpeg.c
   trunk/ffplay.c
   trunk/libavfilter/avfilter.c
   trunk/libavfilter/avfilter.h
   trunk/libavfilter/defaults.c
   trunk/libavfilter/vf_crop.c
   trunk/libavfilter/vf_pad.c
   trunk/libavfilter/vf_pixdesctest.c
   trunk/libavfilter/vf_scale.c
   trunk/libavfilter/vf_unsharp.c
   trunk/libavfilter/vsrc_buffer.c

Modified: trunk/ffmpeg.c
==============================================================================
--- trunk/ffmpeg.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/ffmpeg.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -1777,7 +1777,7 @@ static int output_packet(AVInputStream *
             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);

Modified: trunk/ffplay.c
==============================================================================
--- trunk/ffplay.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/ffplay.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -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,
         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(AVCodecConte
 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(AVFilterL
         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

Modified: trunk/libavfilter/avfilter.c
==============================================================================
--- trunk/libavfilter/avfilter.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/avfilter.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -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->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 *li
     /* 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;
     }
 

Modified: trunk/libavfilter/avfilter.h
==============================================================================
--- trunk/libavfilter/avfilter.h	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/avfilter.h	Sat Aug  7 03:15:27 2010	(r24731)
@@ -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_
 }
 
 /**
- * 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(AVFilterContex
 
 /**
  * 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);

Modified: trunk/libavfilter/defaults.c
==============================================================================
--- trunk/libavfilter/defaults.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/defaults.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -39,7 +39,7 @@ AVFilterBufferRef *avfilter_default_get_
     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(AVFilt
 
     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(AVFilter
     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);

Modified: trunk/libavfilter/vf_crop.c
==============================================================================
--- trunk/libavfilter/vf_crop.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vf_crop.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -132,7 +132,7 @@ static int config_output(AVFilterLink *l
 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;

Modified: trunk/libavfilter/vf_pad.c
==============================================================================
--- trunk/libavfilter/vf_pad.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vf_pad.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -244,7 +244,7 @@ static AVFilterBufferRef *get_video_buff
 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 *in
 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(AVFilterL
     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;
 }

Modified: trunk/libavfilter/vf_pixdesctest.c
==============================================================================
--- trunk/libavfilter/vf_pixdesctest.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vf_pixdesctest.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -58,7 +58,7 @@ static void start_frame(AVFilterLink *in
     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 *in
     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)

Modified: trunk/libavfilter/vf_scale.c
==============================================================================
--- trunk/libavfilter/vf_scale.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vf_scale.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -152,7 +152,7 @@ static void start_frame(AVFilterLink *li
     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 *li
               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)

Modified: trunk/libavfilter/vf_unsharp.c
==============================================================================
--- trunk/libavfilter/vf_unsharp.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vf_unsharp.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -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)

Modified: trunk/libavfilter/vsrc_buffer.c
==============================================================================
--- trunk/libavfilter/vsrc_buffer.c	Sat Aug  7 03:15:19 2010	(r24730)
+++ trunk/libavfilter/vsrc_buffer.c	Sat Aug  7 03:15:27 2010	(r24731)
@@ -126,10 +126,10 @@ static int request_frame(AVFilterLink *l
     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;
 



More information about the ffmpeg-cvslog mailing list