...
|
...
|
@@ -57,7 +57,6 @@ typedef struct {
|
57
|
57
|
uint16_t born_rule; ///< encode the behavior for empty cells
|
58
|
58
|
uint64_t pts;
|
59
|
59
|
AVRational time_base;
|
60
|
|
- char *size; ///< video frame size
|
61
|
60
|
char *rate; ///< video frame rate
|
62
|
61
|
double random_fill_ratio;
|
63
|
62
|
uint32_t random_seed;
|
...
|
...
|
@@ -79,8 +78,8 @@ typedef struct {
|
79
|
79
|
static const AVOption life_options[] = {
|
80
|
80
|
{ "filename", "set source file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 },
|
81
|
81
|
{ "f", "set source file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 },
|
82
|
|
- { "size", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 },
|
83
|
|
- { "s", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 },
|
|
82
|
+ { "size", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0 },
|
|
83
|
+ { "s", "set video size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL}, 0, 0 },
|
84
|
84
|
{ "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 },
|
85
|
85
|
{ "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 },
|
86
|
86
|
{ "rule", "set rule", OFFSET(rule_str), AV_OPT_TYPE_STRING, {.str = "B3/S23"}, CHAR_MIN, CHAR_MAX },
|
...
|
...
|
@@ -190,7 +189,7 @@ static int init_pattern_from_file(AVFilterContext *ctx)
|
190
|
190
|
}
|
191
|
191
|
av_log(ctx, AV_LOG_DEBUG, "h:%d max_w:%d\n", h, max_w);
|
192
|
192
|
|
193
|
|
- if (life->size) {
|
|
193
|
+ if (life->w) {
|
194
|
194
|
if (max_w > life->w || h > life->h) {
|
195
|
195
|
av_log(ctx, AV_LOG_ERROR,
|
196
|
196
|
"The specified size is %dx%d which cannot contain the provided file size of %dx%d\n",
|
...
|
...
|
@@ -246,16 +245,9 @@ static int init(AVFilterContext *ctx, const char *args, void *opaque)
|
246
|
246
|
}
|
247
|
247
|
av_freep(&life->rate);
|
248
|
248
|
|
249
|
|
- if (!life->size && !life->filename)
|
|
249
|
+ if (!life->w && !life->filename)
|
250
|
250
|
av_opt_set(life, "size", "320x240", 0);
|
251
|
251
|
|
252
|
|
- if (life->size &&
|
253
|
|
- (ret = av_parse_video_size(&life->w, &life->h, life->size)) < 0) {
|
254
|
|
- av_log(ctx, AV_LOG_ERROR, "Invalid frame size: %s\n", life->size);
|
255
|
|
- return ret;
|
256
|
|
- }
|
257
|
|
- av_freep(&life->size);
|
258
|
|
-
|
259
|
252
|
if ((ret = parse_rule(&life->born_rule, &life->stay_rule, life->rule_str, ctx)) < 0)
|
260
|
253
|
return ret;
|
261
|
254
|
|