summaryrefslogtreecommitdiff
path: root/libavfilter/defaults.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-05-16 02:27:31 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-05-16 02:27:31 +0200
commit1cbf7fb4345a3e5b7791d483241bf4759bde4ece (patch)
treed7acd8317309e051fb240e3505f77aabe2ea0437 /libavfilter/defaults.c
parenta48abf5e263ad7f2e68821766e7cf4d29befb58e (diff)
parent0ff0af731ce4544f84b2f748dcc699717a2df8d6 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (26 commits) fate: use diff -b in oneline comparison Add missing version bumps and APIchanges/Changelog entries. lavfi: move buffer management function to a separate file. lavfi: move formats-related functions from default.c to formats.c lavfi: move video-related functions to a separate file. fate: make smjpeg a demux test fate: separate sierra-vmd audio and video tests fate: separate smacker audio and video tests libmp3lame: set supported channel layouts. avconv: automatically insert asyncts when -async is used. avconv: add support for audio filters. lavfi: add asyncts filter. lavfi: add aformat filter lavfi: add an audio buffer sink. lavfi: add an audio buffer source. buffersrc: add av_buffersrc_write_frame(). buffersrc: fix invalid read in uninit if the fifo hasn't been allocated lavfi: rename vsrc_buffer.c to buffersrc.c avfiltergraph: reindent lavfi: add channel layout/sample rate negotiation. ... Conflicts: Changelog doc/APIchanges doc/filters.texi ffmpeg.c ffprobe.c libavcodec/libmp3lame.c libavfilter/Makefile libavfilter/af_aformat.c libavfilter/allfilters.c libavfilter/avfilter.c libavfilter/avfilter.h libavfilter/avfiltergraph.c libavfilter/buffersrc.c libavfilter/defaults.c libavfilter/formats.c libavfilter/src_buffer.c libavfilter/version.h libavfilter/vf_yadif.c libavfilter/vsrc_buffer.c libavfilter/vsrc_buffer.h libavutil/avutil.h tests/fate/audio.mak tests/fate/demux.mak tests/fate/video.mak Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter/defaults.c')
-rw-r--r--libavfilter/defaults.c140
1 files changed, 3 insertions, 137 deletions
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index d2e01499be..31dc18d9f7 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -26,111 +26,7 @@
#include "avfilter.h"
#include "internal.h"
-
-void ff_avfilter_default_free_buffer(AVFilterBuffer *ptr)
-{
- if (ptr->extended_data != ptr->data)
- av_freep(&ptr->extended_data);
- av_free(ptr->data[0]);
- av_free(ptr);
-}
-
-/* TODO: set the buffer's priv member to a context structure for the whole
- * filter chain. This will allow for a buffer pool instead of the constant
- * alloc & free cycle currently implemented. */
-AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- int linesize[4];
- uint8_t *data[4];
- int i;
- AVFilterBufferRef *picref = NULL;
- AVFilterPool *pool = link->pool;
-
- if (pool) {
- for (i = 0; i < POOL_SIZE; i++) {
- picref = pool->pic[i];
- if (picref && picref->buf->format == link->format && picref->buf->w == w && picref->buf->h == h) {
- AVFilterBuffer *pic = picref->buf;
- pool->pic[i] = NULL;
- pool->count--;
- picref->video->w = w;
- picref->video->h = h;
- picref->perms = perms | AV_PERM_READ;
- picref->format = link->format;
- pic->refcount = 1;
- memcpy(picref->data, pic->data, sizeof(picref->data));
- memcpy(picref->linesize, pic->linesize, sizeof(picref->linesize));
- pool->refcount++;
- return picref;
- }
- }
- } else {
- pool = link->pool = av_mallocz(sizeof(AVFilterPool));
- pool->refcount = 1;
- }
-
- // align: +2 is needed for swscaler, +16 to be SIMD-friendly
- if ((i = av_image_alloc(data, linesize, w, h, link->format, 32)) < 0)
- return NULL;
-
- picref = avfilter_get_video_buffer_ref_from_arrays(data, linesize,
- perms, w, h, link->format);
- if (!picref) {
- av_free(data[0]);
- return NULL;
- }
- memset(data[0], 128, i);
-
- picref->buf->priv = pool;
- picref->buf->free = NULL;
- pool->refcount++;
-
- return picref;
-}
-
-void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- if (outlink) {
- outlink->out_buf = avfilter_get_video_buffer(outlink, AV_PERM_WRITE, outlink->w, outlink->h);
- avfilter_copy_buffer_ref_props(outlink->out_buf, picref);
- avfilter_start_frame(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
- }
-}
-
-void avfilter_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- if (outlink)
- avfilter_draw_slice(outlink, y, h, slice_dir);
-}
-
-void avfilter_default_end_frame(AVFilterLink *inlink)
-{
- AVFilterLink *outlink = NULL;
-
- if (inlink->dst->output_count)
- outlink = inlink->dst->outputs[0];
-
- avfilter_unref_buffer(inlink->cur_buf);
- inlink->cur_buf = NULL;
-
- if (outlink) {
- if (outlink->out_buf) {
- avfilter_unref_buffer(outlink->out_buf);
- outlink->out_buf = NULL;
- }
- avfilter_end_frame(outlink);
- }
-}
+#include "formats.h"
static void set_common_formats(AVFilterContext *ctx, AVFilterFormats *fmts,
enum AVMediaType type, int offin, int offout)
@@ -170,8 +66,8 @@ void avfilter_set_common_sample_formats(AVFilterContext *ctx, AVFilterFormats *f
void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats *formats)
{
set_common_formats(ctx, formats, AVMEDIA_TYPE_AUDIO,
- offsetof(AVFilterLink, in_chlayouts),
- offsetof(AVFilterLink, out_chlayouts));
+ offsetof(AVFilterLink, in_channel_layouts),
+ offsetof(AVFilterLink, out_channel_layouts));
}
void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats)
@@ -180,33 +76,3 @@ void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *
offsetof(AVFilterLink, in_packing),
offsetof(AVFilterLink, out_packing));
}
-
-int avfilter_default_query_formats(AVFilterContext *ctx)
-{
- avfilter_set_common_pixel_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_VIDEO));
- avfilter_set_common_sample_formats(ctx, avfilter_make_all_formats(AVMEDIA_TYPE_AUDIO));
- avfilter_set_common_channel_layouts(ctx, avfilter_make_all_channel_layouts());
- avfilter_set_common_packing_formats(ctx, avfilter_make_all_packing_formats());
-
- return 0;
-}
-
-void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
-{
- avfilter_start_frame(link->dst->outputs[0], picref);
-}
-
-void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
-{
- avfilter_draw_slice(link->dst->outputs[0], y, h, slice_dir);
-}
-
-void avfilter_null_end_frame(AVFilterLink *link)
-{
- avfilter_end_frame(link->dst->outputs[0]);
-}
-
-AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
-{
- return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
-}