On Wed, Nov 4, 2015 at 1:10 PM, James Almer <jamr...@gmail.com> wrote: > On 11/4/2015 3:19 PM, Kyle Swanson wrote: >> Signed-off-by: Kyle Swanson <k...@ylo.ph> >> diff --git a/libavfilter/asrc_anoisesrc.c b/libavfilter/asrc_anoisesrc.c >> new file mode 100644 >> index 0000000..d008d67 >> --- /dev/null >> +++ b/libavfilter/asrc_anoisesrc.c >> @@ -0,0 +1,222 @@ >> +/* >> + * Copyright (c) 2015 Kyle Swanson <k...@ylo.ph>. >> + * >> + * This file is part of FFmpeg. >> + * >> + * FFmpeg 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. >> + * >> + * FFmpeg 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 FFmpeg; if not, write to the Free Software Foundation, Inc., >> + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA >> + */ >> + >> +#include <float.h> >> + >> +#include "libavutil/opt.h" >> +#include "audio.h" >> +#include "avfilter.h" >> +#include "internal.h" >> +#include "libavutil/lfg.h" >> + >> +typedef struct { >> + const AVClass *class; >> + int sample_rate; >> + double amplitude; >> + int64_t dur; >> + char *color; >> + int seed; > > uint32_t. > > Also, why not use av_get_random_seed() when no seed is specified? > In that case both this and the AVOptions below should be int64_t, and the > range of values -1 to UINT32_MAX, with -1 as default. > > See f_perms.c
Good idea. I'll add this. >> + >> + int infinite; >> + double (*filter)(double white, double *buf); >> + double* buf; >> + int buf_size; >> + AVLFG c; >> +} ANoiseSrcContext; >> + >> +#define OFFSET(x) offsetof(ANoiseSrcContext, x) >> +#define FLAGS AV_OPT_FLAG_AUDIO_PARAM|AV_OPT_FLAG_FILTERING_PARAM >> + >> +static const AVOption anoisesrc_options[] = { >> + { "sample_rate", "set sample rate", OFFSET(sample_rate), >> AV_OPT_TYPE_INT, {.i64 = 48000}, 15, INT_MAX, FLAGS }, >> + { "r", "set sample rate", OFFSET(sample_rate), >> AV_OPT_TYPE_INT, {.i64 = 48000}, 15, INT_MAX, FLAGS }, >> + { "amplitude", "set amplitude", OFFSET(amplitude), >> AV_OPT_TYPE_DOUBLE, {.dbl = 1.}, 0., 1., FLAGS }, >> + { "a", "set amplitude", OFFSET(amplitude), >> AV_OPT_TYPE_DOUBLE, {.dbl = 1.}, 0., 1., FLAGS }, >> + { "duration", "set duration", OFFSET(dur), >> AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, >> + { "d", "set duration", OFFSET(dur), >> AV_OPT_TYPE_DURATION, {.i64 = 0}, 0, INT64_MAX, FLAGS }, >> + { "color", "set noise color", OFFSET(color), >> AV_OPT_TYPE_STRING, {.str = "white"}, CHAR_MIN, CHAR_MAX, FLAGS }, >> + { "colour", "set noise color", OFFSET(color), >> AV_OPT_TYPE_STRING, {.str = "white"}, CHAR_MIN, CHAR_MAX, FLAGS }, >> + { "c", "set noise color", OFFSET(color), >> AV_OPT_TYPE_STRING, {.str = "white"}, CHAR_MIN, CHAR_MAX, FLAGS }, >> + { "seed", "set random seed", OFFSET(seed), >> AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, FLAGS }, >> + { "s", "set random seed", OFFSET(seed), >> AV_OPT_TYPE_INT, {.i64 = 0}, 0, UINT_MAX, FLAGS }, >> + {NULL} >> +}; > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel