[FFmpeg-devel] [PATCH] lavfi: add aliases for buffer and abuffer sources
Stefano Sabatini
stefasab at gmail.com
Sun Dec 1 01:24:56 CET 2013
The new names are consistent with filename and with the corresponding
sink names.
TODO: bump minor
---
doc/filters.texi | 4 ++--
libavfilter/buffersrc.c | 49 +++++++++++++++++++++----------------------------
2 files changed, 23 insertions(+), 30 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 8329bf0..0804bb4 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -1832,7 +1832,7 @@ raising it by +5 dB causes clipping for 6 samples, etc.
Below is a description of the currently available audio sources.
- at section abuffer
+ at section abuffer, abuffersrc
Buffer audio frames, and make them available to the filter chain.
@@ -8285,7 +8285,7 @@ Default value is @code{all}.
Below is a description of the currently available video sources.
- at section buffer
+ at section buffer, buffersrc
Buffer video frames, and make them available to the filter chain.
diff --git a/libavfilter/buffersrc.c b/libavfilter/buffersrc.c
index 6b6210d..0eec106 100644
--- a/libavfilter/buffersrc.c
+++ b/libavfilter/buffersrc.c
@@ -500,7 +500,22 @@ static int poll_frame(AVFilterLink *link)
return size/sizeof(AVFrame*);
}
-static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {
+#define DEFINE_BUFFERSRC(name_, prefix, type_str, outputs_, init_fn) \
+ AVFilter prefix##_##name_ = { \
+ .name = #name_, \
+ .description = NULL_IF_CONFIG_SMALL("Buffer " type_str " frames, and make them accessible to the filterchain."), \
+ .priv_size = sizeof(BufferSourceContext), \
+ .query_formats = query_formats, \
+ \
+ .init = init_fn, \
+ .uninit = uninit, \
+ \
+ .inputs = NULL, \
+ .outputs = outputs_, \
+ .priv_class = &buffer_class, \
+ }
+
+static const AVFilterPad buffersrc_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_VIDEO,
@@ -511,21 +526,10 @@ static const AVFilterPad avfilter_vsrc_buffer_outputs[] = {
{ NULL }
};
-AVFilter ff_vsrc_buffer = {
- .name = "buffer",
- .description = NULL_IF_CONFIG_SMALL("Buffer video frames, and make them accessible to the filterchain."),
- .priv_size = sizeof(BufferSourceContext),
- .query_formats = query_formats,
-
- .init = init_video,
- .uninit = uninit,
-
- .inputs = NULL,
- .outputs = avfilter_vsrc_buffer_outputs,
- .priv_class = &buffer_class,
-};
+DEFINE_BUFFERSRC(buffer, ff_vsrc, "video", buffersrc_outputs, init_video);
+DEFINE_BUFFERSRC(buffersrc, ff_vsrc, "video", buffersrc_outputs, init_video);
-static const AVFilterPad avfilter_asrc_abuffer_outputs[] = {
+static const AVFilterPad abuffersrc_outputs[] = {
{
.name = "default",
.type = AVMEDIA_TYPE_AUDIO,
@@ -536,16 +540,5 @@ static const AVFilterPad avfilter_asrc_abuffer_outputs[] = {
{ NULL }
};
-AVFilter ff_asrc_abuffer = {
- .name = "abuffer",
- .description = NULL_IF_CONFIG_SMALL("Buffer audio frames, and make them accessible to the filterchain."),
- .priv_size = sizeof(BufferSourceContext),
- .query_formats = query_formats,
-
- .init = init_audio,
- .uninit = uninit,
-
- .inputs = NULL,
- .outputs = avfilter_asrc_abuffer_outputs,
- .priv_class = &abuffer_class,
-};
+DEFINE_BUFFERSRC(abuffer, ff_asrc, "audio", abuffersrc_outputs, init_audio);
+DEFINE_BUFFERSRC(abuffersrc, ff_asrc, "audio", abuffersrc_outputs, init_audio);
--
1.8.1.2
More information about the ffmpeg-devel
mailing list