FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
opt.c File Reference
#include <limits.h>
#include <stdio.h>
#include "libavutil/common.h"
#include "libavutil/channel_layout.h"
#include "libavutil/error.h"
#include "libavutil/log.h"
#include "libavutil/mem.h"
#include "libavutil/rational.h"
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"

Go to the source code of this file.

Data Structures

struct  TestContext
 

Macros

#define OFFSET(x)   offsetof(TestContext, x)
 
#define TEST_FLAG_COOL   01
 
#define TEST_FLAG_LAME   02
 
#define TEST_FLAG_MU   04
 

Functions

static const char * test_get_name (void *ctx)
 
static void log_callback_help (void *ptr, int level, const char *fmt, va_list vl)
 
int main (void)
 

Variables

static const AVOption test_options []
 
static const AVClass test_class
 

Macro Definition Documentation

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

Definition at line 60 of file opt.c.

#define TEST_FLAG_COOL   01

Definition at line 62 of file opt.c.

#define TEST_FLAG_LAME   02

Definition at line 63 of file opt.c.

#define TEST_FLAG_MU   04

Definition at line 64 of file opt.c.

Function Documentation

static const char* test_get_name ( void ctx)
static

Definition at line 95 of file opt.c.

static void log_callback_help ( void ptr,
int  level,
const char *  fmt,
va_list  vl 
)
static

Definition at line 106 of file opt.c.

Referenced by main().

int main ( void  )

Definition at line 111 of file opt.c.

Variable Documentation

const AVOption test_options[]
static
Initial value:
= {
{"num", "set num", OFFSET(num), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 100, 1 },
{"toggle", "set toggle", OFFSET(toggle), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, 1 },
{"rational", "set rational", OFFSET(rational), AV_OPT_TYPE_RATIONAL, { .dbl = 1 }, 0, 10, 1 },
{"string", "set string", OFFSET(string), AV_OPT_TYPE_STRING, { .str = "default" }, CHAR_MIN, CHAR_MAX, 1 },
{"escape", "set escape str", OFFSET(escape), AV_OPT_TYPE_STRING, { .str = "\\=," }, CHAR_MIN, CHAR_MAX, 1 },
{"flags", "set flags", OFFSET(flags), AV_OPT_TYPE_FLAGS, { .i64 = 1 }, 0, INT_MAX, 1, "flags" },
{"cool", "set cool flag", 0, AV_OPT_TYPE_CONST, { .i64 = TEST_FLAG_COOL }, INT_MIN, INT_MAX, 1, "flags" },
{"lame", "set lame flag", 0, AV_OPT_TYPE_CONST, { .i64 = TEST_FLAG_LAME }, INT_MIN, INT_MAX, 1, "flags" },
{"mu", "set mu flag", 0, AV_OPT_TYPE_CONST, { .i64 = TEST_FLAG_MU }, INT_MIN, INT_MAX, 1, "flags" },
{"size", "set size", OFFSET(w), AV_OPT_TYPE_IMAGE_SIZE, { .str="200x300" }, 0, 0, 1 },
{"pix_fmt", "set pixfmt", OFFSET(pix_fmt), AV_OPT_TYPE_PIXEL_FMT, { .i64 = AV_PIX_FMT_0BGR }, -1, INT_MAX, 1 },
{"sample_fmt", "set samplefmt", OFFSET(sample_fmt), AV_OPT_TYPE_SAMPLE_FMT, { .i64 = AV_SAMPLE_FMT_S16 }, -1, INT_MAX, 1 },
{"video_rate", "set videorate", OFFSET(video_rate), AV_OPT_TYPE_VIDEO_RATE, { .str = "25" }, 0, INT_MAX, 1 },
{"duration", "set duration", OFFSET(duration), AV_OPT_TYPE_DURATION, { .i64 = 1000 }, 0, INT64_MAX, 1 },
{"color", "set color", OFFSET(color), AV_OPT_TYPE_COLOR, { .str = "pink" }, 0, 0, 1 },
{"cl", "set channel layout", OFFSET(channel_layout), AV_OPT_TYPE_CHANNEL_LAYOUT, { .i64 = AV_CH_LAYOUT_HEXAGONAL }, 0, INT64_MAX, 1 },
{"bin", "set binary value", OFFSET(binary), AV_OPT_TYPE_BINARY, { .str="62696e00" }, 0, 0, 1 },
{"bin1", "set binary value", OFFSET(binary1), AV_OPT_TYPE_BINARY, { .str=NULL }, 0, 0, 1 },
{"bin2", "set binary value", OFFSET(binary2), AV_OPT_TYPE_BINARY, { .str="" }, 0, 0, 1 },
{"num64", "set num 64bit", OFFSET(num64), AV_OPT_TYPE_INT64, { .i64 = 1 }, 0, 100, 1 },
{"flt", "set float", OFFSET(flt), AV_OPT_TYPE_FLOAT, { .dbl = 1.0 / 3 }, 0, 100, 1 },
{"dbl", "set double", OFFSET(dbl), AV_OPT_TYPE_DOUBLE, { .dbl = 1.0 / 3 }, 0, 100, 1 },
{"bool1", "set boolean value", OFFSET(bool1), AV_OPT_TYPE_BOOL, { .i64 = -1 }, -1, 1, 1 },
{"bool2", "set boolean value", OFFSET(bool2), AV_OPT_TYPE_BOOL, { .i64 = 1 }, -1, 1, 1 },
{"bool3", "set boolean value", OFFSET(bool3), AV_OPT_TYPE_BOOL, { .i64 = 0 }, 0, 1, 1 },
{ NULL },
}
#define NULL
Definition: coverity.c:32
static enum AVPixelFormat pix_fmt
#define OFFSET(x)
Definition: opt.c:60
packed BGR 8:8:8, 32bpp, XBGRXBGR... X=unused/undefined
Definition: pixfmt.h:252
#define AV_CH_LAYOUT_HEXAGONAL
int64_t duration
Definition: movenc.c:63
offset must point to a pointer immediately followed by an int for the length
Definition: opt.h:229
#define TEST_FLAG_LAME
Definition: opt.c:63
offset must point to AVRational
Definition: opt.h:235
offset must point to two consecutive integers
Definition: opt.h:232
#define TEST_FLAG_MU
Definition: opt.c:64
static int flags
Definition: cpu.c:47
#define TEST_FLAG_COOL
Definition: opt.c:62
signed 16 bits
Definition: samplefmt.h:61

Definition at line 66 of file opt.c.

const AVClass test_class
static
Initial value:
= {
"TestContext",
}
static const AVOption test_options[]
Definition: opt.c:66
static const char * test_get_name(void *ctx)
Definition: opt.c:95

Definition at line 100 of file opt.c.

Referenced by main().