[FFmpeg-cvslog] lavfi/showwaves: switch to an AVOptions-based system.
Clément Bœsch
git at videolan.org
Thu Apr 11 14:19:15 CEST 2013
ffmpeg | branch: master | Clément Bœsch <ubitux at gmail.com> | Thu Apr 11 14:17:20 2013 +0200| [3c2e4c2a9bacb3262bd689c7d84f8a46359b9040] | committer: Clément Bœsch
lavfi/showwaves: switch to an AVOptions-based system.
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c2e4c2a9bacb3262bd689c7d84f8a46359b9040
---
doc/filters.texi | 8 +++++---
libavfilter/avf_showwaves.c | 28 ++++++----------------------
libavfilter/avfilter.c | 1 -
3 files changed, 11 insertions(+), 26 deletions(-)
diff --git a/doc/filters.texi b/doc/filters.texi
index 12a7cf5..6356e74 100644
--- a/doc/filters.texi
+++ b/doc/filters.texi
@@ -7140,8 +7140,12 @@ ffplay -f lavfi 'amovie=input.mp3, asplit [a][out1];
Convert input audio to a video output, representing the samples waves.
-The filter accepts the following named parameters:
+The filter accepts the following options:
+
@table @option
+ at item size, s
+Specify the video size for the output. Default value is "600x240".
+
@item mode
Set display mode.
@@ -7166,8 +7170,6 @@ is not explicitly specified.
Set the (approximate) output frame rate. This is done by setting the
option @var{n}. Default value is "25".
- at item size, s
-Specify the video size for the output. Default value is "600x240".
@end table
@subsection Examples
diff --git a/libavfilter/avf_showwaves.c b/libavfilter/avf_showwaves.c
index 095fc57..5e89146 100644
--- a/libavfilter/avf_showwaves.c
+++ b/libavfilter/avf_showwaves.c
@@ -54,35 +54,19 @@ typedef struct {
#define FLAGS AV_OPT_FLAG_FILTERING_PARAM|AV_OPT_FLAG_VIDEO_PARAM
static const AVOption showwaves_options[] = {
- { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
- { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
{ "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "600x240"}, 0, 0, FLAGS },
{ "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = "600x240"}, 0, 0, FLAGS },
+ { "mode", "select display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_POINT}, 0, MODE_NB-1, FLAGS, "mode"},
+ { "point", "draw a point for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_POINT}, .flags=FLAGS, .unit="mode"},
+ { "line", "draw a line for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_LINE}, .flags=FLAGS, .unit="mode"},
{ "n", "set how many samples to show in the same point", OFFSET(n), AV_OPT_TYPE_INT, {.i64 = 0}, 0, INT_MAX, FLAGS },
-
- {"mode", "select display mode", OFFSET(mode), AV_OPT_TYPE_INT, {.i64=MODE_POINT}, 0, MODE_NB-1, FLAGS, "mode"},
- {"point", "draw a point for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_POINT}, .flags=FLAGS, .unit="mode"},
- {"line", "draw a line for each sample", 0, AV_OPT_TYPE_CONST, {.i64=MODE_LINE}, .flags=FLAGS, .unit="mode"},
+ { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
+ { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, 0, FLAGS },
{ NULL },
};
AVFILTER_DEFINE_CLASS(showwaves);
-static av_cold int init(AVFilterContext *ctx, const char *args)
-{
- ShowWavesContext *showwaves = ctx->priv;
- int err;
-
- showwaves->class = &showwaves_class;
- av_opt_set_defaults(showwaves);
- showwaves->buf_idx = 0;
-
- if ((err = av_set_options_string(showwaves, args, "=", ":")) < 0)
- return err;
-
- return 0;
-}
-
static av_cold void uninit(AVFilterContext *ctx)
{
ShowWavesContext *showwaves = ctx->priv;
@@ -133,6 +117,7 @@ static int config_output(AVFilterLink *outlink)
if (!showwaves->n)
showwaves->n = FFMAX(1, ((double)inlink->sample_rate / (showwaves->w * av_q2d(showwaves->rate))) + 0.5);
+ showwaves->buf_idx = 0;
outlink->w = showwaves->w;
outlink->h = showwaves->h;
outlink->sample_aspect_ratio = (AVRational){1,1};
@@ -261,7 +246,6 @@ static const AVFilterPad showwaves_outputs[] = {
AVFilter avfilter_avf_showwaves = {
.name = "showwaves",
.description = NULL_IF_CONFIG_SMALL("Convert input audio to a video output."),
- .init = init,
.uninit = uninit,
.query_formats = query_formats,
.priv_size = sizeof(ShowWavesContext),
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 8c92b88..3898529 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -694,7 +694,6 @@ static const char *const filters_left_to_update[] = {
"sendcmd",
"setdar",
"setsar",
- "showwaves",
"smptebars",
};
More information about the ffmpeg-cvslog
mailing list