Merge commit '73d5d405d424c06f3f354337cfdb24794932094d'

* commit '73d5d405d424c06f3f354337cfdb24794932094d':
  split: switch to an AVOptions-based system.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2013-04-11 02:49:13 +02:00
commit 7f2198a2f1
2 changed files with 39 additions and 11 deletions

View File

@ -662,6 +662,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "amix" ) ||
!strcmp(filter->filter->name, "apad" ) ||
!strcmp(filter->filter->name, "aphaser" ) ||
!strcmp(filter->filter->name, "asplit" ) ||
!strcmp(filter->filter->name, "ass") ||
!strcmp(filter->filter->name, "asyncts" ) ||
!strcmp(filter->filter->name, "bandpass" ) ||
@ -725,6 +726,7 @@ int avfilter_init_filter(AVFilterContext *filter, const char *args, void *opaque
!strcmp(filter->filter->name, "showspectrum") ||
!strcmp(filter->filter->name, "silencedetect") ||
!strcmp(filter->filter->name, "smartblur") ||
!strcmp(filter->filter->name, "split" ) ||
!strcmp(filter->filter->name, "stereo3d" ) ||
!strcmp(filter->filter->name, "subtitles") ||
!strcmp(filter->filter->name, "thumbnail") ||

View File

@ -27,25 +27,24 @@
#include "libavutil/internal.h"
#include "libavutil/mem.h"
#include "libavutil/opt.h"
#include "avfilter.h"
#include "audio.h"
#include "internal.h"
#include "video.h"
typedef struct SplitContext {
const AVClass *class;
int nb_outputs;
} SplitContext;
static int split_init(AVFilterContext *ctx, const char *args)
{
int i, nb_outputs = 2;
SplitContext *s = ctx->priv;
int i;
if (args) {
nb_outputs = strtol(args, NULL, 0);
if (nb_outputs <= 0) {
av_log(ctx, AV_LOG_ERROR, "Invalid number of outputs specified: %d.\n",
nb_outputs);
return AVERROR(EINVAL);
}
}
for (i = 0; i < nb_outputs; i++) {
for (i = 0; i < s->nb_outputs; i++) {
char name[32];
AVFilterPad pad = { 0 };
@ -91,6 +90,27 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
return ret;
}
#define OFFSET(x) offsetof(SplitContext, x)
#define FLAGS AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_VIDEO_PARAM
static const AVOption options[] = {
{ "outputs", "Number of outputs", OFFSET(nb_outputs), AV_OPT_TYPE_INT, { .i64 = 2 }, 1, INT_MAX, FLAGS },
{ NULL },
};
static const AVClass split_class = {
.class_name = "split",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVClass asplit_class = {
.class_name = "asplit",
.item_name = av_default_item_name,
.option = options,
.version = LIBAVUTIL_VERSION_INT,
};
static const AVFilterPad avfilter_vf_split_inputs[] = {
{
.name = "default",
@ -105,6 +125,9 @@ AVFilter avfilter_vf_split = {
.name = "split",
.description = NULL_IF_CONFIG_SMALL("Pass on the input video to N outputs."),
.priv_size = sizeof(SplitContext),
.priv_class = &split_class,
.init = split_init,
.uninit = split_uninit,
@ -126,6 +149,9 @@ AVFilter avfilter_af_asplit = {
.name = "asplit",
.description = NULL_IF_CONFIG_SMALL("Pass on the audio input to N audio outputs."),
.priv_size = sizeof(SplitContext),
.priv_class = &asplit_class,
.init = split_init,
.uninit = split_uninit,