libavfilter/vsrc_testsrc.c File Reference

Misc test sources. More...

#include <float.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 (AVFilterContext *ctx, const char *args, void *opaque)
static int config_props (AVFilterLink *outlink)
static int request_frame (AVFilterLink *outlink)
static const char * nullsrc_get_name (void *ctx)
static void nullsrc_fill_picture (AVFilterContext *ctx, AVFilterBufferRef *picref)
static av_cold int nullsrc_init (AVFilterContext *ctx, const char *args, void *opaque)
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 nullsrc_class
AVFilter avfilter_vsrc_nullsrc
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 444 of file vsrc_testsrc.c.

#define B   2

Definition at line 443 of file vsrc_testsrc.c.

#define BOT_HBAR   4

Referenced by draw_digit().

#define G   1

Definition at line 442 of file vsrc_testsrc.c.

#define GRADIENT_SIZE   (6 * 256)

Definition at line 284 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 441 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 123 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 241 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 226 of file vsrc_testsrc.c.

Referenced by draw_digit().

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

Definition at line 73 of file vsrc_testsrc.c.

Referenced by nullsrc_init(), rgbtest_init(), and test_init().

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

Definition at line 174 of file vsrc_testsrc.c.

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

Definition at line 163 of file vsrc_testsrc.c.

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

Definition at line 176 of file vsrc_testsrc.c.

static int request_frame ( AVFilterLink outlink  )  [static]

Definition at line 135 of file vsrc_testsrc.c.

static int rgbtest_config_props ( AVFilterLink outlink  )  [static]

Definition at line 520 of file vsrc_testsrc.c.

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

Definition at line 477 of file vsrc_testsrc.c.

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

Definition at line 497 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 446 of file vsrc_testsrc.c.

Referenced by rgbtest_fill_picture().

static int rgbtest_query_formats ( AVFilterContext ctx  )  [static]

Definition at line 506 of file vsrc_testsrc.c.

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

Definition at line 430 of file vsrc_testsrc.c.

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

Definition at line 286 of file vsrc_testsrc.c.

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

Definition at line 391 of file vsrc_testsrc.c.

static int test_query_formats ( AVFilterContext ctx  )  [static]

Definition at line 400 of file vsrc_testsrc.c.

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

Definition at line 203 of file vsrc_testsrc.c.


Variable Documentation

Initial value:
 {
    .name        = "nullsrc",
    .description = NULL_IF_CONFIG_SMALL("Null video source, return unprocessed video frames."),
    .init       = nullsrc_init,
    .priv_size  = sizeof(TestSourceContext),

    .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 185 of file vsrc_testsrc.c.

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    = (const AVFilterPad[]) {{ .name = NULL}},

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

Definition at line 536 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    = (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 409 of file vsrc_testsrc.c.

const AVClass nullsrc_class [static]
Initial value:
 {
    .class_name = "NullSourceContext",
    .item_name  = nullsrc_get_name,
    .option     = testsrc_options,
}

Definition at line 168 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 435 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 208 of file vsrc_testsrc.c.

const AVOption testsrc_options[] [static]
Initial value:
 {
    { "size",     "set video size",     OFFSET(size),     AV_OPT_TYPE_STRING, {.str = "320x240"}, 0, 0 },
    { "s",        "set video size",     OFFSET(size),     AV_OPT_TYPE_STRING, {.str = "320x240"}, 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 },
    { "duration", "set video duration", OFFSET(duration), AV_OPT_TYPE_STRING, {.str = NULL},      0, 0 },
    { "d",        "set video duration", OFFSET(duration), AV_OPT_TYPE_STRING, {.str = NULL},      0, 0 },
    { "sar",      "set video sample aspect ratio", OFFSET(sar), AV_OPT_TYPE_RATIONAL, {.dbl= 1},  0, INT_MAX },
    { "decimals", "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.dbl=0},  INT_MIN, INT_MAX },
    { "n",        "set number of decimals to show", OFFSET(nb_decimals), AV_OPT_TYPE_INT, {.dbl=0},  INT_MIN, INT_MAX },
    { NULL },
}

Definition at line 60 of file vsrc_testsrc.c.