libavfilter/vsrc_testsrc.c File Reference

Misc test sources. More...

#include <float.h>
#include "libavutil/mathematics.h"
#include "libavutil/opt.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/parseutils.h"
#include "avfilter.h"

Go to the source code of this file.

Data Structures

struct  TestSourceContext

Defines

#define OFFSET(x)   offsetof(TestSourceContext, x)
#define TOP_HBAR   1
#define MID_HBAR   2
#define BOT_HBAR   4
#define LEFT_TOP_VBAR   8
#define LEFT_BOT_VBAR   16
#define RIGHT_TOP_VBAR   32
#define RIGHT_BOT_VBAR   64
#define GRADIENT_SIZE   (6 * 256)
#define R   0
#define G   1
#define B   2
#define A   3

Functions

static av_cold int init_common (AVFilterContext *ctx, const char *args, void *opaque)
static int config_props (AVFilterLink *outlink)
static int request_frame (AVFilterLink *outlink)
static const char * testsrc_get_name (void *ctx)
static void draw_rectangle (unsigned val, uint8_t *dst, int dst_linesize, unsigned segment_width, unsigned x, unsigned y, unsigned w, unsigned h)
 Fill a rectangle with value val.
static void draw_digit (int digit, uint8_t *dst, unsigned dst_linesize, unsigned segment_width)
static void test_fill_picture (AVFilterContext *ctx, AVFilterBufferRef *picref)
static av_cold int test_init (AVFilterContext *ctx, const char *args, void *opaque)
static int test_query_formats (AVFilterContext *ctx)
static const char * rgbtestsrc_get_name (void *ctx)
static void rgbtest_put_pixel (uint8_t *dst, int dst_linesize, int x, int y, int r, int g, int b, enum PixelFormat fmt, int rgba_map[4])
static void rgbtest_fill_picture (AVFilterContext *ctx, AVFilterBufferRef *picref)
static av_cold int rgbtest_init (AVFilterContext *ctx, const char *args, void *opaque)
static int rgbtest_query_formats (AVFilterContext *ctx)
static int rgbtest_config_props (AVFilterLink *outlink)

Variables

static const AVOption testsrc_options []
static const AVClass testsrc_class
AVFilter avfilter_vsrc_testsrc
static const AVClass rgbtestsrc_class
AVFilter avfilter_vsrc_rgbtestsrc

Detailed Description

Misc test sources.

testsrc is based on the test pattern generator demuxer by Nicolas George: http://lists.ffmpeg.org/pipermail/ffmpeg-devel/2007-October/037845.html

rgbtestsrc is ported from MPlayer libmpcodecs/vf_rgbtest.c by Michael Niedermayer.

Definition in file vsrc_testsrc.c.


Define Documentation

#define A   3

Definition at line 390 of file vsrc_testsrc.c.

#define B   2

Definition at line 389 of file vsrc_testsrc.c.

#define BOT_HBAR   4

Referenced by draw_digit().

#define G   1

Definition at line 388 of file vsrc_testsrc.c.

#define GRADIENT_SIZE   (6 * 256)

Definition at line 235 of file vsrc_testsrc.c.

Referenced by test_fill_picture().

#define LEFT_BOT_VBAR   16

Referenced by draw_digit().

#define LEFT_TOP_VBAR   8

Referenced by draw_digit().

#define MID_HBAR   2

Referenced by draw_digit().

#define OFFSET (   x  )     offsetof(TestSourceContext, x)

Definition at line 58 of file vsrc_testsrc.c.

#define R   0

Definition at line 387 of file vsrc_testsrc.c.

#define RIGHT_BOT_VBAR   64
#define RIGHT_TOP_VBAR   32

Referenced by draw_digit().

#define TOP_HBAR   1

Referenced by draw_digit().


Function Documentation

static int config_props ( AVFilterLink outlink  )  [static]

Definition at line 114 of file vsrc_testsrc.c.

Referenced by rgbtest_config_props().

static void draw_digit ( int  digit,
uint8_t *  dst,
unsigned  dst_linesize,
unsigned  segment_width 
) [static]

Definition at line 192 of file vsrc_testsrc.c.

Referenced by test_fill_picture().

static void draw_rectangle ( unsigned  val,
uint8_t *  dst,
int  dst_linesize,
unsigned  segment_width,
unsigned  x,
unsigned  y,
unsigned  w,
unsigned  h 
) [static]

Fill a rectangle with value val.

Parameters:
val the RGB value to set
dst pointer to the destination buffer to fill
dst_linesize linesize of destination
segment_width width of the segment
x horizontal coordinate where to draw the rectangle in the destination buffer
y horizontal coordinate where to draw the rectangle in the destination buffer
w width of the rectangle to draw, expressed as a number of segment_width units
h height of the rectangle to draw, expressed as a number of segment_width units

Definition at line 177 of file vsrc_testsrc.c.

Referenced by draw_digit().

static av_cold int init_common ( AVFilterContext ctx,
const char *  args,
void *  opaque 
) [static]

Definition at line 70 of file vsrc_testsrc.c.

Referenced by rgbtest_init(), and test_init().

static int request_frame ( AVFilterLink outlink  )  [static]

Definition at line 126 of file vsrc_testsrc.c.

static int rgbtest_config_props ( AVFilterLink outlink  )  [static]

Definition at line 466 of file vsrc_testsrc.c.

static void rgbtest_fill_picture ( AVFilterContext ctx,
AVFilterBufferRef picref 
) [static]

Definition at line 423 of file vsrc_testsrc.c.

static av_cold int rgbtest_init ( AVFilterContext ctx,
const char *  args,
void *  opaque 
) [static]

Definition at line 443 of file vsrc_testsrc.c.

static void rgbtest_put_pixel ( uint8_t *  dst,
int  dst_linesize,
int  x,
int  y,
int  r,
int  g,
int  b,
enum PixelFormat  fmt,
int  rgba_map[4] 
) [static]

Definition at line 392 of file vsrc_testsrc.c.

Referenced by rgbtest_fill_picture().

static int rgbtest_query_formats ( AVFilterContext ctx  )  [static]

Definition at line 452 of file vsrc_testsrc.c.

static const char* rgbtestsrc_get_name ( void *  ctx  )  [static]

Definition at line 376 of file vsrc_testsrc.c.

static void test_fill_picture ( AVFilterContext ctx,
AVFilterBufferRef picref 
) [static]

Definition at line 237 of file vsrc_testsrc.c.

static av_cold int test_init ( AVFilterContext ctx,
const char *  args,
void *  opaque 
) [static]

Definition at line 337 of file vsrc_testsrc.c.

static int test_query_formats ( AVFilterContext ctx  )  [static]

Definition at line 346 of file vsrc_testsrc.c.

static const char* testsrc_get_name ( void *  ctx  )  [static]

Definition at line 154 of file vsrc_testsrc.c.


Variable Documentation

Initial value:
 {
    .name          = "rgbtestsrc",
    .description   = NULL_IF_CONFIG_SMALL("Generate RGB test pattern."),
    .priv_size     = sizeof(TestSourceContext),
    .init          = rgbtest_init,

    .query_formats = rgbtest_query_formats,

    .inputs    = (AVFilterPad[]) {{ .name = NULL}},

    .outputs   = (AVFilterPad[]) {{ .name = "default",
                                    .type = AVMEDIA_TYPE_VIDEO,
                                    .request_frame = request_frame,
                                    .config_props  = rgbtest_config_props, },
                                  { .name = NULL }},
}

Definition at line 482 of file vsrc_testsrc.c.

Initial value:
 {
    .name          = "testsrc",
    .description   = NULL_IF_CONFIG_SMALL("Generate test pattern."),
    .priv_size     = sizeof(TestSourceContext),
    .init          = test_init,

    .query_formats = test_query_formats,

    .inputs    = (AVFilterPad[]) {{ .name = NULL}},

    .outputs   = (AVFilterPad[]) {{ .name = "default",
                                    .type = AVMEDIA_TYPE_VIDEO,
                                    .request_frame = request_frame,
                                    .config_props  = config_props, },
                                  { .name = NULL }},
}

Definition at line 355 of file vsrc_testsrc.c.

const AVClass rgbtestsrc_class [static]
Initial value:
 {
    .class_name = "RGBTestSourceContext",
    .item_name  = rgbtestsrc_get_name,
    .option     = testsrc_options,
}

Definition at line 381 of file vsrc_testsrc.c.

const AVClass testsrc_class [static]
Initial value:
 {
    .class_name = "TestSourceContext",
    .item_name  = testsrc_get_name,
    .option     = testsrc_options,
}

Definition at line 159 of file vsrc_testsrc.c.

const AVOption testsrc_options[] [static]
Initial value:
 {
    { "size",     "set video size",     OFFSET(size),     FF_OPT_TYPE_STRING, {.str = "320x240"}},
    { "s",        "set video size",     OFFSET(size),     FF_OPT_TYPE_STRING, {.str = "320x240"}},
    { "rate",     "set video rate",     OFFSET(rate),     FF_OPT_TYPE_STRING, {.str = "25"},    },
    { "r",        "set video rate",     OFFSET(rate),     FF_OPT_TYPE_STRING, {.str = "25"},    },
    { "duration", "set video duration", OFFSET(duration), FF_OPT_TYPE_STRING, {.str = NULL},    },
    { "sar",      "set video sample aspect ratio", OFFSET(sar), FF_OPT_TYPE_RATIONAL, {1},  0, INT_MAX },
    { NULL },
}

Definition at line 60 of file vsrc_testsrc.c.