lavfi: remove avfilter_default_* from public API on next bump.

Those functions are only useful inside filters. It is better to not
support user filters until the API is more stable.
This commit is contained in:
Anton Khirnov 2012-05-19 10:37:56 +02:00
parent 88c3b87bd8
commit 43c7a01e98
10 changed files with 81 additions and 16 deletions

View File

@ -451,13 +451,17 @@ struct AVFilterPad {
int (*config_props)(AVFilterLink *link);
};
#if FF_API_FILTERS_PUBLIC
/** default handler for start_frame() for video inputs */
attribute_deprecated
void avfilter_default_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);
/** default handler for draw_slice() for video inputs */
attribute_deprecated
void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
/** default handler for end_frame() for video inputs */
attribute_deprecated
void avfilter_default_end_frame(AVFilterLink *link);
#if FF_API_DEFAULT_CONFIG_OUTPUT_LINK
@ -467,9 +471,15 @@ int avfilter_default_config_output_link(AVFilterLink *link);
#endif
/** default handler for get_video_buffer() for video inputs */
attribute_deprecated
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
int perms, int w, int h);
/** Default handler for query_formats() */
attribute_deprecated
int avfilter_default_query_formats(AVFilterContext *ctx);
#endif
/**
* A helper for query_formats() which sets all links to the same list of
* formats. If there are no links hooked to this filter, the list of formats is
@ -477,9 +487,6 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
*/
void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats);
/** Default handler for query_formats() */
int avfilter_default_query_formats(AVFilterContext *ctx);
/** start_frame() handler for filters which simply pass video along */
void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref);

View File

@ -161,7 +161,7 @@ static int query_formats(AVFilterGraph *graph, AVClass *log_ctx)
if (graph->filters[i]->filter->query_formats)
graph->filters[i]->filter->query_formats(graph->filters[i]);
else
avfilter_default_query_formats(graph->filters[i]);
ff_default_query_formats(graph->filters[i]);
}
/* go through and merge as many format lists as possible */

View File

@ -364,7 +364,7 @@ void avfilter_set_common_formats(AVFilterContext *ctx, AVFilterFormats *formats)
avfilter_formats_ref, formats);
}
int avfilter_default_query_formats(AVFilterContext *ctx)
int ff_default_query_formats(AVFilterContext *ctx)
{
enum AVMediaType type = ctx->inputs && ctx->inputs [0] ? ctx->inputs [0]->type :
ctx->outputs && ctx->outputs[0] ? ctx->outputs[0]->type :
@ -378,3 +378,10 @@ int avfilter_default_query_formats(AVFilterContext *ctx)
return 0;
}
#if FF_API_FILTERS_PUBLIC
int avfilter_default_query_formats(AVFilterContext *ctx)
{
return ff_default_query_formats(ctx);
}
#endif

View File

@ -75,4 +75,6 @@ void ff_channel_layouts_unref(AVFilterChannelLayouts **ref);
void ff_channel_layouts_changeref(AVFilterChannelLayouts **oldref,
AVFilterChannelLayouts **newref);
int ff_default_query_formats(AVFilterContext *ctx);
#endif // AVFILTER_FORMATS_H

View File

@ -56,5 +56,8 @@
#ifndef FF_API_DEFAULT_CONFIG_OUTPUT_LINK
#define FF_API_DEFAULT_CONFIG_OUTPUT_LINK (LIBAVFILTER_VERSION_MAJOR < 3)
#endif
#ifndef FF_API_FILTERS_PUBLIC
#define FF_API_FILTERS_PUBLIC (LIBAVFILTER_VERSION_MAJOR < 3)
#endif
#endif // AVFILTER_VERSION_H

View File

@ -25,6 +25,7 @@
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "video.h"
typedef struct {
int vsub; ///< vertical chroma subsampling
@ -47,7 +48,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms,
int i;
if (!(perms & AV_PERM_NEG_LINESIZES))
return avfilter_default_get_video_buffer(link, perms, w, h);
return ff_default_get_video_buffer(link, perms, w, h);
picref = avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
for (i = 0; i < 4; i ++) {

View File

@ -23,6 +23,7 @@
#include "libavutil/common.h"
#include "libavutil/pixdesc.h"
#include "avfilter.h"
#include "video.h"
#include "yadif.h"
#undef NDEBUG
@ -180,7 +181,7 @@ static AVFilterBufferRef *get_video_buffer(AVFilterLink *link, int perms, int w,
int height= FFALIGN(h+2, 32);
int i;
picref = avfilter_default_get_video_buffer(link, perms, width, height);
picref = ff_default_get_video_buffer(link, perms, width, height);
picref->video->w = w;
picref->video->h = h;

View File

@ -20,6 +20,7 @@
#include "avfilter.h"
#include "internal.h"
#include "video.h"
#ifdef DEBUG
static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms)
@ -72,7 +73,7 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms,
/* 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)
AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
int linesize[4];
uint8_t *data[4];
@ -149,7 +150,7 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int
ret = link->dstpad->get_video_buffer(link, perms, w, h);
if (!ret)
ret = avfilter_default_get_video_buffer(link, perms, w, h);
ret = ff_default_get_video_buffer(link, perms, w, h);
if (ret)
ret->type = AVMEDIA_TYPE_VIDEO;
@ -164,7 +165,7 @@ void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
avfilter_start_frame(link->dst->outputs[0], picref);
}
void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
static void default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
AVFilterLink *outlink = NULL;
@ -189,7 +190,7 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref)
FF_DPRINTF_START(NULL, start_frame); ff_dlog_link(NULL, link, 0); av_dlog(NULL, " "); ff_dlog_ref(NULL, picref, 1);
if (!(start_frame = dst->start_frame))
start_frame = avfilter_default_start_frame;
start_frame = default_start_frame;
if (picref->linesize[0] < 0)
perms |= AV_PERM_NEG_LINESIZES;
@ -215,7 +216,7 @@ void avfilter_null_end_frame(AVFilterLink *link)
avfilter_end_frame(link->dst->outputs[0]);
}
void avfilter_default_end_frame(AVFilterLink *inlink)
static void default_end_frame(AVFilterLink *inlink)
{
AVFilterLink *outlink = NULL;
@ -239,7 +240,7 @@ void avfilter_end_frame(AVFilterLink *link)
void (*end_frame)(AVFilterLink *);
if (!(end_frame = link->dstpad->end_frame))
end_frame = avfilter_default_end_frame;
end_frame = default_end_frame;
end_frame(link);
@ -256,7 +257,7 @@ 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_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
static void default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
AVFilterLink *outlink = NULL;
@ -304,7 +305,25 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
}
if (!(draw_slice = link->dstpad->draw_slice))
draw_slice = avfilter_default_draw_slice;
draw_slice = default_draw_slice;
draw_slice(link, y, h, slice_dir);
}
#if FF_API_FILTERS_PUBLIC
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
{
return ff_default_get_video_buffer(link, perms, w, h);
}
void avfilter_default_start_frame(AVFilterLink *inlink, AVFilterBufferRef *picref)
{
default_start_frame(inlink, picref);
}
void avfilter_default_end_frame(AVFilterLink *inlink)
{
default_end_frame(inlink);
}
void avfilter_default_draw_slice(AVFilterLink *inlink, int y, int h, int slice_dir)
{
default_draw_slice(inlink, y, h, slice_dir);
}
#endif

24
libavfilter/video.h Normal file
View File

@ -0,0 +1,24 @@
/*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef AVFILTER_VIDEO_H
#define AVFILTER_VIDEO_H
AVFilterBufferRef *ff_default_get_video_buffer(AVFilterLink *link,
int perms, int w, int h);
#endif /* AVFILTER_VIDEO_H */

View File

@ -21,6 +21,7 @@
#include "libavformat/avformat.h"
#include "libavutil/pixdesc.h"
#include "libavfilter/avfilter.h"
#include "libavfilter/formats.h"
int main(int argc, char **argv)
{
@ -75,7 +76,7 @@ int main(int argc, char **argv)
if (filter->query_formats)
filter->query_formats(filter_ctx);
else
avfilter_default_query_formats(filter_ctx);
ff_default_query_formats(filter_ctx);
/* print the supported formats in input */
for (i = 0; i < filter_ctx->input_count; i++) {