History

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

S.N. Hemanth Meenakshisundaram committed 16 years ago

Commit 7fce4811 parent ecc8dad11 files · +49 −49Browse files

Unified · Split

11 files
  1. ffmpeg.c +1 −1
  2. ffplay.c +5 −5
  3. libavfilter/avfilter.c +7 −7
  4. libavfilter/avfilter.h +18 −18
  5. libavfilter/defaults.c +5 −5
  6. libavfilter/vf_crop.c +1 −1
  7. libavfilter/vf_pad.c +4 −4
  8. libavfilter/vf_pixdesctest.c +2 −2
  9. libavfilter/vf_scale.c +2 −2
  10. libavfilter/vf_unsharp.c +2 −2
  11. libavfilter/vsrc_buffer.c +2 −2
ffmpeg.c+1−1
@@ -1777,7 +1777,7 @@ static int output_packet(AVInputStream *ist, int ist_index, · 1776 unmodified lines
17771777 frame_available = (ist->st->codec->codec_type == AVMEDIA_TYPE_VIDEO) &&
17781778 ist->out_video_filter && avfilter_poll_frame(ist->out_video_filter->inputs[0]);
17791779 if(ist->picref)
1780− avfilter_unref_pic(ist->picref);
1780+ avfilter_unref_buffer(ist->picref);
17811781 }
17821782 #endif
17831783 av_free(buffer_to_free);
ffplay.c+5−5
@@ -1304,7 +1304,7 @@ static void alloc_picture(void *opaque) · 1303 unmodified lines
13041304
13051305 #if CONFIG_AVFILTER
13061306 if (vp->picref)
1307− avfilter_unref_pic(vp->picref);
1307+ avfilter_unref_buffer(vp->picref);
13081308 vp->picref = NULL;
13091309
13101310 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 · 78 unmodified lines
13891389 AVPicture pict;
13901390 #if CONFIG_AVFILTER
13911391 if(vp->picref)
1392− avfilter_unref_pic(vp->picref);
1392+ avfilter_unref_buffer(vp->picref);
13931393 vp->picref = src_frame->opaque;
13941394 #endif
13951395
@@ -1604,7 +1604,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic) · 208 unmodified lines
16041604 static void input_release_buffer(AVCodecContext *codec, AVFrame *pic)
16051605 {
16061606 memset(pic->data, 0, sizeof(pic->data));
1607− avfilter_unref_pic(pic->opaque);
1607+ avfilter_unref_buffer(pic->opaque);
16081608 }
16091609
16101610 static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
@@ -1667,7 +1667,7 @@ static int input_request_frame(AVFilterLink *link) · 56 unmodified lines
16671667 return -1;
16681668
16691669 if(priv->use_dr1) {
1670− picref = avfilter_ref_pic(priv->frame->opaque, ~0);
1670+ picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
16711671 } else {
16721672 picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
16731673 av_picture_copy((AVPicture *)&picref->data, (AVPicture *)priv->frame,
@@ -2672,7 +2672,7 @@ static void stream_close(VideoState *is) · 998 unmodified lines
26722672 vp = &is->pictq[i];
26732673 #if CONFIG_AVFILTER
26742674 if (vp->picref) {
2675− avfilter_unref_pic(vp->picref);
2675+ avfilter_unref_buffer(vp->picref);
26762676 vp->picref = NULL;
26772677 }
26782678 #endif
libavfilter/avfilter.c+7−7
@@ -45,19 +45,19 @@ const char *avfilter_license(void) · 44 unmodified lines
4545 #define link_dpad(link) link->dst-> input_pads[link->dstpad]
4646 #define link_spad(link) link->src->output_pads[link->srcpad]
4747
48−AVFilterBufferRef *avfilter_ref_pic(AVFilterBufferRef *ref, int pmask)
48+AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
4949 {
5050 AVFilterBufferRef *ret = av_malloc(sizeof(AVFilterBufferRef));
5151 *ret = *ref;
5252 ret->perms &= pmask;
53− ret->pic->refcount ++;
53+ ret->buf->refcount ++;
5454 return ret;
5555 }
5656
57−void avfilter_unref_pic(AVFilterBufferRef *ref)
57+void avfilter_unref_buffer(AVFilterBufferRef *ref)
5858 {
59− if(!(--ref->pic->refcount))
60− ref->pic->free(ref->pic);
59+ if(!(--ref->buf->refcount))
60+ ref->buf->free(ref->buf);
6161 av_free(ref);
6262 }
6363
@@ -264,7 +264,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 200 unmodified lines
264264
265265 link->cur_pic = avfilter_default_get_video_buffer(link, dst->min_perms, link->w, link->h);
266266 link->srcpic = picref;
267− avfilter_copy_picref_props(link->cur_pic, link->srcpic);
267+ avfilter_copy_buffer_ref_props(link->cur_pic, link->srcpic);
268268 }
269269 else
270270 link->cur_pic = picref;
@@ -284,7 +284,7 @@ void avfilter_end_frame(AVFilterLink *link) · 13 unmodified lines
284284 /* unreference the source picture if we're feeding the destination filter
285285 * a copied version dues to permission issues */
286286 if(link->srcpic) {
287− avfilter_unref_pic(link->srcpic);
287+ avfilter_unref_buffer(link->srcpic);
288288 link->srcpic = NULL;
289289 }
290290
libavfilter/avfilter.h+18−18
@@ -25,7 +25,7 @@ · 24 unmodified lines
2525 #include "libavutil/avutil.h"
2626
2727 #define LIBAVFILTER_VERSION_MAJOR 1
28−#define LIBAVFILTER_VERSION_MINOR 29
28+#define LIBAVFILTER_VERSION_MINOR 30
2929 #define LIBAVFILTER_VERSION_MICRO 0
3030
3131 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
@@ -90,7 +90,7 @@ typedef struct AVFilterBuffer · 58 unmodified lines
9090
9191 /**
9292 * A reference to an AVFilterBuffer. Since filters can manipulate the origin of
93− * a picture to, for example, crop image without any memcpy, the picture origin
93+ * a buffer to, for example, crop image without any memcpy, the buffer origin
9494 * and dimensions are per-reference properties. Linesize is also useful for
9595 * image flipping, frame to field filters, etc, and so is also per-reference.
9696 *
@@ -98,7 +98,7 @@ typedef struct AVFilterBuffer · 1 unmodified line
9898 */
9999 typedef struct AVFilterBufferRef
100100 {
101− AVFilterBuffer *pic; ///< the picture that this is a reference to
101+ AVFilterBuffer *buf; ///< the buffer that this is a reference to
102102 uint8_t *data[4]; ///< picture data for each plane
103103 int linesize[4]; ///< number of bytes per line
104104 int w; ///< image width
@@ -120,7 +120,7 @@ typedef struct AVFilterBufferRef · 15 unmodified lines
120120 * Copy properties of src to dst, without copying the actual video
121121 * data.
122122 */
123−static inline void avfilter_copy_picref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
123+static inline void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
124124 {
125125 dst->pts = src->pts;
126126 dst->pos = src->pos;
@@ -132,21 +132,21 @@ static inline void avfilter_copy_picref_props(AVFilterBufferRef *dst, AVFilterBu · 5 unmodified lines
132132 }
133133
134134 /**
135− * Add a new reference to a picture.
136− * @param ref an existing reference to the picture
135+ * Add a new reference to a buffer.
136+ * @param ref an existing reference to the buffer
137137 * @param pmask a bitmask containing the allowable permissions in the new
138138 * reference
139− * @return a new reference to the picture with the same properties as the
139+ * @return a new reference to the buffer with the same properties as the
140140 * old, excluding any permissions denied by pmask
141141 */
142−AVFilterBufferRef *avfilter_ref_pic(AVFilterBufferRef *ref, int pmask);
142+AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask);
143143
144144 /**
145− * Remove a reference to a picture. If this is the last reference to the
146− * picture, the picture itself is also automatically freed.
147− * @param ref reference to the picture
145+ * Remove a reference to a buffer. If this is the last reference to the
146+ * buffer, the buffer itself is also automatically freed.
147+ * @param ref reference to the buffer
148148 */
149−void avfilter_unref_pic(AVFilterBufferRef *ref);
149+void avfilter_unref_buffer(AVFilterBufferRef *ref);
150150
151151 /**
152152 * A list of supported formats for one end of a filter link. This is used
@@ -442,7 +442,7 @@ typedef struct AVFilter · 289 unmodified lines
442442
443443 /**
444444 * Filter uninitialization function. Should deallocate any memory held
445− * by the filter, release any picture references, etc. This does not need
445+ * by the filter, release any buffer references, etc. This does not need
446446 * to deallocate the AVFilterContext->priv memory itself.
447447 */
448448 void (*uninit)(AVFilterContext *ctx);
@@ -524,9 +524,9 @@ struct AVFilterLink · 75 unmodified lines
524524 AVFilterFormats *out_formats;
525525
526526 /**
527− * The picture reference currently being sent across the link by the source
527+ * The buffer reference currently being sent across the link by the source
528528 * filter. This is used internally by the filter system to allow
529− * automatic copying of pictures which do not have sufficient permissions
529+ * automatic copying of buffers which do not have sufficient permissions
530530 * for the destination. This should not be accessed directly by the
531531 * filters.
532532 */
@@ -556,13 +556,13 @@ int avfilter_config_links(AVFilterContext *filter); · 23 unmodified lines
556556
557557 /**
558558 * Request a picture buffer with a specific set of permissions.
559− * @param link the output link to the filter from which the picture will
559+ * @param link the output link to the filter from which the buffer will
560560 * be requested
561561 * @param perms the required access permissions
562562 * @param w the minimum width of the buffer to allocate
563563 * @param h the minimum height of the buffer to allocate
564− * @return A reference to the picture. This must be unreferenced with
565− * avfilter_unref_pic when you are finished with it.
564+ * @return A reference to the buffer. This must be unreferenced with
565+ * avfilter_unref_buffer when you are finished with it.
566566 */
567567 AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms,
568568 int w, int h);
libavfilter/defaults.c+5−5
@@ -39,7 +39,7 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per · 38 unmodified lines
3939 int i, tempsize;
4040 char *buf;
4141
42− ref->pic = pic;
42+ ref->buf = pic;
4343 ref->w = w;
4444 ref->h = h;
4545
@@ -74,8 +74,8 @@ void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 28 unmodified lines
7474
7575 if(out) {
7676 out->outpic = avfilter_get_video_buffer(out, AV_PERM_WRITE, out->w, out->h);
77− avfilter_copy_picref_props(out->outpic, picref);
78− avfilter_start_frame(out, avfilter_ref_pic(out->outpic, ~0));
77+ avfilter_copy_buffer_ref_props(out->outpic, picref);
78+ avfilter_start_frame(out, avfilter_ref_buffer(out->outpic, ~0));
7979 }
8080 }
8181
@@ -97,12 +97,12 @@ void avfilter_default_end_frame(AVFilterLink *link) · 15 unmodified lines
9797 if(link->dst->output_count)
9898 out = link->dst->outputs[0];
9999
100− avfilter_unref_pic(link->cur_pic);
100+ avfilter_unref_buffer(link->cur_pic);
101101 link->cur_pic = NULL;
102102
103103 if(out) {
104104 if(out->outpic) {
105− avfilter_unref_pic(out->outpic);
105+ avfilter_unref_buffer(out->outpic);
106106 out->outpic = NULL;
107107 }
108108 avfilter_end_frame(out);
libavfilter/vf_crop.c+1−1
@@ -132,7 +132,7 @@ static int config_output(AVFilterLink *link) · 131 unmodified lines
132132 static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
133133 {
134134 CropContext *crop = link->dst->priv;
135− AVFilterBufferRef *ref2 = avfilter_ref_pic(picref, ~0);
135+ AVFilterBufferRef *ref2 = avfilter_ref_buffer(picref, ~0);
136136 int i;
137137
138138 ref2->w = crop->w;
libavfilter/vf_pad.c+4−4
@@ -244,7 +244,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *inlink, int perms, int · 243 unmodified lines
244244 static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref)
245245 {
246246 PadContext *pad = inlink->dst->priv;
247− AVFilterBufferRef *outpicref = avfilter_ref_pic(inpicref, ~0);
247+ AVFilterBufferRef *outpicref = avfilter_ref_buffer(inpicref, ~0);
248248 int plane;
249249
250250 inlink->dst->outputs[0]->outpic = outpicref;
@@ -263,7 +263,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *inpicref) · 12 unmodified lines
263263 static void end_frame(AVFilterLink *link)
264264 {
265265 avfilter_end_frame(link->dst->outputs[0]);
266− avfilter_unref_pic(link->cur_pic);
266+ avfilter_unref_buffer(link->cur_pic);
267267 }
268268
269269 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) · 162 unmodified lines
432432 picref->pts = av_rescale_q(color->pts++, color->time_base, AV_TIME_BASE_Q);
433433 picref->pos = 0;
434434
435− avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
435+ avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
436436 draw_rectangle(picref,
437437 color->line, color->line_step, color->hsub, color->vsub,
438438 0, 0, color->w, color->h);
439439 avfilter_draw_slice(link, 0, color->h, 1);
440440 avfilter_end_frame(link);
441− avfilter_unref_pic(picref);
441+ avfilter_unref_buffer(picref);
442442
443443 return 0;
444444 }
libavfilter/vf_pixdesctest.c+2−2
@@ -58,7 +58,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 57 unmodified lines
5858 outlink->outpic = avfilter_get_video_buffer(outlink, AV_PERM_WRITE,
5959 outlink->w, outlink->h);
6060 outpicref = outlink->outpic;
61− avfilter_copy_picref_props(outpicref, picref);
61+ avfilter_copy_buffer_ref_props(outpicref, picref);
6262
6363 for (i = 0; i < 4; i++) {
6464 int h = outlink->h;
@@ -74,7 +74,7 @@ static void start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref) · 9 unmodified lines
7474 if (priv->pix_desc->flags & PIX_FMT_PAL)
7575 memcpy(outpicref->data[1], outpicref->data[1], 256*4);
7676
77− avfilter_start_frame(outlink, avfilter_ref_pic(outpicref, ~0));
77+ avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
7878 }
7979
8080 static void draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
libavfilter/vf_scale.c+2−2
@@ -152,7 +152,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 151 unmodified lines
152152 scale->vsub = av_pix_fmt_descriptors[link->format].log2_chroma_h;
153153
154154 outpicref = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
155− avfilter_copy_picref_props(outpicref, picref);
155+ avfilter_copy_buffer_ref_props(outpicref, picref);
156156
157157 outlink->outpic = outpicref;
158158
@@ -162,7 +162,7 @@ static void start_frame(AVFilterLink *link, AVFilterBufferRef *picref) · 3 unmodified lines
162162 INT_MAX);
163163
164164 scale->slice_y = 0;
165− avfilter_start_frame(outlink, avfilter_ref_pic(outpicref, ~0));
165+ avfilter_start_frame(outlink, avfilter_ref_buffer(outpicref, ~0));
166166 }
167167
168168 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
libavfilter/vf_unsharp.c+2−2
@@ -202,10 +202,10 @@ static void end_frame(AVFilterLink *link) · 201 unmodified lines
202202 unsharpen(out->data[1], in->data[1], out->linesize[1], in->linesize[1], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma);
203203 unsharpen(out->data[2], in->data[2], out->linesize[2], in->linesize[2], CHROMA_WIDTH(link), CHROMA_HEIGHT(link), &unsharp->chroma);
204204
205− avfilter_unref_pic(in);
205+ avfilter_unref_buffer(in);
206206 avfilter_draw_slice(link->dst->outputs[0], 0, link->h, 1);
207207 avfilter_end_frame(link->dst->outputs[0]);
208− avfilter_unref_pic(out);
208+ avfilter_unref_buffer(out);
209209 }
210210
211211 static void draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
libavfilter/vsrc_buffer.c+2−2
@@ -126,10 +126,10 @@ static int request_frame(AVFilterLink *link) · 125 unmodified lines
126126 picref->pixel_aspect = c->pixel_aspect;
127127 picref->interlaced = c->frame.interlaced_frame;
128128 picref->top_field_first = c->frame.top_field_first;
129− avfilter_start_frame(link, avfilter_ref_pic(picref, ~0));
129+ avfilter_start_frame(link, avfilter_ref_buffer(picref, ~0));
130130 avfilter_draw_slice(link, 0, link->h, 1);
131131 avfilter_end_frame(link);
132− avfilter_unref_pic(picref);
132+ avfilter_unref_buffer(picref);
133133
134134 c->has_frame = 0;
135135

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t