[FFmpeg-cvslog] lavfi/audio: eliminate ff_default_filter_samples().

Anton Khirnov git at videolan.org
Sun Jun 24 02:20:44 CEST 2012


ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Jun 17 10:09:54 2012 +0200| [fa0662393096a1ece73ccc321cd5b8948e96e431] | committer: Anton Khirnov

lavfi/audio: eliminate ff_default_filter_samples().

It currently does the following:
1) get a zeroed audio buffer
2) copy some properties (but not the data) of the input buffer to it
3) pass this buffer to the output filter
This looks useless and is indeed not used by any filters, therefore
delete it.

Make ff_null_filter_samples() (just pass the buffer to the next filter)
the new default.

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=fa0662393096a1ece73ccc321cd5b8948e96e431
---

 libavfilter/af_aformat.c |    3 +--
 libavfilter/af_anull.c   |    3 +--
 libavfilter/audio.c      |   26 +++-----------------------
 libavfilter/audio.h      |    6 ------
 4 files changed, 5 insertions(+), 33 deletions(-)

diff --git a/libavfilter/af_aformat.c b/libavfilter/af_aformat.c
index 3a75b92..5b00d7d 100644
--- a/libavfilter/af_aformat.c
+++ b/libavfilter/af_aformat.c
@@ -139,8 +139,7 @@ AVFilter avfilter_af_aformat = {
     .priv_size     = sizeof(AFormatContext),
 
     .inputs        = (AVFilterPad[]) {{ .name            = "default",
-                                        .type            = AVMEDIA_TYPE_AUDIO,
-                                        .filter_samples  = ff_null_filter_samples },
+                                        .type            = AVMEDIA_TYPE_AUDIO, },
                                       { .name = NULL}},
     .outputs       = (AVFilterPad[]) {{ .name            = "default",
                                         .type            = AVMEDIA_TYPE_AUDIO},
diff --git a/libavfilter/af_anull.c b/libavfilter/af_anull.c
index 294586e..231fc8c 100644
--- a/libavfilter/af_anull.c
+++ b/libavfilter/af_anull.c
@@ -33,8 +33,7 @@ AVFilter avfilter_af_anull = {
 
     .inputs    = (AVFilterPad[]) {{ .name             = "default",
                                     .type             = AVMEDIA_TYPE_AUDIO,
-                                    .get_audio_buffer = ff_null_get_audio_buffer,
-                                    .filter_samples   = ff_null_filter_samples },
+                                    .get_audio_buffer = ff_null_get_audio_buffer, },
                                   { .name = NULL}},
 
     .outputs   = (AVFilterPad[]) {{ .name             = "default",
diff --git a/libavfilter/audio.c b/libavfilter/audio.c
index 72e2ced..1489608 100644
--- a/libavfilter/audio.c
+++ b/libavfilter/audio.c
@@ -146,32 +146,12 @@ fail:
     return NULL;
 }
 
-void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
+static void default_filter_samples(AVFilterLink *link,
+                                   AVFilterBufferRef *samplesref)
 {
     ff_filter_samples(link->dst->outputs[0], samplesref);
 }
 
-/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
-void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
-{
-    AVFilterLink *outlink = NULL;
-
-    if (inlink->dst->nb_outputs)
-        outlink = inlink->dst->outputs[0];
-
-    if (outlink) {
-        outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
-                                                       samplesref->audio->nb_samples);
-        outlink->out_buf->pts                = samplesref->pts;
-        outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;
-        ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
-        avfilter_unref_buffer(outlink->out_buf);
-        outlink->out_buf = NULL;
-    }
-    avfilter_unref_buffer(samplesref);
-    inlink->cur_buf = NULL;
-}
-
 void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
 {
     void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
@@ -181,7 +161,7 @@ void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
     FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
 
     if (!(filter_samples = dst->filter_samples))
-        filter_samples = ff_default_filter_samples;
+        filter_samples = default_filter_samples;
 
     /* prepare to copy the samples if the buffer has insufficient permissions */
     if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
diff --git a/libavfilter/audio.h b/libavfilter/audio.h
index 935bec5..9af44f8 100644
--- a/libavfilter/audio.h
+++ b/libavfilter/audio.h
@@ -42,12 +42,6 @@ AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
 AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
                                              int nb_samples);
 
-/** default handler for filter_samples() for audio inputs */
-void ff_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
-/** filter_samples() handler for filters which simply pass audio along */
-void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
 /**
  * Send a buffer of audio samples to the next filter.
  *



More information about the ffmpeg-cvslog mailing list