51 caca_free_display(
c->display);
55 caca_free_dither(
c->dither);
59 caca_free_canvas(
c->canvas);
67 const char *
const *drivers = caca_get_display_driver_list();
71 for (
i = 0; drivers[
i];
i += 2)
75 #define DEFINE_LIST_DITHER(thing, thing_str) \
76 static void list_dither_## thing(CACAContext *c) \
78 const char *const *thing = caca_get_dither_## thing ##_list(c->dither); \
81 av_log(c->ctx, AV_LOG_INFO, "Available %s:\n", thing_str); \
82 for (i = 0; thing[i]; i += 2) \
83 av_log(c->ctx, AV_LOG_INFO, "%s: %s\n", thing[i], thing[i + 1]); \
99 if (
c->list_drivers) {
103 if (
c->list_dither) {
104 if (!strcmp(
c->list_dither,
"colors")) {
105 list_dither_color(
c);
106 }
else if (!strcmp(
c->list_dither,
"charsets")) {
107 list_dither_charset(
c);
108 }
else if (!strcmp(
c->list_dither,
"algorithms")) {
109 list_dither_algorithm(
c);
110 }
else if (!strcmp(
c->list_dither,
"antialiases")) {
111 list_dither_antialias(
c);
114 "Invalid argument '%s', for 'list_dither' option\n"
115 "Argument must be one of 'algorithms, 'antialiases', 'charsets', 'colors'\n",
122 if (
s->nb_streams > 1
131 "Unsupported pixel format '%s', choose rgb24\n",
136 c->canvas = caca_create_canvas(
c->window_width,
c->window_height);
144 c->dither = caca_create_dither(bpp, encctx->
width, encctx->
height,
145 bpp / 8 * encctx->
width,
146 0x0000ff, 0x00ff00, 0xff0000, 0);
153 #define CHECK_DITHER_OPT(opt) do { \
154 if (caca_set_dither_##opt(c->dither, c->opt) < 0) { \
155 ret = AVERROR(errno); \
156 av_log(s, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", \
167 c->display = caca_create_display_with_driver(
c->canvas,
c->driver);
175 if (!
c->window_width || !
c->window_height) {
176 c->window_width = caca_get_canvas_width(
c->canvas);
177 c->window_height = caca_get_canvas_height(
c->canvas);
180 if (!
c->window_title)
182 caca_set_display_title(
c->display,
c->window_title);
196 caca_dither_bitmap(
c->canvas, 0, 0,
c->window_width,
c->window_height,
c->dither,
pkt->
data);
197 caca_refresh_display(
c->display);
202 #define OFFSET(x) offsetof(CACAContext,x)
203 #define ENC AV_OPT_FLAG_ENCODING_PARAM
Main libavdevice API header.
static const AVOption options[]
static int caca_write_trailer(AVFormatContext *s)
static void list_drivers(CACAContext *c)
static const AVClass caca_class
#define DEFINE_LIST_DITHER(thing, thing_str)
#define CHECK_DITHER_OPT(opt)
static int caca_write_packet(AVFormatContext *s, AVPacket *pkt)
static int caca_write_header(AVFormatContext *s)
AVOutputFormat ff_caca_muxer
#define flags(name, subs,...)
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
static const char * window_title
static void write_header(FFV1Context *f)
@ AV_OPT_TYPE_IMAGE_SIZE
offset must point to two consecutive integers
#define AVERROR_EXIT
Immediate exit was requested; the called function should not be restarted.
#define AV_LOG_INFO
Standard information.
#define AV_LOG_ERROR
Something went wrong and cannot losslessly be recovered.
const char * av_default_item_name(void *ptr)
Return the context name.
int64_t av_rescale_q(int64_t a, AVRational bq, AVRational cq)
Rescale a 64-bit integer by 2 rational numbers.
char * av_strdup(const char *s)
Duplicate a string.
#define AV_TIME_BASE_Q
Internal time base represented as fractional value.
#define LIBAVUTIL_VERSION_INT
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
@ AV_CLASS_CATEGORY_DEVICE_VIDEO_OUTPUT
int av_get_bits_per_pixel(const AVPixFmtDescriptor *pixdesc)
Return the number of bits per pixel used by the pixel format described by pixdesc.
const char * av_get_pix_fmt_name(enum AVPixelFormat pix_fmt)
Return the short name for a pixel format, NULL in case pix_fmt is unknown.
const AVPixFmtDescriptor * av_pix_fmt_desc_get(enum AVPixelFormat pix_fmt)
@ AV_PIX_FMT_RGB24
packed RGB 8:8:8, 24bpp, RGBRGB...
Describe the class of an AVClass context structure.
const char * class_name
The name of the class; usually it is the same name as the context structure type to which the AVClass...
This struct describes the properties of an encoded stream.
enum AVMediaType codec_type
General type of the encoded data.
enum AVCodecID codec_id
Specific type of the encoded data (the codec used).
This structure stores compressed data.
AVCodecParameters * codecpar
Codec parameters associated with this stream.
AVRational time_base
This is the fundamental unit of time (in seconds) in terms of which frame timestamps are represented.
static int write_trailer(AVFormatContext *s1)