History

lavfi: remove some audio-related function from public API.

Those functions are only useful inside filters. It is better to not support user filters until the API is more stable. This breaks audio filtering API and ABI in theory, but since it's unusable right now this shouldn't be a problem.

Anton Khirnov committed 14 years ago

Commit 472fb3b1 parent f20ab495 files · +86 −57Browse files

Unified · Split

5 files
  1. libavfilter/af_anull.c +3 −2
  2. libavfilter/audio.h +61 −0
  3. libavfilter/avfilter.c +9 −7
  4. libavfilter/avfilter.h +0 −37
  5. libavfilter/defaults.c +13 −11
libavfilter/af_anull.c+3−2
@@ -21,6 +21,7 @@ · 20 unmodified lines
2121 * null audio filter
2222 */
2323
24+#include "audio.h"
2425 #include "avfilter.h"
2526
2627 AVFilter avfilter_af_anull = {
@@ -31,8 +32,8 @@ AVFilter avfilter_af_anull = { · 4 unmodified lines
3132
3233 .inputs = (AVFilterPad[]) {{ .name = "default",
3334 .type = AVMEDIA_TYPE_AUDIO,
34− .get_audio_buffer = avfilter_null_get_audio_buffer,
35− .filter_samples = avfilter_null_filter_samples },
35+ .get_audio_buffer = ff_null_get_audio_buffer,
36+ .filter_samples = ff_null_filter_samples },
3637 { .name = NULL}},
3738
3839 .outputs = (AVFilterPad[]) {{ .name = "default",
libavfilter/audio.h+61−0
@@ -0,0 +1,61 @@
1+/*
2+ * This file is part of Libav.
3+ *
4+ * Libav is free software; you can redistribute it and/or
5+ * modify it under the terms of the GNU Lesser General Public
6+ * License as published by the Free Software Foundation; either
7+ * version 2.1 of the License, or (at your option) any later version.
8+ *
9+ * Libav is distributed in the hope that it will be useful,
10+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12+ * Lesser General Public License for more details.
13+ *
14+ * You should have received a copy of the GNU Lesser General Public
15+ * License along with Libav; if not, write to the Free Software
16+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
17+ */
18+
19+#ifndef AVFILTER_AUDIO_H
20+#define AVFILTER_AUDIO_H
21+
22+#include "avfilter.h"
23+
24+/** default handler for get_audio_buffer() for audio inputs */
25+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
26+ int nb_samples);
27+
28+/** get_audio_buffer() handler for filters which simply pass audio along */
29+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
30+ int nb_samples);
31+
32+/**
33+ * Request an audio samples buffer with a specific set of permissions.
34+ *
35+ * @param link the output link to the filter from which the buffer will
36+ * be requested
37+ * @param perms the required access permissions
38+ * @param nb_samples the number of samples per channel
39+ * @return A reference to the samples. This must be unreferenced with
40+ * avfilter_unref_buffer when you are finished with it.
41+ */
42+AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
43+ int nb_samples);
44+
45+/** default handler for filter_samples() for audio inputs */
46+void ff_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
47+
48+/** filter_samples() handler for filters which simply pass audio along */
49+void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
50+
51+/**
52+ * Send a buffer of audio samples to the next filter.
53+ *
54+ * @param link the output link over which the audio samples are being sent
55+ * @param samplesref a reference to the buffer of audio samples being sent. The
56+ * receiving filter will free this reference when it no longer
57+ * needs it or pass it on to the next filter.
58+ */
59+void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
60+
61+#endif /* AVFILTER_AUDIO_H */
libavfilter/avfilter.c+9−7
@@ -26,6 +26,8 @@ · 25 unmodified lines
2626 #include "libavutil/audioconvert.h"
2727 #include "libavutil/imgutils.h"
2828 #include "libavcodec/avcodec.h"
29+
30+#include "audio.h"
2931 #include "avfilter.h"
3032 #include "internal.h"
3133
@@ -366,8 +368,8 @@ fail: · 334 unmodified lines
366368 return NULL;
367369 }
368370
369−AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
370− int nb_samples)
371+AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
372+ int nb_samples)
371373 {
372374 AVFilterBufferRef *ret = NULL;
373375
@@ -375,7 +377,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, · 1 unmodified line
375377 ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);
376378
377379 if (!ret)
378− ret = avfilter_default_get_audio_buffer(link, perms, nb_samples);
380+ ret = ff_default_get_audio_buffer(link, perms, nb_samples);
379381
380382 if (ret)
381383 ret->type = AVMEDIA_TYPE_AUDIO;
@@ -570,7 +572,7 @@ void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir) · 188 unmodified lines
570572 draw_slice(link, y, h, slice_dir);
571573 }
572574
573−void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
575+void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
574576 {
575577 void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
576578 AVFilterPad *dst = link->dstpad;
@@ -578,7 +580,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) · 1 unmodified line
578580 FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
579581
580582 if (!(filter_samples = dst->filter_samples))
581− filter_samples = avfilter_default_filter_samples;
583+ filter_samples = ff_default_filter_samples;
582584
583585 /* prepare to copy the samples if the buffer has insufficient permissions */
584586 if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
@@ -591,8 +593,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) · 6 unmodified lines
591593 "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",
592594 samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);
593595
594− link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms,
595− samplesref->audio->nb_samples);
596+ link->cur_buf = ff_default_get_audio_buffer(link, dst->min_perms,
597+ samplesref->audio->nb_samples);
596598 link->cur_buf->pts = samplesref->pts;
597599 link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
598600
libavfilter/avfilter.h+0−37
@@ -460,9 +460,6 @@ void avfilter_default_draw_slice(AVFilterLink *link, int y, int h, int slice_dir · 459 unmodified lines
460460 /** default handler for end_frame() for video inputs */
461461 void avfilter_default_end_frame(AVFilterLink *link);
462462
463−/** default handler for filter_samples() for audio inputs */
464−void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
465−
466463 /** default handler for config_props() for audio/video outputs */
467464 int avfilter_default_config_output_link(AVFilterLink *link);
468465
@@ -470,10 +467,6 @@ int avfilter_default_config_output_link(AVFilterLink *link); · 1 unmodified line
470467 AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
471468 int perms, int w, int h);
472469
473−/** default handler for get_audio_buffer() for audio inputs */
474−AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
475− int nb_samples);
476−
477470 /**
478471 * A helper for query_formats() which sets all links to the same list of
479472 * 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); · 13 unmodified lines
493486 /** end_frame() handler for filters which simply pass video along */
494487 void avfilter_null_end_frame(AVFilterLink *link);
495488
496−/** filter_samples() handler for filters which simply pass audio along */
497−void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
498−
499489 /** get_video_buffer() handler for filters which simply pass video along */
500490 AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,
501491 int perms, int w, int h);
502492
503−/** get_audio_buffer() handler for filters which simply pass audio along */
504−AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
505− int nb_samples);
506−
507493 /**
508494 * Filter definition. This defines the pads a filter contains, and all the
509495 * callback functions used to interact with the filter.
@@ -683,19 +669,6 @@ AVFilterBufferRef * · 173 unmodified lines
683669 avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
684670 int w, int h, enum PixelFormat format);
685671
686−/**
687− * Request an audio samples buffer with a specific set of permissions.
688− *
689− * @param link the output link to the filter from which the buffer will
690− * be requested
691− * @param perms the required access permissions
692− * @param nb_samples the number of samples per channel
693− * @return A reference to the samples. This must be unreferenced with
694− * avfilter_unref_buffer when you are finished with it.
695− */
696−AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
697− int nb_samples);
698−
699672 /**
700673 * Create an audio buffer reference wrapped around an already
701674 * allocated samples buffer.
@@ -766,16 +739,6 @@ void avfilter_end_frame(AVFilterLink *link); · 64 unmodified lines
766739 */
767740 void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
768741
769−/**
770− * Send a buffer of audio samples to the next filter.
771− *
772− * @param link the output link over which the audio samples are being sent
773− * @param samplesref a reference to the buffer of audio samples being sent. The
774− * receiving filter will free this reference when it no longer
775− * needs it or pass it on to the next filter.
776− */
777−void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
778−
779742 /** Initialize the filter system. Register all builtin filters. */
780743 void avfilter_register_all(void);
781744
libavfilter/defaults.c+13−11
@@ -22,6 +22,8 @@ · 21 unmodified lines
2222 #include "libavutil/audioconvert.h"
2323 #include "libavutil/imgutils.h"
2424 #include "libavutil/samplefmt.h"
25+
26+#include "audio.h"
2527 #include "avfilter.h"
2628 #include "internal.h"
2729
@@ -57,8 +59,8 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per · 29 unmodified lines
5759 return picref;
5860 }
5961
60−AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
61− int nb_samples)
62+AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
63+ int nb_samples)
6264 {
6365 AVFilterBufferRef *samplesref = NULL;
6466 uint8_t **data;
@@ -133,7 +135,7 @@ void avfilter_default_end_frame(AVFilterLink *inlink) · 68 unmodified lines
133135 }
134136
135137 /* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
136−void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
138+void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
137139 {
138140 AVFilterLink *outlink = NULL;
139141
@@ -141,11 +143,11 @@ void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa · 1 unmodified line
141143 outlink = inlink->dst->outputs[0];
142144
143145 if (outlink) {
144− outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE,
145− samplesref->audio->nb_samples);
146+ outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
147+ samplesref->audio->nb_samples);
146148 outlink->out_buf->pts = samplesref->pts;
147149 outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;
148− avfilter_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
150+ ff_filter_samples(outlink, avfilter_ref_buffer(outlink->out_buf, ~0));
149151 avfilter_unref_buffer(outlink->out_buf);
150152 outlink->out_buf = NULL;
151153 }
@@ -233,9 +235,9 @@ void avfilter_null_end_frame(AVFilterLink *link) · 81 unmodified lines
233235 avfilter_end_frame(link->dst->outputs[0]);
234236 }
235237
236−void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
238+void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
237239 {
238− avfilter_filter_samples(link->dst->outputs[0], samplesref);
240+ ff_filter_samples(link->dst->outputs[0], samplesref);
239241 }
240242
241243 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, · 1 unmodified line
243245 return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
244246 }
245247
246−AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
247− int nb_samples)
248+AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
249+ int nb_samples)
248250 {
249− return avfilter_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
251+ return ff_get_audio_buffer(link->dst->outputs[0], perms, nb_samples);
250252 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t