mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2025-12-08 06:09:50 +00:00
Merge commit '7e350379f8'
* commit '7e350379f8': 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 commit759001c534by 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> Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
commit
a05a44e205
124 changed files with 1827 additions and 1933 deletions
|
|
@ -92,84 +92,13 @@ AVFilterBufferRef *avfilter_ref_buffer(AVFilterBufferRef *ref, int pmask)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void ff_free_pool(AVFilterPool *pool)
|
||||
{
|
||||
int i;
|
||||
|
||||
av_assert0(pool->refcount > 0);
|
||||
|
||||
for (i = 0; i < POOL_SIZE; i++) {
|
||||
if (pool->pic[i]) {
|
||||
AVFilterBufferRef *picref = pool->pic[i];
|
||||
/* free buffer: picrefs stored in the pool are not
|
||||
* supposed to contain a free callback */
|
||||
av_assert0(!picref->buf->refcount);
|
||||
av_freep(&picref->buf->data[0]);
|
||||
av_freep(&picref->buf);
|
||||
|
||||
av_freep(&picref->audio);
|
||||
av_assert0(!picref->video || !picref->video->qp_table);
|
||||
av_freep(&picref->video);
|
||||
av_freep(&pool->pic[i]);
|
||||
pool->count--;
|
||||
}
|
||||
}
|
||||
pool->draining = 1;
|
||||
|
||||
if (!--pool->refcount) {
|
||||
av_assert0(!pool->count);
|
||||
av_free(pool);
|
||||
}
|
||||
}
|
||||
|
||||
static void store_in_pool(AVFilterBufferRef *ref)
|
||||
{
|
||||
int i;
|
||||
AVFilterPool *pool= ref->buf->priv;
|
||||
|
||||
av_assert0(ref->buf->data[0]);
|
||||
av_assert0(pool->refcount>0);
|
||||
|
||||
if (ref->video)
|
||||
av_freep(&ref->video->qp_table);
|
||||
|
||||
if (pool->count == POOL_SIZE) {
|
||||
AVFilterBufferRef *ref1 = pool->pic[0];
|
||||
av_freep(&ref1->video);
|
||||
av_freep(&ref1->audio);
|
||||
av_freep(&ref1->buf->data[0]);
|
||||
av_freep(&ref1->buf);
|
||||
av_free(ref1);
|
||||
memmove(&pool->pic[0], &pool->pic[1], sizeof(void*)*(POOL_SIZE-1));
|
||||
pool->count--;
|
||||
pool->pic[POOL_SIZE-1] = NULL;
|
||||
}
|
||||
|
||||
for (i = 0; i < POOL_SIZE; i++) {
|
||||
if (!pool->pic[i]) {
|
||||
pool->pic[i] = ref;
|
||||
pool->count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pool->draining) {
|
||||
ff_free_pool(pool);
|
||||
} else
|
||||
--pool->refcount;
|
||||
}
|
||||
|
||||
void avfilter_unref_buffer(AVFilterBufferRef *ref)
|
||||
{
|
||||
if (!ref)
|
||||
return;
|
||||
av_assert0(ref->buf->refcount > 0);
|
||||
if (!(--ref->buf->refcount)) {
|
||||
if (!ref->buf->free) {
|
||||
store_in_pool(ref);
|
||||
return;
|
||||
}
|
||||
if (!(--ref->buf->refcount))
|
||||
ref->buf->free(ref->buf);
|
||||
}
|
||||
if (ref->extended_data != ref->data)
|
||||
av_freep(&ref->extended_data);
|
||||
if (ref->video)
|
||||
|
|
@ -186,6 +115,36 @@ void avfilter_unref_bufferp(AVFilterBufferRef **ref)
|
|||
*ref = NULL;
|
||||
}
|
||||
|
||||
int avfilter_copy_frame_props(AVFilterBufferRef *dst, const AVFrame *src)
|
||||
{
|
||||
dst->pts = src->pts;
|
||||
dst->pos = av_frame_get_pkt_pos(src);
|
||||
dst->format = src->format;
|
||||
|
||||
av_dict_free(&dst->metadata);
|
||||
av_dict_copy(&dst->metadata, av_frame_get_metadata(src), 0);
|
||||
|
||||
switch (dst->type) {
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
dst->video->w = src->width;
|
||||
dst->video->h = src->height;
|
||||
dst->video->sample_aspect_ratio = src->sample_aspect_ratio;
|
||||
dst->video->interlaced = src->interlaced_frame;
|
||||
dst->video->top_field_first = src->top_field_first;
|
||||
dst->video->key_frame = src->key_frame;
|
||||
dst->video->pict_type = src->pict_type;
|
||||
break;
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
dst->audio->sample_rate = src->sample_rate;
|
||||
dst->audio->channel_layout = src->channel_layout;
|
||||
break;
|
||||
default:
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *src)
|
||||
{
|
||||
// copy common properties
|
||||
|
|
@ -206,40 +165,3 @@ void avfilter_copy_buffer_ref_props(AVFilterBufferRef *dst, AVFilterBufferRef *s
|
|||
av_dict_free(&dst->metadata);
|
||||
av_dict_copy(&dst->metadata, src->metadata, 0);
|
||||
}
|
||||
|
||||
AVFilterBufferRef *ff_copy_buffer_ref(AVFilterLink *outlink,
|
||||
AVFilterBufferRef *ref)
|
||||
{
|
||||
AVFilterBufferRef *buf;
|
||||
int channels;
|
||||
|
||||
switch (outlink->type) {
|
||||
|
||||
case AVMEDIA_TYPE_VIDEO:
|
||||
buf = ff_get_video_buffer(outlink, AV_PERM_WRITE,
|
||||
ref->video->w, ref->video->h);
|
||||
if(!buf)
|
||||
return NULL;
|
||||
av_image_copy(buf->data, buf->linesize,
|
||||
(void*)ref->data, ref->linesize,
|
||||
ref->format, ref->video->w, ref->video->h);
|
||||
break;
|
||||
|
||||
case AVMEDIA_TYPE_AUDIO:
|
||||
buf = ff_get_audio_buffer(outlink, AV_PERM_WRITE,
|
||||
ref->audio->nb_samples);
|
||||
if(!buf)
|
||||
return NULL;
|
||||
channels = ref->audio->channels;
|
||||
av_samples_copy(buf->extended_data, ref->buf->extended_data,
|
||||
0, 0, ref->audio->nb_samples,
|
||||
channels,
|
||||
ref->format);
|
||||
break;
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
avfilter_copy_buffer_ref_props(buf, ref);
|
||||
return buf;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue