mirror of
https://github.com/xenia-project/FFmpeg.git
synced 2025-02-11 06:55:44 +00:00
lavfi: add an audio split filter
Based on current version of the asplit filter in FFmpeg written by Stefano Sabatini and others.
This commit is contained in:
parent
cc30080b3f
commit
afeb3590fc
@ -19,6 +19,7 @@ version <next>:
|
|||||||
- add libavresample audio conversion library
|
- add libavresample audio conversion library
|
||||||
- audio filters support in libavfilter and avconv
|
- audio filters support in libavfilter and avconv
|
||||||
- add fps filter
|
- add fps filter
|
||||||
|
- audio split filter
|
||||||
|
|
||||||
|
|
||||||
version 0.8:
|
version 0.8:
|
||||||
|
@ -137,6 +137,19 @@ aformat=sample_fmts\=u8\,s16:channel_layouts\=stereo
|
|||||||
|
|
||||||
Pass the audio source unchanged to the output.
|
Pass the audio source unchanged to the output.
|
||||||
|
|
||||||
|
@section asplit
|
||||||
|
|
||||||
|
Split input audio into several identical outputs.
|
||||||
|
|
||||||
|
The filter accepts a single parameter which specifies the number of outputs. If
|
||||||
|
unspecified, it defaults to 2.
|
||||||
|
|
||||||
|
For example
|
||||||
|
@example
|
||||||
|
avconv -i INPUT -filter_complex asplit=5 OUTPUT
|
||||||
|
@end example
|
||||||
|
will create 5 copies of the input audio.
|
||||||
|
|
||||||
@section asyncts
|
@section asyncts
|
||||||
Synchronize audio data with timestamps by squeezing/stretching it and/or
|
Synchronize audio data with timestamps by squeezing/stretching it and/or
|
||||||
dropping samples/adding silence when needed.
|
dropping samples/adding silence when needed.
|
||||||
|
@ -27,6 +27,7 @@ OBJS = allfilters.o \
|
|||||||
|
|
||||||
OBJS-$(CONFIG_AFORMAT_FILTER) += af_aformat.o
|
OBJS-$(CONFIG_AFORMAT_FILTER) += af_aformat.o
|
||||||
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
|
OBJS-$(CONFIG_ANULL_FILTER) += af_anull.o
|
||||||
|
OBJS-$(CONFIG_ASPLIT_FILTER) += split.o
|
||||||
OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o
|
OBJS-$(CONFIG_ASYNCTS_FILTER) += af_asyncts.o
|
||||||
OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o
|
OBJS-$(CONFIG_RESAMPLE_FILTER) += af_resample.o
|
||||||
|
|
||||||
|
@ -36,6 +36,7 @@ void avfilter_register_all(void)
|
|||||||
|
|
||||||
REGISTER_FILTER (AFORMAT, aformat, af);
|
REGISTER_FILTER (AFORMAT, aformat, af);
|
||||||
REGISTER_FILTER (ANULL, anull, af);
|
REGISTER_FILTER (ANULL, anull, af);
|
||||||
|
REGISTER_FILTER (ASPLIT, asplit, af);
|
||||||
REGISTER_FILTER (ASYNCTS, asyncts, af);
|
REGISTER_FILTER (ASYNCTS, asyncts, af);
|
||||||
REGISTER_FILTER (RESAMPLE, resample, af);
|
REGISTER_FILTER (RESAMPLE, resample, af);
|
||||||
|
|
||||||
|
@ -20,10 +20,11 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @file
|
* @file
|
||||||
* Video splitter
|
* audio and video splitter
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "avfilter.h"
|
#include "avfilter.h"
|
||||||
|
#include "audio.h"
|
||||||
|
|
||||||
static int split_init(AVFilterContext *ctx, const char *args, void *opaque)
|
static int split_init(AVFilterContext *ctx, const char *args, void *opaque)
|
||||||
{
|
{
|
||||||
@ -43,7 +44,7 @@ static int split_init(AVFilterContext *ctx, const char *args, void *opaque)
|
|||||||
AVFilterPad pad = { 0 };
|
AVFilterPad pad = { 0 };
|
||||||
|
|
||||||
snprintf(name, sizeof(name), "output%d", i);
|
snprintf(name, sizeof(name), "output%d", i);
|
||||||
pad.type = AVMEDIA_TYPE_VIDEO;
|
pad.type = ctx->filter->inputs[0].type;
|
||||||
pad.name = av_strdup(name);
|
pad.name = av_strdup(name);
|
||||||
|
|
||||||
avfilter_insert_outpad(ctx, i, &pad);
|
avfilter_insert_outpad(ctx, i, &pad);
|
||||||
@ -106,3 +107,28 @@ AVFilter avfilter_vf_split = {
|
|||||||
{ .name = NULL}},
|
{ .name = NULL}},
|
||||||
.outputs = (AVFilterPad[]) {{ .name = NULL}},
|
.outputs = (AVFilterPad[]) {{ .name = NULL}},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void filter_samples(AVFilterLink *inlink, AVFilterBufferRef *samplesref)
|
||||||
|
{
|
||||||
|
AVFilterContext *ctx = inlink->dst;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < ctx->output_count; i++)
|
||||||
|
ff_filter_samples(inlink->dst->outputs[i],
|
||||||
|
avfilter_ref_buffer(samplesref, ~AV_PERM_WRITE));
|
||||||
|
}
|
||||||
|
|
||||||
|
AVFilter avfilter_af_asplit = {
|
||||||
|
.name = "asplit",
|
||||||
|
.description = NULL_IF_CONFIG_SMALL("Pass on the audio input to N audio outputs."),
|
||||||
|
|
||||||
|
.init = split_init,
|
||||||
|
.uninit = split_uninit,
|
||||||
|
|
||||||
|
.inputs = (const AVFilterPad[]) {{ .name = "default",
|
||||||
|
.type = AVMEDIA_TYPE_AUDIO,
|
||||||
|
.get_audio_buffer = ff_null_get_audio_buffer,
|
||||||
|
.filter_samples = filter_samples },
|
||||||
|
{ .name = NULL }},
|
||||||
|
.outputs = (const AVFilterPad[]) {{ .name = NULL }},
|
||||||
|
};
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
#include "libavutil/avutil.h"
|
#include "libavutil/avutil.h"
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_MAJOR 2
|
#define LIBAVFILTER_VERSION_MAJOR 2
|
||||||
#define LIBAVFILTER_VERSION_MINOR 18
|
#define LIBAVFILTER_VERSION_MINOR 19
|
||||||
#define LIBAVFILTER_VERSION_MICRO 0
|
#define LIBAVFILTER_VERSION_MICRO 0
|
||||||
|
|
||||||
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user