58 caca_free_display(
c->display);
62 caca_free_dither(
c->dither);
66 caca_free_canvas(
c->canvas);
73 const char *
const *drivers = caca_get_display_driver_list();
77 for (
i = 0; drivers[
i];
i += 2)
81#define DEFINE_LIST_DITHER(thing, thing_str) \
82static void list_dither_## thing(CACAContext *c) \
84 const char *const *thing = caca_get_dither_## thing ##_list(c->dither); \
87 av_log(c->ctx, AV_LOG_INFO, "Available %s:\n", thing_str); \
88 for (i = 0; thing[i]; i += 2) \
89 av_log(c->ctx, AV_LOG_INFO, "%s: %s\n", thing[i], thing[i + 1]); \
105 if (
c->list_drivers) {
109 if (
c->list_dither) {
111 list_dither_color(
c);
113 list_dither_charset(
c);
115 list_dither_algorithm(
c);
117 list_dither_antialias(
c);
121 if (
s->nb_streams > 1
130 "Unsupported pixel format '%s', choose rgb24\n",
135 c->canvas = caca_create_canvas(
c->window_width,
c->window_height);
143 c->dither = caca_create_dither(bpp, encctx->
width, encctx->
height,
144 bpp / 8 * encctx->
width,
145 0x0000ff, 0x00ff00, 0xff0000, 0);
152#define CHECK_DITHER_OPT(opt) do { \
153 if (caca_set_dither_##opt(c->dither, c->opt) < 0) { \
154 ret = AVERROR(errno); \
155 av_log(s, AV_LOG_ERROR, "Failed to set value '%s' for option '%s'\n", \
166 c->display = caca_create_display_with_driver(
c->canvas,
c->driver);
174 if (!
c->window_width || !
c->window_height) {
175 c->window_width = caca_get_canvas_width(
c->canvas);
176 c->window_height = caca_get_canvas_height(
c->canvas);
179 if (!
c->window_title)
181 caca_set_display_title(
c->display,
c->window_title);
191 caca_dither_bitmap(
c->canvas, 0, 0,
c->window_width,
c->window_height,
c->dither,
pkt->data);
192 caca_refresh_display(
c->display);
197#define OFFSET(x) offsetof(CACAContext,x)
198#define ENC AV_OPT_FLAG_ENCODING_PARAM
209 {
"list_dither",
"list available dither options",
OFFSET(list_dither),
AV_OPT_TYPE_FLAGS, { .i64 = 0 }, 0, INT_MAX,
ENC, .unit =
"list_dither" },
218 .class_name =
"caca outdev",
const FFOutputFormat ff_caca_muxer
Main libavdevice API header.
static void list_drivers(CACAContext *c)
static void caca_deinit(AVFormatContext *s)
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)
#define i(width, name, range_min, range_max)
static const char * window_title
@ AV_OPT_TYPE_IMAGE_SIZE
Underlying C type is two consecutive integers.
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
@ AV_OPT_TYPE_FLAGS
Underlying C type is unsigned int.
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
@ AV_OPT_TYPE_STRING
Underlying C type is a uint8_t* that is either NULL or points to a C string allocated with the av_mal...
#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.
#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
Memory handling functions.
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.
This struct describes the properties of an encoded stream.
int height
The height of the video frame in pixels.
int width
The width of the video frame in pixels.
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.