diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-05-23 21:41:13 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-05-23 21:48:31 +0200 |
commit | d0ad91c258821708ce21b4ae53018922ef1f5614 (patch) | |
tree | 95332c7c22137cedd30a84bcc51cf6924ee2d631 /libavfilter | |
parent | d0f78e77e1cde44532d613525a4f521e8effe3ed (diff) | |
parent | 3f9d6e423978f5e905def374e9c2e9166e3ebb2c (diff) | |
download | ffmpeg-d0ad91c258821708ce21b4ae53018922ef1f5614.tar.gz |
Merge remote-tracking branch 'qatar/master'
* qatar/master:
os_support: Define SHUT_RD, SHUT_WR and SHUT_RDWR on OS/2
http: Add support for reading http POST reply headers
http: Add http_shutdown() for ending writing of posts
tcp: Allow signalling end of reading/writing
avio: Add a function for signalling end of reading/writing
lavfi: fix comment, audio is supported now.
lavfi: fix incorrect comment.
lavfi: remove avfilter_null_* from public API on next bump.
lavfi: remove avfilter_default_* from public API on next bump.
lavfi: deprecate default config_props() callback and refactor avfilter_config_links()
avfiltergraph: smarter sample format selection.
avconv: rename transcode_audio/video to decode_audio/video.
asyncts: reset delta to 0 when it's not used.
x86: lavc: use %if HAVE_AVX guards around AVX functions in yasm code.
dwt: return errors from ff_slice_buffer_init()
Conflicts:
ffmpeg.c
libavfilter/avfilter.c
libavfilter/avfilter.h
libavfilter/formats.c
libavfilter/version.h
libavfilter/vf_blackframe.c
libavfilter/vf_drawtext.c
libavfilter/vf_fade.c
libavfilter/vf_format.c
libavfilter/vf_showinfo.c
libavfilter/video.c
libavfilter/video.h
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavfilter')
29 files changed, 253 insertions, 69 deletions
diff --git a/libavfilter/af_asyncts.c b/libavfilter/af_asyncts.c index 5cde0bf00a..adb5347a80 100644 --- a/libavfilter/af_asyncts.c +++ b/libavfilter/af_asyncts.c @@ -182,10 +182,13 @@ static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *buf) if (labs(delta) > s->min_delta) { av_log(ctx, AV_LOG_VERBOSE, "Discontinuity - %"PRId64" samples.\n", delta); out_size += delta; - } else if (s->resample) { - int comp = av_clip(delta, -s->max_comp, s->max_comp); - av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp); - avresample_set_compensation(s->avr, delta, inlink->sample_rate); + } else { + if (s->resample) { + int comp = av_clip(delta, -s->max_comp, s->max_comp); + av_log(ctx, AV_LOG_VERBOSE, "Compensating %d samples per second.\n", comp); + avresample_set_compensation(s->avr, delta, inlink->sample_rate); + } + delta = 0; } if (out_size > 0) { diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c index c6a8594514..9473c355fe 100644 --- a/libavfilter/avfilter.c +++ b/libavfilter/avfilter.c @@ -202,7 +202,6 @@ int avfilter_config_links(AVFilterContext *filter) link->sample_aspect_ratio = inlink ? inlink->sample_aspect_ratio : (AVRational){1,1}; -#if 1 if (inlink) { if (!link->w) link->w = inlink->w; @@ -233,7 +232,6 @@ int avfilter_config_links(AVFilterContext *filter) link->time_base = (AVRational) {1, link->sample_rate}; } -#endif if ((config_link = link->dstpad->config_props)) if ((ret = config_link(link)) < 0) return ret; diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h index 758d8a8541..c9d63d65f7 100644 --- a/libavfilter/avfilter.h +++ b/libavfilter/avfilter.h @@ -383,7 +383,7 @@ struct AVFilterPad { const char *name; /** - * AVFilterPad type. Can be AVMEDIA_TYPE_VIDEO or AVMEDIA_TYPE_AUDIO. + * AVFilterPad type. */ enum AVMediaType type; @@ -465,7 +465,7 @@ struct AVFilterPad { * * Defaults to just calling the source poll_frame() method. * - * Output video pads only. + * Output pads only. */ int (*poll_frame)(AVFilterLink *link); @@ -476,7 +476,7 @@ struct AVFilterPad { * See avfilter_request_frame() for the error codes with a specific * meaning. * - * Output video pads only. + * Output pads only. */ int (*request_frame)(AVFilterLink *link); @@ -500,19 +500,28 @@ 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); /** 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 /** * Helpers for query_formats() which set all links to the same list of @@ -527,21 +536,24 @@ void avfilter_set_common_channel_layouts(AVFilterContext *ctx, AVFilterFormats * void avfilter_set_common_packing_formats(AVFilterContext *ctx, AVFilterFormats *formats); #endif -/** Default handler for query_formats() */ -int avfilter_default_query_formats(AVFilterContext *ctx); - +#if FF_API_FILTERS_PUBLIC /** start_frame() handler for filters which simply pass video along */ +attribute_deprecated void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); /** draw_slice() handler for filters which simply pass video along */ +attribute_deprecated void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); /** end_frame() handler for filters which simply pass video along */ +attribute_deprecated void avfilter_null_end_frame(AVFilterLink *link); /** get_video_buffer() handler for filters which simply pass video along */ +attribute_deprecated AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h); +#endif /** * Filter definition. This defines the pads a filter contains, and all the diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index 9743009eb5..8d2312e05d 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -227,7 +227,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 */ @@ -571,6 +571,74 @@ static void swap_channel_layouts(AVFilterGraph *graph) swap_channel_layouts_on_filter(graph->filters[i]); } +static void swap_sample_fmts_on_filter(AVFilterContext *filter) +{ + AVFilterLink *link = NULL; + int format, bps; + int i, j; + + for (i = 0; i < filter->input_count; i++) { + link = filter->inputs[i]; + + if (link->type == AVMEDIA_TYPE_AUDIO && + link->out_formats->format_count == 1) + break; + } + if (i == filter->input_count) + return; + + format = link->out_formats->formats[0]; + bps = av_get_bytes_per_sample(format); + + for (i = 0; i < filter->output_count; i++) { + AVFilterLink *outlink = filter->outputs[i]; + int best_idx, best_score = INT_MIN; + + if (outlink->type != AVMEDIA_TYPE_AUDIO || + outlink->in_formats->format_count < 2) + continue; + + for (j = 0; j < outlink->in_formats->format_count; j++) { + int out_format = outlink->in_formats->formats[j]; + int out_bps = av_get_bytes_per_sample(out_format); + int score; + + if (av_get_packed_sample_fmt(out_format) == format || + av_get_planar_sample_fmt(out_format) == format) { + best_idx = j; + break; + } + + /* for s32 and float prefer double to prevent loss of information */ + if (bps == 4 && out_bps == 8) { + best_idx = j; + break; + } + + /* prefer closest higher or equal bps */ + score = -abs(out_bps - bps); + if (out_bps >= bps) + score += INT_MAX/2; + + if (score > best_score) { + best_score = score; + best_idx = j; + } + } + FFSWAP(int, outlink->in_formats->formats[0], + outlink->in_formats->formats[best_idx]); + } +} + +static void swap_sample_fmts(AVFilterGraph *graph) +{ + int i; + + for (i = 0; i < graph->filter_count; i++) + swap_sample_fmts_on_filter(graph->filters[i]); + +} + static int pick_formats(AVFilterGraph *graph) { int i, j, ret; @@ -633,8 +701,9 @@ int ff_avfilter_graph_config_formats(AVFilterGraph *graph, AVClass *log_ctx) * of format conversion inside filters */ reduce_formats(graph); - /* for audio filters, ensure the best sample rate and channel layout + /* for audio filters, ensure the best format, sample rate and channel layout * is selected */ + swap_sample_fmts(graph); swap_samplerates(graph); swap_channel_layouts(graph); diff --git a/libavfilter/formats.c b/libavfilter/formats.c index d0ff717d85..9e15024237 100644 --- a/libavfilter/formats.c +++ b/libavfilter/formats.c @@ -449,7 +449,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 : @@ -534,6 +534,12 @@ int ff_parse_channel_layout(int64_t *ret, const char *arg, void *log_ctx) return 0; } +#if FF_API_FILTERS_PUBLIC +int avfilter_default_query_formats(AVFilterContext *ctx) +{ + return ff_default_query_formats(ctx); +} +#endif #ifdef TEST #undef printf @@ -552,4 +558,3 @@ int main(void) } #endif - diff --git a/libavfilter/formats.h b/libavfilter/formats.h index 7b0eab5dea..c7503d649a 100644 --- a/libavfilter/formats.h +++ b/libavfilter/formats.h @@ -78,4 +78,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 diff --git a/libavfilter/split.c b/libavfilter/split.c index ec34eedb91..97e5265a30 100644 --- a/libavfilter/split.c +++ b/libavfilter/split.c @@ -25,6 +25,7 @@ #include "avfilter.h" #include "audio.h" +#include "video.h" static int split_init(AVFilterContext *ctx, const char *args, void *opaque) { @@ -100,7 +101,7 @@ AVFilter avfilter_vf_split = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer= avfilter_null_get_video_buffer, + .get_video_buffer= ff_null_get_video_buffer, .start_frame = start_frame, .draw_slice = draw_slice, .end_frame = end_frame, }, diff --git a/libavfilter/version.h b/libavfilter/version.h index 7ae29ec36e..7d7a5873c4 100644 --- a/libavfilter/version.h +++ b/libavfilter/version.h @@ -56,5 +56,11 @@ #ifndef FF_API_PACKING #define FF_API_PACKING (LIBAVFILTER_VERSION_MAJOR < 3) #endif +#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 diff --git a/libavfilter/vf_aspect.c b/libavfilter/vf_aspect.c index 8a56116471..685c96f2d2 100644 --- a/libavfilter/vf_aspect.c +++ b/libavfilter/vf_aspect.c @@ -26,6 +26,7 @@ #include "libavutil/mathematics.h" #include "libavutil/parseutils.h" #include "avfilter.h" +#include "video.h" typedef struct { AVRational ratio; @@ -86,9 +87,9 @@ AVFilter avfilter_vf_setdar = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = setdar_config_props, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = start_frame, - .end_frame = avfilter_null_end_frame }, + .end_frame = ff_null_end_frame }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", @@ -118,9 +119,9 @@ AVFilter avfilter_vf_setsar = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = setsar_config_props, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = start_frame, - .end_frame = avfilter_null_end_frame }, + .end_frame = ff_null_end_frame }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", diff --git a/libavfilter/vf_blackframe.c b/libavfilter/vf_blackframe.c index 7e80fd7e46..c54a8e1b45 100644 --- a/libavfilter/vf_blackframe.c +++ b/libavfilter/vf_blackframe.c @@ -29,6 +29,7 @@ #include "avfilter.h" #include "internal.h" +#include "video.h" typedef struct { unsigned int bamount; ///< black amount @@ -127,7 +128,7 @@ AVFilter avfilter_vf_blackframe = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .draw_slice = draw_slice, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = ff_null_start_frame_keep_ref, .end_frame = end_frame, }, { .name = NULL}}, diff --git a/libavfilter/vf_copy.c b/libavfilter/vf_copy.c index d253906786..8f128efc5b 100644 --- a/libavfilter/vf_copy.c +++ b/libavfilter/vf_copy.c @@ -22,6 +22,7 @@ */ #include "avfilter.h" +#include "video.h" AVFilter avfilter_vf_copy = { .name = "copy", @@ -29,9 +30,9 @@ AVFilter avfilter_vf_copy = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, - .end_frame = avfilter_null_end_frame, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, + .end_frame = ff_null_end_frame, .rej_perms = ~0 }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", diff --git a/libavfilter/vf_crop.c b/libavfilter/vf_crop.c index 5015c74dc7..b8cfd440aa 100644 --- a/libavfilter/vf_crop.c +++ b/libavfilter/vf_crop.c @@ -26,6 +26,7 @@ /* #define DEBUG */ #include "avfilter.h" +#include "video.h" #include "libavutil/eval.h" #include "libavutil/avstring.h" #include "libavutil/libm.h" @@ -352,7 +353,7 @@ AVFilter avfilter_vf_crop = { .start_frame = start_frame, .draw_slice = draw_slice, .end_frame = end_frame, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .config_props = config_input, }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", diff --git a/libavfilter/vf_cropdetect.c b/libavfilter/vf_cropdetect.c index 36e6556888..19e6e8d375 100644 --- a/libavfilter/vf_cropdetect.c +++ b/libavfilter/vf_cropdetect.c @@ -25,6 +25,7 @@ #include "libavutil/imgutils.h" #include "avfilter.h" +#include "video.h" typedef struct { int x1, y1, x2, y2; @@ -203,8 +204,8 @@ AVFilter avfilter_vf_cropdetect = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, .end_frame = end_frame, }, { .name = NULL}}, diff --git a/libavfilter/vf_delogo.c b/libavfilter/vf_delogo.c index fbc5bf6c0c..ffef1c7155 100644 --- a/libavfilter/vf_delogo.c +++ b/libavfilter/vf_delogo.c @@ -29,6 +29,7 @@ #include "libavutil/opt.h" #include "libavutil/pixdesc.h" #include "avfilter.h" +#include "video.h" /** * Apply a simple delogo algorithm to the image in dst and put the @@ -275,7 +276,7 @@ AVFilter avfilter_vf_delogo = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = start_frame, .draw_slice = null_draw_slice, .end_frame = end_frame, diff --git a/libavfilter/vf_drawbox.c b/libavfilter/vf_drawbox.c index 4d9bae467e..c23406ad0a 100644 --- a/libavfilter/vf_drawbox.c +++ b/libavfilter/vf_drawbox.c @@ -28,6 +28,7 @@ #include "libavutil/pixdesc.h" #include "libavutil/parseutils.h" #include "avfilter.h" +#include "video.h" enum { Y, U, V, A }; @@ -130,10 +131,10 @@ AVFilter avfilter_vf_drawbox = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_input, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, .draw_slice = draw_slice, - .end_frame = avfilter_null_end_frame, + .end_frame = ff_null_end_frame, .min_perms = AV_PERM_WRITE | AV_PERM_READ, .rej_perms = AV_PERM_PRESERVE }, { .name = NULL}}, diff --git a/libavfilter/vf_drawtext.c b/libavfilter/vf_drawtext.c index 59f6f00191..898bbd40c4 100644 --- a/libavfilter/vf_drawtext.c +++ b/libavfilter/vf_drawtext.c @@ -41,6 +41,7 @@ #include "libavutil/lfg.h" #include "avfilter.h" #include "drawutils.h" +#include "video.h" #undef time @@ -830,8 +831,8 @@ AVFilter avfilter_vf_drawtext = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, .draw_slice = null_draw_slice, .end_frame = end_frame, .config_props = config_input, diff --git a/libavfilter/vf_fade.c b/libavfilter/vf_fade.c index 27f5badbf0..a38387f184 100644 --- a/libavfilter/vf_fade.c +++ b/libavfilter/vf_fade.c @@ -32,6 +32,7 @@ #include "avfilter.h" #include "drawutils.h" #include "internal.h" +#include "video.h" #define R 0 #define G 1 @@ -288,8 +289,8 @@ AVFilter avfilter_vf_fade = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, .config_props = config_props, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, .draw_slice = draw_slice, .end_frame = end_frame, .min_perms = AV_PERM_READ | AV_PERM_WRITE, diff --git a/libavfilter/vf_fifo.c b/libavfilter/vf_fifo.c index 06018116ed..91e4b9d111 100644 --- a/libavfilter/vf_fifo.c +++ b/libavfilter/vf_fifo.c @@ -24,6 +24,7 @@ */ #include "avfilter.h" +#include "video.h" typedef struct BufPic { AVFilterBufferRef *picref; @@ -106,7 +107,7 @@ AVFilter avfilter_vf_fifo = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer= avfilter_null_get_video_buffer, + .get_video_buffer= ff_null_get_video_buffer, .start_frame = start_frame, .draw_slice = draw_slice, .end_frame = end_frame, diff --git a/libavfilter/vf_format.c b/libavfilter/vf_format.c index cbcc24bfba..d8b3a40a7d 100644 --- a/libavfilter/vf_format.c +++ b/libavfilter/vf_format.c @@ -26,6 +26,7 @@ #include "libavutil/pixdesc.h" #include "avfilter.h" #include "internal.h" +#include "video.h" typedef struct { /** @@ -102,10 +103,10 @@ AVFilter avfilter_vf_format = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer= avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, - .draw_slice = avfilter_null_draw_slice, - .end_frame = avfilter_null_end_frame, }, + .get_video_buffer= ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, + .draw_slice = ff_null_draw_slice, + .end_frame = ff_null_end_frame, }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO }, @@ -132,10 +133,10 @@ AVFilter avfilter_vf_noformat = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer= avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, - .draw_slice = avfilter_null_draw_slice, - .end_frame = avfilter_null_end_frame, }, + .get_video_buffer= ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, + .draw_slice = ff_null_draw_slice, + .end_frame = ff_null_end_frame, }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO }, diff --git a/libavfilter/vf_null.c b/libavfilter/vf_null.c index 5718ee0c1d..b98f3efc64 100644 --- a/libavfilter/vf_null.c +++ b/libavfilter/vf_null.c @@ -22,6 +22,7 @@ */ #include "avfilter.h" +#include "video.h" AVFilter avfilter_vf_null = { .name = "null", @@ -31,9 +32,9 @@ AVFilter avfilter_vf_null = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, - .start_frame = avfilter_null_start_frame, - .end_frame = avfilter_null_end_frame }, + .get_video_buffer = ff_null_get_video_buffer, + .start_frame = ff_null_start_frame, + .end_frame = ff_null_end_frame }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", diff --git a/libavfilter/vf_select.c b/libavfilter/vf_select.c index 2ffa496788..d3f649cbff 100644 --- a/libavfilter/vf_select.c +++ b/libavfilter/vf_select.c @@ -26,6 +26,7 @@ #include "libavutil/eval.h" #include "libavutil/fifo.h" #include "avfilter.h" +#include "video.h" static const char *const var_names[] = { "TB", ///< timebase @@ -326,7 +327,7 @@ AVFilter avfilter_vf_select = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .config_props = config_input, .start_frame = start_frame, .draw_slice = draw_slice, diff --git a/libavfilter/vf_setpts.c b/libavfilter/vf_setpts.c index 57b97bb9bd..9a5170037f 100644 --- a/libavfilter/vf_setpts.c +++ b/libavfilter/vf_setpts.c @@ -29,6 +29,7 @@ #include "libavutil/eval.h" #include "libavutil/mathematics.h" #include "avfilter.h" +#include "video.h" static const char *const var_names[] = { "INTERLACED", ///< tell if the current frame is interlaced @@ -139,7 +140,7 @@ AVFilter avfilter_vf_setpts = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .config_props = config_input, .start_frame = start_frame, }, { .name = NULL }}, diff --git a/libavfilter/vf_settb.c b/libavfilter/vf_settb.c index 84bebd6e35..00b735cdf7 100644 --- a/libavfilter/vf_settb.c +++ b/libavfilter/vf_settb.c @@ -29,6 +29,7 @@ #include "libavutil/rational.h" #include "avfilter.h" #include "internal.h" +#include "video.h" static const char *const var_names[] = { "AVTB", /* default timebase 1/AV_TIME_BASE */ @@ -121,9 +122,9 @@ AVFilter avfilter_vf_settb = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = start_frame, - .end_frame = avfilter_null_end_frame }, + .end_frame = ff_null_end_frame }, { .name = NULL }}, .outputs = (const AVFilterPad[]) {{ .name = "default", diff --git a/libavfilter/vf_showinfo.c b/libavfilter/vf_showinfo.c index ece6230877..d14d99b1f1 100644 --- a/libavfilter/vf_showinfo.c +++ b/libavfilter/vf_showinfo.c @@ -28,6 +28,7 @@ #include "libavutil/timestamp.h" #include "avfilter.h" #include "internal.h" +#include "video.h" typedef struct { unsigned int frame; @@ -93,7 +94,7 @@ AVFilter avfilter_vf_showinfo = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = ff_null_start_frame_keep_ref, .end_frame = end_frame, .min_perms = AV_PERM_READ, }, diff --git a/libavfilter/vf_slicify.c b/libavfilter/vf_slicify.c index 0c2f5a66fe..f496bfd9b6 100644 --- a/libavfilter/vf_slicify.c +++ b/libavfilter/vf_slicify.c @@ -24,6 +24,7 @@ */ #include "avfilter.h" +#include "video.h" #include "libavutil/pixdesc.h" typedef struct { @@ -105,11 +106,11 @@ AVFilter avfilter_vf_slicify = { .inputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, - .get_video_buffer = avfilter_null_get_video_buffer, + .get_video_buffer = ff_null_get_video_buffer, .start_frame = start_frame, .draw_slice = draw_slice, .config_props = config_props, - .end_frame = avfilter_null_end_frame, }, + .end_frame = ff_null_end_frame, }, { .name = NULL}}, .outputs = (const AVFilterPad[]) {{ .name = "default", .type = AVMEDIA_TYPE_VIDEO, }, diff --git a/libavfilter/vf_vflip.c b/libavfilter/vf_vflip.c index b01d9f5f10..24288e6966 100644 --- a/libavfilter/vf_vflip.c +++ b/libavfilter/vf_vflip.c @@ -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 ++) { diff --git a/libavfilter/vf_yadif.c b/libavfilter/vf_yadif.c index d7fa98acc4..19b699b584 100644 --- a/libavfilter/vf_yadif.c +++ b/libavfilter/vf_yadif.c @@ -22,6 +22,7 @@ #include "libavutil/common.h" #include "libavutil/pixdesc.h" #include "avfilter.h" +#include "video.h" #include "yadif.h" #undef NDEBUG @@ -179,7 +180,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; diff --git a/libavfilter/video.c b/libavfilter/video.c index 6dbc8cb4cf..5c750ff96a 100644 --- a/libavfilter/video.c +++ b/libavfilter/video.c @@ -20,6 +20,7 @@ #include "avfilter.h" #include "internal.h" +#include "video.h" static char *ff_get_ref_perms_string(char *buf, size_t buf_size, int perms) { @@ -61,12 +62,12 @@ static void ff_dlog_ref(void *ctx, AVFilterBufferRef *ref, int end) av_dlog(ctx, "]%s", end ? "\n" : ""); } -AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) +AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) { return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h); } -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]; @@ -174,7 +175,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; @@ -184,12 +185,12 @@ AVFilterBufferRef *avfilter_get_video_buffer(AVFilterLink *link, int perms, int return ret; } -void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) +void ff_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; @@ -215,7 +216,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; @@ -246,12 +247,12 @@ void avfilter_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) ff_update_link_current_pts(link, link->cur_buf->pts); } -void avfilter_null_end_frame(AVFilterLink *link) +void ff_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; @@ -275,7 +276,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); @@ -287,12 +288,12 @@ void avfilter_end_frame(AVFilterLink *link) } } -void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) +void ff_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; @@ -340,7 +341,41 @@ 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); +} +AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h) +{ + return ff_null_get_video_buffer(link, perms, w, h); +} +void avfilter_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref) +{ + ff_null_start_frame(link, picref); +} +void avfilter_null_end_frame(AVFilterLink *link) +{ + ff_null_end_frame(link); +} +void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) +{ + ff_null_draw_slice(link, y, h, slice_dir); +} +#endif diff --git a/libavfilter/video.h b/libavfilter/video.h new file mode 100644 index 0000000000..d4c31a0ba1 --- /dev/null +++ b/libavfilter/video.h @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Bobby Bingham + * + * This file is part of FFmpeg. + * + * FFmpeg 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. + * + * FFmpeg 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 FFmpeg; 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); +AVFilterBufferRef *ff_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h); + + +void ff_null_start_frame(AVFilterLink *link, AVFilterBufferRef *picref); +void ff_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir); +void ff_null_end_frame(AVFilterLink *link); + +#endif /* AVFILTER_VIDEO_H */ |