Simplify/extend syntax.
Stefano Sabatini authored on 2013/12/17 00:37:37... | ... |
@@ -58,7 +58,6 @@ typedef struct { |
58 | 58 |
/* audio only */ |
59 | 59 |
int sample_rate; |
60 | 60 |
enum AVSampleFormat sample_fmt; |
61 |
- char *sample_fmt_str; |
|
62 | 61 |
int channels; |
63 | 62 |
uint64_t channel_layout; |
64 | 63 |
char *channel_layout_str; |
... | ... |
@@ -348,7 +347,7 @@ AVFILTER_DEFINE_CLASS(buffer); |
348 | 348 |
static const AVOption abuffer_options[] = { |
349 | 349 |
{ "time_base", NULL, OFFSET(time_base), AV_OPT_TYPE_RATIONAL, { .dbl = 0 }, 0, INT_MAX, A }, |
350 | 350 |
{ "sample_rate", NULL, OFFSET(sample_rate), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A }, |
351 |
- { "sample_fmt", NULL, OFFSET(sample_fmt_str), AV_OPT_TYPE_STRING, .flags = A }, |
|
351 |
+ { "sample_fmt", NULL, OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_NONE }, .min = AV_SAMPLE_FMT_NONE, .max = INT_MAX, .flags = A }, |
|
352 | 352 |
{ "channel_layout", NULL, OFFSET(channel_layout_str), AV_OPT_TYPE_STRING, .flags = A }, |
353 | 353 |
{ "channels", NULL, OFFSET(channels), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, INT_MAX, A }, |
354 | 354 |
{ NULL }, |
... | ... |
@@ -361,10 +360,8 @@ static av_cold int init_audio(AVFilterContext *ctx) |
361 | 361 |
BufferSourceContext *s = ctx->priv; |
362 | 362 |
int ret = 0; |
363 | 363 |
|
364 |
- s->sample_fmt = av_get_sample_fmt(s->sample_fmt_str); |
|
365 | 364 |
if (s->sample_fmt == AV_SAMPLE_FMT_NONE) { |
366 |
- av_log(ctx, AV_LOG_ERROR, "Invalid sample format %s\n", |
|
367 |
- s->sample_fmt_str); |
|
365 |
+ av_log(ctx, AV_LOG_ERROR, "Sample format was not set or was invalid\n"); |
|
368 | 366 |
return AVERROR(EINVAL); |
369 | 367 |
} |
370 | 368 |
|
... | ... |
@@ -402,7 +399,7 @@ static av_cold int init_audio(AVFilterContext *ctx) |
402 | 402 |
|
403 | 403 |
av_log(ctx, AV_LOG_VERBOSE, |
404 | 404 |
"tb:%d/%d samplefmt:%s samplerate:%d chlayout:%s\n", |
405 |
- s->time_base.num, s->time_base.den, s->sample_fmt_str, |
|
405 |
+ s->time_base.num, s->time_base.den, av_get_sample_fmt_name(s->sample_fmt), |
|
406 | 406 |
s->sample_rate, s->channel_layout_str); |
407 | 407 |
s->warning_limit = 100; |
408 | 408 |
|
... | ... |
@@ -31,7 +31,7 @@ |
31 | 31 |
|
32 | 32 |
#define LIBAVFILTER_VERSION_MAJOR 4 |
33 | 33 |
#define LIBAVFILTER_VERSION_MINOR 0 |
34 |
-#define LIBAVFILTER_VERSION_MICRO 102 |
|
34 |
+#define LIBAVFILTER_VERSION_MICRO 103 |
|
35 | 35 |
|
36 | 36 |
#define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \ |
37 | 37 |
LIBAVFILTER_VERSION_MINOR, \ |