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
21 * null audio filter21 * null audio filter
22 */22 */
23 23
24#include "audio.h"
24#include "avfilter.h"25#include "avfilter.h"
25 26
26AVFilter avfilter_af_anull = {27AVFilter avfilter_af_anull = {
@@ -31,8 +32,8 @@ AVFilter avfilter_af_anull = { · 4 unmodified lines
31 32
32 .inputs = (AVFilterPad[]) {{ .name = "default",33 .inputs = (AVFilterPad[]) {{ .name = "default",
33 .type = AVMEDIA_TYPE_AUDIO,34 .type = AVMEDIA_TYPE_AUDIO,
34 .get_audio_buffer = avfilter_null_get_audio_buffer,35 .get_audio_buffer = ff_null_get_audio_buffer,
35 .filter_samples = avfilter_null_filter_samples },36 .filter_samples = ff_null_filter_samples },
36 { .name = NULL}},37 { .name = NULL}},
37 38
38 .outputs = (AVFilterPad[]) {{ .name = "default",39 .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 */
25AVFilterBufferRef *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 */
29AVFilterBufferRef *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 */
42AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
43 int nb_samples);
44
45/** default handler for filter_samples() for audio inputs */
46void ff_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
47
48/** filter_samples() handler for filters which simply pass audio along */
49void 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 */
59void 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
26#include "libavutil/audioconvert.h"26#include "libavutil/audioconvert.h"
27#include "libavutil/imgutils.h"27#include "libavutil/imgutils.h"
28#include "libavcodec/avcodec.h"28#include "libavcodec/avcodec.h"
29
30#include "audio.h"
29#include "avfilter.h"31#include "avfilter.h"
30#include "internal.h"32#include "internal.h"
31 33
@@ -366,8 +368,8 @@ fail: · 334 unmodified lines
366 return NULL;368 return NULL;
367}369}
368 370
369AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,371AVFilterBufferRef *ff_get_audio_buffer(AVFilterLink *link, int perms,
370 int nb_samples)372 int nb_samples)
371{373{
372 AVFilterBufferRef *ret = NULL;374 AVFilterBufferRef *ret = NULL;
373 375
@@ -375,7 +377,7 @@ AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms, · 1 unmodified line
375 ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);377 ret = link->dstpad->get_audio_buffer(link, perms, nb_samples);
376 378
377 if (!ret)379 if (!ret)
378 ret = avfilter_default_get_audio_buffer(link, perms, nb_samples);380 ret = ff_default_get_audio_buffer(link, perms, nb_samples);
379 381
380 if (ret)382 if (ret)
381 ret->type = AVMEDIA_TYPE_AUDIO;383 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
570 draw_slice(link, y, h, slice_dir);572 draw_slice(link, y, h, slice_dir);
571}573}
572 574
573void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)575void ff_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
574{576{
575 void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);577 void (*filter_samples)(AVFilterLink *, AVFilterBufferRef *);
576 AVFilterPad *dst = link->dstpad;578 AVFilterPad *dst = link->dstpad;
@@ -578,7 +580,7 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) · 1 unmodified line
578 FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);580 FF_DPRINTF_START(NULL, filter_samples); ff_dlog_link(NULL, link, 1);
579 581
580 if (!(filter_samples = dst->filter_samples))582 if (!(filter_samples = dst->filter_samples))
581 filter_samples = avfilter_default_filter_samples;583 filter_samples = ff_default_filter_samples;
582 584
583 /* prepare to copy the samples if the buffer has insufficient permissions */585 /* prepare to copy the samples if the buffer has insufficient permissions */
584 if ((dst->min_perms & samplesref->perms) != dst->min_perms ||586 if ((dst->min_perms & samplesref->perms) != dst->min_perms ||
@@ -591,8 +593,8 @@ void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref) · 6 unmodified lines
591 "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",593 "Copying audio data in avfilter (have perms %x, need %x, reject %x)\n",
592 samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);594 samplesref->perms, link->dstpad->min_perms, link->dstpad->rej_perms);
593 595
594 link->cur_buf = avfilter_default_get_audio_buffer(link, dst->min_perms,596 link->cur_buf = ff_default_get_audio_buffer(link, dst->min_perms,
595 samplesref->audio->nb_samples);597 samplesref->audio->nb_samples);
596 link->cur_buf->pts = samplesref->pts;598 link->cur_buf->pts = samplesref->pts;
597 link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;599 link->cur_buf->audio->sample_rate = samplesref->audio->sample_rate;
598 600
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
460/** default handler for end_frame() for video inputs */460/** default handler for end_frame() for video inputs */
461void avfilter_default_end_frame(AVFilterLink *link);461void avfilter_default_end_frame(AVFilterLink *link);
462 462
463/** default handler for filter_samples() for audio inputs */
464void avfilter_default_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
465
466/** default handler for config_props() for audio/video outputs */463/** default handler for config_props() for audio/video outputs */
467int avfilter_default_config_output_link(AVFilterLink *link);464int avfilter_default_config_output_link(AVFilterLink *link);
468 465
@@ -470,10 +467,6 @@ int avfilter_default_config_output_link(AVFilterLink *link); · 1 unmodified line
470AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,467AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link,
471 int perms, int w, int h);468 int perms, int w, int h);
472 469
473/** default handler for get_audio_buffer() for audio inputs */
474AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,
475 int nb_samples);
476
477/**470/**
478 * A helper for query_formats() which sets all links to the same list of471 * A helper for query_formats() which sets all links to the same list of
479 * formats. If there are no links hooked to this filter, the list of formats is472 * 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
493/** end_frame() handler for filters which simply pass video along */486/** end_frame() handler for filters which simply pass video along */
494void avfilter_null_end_frame(AVFilterLink *link);487void avfilter_null_end_frame(AVFilterLink *link);
495 488
496/** filter_samples() handler for filters which simply pass audio along */
497void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
498
499/** get_video_buffer() handler for filters which simply pass video along */489/** get_video_buffer() handler for filters which simply pass video along */
500AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,490AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link,
501 int perms, int w, int h);491 int perms, int w, int h);
502 492
503/** get_audio_buffer() handler for filters which simply pass audio along */
504AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,
505 int nb_samples);
506
507/**493/**
508 * Filter definition. This defines the pads a filter contains, and all the494 * Filter definition. This defines the pads a filter contains, and all the
509 * callback functions used to interact with the filter.495 * callback functions used to interact with the filter.
@@ -683,19 +669,6 @@ AVFilterBufferRef * · 173 unmodified lines
683avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,669avfilter_get_video_buffer_ref_from_arrays(uint8_t *data[4], int linesize[4], int perms,
684 int w, int h, enum PixelFormat format);670 int w, int h, enum PixelFormat format);
685 671
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 */
696AVFilterBufferRef *avfilter_get_audio_buffer(AVFilterLink *link, int perms,
697 int nb_samples);
698
699/**672/**
700 * Create an audio buffer reference wrapped around an already673 * Create an audio buffer reference wrapped around an already
701 * allocated samples buffer.674 * allocated samples buffer.
@@ -766,16 +739,6 @@ void avfilter_end_frame(AVFilterLink *link); · 64 unmodified lines
766 */739 */
767void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);740void avfilter_draw_slice(AVFilterLink *link, int y, int h, int slice_dir);
768 741
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 */
777void avfilter_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref);
778
779/** Initialize the filter system. Register all builtin filters. */742/** Initialize the filter system. Register all builtin filters. */
780void avfilter_register_all(void);743void avfilter_register_all(void);
781 744
libavfilter/defaults.c+13−11
@@ -22,6 +22,8 @@ · 21 unmodified lines
22#include "libavutil/audioconvert.h"22#include "libavutil/audioconvert.h"
23#include "libavutil/imgutils.h"23#include "libavutil/imgutils.h"
24#include "libavutil/samplefmt.h"24#include "libavutil/samplefmt.h"
25
26#include "audio.h"
25#include "avfilter.h"27#include "avfilter.h"
26#include "internal.h"28#include "internal.h"
27 29
@@ -57,8 +59,8 @@ AVFilterBufferRef *avfilter_default_get_video_buffer(AVFilterLink *link, int per · 29 unmodified lines
57 return picref;59 return picref;
58}60}
59 61
60AVFilterBufferRef *avfilter_default_get_audio_buffer(AVFilterLink *link, int perms,62AVFilterBufferRef *ff_default_get_audio_buffer(AVFilterLink *link, int perms,
61 int nb_samples)63 int nb_samples)
62{64{
63 AVFilterBufferRef *samplesref = NULL;65 AVFilterBufferRef *samplesref = NULL;
64 uint8_t **data;66 uint8_t **data;
@@ -133,7 +135,7 @@ void avfilter_default_end_frame(AVFilterLink *inlink) · 68 unmodified lines
133}135}
134 136
135/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */137/* FIXME: samplesref is same as link->cur_buf. Need to consider removing the redundant parameter. */
136void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)138void ff_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
137{139{
138 AVFilterLink *outlink = NULL;140 AVFilterLink *outlink = NULL;
139 141
@@ -141,11 +143,11 @@ void avfilter_default_filter_samples(AVFilterLink *inlink, AVFilterBufferRef *sa · 1 unmodified line
141 outlink = inlink->dst->outputs[0];143 outlink = inlink->dst->outputs[0];
142 144
143 if (outlink) {145 if (outlink) {
144 outlink->out_buf = avfilter_default_get_audio_buffer(inlink, AV_PERM_WRITE,146 outlink->out_buf = ff_default_get_audio_buffer(inlink, AV_PERM_WRITE,
145 samplesref->audio->nb_samples);147 samplesref->audio->nb_samples);
146 outlink->out_buf->pts = samplesref->pts;148 outlink->out_buf->pts = samplesref->pts;
147 outlink->out_buf->audio->sample_rate = samplesref->audio->sample_rate;149 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));
149 avfilter_unref_buffer(outlink->out_buf);151 avfilter_unref_buffer(outlink->out_buf);
150 outlink->out_buf = NULL;152 outlink->out_buf = NULL;
151 }153 }
@@ -233,9 +235,9 @@ void avfilter_null_end_frame(AVFilterLink *link) · 81 unmodified lines
233 avfilter_end_frame(link->dst->outputs[0]);235 avfilter_end_frame(link->dst->outputs[0]);
234}236}
235 237
236void avfilter_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)238void ff_null_filter_samples(AVFilterLink *link, AVFilterBufferRef *samplesref)
237{239{
238 avfilter_filter_samples(link->dst->outputs[0], samplesref);240 ff_filter_samples(link->dst->outputs[0], samplesref);
239}241}
240 242
241AVFilterBufferRef *avfilter_null_get_video_buffer(AVFilterLink *link, int perms, int w, int h)243AVFilterBufferRef *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
243 return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);245 return avfilter_get_video_buffer(link->dst->outputs[0], perms, w, h);
244}246}
245 247
246AVFilterBufferRef *avfilter_null_get_audio_buffer(AVFilterLink *link, int perms,248AVFilterBufferRef *ff_null_get_audio_buffer(AVFilterLink *link, int perms,
247 int nb_samples)249 int nb_samples)
248{250{
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);
250}252}

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