summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libavfilter/af_anull.c5
-rw-r--r--libavfilter/audio.h61
-rw-r--r--libavfilter/avfilter.c16
-rw-r--r--libavfilter/avfilter.h37
-rw-r--r--libavfilter/defaults.c24
5 files changed, 86 insertions, 57 deletions
diff --git a/libavfilter/af_anull.c b/libavfilter/af_anull.c
index e2bed36f0a..59b275c767 100644
--- a/libavfilter/af_anull.c
+++ b/libavfilter/af_anull.c
@@ -21,6 +21,7 @@
* null audio filter
*/
+#include "audio.h"
#include "avfilter.h"
AVFilter avfilter_af_anull = {
@@ -31,8 +32,8 @@ AVFilter avfilter_af_anull = {
.inputs = (AVFilterPad[]) {{ .name = "default",
.type = AVMEDIA_TYPE_AUDIO,
- .get_audio_buffer = avfilter_null_get_audio_buffer,
- .filter_samples = avfilter_null_filter_samples },
+ .get_audio_buffer = ff_null_get_audio_buffer,
+ .filter_samples = ff_null_filter_samples },
{ .name = NULL}},
.outputs = (AVFilterPad[]) {{ .name = "default",
diff --git a/libavfilter/audio.h b/libavfilter/audio.h
new file mode 100644
index 0000000000..935bec5c43
--- /dev/null
+++ b/libavfilter/audio.h
@@ -0,0 +1,61 @@
+/*
+ * 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_AUDIO_H
+#define AVFILTER_AUDIO_H
+
+#include "avfilter.h"
+
+/** default handler for get_audio_buffer() for audio inputs */
+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples);
+
+/** get_audio_buffer() handler for filters which simply pass audio along */
+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples);
+
+/**
+ * Request an audio samples buffer with a specific set of permissions.
+ *
+ * @param link the output link to the filter from which the buffer will
+ * be requested
+ * @param perms the required access permissions
+ * @param nb_samples the number of samples per channel
+ * @return A reference to the samples. This must be unreferenced with
+ * avfilter_unref_buffer when you are finished with it.
+ */
+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.
+ *
+ * @param link the output link over which the audio samples are being sent
+ * @param samplesref a reference to the buffer of audio samples being sent. The
+ * receiving filter will free this reference when it no longer
+ * needs it or pass it on to the next filter.
+ */
+void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
+
+#endif /* AVFILTER_AUDIO_H */
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index e301ddb37b..6a530f8fd6 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -26,6 +26,8 @@
#include "libavutil/audioconvert.h"
#include "libavutil/imgutils.h"
#include "libavcodec/avcodec.h"
+
+#include "audio.h"
#include "avfilter.h"
#include "internal.h"
@@ -366,8 +368,8 @@ fail:
return NULL;
}
-AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples)
+AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
{
AVFilterBufferRef *ret = NULL;
@@ -375,7 +377,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);
if (!ret)
- ret = avfilter_default_get_audio_buffer(link, perms, nb_samples);
+ ret = ff_default_get_audio_buffer(link, perms, nb_samples);
if (ret)
ret->type = AVMEDIA_TYPE_AUDIO;
@@ -570,7 +572,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir)
draw_slice(link, y, h, slice_dir);
}
-void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
+void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
{
void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
AVFilterPad *dst = link->dstpad;
@@ -578,7 +580,7 @@ void avfilter_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 = avfilter_default_filter_samples;
+ filter_samples = ff_default_filter_samples;
/* prepare to copy the samples if the buffer has insufficient permissions */
if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
@@ -591,8 +593,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
"Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",
samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);
- link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms,
- samplesref->audio->nb_samples);
+ link->cur_buf = ff_default_get_audio_buffer(link, dst->min_perms,
+ samplesref->audio->nb_samples);
link->cur_buf->pts = samplesref->pts;
link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 69ada1b8be..fd996db94b 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -460,9 +460,6 @@ void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir
/** default handler for end_frame() for video inputs */
void avfilter_default_end_frame(AVFilterLink *link);
-/** default handler for filter_samples() for audio inputs */
-void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
/** default handler for config_props() for audio/video outputs */
int avfilter_default_config_output_link(AVFilterLink *link);
@@ -470,10 +467,6 @@ int avfilter_default_config_output_link(AVFilterLink *link);
AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
int perms, int w, int h);
-/** default handler for get_audio_buffer() for audio inputs */
-AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples);
-
/**
* 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
@@ -493,17 +486,10 @@ void avfilter_null_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
/** end_frame() handler for filters which simply pass video along */
void avfilter_null_end_frame(AVFilterLink *link);
-/** filter_samples() handler for filters which simply pass audio along */
-void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
/** get_video_buffer() handler for filters which simply pass video along */
AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,
int perms, int w, int h);
-/** get_audio_buffer() handler for filters which simply pass audio along */
-AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples);
-
/**
* Filter definition. This defines the pads a filter contains, and all the
* callback functions used to interact with the filter.
@@ -684,19 +670,6 @@ avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int
int w, int h, enum PixelFormat format);
/**
- * Request an audio samples buffer with a specific set of permissions.
- *
- * @param link the output link to the filter from which the buffer will
- * be requested
- * @param perms the required access permissions
- * @param nb_samples the number of samples per channel
- * @return A reference to the samples. This must be unreferenced with
- * avfilter_unref_buffer when you are finished with it.
- */
-AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples);
-
-/**
* Create an audio buffer reference wrapped around an already
* allocated samples buffer.
*
@@ -766,16 +739,6 @@ void avfilter_end_frame(AVFilterLink *link);
*/
void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
-/**
- * Send a buffer of audio samples to the next filter.
- *
- * @param link the output link over which the audio samples are being sent
- * @param samplesref a reference to the buffer of audio samples being sent. The
- * receiving filter will free this reference when it no longer
- * needs it or pass it on to the next filter.
- */
-void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
-
/** Initialize the filter system. Register all builtin filters. */
void avfilter_register_all(void);
diff --git a/libavfilter/defaults.c b/libavfilter/defaults.c
index df05c06d63..c25d37f8b3 100644
--- a/libavfilter/defaults.c
+++ b/libavfilter/defaults.c
@@ -22,6 +22,8 @@
#include "libavutil/audioconvert.h"
#include "libavutil/imgutils.h"
#include "libavutil/samplefmt.h"
+
+#include "audio.h"
#include "avfilter.h"
#include "internal.h"
@@ -57,8 +59,8 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per
return picref;
}
-AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples)
+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
{
AVFilterBufferRef *samplesref = NULL;
uint8_t **data;
@@ -133,7 +135,7 @@ void avfilter_default_end_frame(AVFilterLink *inlink)
}
/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
-void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
+void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
{
AVFilterLink *outlink = NULL;
@@ -141,11 +143,11 @@ void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa
outlink = inlink->dst->outputs[0];
if (outlink) {
- outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE,
- samplesref->audio->nb_samples);
+ 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;
- avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
+ ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
avfilter_unref_buffer(outlink->out_buf);
outlink->out_buf = NULL;
}
@@ -233,9 +235,9 @@ void avfilter_null_end_frame(AVFilterLink *link)
avfilter_end_frame(link->dst->outputs[0]);
}
-void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
+void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
{
- avfilter_filter_samples(link->dst->outputs[0], samplesref);
+ ff_filter_samples(link->dst->outputs[0], samplesref);
}
AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)
@@ -243,8 +245,8 @@ AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms,
return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
}
-AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
- int nb_samples)
+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
+ int nb_samples)
{
- return avfilter_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
+ return ff_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
}