#include "libavutil/file.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/lfg.h"
#include "libavutil/opt.h"
#include "libavutil/parseutils.h"
#include "libavutil/random_seed.h"
#include "avfilter.h"
Go to the source code of this file.
Data Structures | |
struct | LifeContext |
Defines | |
#define | ALIVE_CELL 0xFF |
#define | OFFSET(x) offsetof(LifeContext, x) |
#define | PARSE_COLOR(name) |
#define | FAST_DIV255(x) ((((x) + 128) * 257) >> 16) |
Functions | |
static const char * | life_get_name (void *ctx) |
static int | parse_rule (uint16_t *born_rule, uint16_t *stay_rule, const char *rule_str, void *log_ctx) |
static int | init_pattern_from_file (AVFilterContext *ctx) |
static int | init (AVFilterContext *ctx, const char *args, void *opaque) |
static av_cold void | uninit (AVFilterContext *ctx) |
static int | config_props (AVFilterLink *outlink) |
static void | evolve (AVFilterContext *ctx) |
static void | fill_picture_monoblack (AVFilterContext *ctx, AVFilterBufferRef *picref) |
static void | fill_picture_rgb (AVFilterContext *ctx, AVFilterBufferRef *picref) |
static int | request_frame (AVFilterLink *outlink) |
static int | query_formats (AVFilterContext *ctx) |
Variables | |
static const AVOption | life_options [] |
static const AVClass | life_class |
AVFilter | avfilter_vsrc_life |
Definition in file vsrc_life.c.
#define ALIVE_CELL 0xFF |
Definition at line 76 of file vsrc_life.c.
Referenced by evolve(), fill_picture_monoblack(), fill_picture_rgb(), init(), and init_pattern_from_file().
#define FAST_DIV255 | ( | x | ) | ((((x) + 128) * 257) >> 16) |
Definition at line 411 of file vsrc_life.c.
#define OFFSET | ( | x | ) | offsetof(LifeContext, x) |
Definition at line 77 of file vsrc_life.c.
#define PARSE_COLOR | ( | name | ) |
Value:
do { \ if ((ret = av_parse_color(life->name ## _color, life->name ## _color_str, -1, ctx))) { \ av_log(ctx, AV_LOG_ERROR, "Invalid " #name " color '%s'\n", \ life->name ## _color_str); \ return ret; \ } \ } while (0)
Referenced by init().
static int config_props | ( | AVFilterLink * | outlink | ) | [static] |
Definition at line 322 of file vsrc_life.c.
static void evolve | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 333 of file vsrc_life.c.
static void fill_picture_monoblack | ( | AVFilterContext * | ctx, | |
AVFilterBufferRef * | picref | |||
) | [static] |
static void fill_picture_rgb | ( | AVFilterContext * | ctx, | |
AVFilterBufferRef * | picref | |||
) | [static] |
static int init | ( | AVFilterContext * | ctx, | |
const char * | args, | |||
void * | opaque | |||
) | [static] |
Definition at line 228 of file vsrc_life.c.
static int init_pattern_from_file | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 171 of file vsrc_life.c.
static const char* life_get_name | ( | void * | ctx | ) | [static] |
Definition at line 99 of file vsrc_life.c.
static int parse_rule | ( | uint16_t * | born_rule, | |
uint16_t * | stay_rule, | |||
const char * | rule_str, | |||
void * | log_ctx | |||
) | [static] |
static int query_formats | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 462 of file vsrc_life.c.
static int request_frame | ( | AVFilterLink * | outlink | ) | [static] |
Definition at line 440 of file vsrc_life.c.
static av_cold void uninit | ( | AVFilterContext * | ctx | ) | [static] |
Definition at line 312 of file vsrc_life.c.
Initial value:
{ .name = "life", .description = NULL_IF_CONFIG_SMALL("Create life."), .priv_size = sizeof(LifeContext), .init = init, .uninit = uninit, .query_formats = query_formats, .inputs = (const AVFilterPad[]) { { .name = NULL} }, .outputs = (const AVFilterPad[]) { { .name = "default", .type = AVMEDIA_TYPE_VIDEO, .request_frame = request_frame, .config_props = config_props }, { .name = NULL} }, }
Definition at line 478 of file vsrc_life.c.
const AVClass life_class [static] |
Initial value:
{ "LifeContext", life_get_name, life_options }
Definition at line 104 of file vsrc_life.c.
const AVOption life_options[] [static] |
Initial value:
{ { "filename", "set source file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 }, { "f", "set source file", OFFSET(filename), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 }, { "size", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 }, { "s", "set video size", OFFSET(size), AV_OPT_TYPE_STRING, {.str = NULL}, 0, 0 }, { "rate", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 }, { "r", "set video rate", OFFSET(rate), AV_OPT_TYPE_STRING, {.str = "25"}, 0, 0 }, { "rule", "set rule", OFFSET(rule_str), AV_OPT_TYPE_STRING, {.str = "B3/S23"}, CHAR_MIN, CHAR_MAX }, { "random_fill_ratio", "set fill ratio for filling initial grid randomly", OFFSET(random_fill_ratio), AV_OPT_TYPE_DOUBLE, {.dbl=1/M_PHI}, 0, 1 }, { "ratio", "set fill ratio for filling initial grid randomly", OFFSET(random_fill_ratio), AV_OPT_TYPE_DOUBLE, {.dbl=1/M_PHI}, 0, 1 }, { "random_seed", "set the seed for filling the initial grid randomly", OFFSET(random_seed), AV_OPT_TYPE_INT, {.dbl=-1}, -1, UINT32_MAX }, { "seed", "set the seed for filling the initial grid randomly", OFFSET(random_seed), AV_OPT_TYPE_INT, {.dbl=-1}, -1, UINT32_MAX }, { "stitch", "stitch boundaries", OFFSET(stitch), AV_OPT_TYPE_INT, {.dbl=1}, 0, 1 }, { "mold", "set mold speed for dead cells", OFFSET(mold), AV_OPT_TYPE_INT, {.dbl=0}, 0, 0xFF }, { "life_color", "set life color", OFFSET( life_color_str), AV_OPT_TYPE_STRING, {.str="white"}, CHAR_MIN, CHAR_MAX }, { "death_color", "set death color", OFFSET(death_color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, { "mold_color", "set mold color", OFFSET( mold_color_str), AV_OPT_TYPE_STRING, {.str="black"}, CHAR_MIN, CHAR_MAX }, { NULL }, }
Definition at line 79 of file vsrc_life.c.