History

Merge commit '7e350379f87e7f74420b4813170fe808e2313911'

* commit '7e350379f87e7f74420b4813170fe808e2313911': lavfi: switch to AVFrame. Conflicts: doc/filters.texi libavfilter/af_ashowinfo.c libavfilter/audio.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/buffersink.c libavfilter/buffersrc.c libavfilter/buffersrc.h libavfilter/f_select.c libavfilter/f_setpts.c libavfilter/fifo.c libavfilter/split.c libavfilter/src_movie.c libavfilter/version.h libavfilter/vf_aspect.c libavfilter/vf_bbox.c libavfilter/vf_blackframe.c libavfilter/vf_delogo.c libavfilter/vf_drawbox.c libavfilter/vf_drawtext.c libavfilter/vf_fade.c libavfilter/vf_fieldorder.c libavfilter/vf_fps.c libavfilter/vf_frei0r.c libavfilter/vf_gradfun.c libavfilter/vf_hqdn3d.c libavfilter/vf_lut.c libavfilter/vf_overlay.c libavfilter/vf_pad.c libavfilter/vf_scale.c libavfilter/vf_showinfo.c libavfilter/vf_transpose.c libavfilter/vf_vflip.c libavfilter/vf_yadif.c libavfilter/video.c libavfilter/vsrc_testsrc.c libavfilter/yadif.h Following are notes about the merge authorship and various technical details. Michael Niedermayer: * Main merge operation, notably avfilter.c and video.c * Switch to AVFrame: - afade - anullsrc - apad - aresample - blackframe - deshake - idet - il - mandelbrot - mptestsrc - noise - setfield - smartblur - tinterlace * various merge changes and fixes in: - ashowinfo - blackdetect - field - fps - select - testsrc - yadif Nicolas George: * Switch to AVFrame: - make rawdec work with refcounted frames. Adapted from commit 759001c534287a96dc96d1e274665feb7059145d by Anton Khirnov. Also, fix the use of || instead of | in a flags check. - make buffer sink and src, audio and video work all together Clément Bœsch: * Switch to AVFrame: - aevalsrc - alphaextract - blend - cellauto - colormatrix - concat - earwax - ebur128 - edgedetect - geq - histeq - histogram - hue - kerndeint - life - movie - mp (with the help of Michael) - overlay - pad - pan - pp - pp - removelogo - sendcmd - showspectrum - showwaves - silencedetect - stereo3d - subtitles - super2xsai - swapuv - thumbnail - tile Hendrik Leppkes: * Switch to AVFrame: - aconvert - amerge - asetnsamples - atempo - biquads Matthieu Bouron: * Switch to AVFrame - alphamerge - decimate - volumedetect Stefano Sabatini: * Switch to AVFrame: - astreamsync - flite - framestep Signed-off-by: Michael Niedermayer <michaelni@gmx.at> Signed-off-by: Nicolas George <nicolas.george@normalesup.org> Signed-off-by: Clément Bœsch <ubitux@gmail.com> Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com> Signed-off-by: Matthieu Bouron <matthieu.bouron@gmail.com> Signed-off-by: Stefano Sabatini <stefasab@gmail.com>

Michael Niedermayer committed 13 years ago

Commit a05a44e2 parents 586ae70 7e35037124 files · +1820 −1926Browse files

Showing the changes to libavfilter/buffer.c (1 of 124 files). Show all

Unified · Split

libavfilter/buffer.c+31−109
@@ -92,84 +92,13 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask) · 91 unmodified lines
92 return ret;92 return ret;
93}93}
94 94
95void ff_free_pool(AVFilterPool *pool)
96{
97 int i;
98
99 av_assert0(pool->refcount > 0);
100
101 for (i = 0; i < POOL_SIZE; i++) {
102 if (pool->pic[i]) {
103 AVFilterBufferRef *picref = pool->pic[i];
104 /* free buffer: picrefs stored in the pool are not
105 * supposed to contain a free callback */
106 av_assert0(!picref->buf->refcount);
107 av_freep(&picref->buf->data[0]);
108 av_freep(&picref->buf);
109
110 av_freep(&picref->audio);
111 av_assert0(!picref->video || !picref->video->qp_table);
112 av_freep(&picref->video);
113 av_freep(&pool->pic[i]);
114 pool->count--;
115 }
116 }
117 pool->draining = 1;
118
119 if (!--pool->refcount) {
120 av_assert0(!pool->count);
121 av_free(pool);
122 }
123}
124
125static void store_in_pool(AVFilterBufferRef *ref)
126{
127 int i;
128 AVFilterPool *pool= ref->buf->priv;
129
130 av_assert0(ref->buf->data[0]);
131 av_assert0(pool->refcount>0);
132
133 if (ref->video)
134 av_freep(&ref->video->qp_table);
135
136 if (pool->count == POOL_SIZE) {
137 AVFilterBufferRef *ref1 = pool->pic[0];
138 av_freep(&ref1->video);
139 av_freep(&ref1->audio);
140 av_freep(&ref1->buf->data[0]);
141 av_freep(&ref1->buf);
142 av_free(ref1);
143 memmove(&pool->pic[0], &pool->pic[1], sizeof(void*)*(POOL_SIZE-1));
144 pool->count--;
145 pool->pic[POOL_SIZE-1] = NULL;
146 }
147
148 for (i = 0; i < POOL_SIZE; i++) {
149 if (!pool->pic[i]) {
150 pool->pic[i] = ref;
151 pool->count++;
152 break;
153 }
154 }
155 if (pool->draining) {
156 ff_free_pool(pool);
157 } else
158 --pool->refcount;
159}
160
161void avfilter_unref_buffer(AVFilterBufferRef *ref)95void avfilter_unref_buffer(AVFilterBufferRef *ref)
162{96{
163 if (!ref)97 if (!ref)
164 return;98 return;
165 av_assert0(ref->buf->refcount > 0);99 av_assert0(ref->buf->refcount > 0);
166 if (!(--ref->buf->refcount)) {100 if (!(--ref->buf->refcount))
167 if (!ref->buf->free) {
168 store_in_pool(ref);
169 return;
170 }
171 ref->buf->free(ref->buf);101 ref->buf->free(ref->buf);
172 }
173 if (ref->extended_data != ref->data)102 if (ref->extended_data != ref->data)
174 av_freep(&ref->extended_data);103 av_freep(&ref->extended_data);
175 if (ref->video)104 if (ref->video)
@@ -186,6 +115,36 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref) · 10 unmodified lines
186 *ref = NULL;115 *ref = NULL;
187}116}
188 117
118int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
119{
120 dst->pts = src->pts;
121 dst->pos = av_frame_get_pkt_pos(src);
122 dst->format = src->format;
123
124 av_dict_free(&dst->metadata);
125 av_dict_copy(&dst->metadata, av_frame_get_metadata(src), 0);
126
127 switch (dst->type) {
128 case AVMEDIA_TYPE_VIDEO:
129 dst->video->w = src->width;
130 dst->video->h = src->height;
131 dst->video->sample_aspect_ratio = src->sample_aspect_ratio;
132 dst->video->interlaced = src->interlaced_frame;
133 dst->video->top_field_first = src->top_field_first;
134 dst->video->key_frame = src->key_frame;
135 dst->video->pict_type = src->pict_type;
136 break;
137 case AVMEDIA_TYPE_AUDIO:
138 dst->audio->sample_rate = src->sample_rate;
139 dst->audio->channel_layout = src->channel_layout;
140 break;
141 default:
142 return AVERROR(EINVAL);
143 }
144
145 return 0;
146}
147
189void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)148void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
190{149{
191 // copy common properties150 // copy common properties
@@ -206,40 +165,3 @@ void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *s · 14 unmodified lines
206 av_dict_free(&dst->metadata);165 av_dict_free(&dst->metadata);
207 av_dict_copy(&dst->metadata, src->metadata, 0);166 av_dict_copy(&dst->metadata, src->metadata, 0);
208}167}
209
210AVFilterBufferRef *ff_copy_buffer_ref(AVFilterLink *outlink,
211 AVFilterBufferRef *ref)
212{
213 AVFilterBufferRef *buf;
214 int channels;
215
216 switch (outlink->type) {
217
218 case AVMEDIA_TYPE_VIDEO:
219 buf = ff_get_video_buffer(outlink, AV_PERM_WRITE,
220 ref->video->w, ref->video->h);
221 if(!buf)
222 return NULL;
223 av_image_copy(buf->data, buf->linesize,
224 (void*)ref->data, ref->linesize,
225 ref->format, ref->video->w, ref->video->h);
226 break;
227
228 case AVMEDIA_TYPE_AUDIO:
229 buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
230 ref->audio->nb_samples);
231 if(!buf)
232 return NULL;
233 channels = ref->audio->channels;
234 av_samples_copy(buf->extended_data, ref->buf->extended_data,
235 0, 0, ref->audio->nb_samples,
236 channels,
237 ref->format);
238 break;
239
240 default:
241 return NULL;
242 }
243 avfilter_copy_buffer_ref_props(buf, ref);
244 return buf;
245}

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