FFmpeg
Data Structures | Macros | Functions | Variables
caca.c File Reference
#include <caca.h>
#include "libavutil/opt.h"
#include "libavutil/pixdesc.h"
#include "libavformat/mux.h"
#include "avdevice.h"

Go to the source code of this file.

Data Structures

struct  CACAContext
 

Macros

#define DEFINE_LIST_DITHER(thing, thing_str)
 
#define CHECK_DITHER_OPT(opt)
 
#define OFFSET(x)   offsetof(CACAContext,x)
 
#define ENC   AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static void caca_deinit (AVFormatContext *s)
 
static void list_drivers (CACAContext *c)
 
 DEFINE_LIST_DITHER (color, "colors")
 
 DEFINE_LIST_DITHER (charset, "charsets")
 
 DEFINE_LIST_DITHER (algorithm, "algorithms")
 
 DEFINE_LIST_DITHER (antialias, "antialias")
 
static int caca_write_header (AVFormatContext *s)
 
static int caca_write_packet (AVFormatContext *s, AVPacket *pkt)
 

Variables

static const AVOption options []
 
static const AVClass caca_class
 
const FFOutputFormat ff_caca_muxer
 

Macro Definition Documentation

◆ DEFINE_LIST_DITHER

#define DEFINE_LIST_DITHER (   thing,
  thing_str 
)
Value:
static void list_dither_## thing(CACAContext *c) \
{ \
const char *const *thing = caca_get_dither_## thing ##_list(c->dither); \
int i; \
av_log(c->ctx, AV_LOG_INFO, "Available %s:\n", thing_str); \
for (i = 0; thing[i]; i += 2) \
av_log(c->ctx, AV_LOG_INFO, "%s: %s\n", thing[i], thing[i + 1]); \
}

Definition at line 73 of file caca.c.

◆ CHECK_DITHER_OPT

#define CHECK_DITHER_OPT (   opt)
Value:
do { \
if (caca_set_dither_##opt(c->dither, c->opt) < 0) { \
ret = AVERROR(errno); \
av_log(s, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", \
c->opt, #opt); \
return ret; \
} \
} while (0)

◆ OFFSET

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

Definition at line 196 of file caca.c.

◆ ENC

#define ENC   AV_OPT_FLAG_ENCODING_PARAM

Definition at line 197 of file caca.c.

Function Documentation

◆ caca_deinit()

static void caca_deinit ( AVFormatContext s)
static

Definition at line 45 of file caca.c.

◆ list_drivers()

static void list_drivers ( CACAContext c)
static

Definition at line 63 of file caca.c.

Referenced by caca_write_header().

◆ DEFINE_LIST_DITHER() [1/4]

DEFINE_LIST_DITHER ( color  ,
"colors"   
)

◆ DEFINE_LIST_DITHER() [2/4]

DEFINE_LIST_DITHER ( charset  ,
"charsets"   
)

◆ DEFINE_LIST_DITHER() [3/4]

DEFINE_LIST_DITHER ( algorithm  ,
"algorithms"   
)

◆ DEFINE_LIST_DITHER() [4/4]

DEFINE_LIST_DITHER ( antialias  ,
"antialias"   
)

◆ caca_write_header()

static int caca_write_header ( AVFormatContext s)
static

Definition at line 89 of file caca.c.

◆ caca_write_packet()

static int caca_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 186 of file caca.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "window_size", "set window forced size", OFFSET(window_width), AV_OPT_TYPE_IMAGE_SIZE, {.str = NULL }, 0, 0, ENC},
{ "window_title", "set window title", OFFSET(window_title), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, ENC },
{ "driver", "set display driver", OFFSET(driver), AV_OPT_TYPE_STRING, {.str = NULL }, 0, 0, ENC },
{ "algorithm", "set dithering algorithm", OFFSET(algorithm), AV_OPT_TYPE_STRING, {.str = "default" }, 0, 0, ENC },
{ "antialias", "set antialias method", OFFSET(antialias), AV_OPT_TYPE_STRING, {.str = "default" }, 0, 0, ENC },
{ "charset", "set charset used to render output", OFFSET(charset), AV_OPT_TYPE_STRING, {.str = "default" }, 0, 0, ENC },
{ "color", "set color used to render output", OFFSET(color), AV_OPT_TYPE_STRING, {.str = "default" }, 0, 0, ENC },
{ "list_drivers", "list available drivers", OFFSET(list_drivers), AV_OPT_TYPE_BOOL, {.i64=0}, 0, 1, ENC },
{ "list_dither", "list available dither options", OFFSET(list_dither), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 1, ENC, "list_dither" },
{ "algorithms", NULL, 0, AV_OPT_TYPE_CONST, {.str = "algorithms"}, 0, 0, ENC, "list_dither" },
{ "antialiases", NULL, 0, AV_OPT_TYPE_CONST, {.str = "antialiases"},0, 0, ENC, "list_dither" },
{ "charsets", NULL, 0, AV_OPT_TYPE_CONST, {.str = "charsets"}, 0, 0, ENC, "list_dither" },
{ "colors", NULL, 0, AV_OPT_TYPE_CONST, {.str = "colors"}, 0, 0, ENC, "list_dither" },
{ NULL },
}

Definition at line 199 of file caca.c.

◆ caca_class

const AVClass caca_class
static
Initial value:
= {
.class_name = "caca outdev",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 216 of file caca.c.

◆ ff_caca_muxer

const FFOutputFormat ff_caca_muxer
Initial value:
= {
.p.name = "caca",
.p.long_name = NULL_IF_CONFIG_SMALL("caca (color ASCII art) output device"),
.priv_data_size = sizeof(CACAContext),
.p.audio_codec = AV_CODEC_ID_NONE,
.p.video_codec = AV_CODEC_ID_RAWVIDEO,
.write_header = caca_write_header,
.write_packet = caca_write_packet,
.deinit = caca_deinit,
.p.flags = AVFMT_NOFILE,
.p.priv_class = &caca_class,
}

Definition at line 224 of file caca.c.

caca_write_header
static int caca_write_header(AVFormatContext *s)
Definition: caca.c:89
AVERROR
Filter the word “frame” indicates either a video frame or a group of audio as stored in an AVFrame structure Format for each input and each output the list of supported formats For video that means pixel format For audio that means channel sample they are references to shared objects When the negotiation mechanism computes the intersection of the formats supported at each end of a all references to both lists are replaced with a reference to the intersection And when a single format is eventually chosen for a link amongst the remaining all references to the list are updated That means that if a filter requires that its input and output have the same format amongst a supported all it has to do is use a reference to the same list of formats query_formats can leave some formats unset and return AVERROR(EAGAIN) to cause the negotiation mechanism toagain later. That can be used by filters with complex requirements to use the format negotiated on one link to set the formats supported on another. Frame references ownership and permissions
color
Definition: vf_paletteuse.c:511
AV_CODEC_ID_RAWVIDEO
@ AV_CODEC_ID_RAWVIDEO
Definition: codec_id.h:65
OFFSET
#define OFFSET(x)
Definition: caca.c:196
caca_class
static const AVClass caca_class
Definition: caca.c:216
ENC
#define ENC
Definition: caca.c:197
AV_LOG_ERROR
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
Definition: log.h:180
s
#define s(width, name)
Definition: cbs_vp9.c:198
window_title
static const char * window_title
Definition: ffplay.c:309
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
AV_OPT_TYPE_IMAGE_SIZE
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
Definition: opt.h:235
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:237
AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
Definition: log.h:40
c
Undefined Behavior In the C some operations are like signed integer dereferencing freed accessing outside allocated Undefined Behavior must not occur in a C it is not safe even if the output of undefined operations is unused The unsafety may seem nit picking but Optimizing compilers have in fact optimized code on the assumption that no undefined Behavior occurs Optimizing code based on wrong assumptions can and has in some cases lead to effects beyond the output of computations The signed integer overflow problem in speed critical code Code which is highly optimized and works with signed integers sometimes has the problem that often the output of the computation does not c
Definition: undefined.txt:32
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:106
AVFMT_NOFILE
#define AVFMT_NOFILE
Demuxer will use avio_open, no opened file should be provided by the caller.
Definition: avformat.h:469
caca_deinit
static void caca_deinit(AVFormatContext *s)
Definition: caca.c:45
AV_LOG_INFO
#define AV_LOG_INFO
Standard information.
Definition: log.h:191
AV_CODEC_ID_NONE
@ AV_CODEC_ID_NONE
Definition: codec_id.h:50
i
#define i(width, name, range_min, range_max)
Definition: cbs_h2645.c:255
ret
ret
Definition: filter_design.txt:187
options
static const AVOption options[]
Definition: caca.c:199
AV_OPT_TYPE_BOOL
@ AV_OPT_TYPE_BOOL
Definition: opt.h:244
av_log
#define av_log(a,...)
Definition: tableprint_vlc.h:27
caca_write_packet
static int caca_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: caca.c:186
AV_OPT_TYPE_STRING
@ AV_OPT_TYPE_STRING
Definition: opt.h:229
list_drivers
static void list_drivers(CACAContext *c)
Definition: caca.c:63
AV_OPT_TYPE_CONST
@ AV_OPT_TYPE_CONST
Definition: opt.h:234
CACAContext
Definition: caca.c:27