[MPlayer-dev-eng] Re: [PATCH] libcaca native support

Pigeon pigeon at pigeond.net
Sat Apr 3 02:49:28 CEST 2004


    Here's the full patch with updated man page and xml docs.


> Please also add an entry to the VIDEO OUT DRIVERS section of the man
> page.
> Thanks

-------------- next part --------------
diff -ruN mplayer-cvs/AUTHORS mplayer-cvs-hacked/AUTHORS
--- mplayer-cvs/AUTHORS	Sat Apr  3 10:30:08 2004
+++ mplayer-cvs-hacked/AUTHORS	Sat Apr  3 10:31:27 2004
@@ -190,6 +190,9 @@
 Folke Ashberg <folke at ashberg.de>
     * native AAlib driver (-vo aa)
 
+Howell Tam (Pigeon) <pigeon at pigeond.net>
+    * native libcaca driver (-vo caca)
+
 Ivan Kalvachev (iive) <iive at yahoo.com>
     * interlaced MPEG2 support (libmpeg2)
     * libvo2 draft
diff -ruN mplayer-cvs/DOCS/man/en/mplayer.1 mplayer-cvs-hacked/DOCS/man/en/mplayer.1
--- mplayer-cvs/DOCS/man/en/mplayer.1	Sat Apr  3 10:30:08 2004
+++ mplayer-cvs-hacked/DOCS/man/en/mplayer.1	Sat Apr  3 10:30:36 2004
@@ -151,11 +151,11 @@
 .PP
 Another great feature of MPlayer is the wide range of supported output
 drivers.
-It works with X11, XV, DGA, OpenGL, SVGAlib, fbdev, AAlib, DirectFB, but you
-can also use GGI, SDL (and this way all their drivers), VESA (on every VESA
-compatible card, even without X11), some low level card-specific drivers (for
-Matrox, 3Dfx and ATI) and some hardware MPEG decoder boards, such as the
-Siemens DVB, DXR2 and DXR3/\:Hollywood+.
+It works with X11, XV, DGA, OpenGL, SVGAlib, fbdev, AAlib, libcaca, DirectFB,
+but you can also use GGI, SDL (and this way all their drivers), VESA (on
+every VESA compatible card, even without X11), some low level card-specific
+drivers (for Matrox, 3Dfx and ATI) and some hardware MPEG decoder boards,
+such as the Siemens DVB, DXR2 and DXR3/\:Hollywood+.
 Most of them support software or hardware scaling, so you can enjoy movies in
 fullscreen.
 .PP
@@ -3591,6 +3591,9 @@
 .TP
 .B aa\ \ \ \ \ 
 ASCII art output driver that works on a text console.
+.TP
+.B caca\ \ \ \ \ 
+Colour AsCii Art output driver that works on a text console.
 .TP
 .B bl\ \ \ \ \ 
 Video playback using the Blinkenlights UDP protocol.
diff -ruN mplayer-cvs/DOCS/tech/MAINTAINERS mplayer-cvs-hacked/DOCS/tech/MAINTAINERS
--- mplayer-cvs/DOCS/tech/MAINTAINERS	Thu Mar 18 02:58:09 2004
+++ mplayer-cvs-hacked/DOCS/tech/MAINTAINERS	Sat Apr  3 10:30:36 2004
@@ -74,6 +74,7 @@
 libvo drivers:
     * vo_3dfx.c - OBSOLETED, use xv or tdfxfb
     * vo_aa.c - Alban Bedel
+    * vo_caca.c - Howell Tam (Pigeon)
     * vo_bl.c - Rik Snel
     * vo_cvidix.c - Sascha Sommer
     * vo_dga.c - ? (Acki (outdated))
diff -ruN mplayer-cvs/DOCS/tech/libvo2.txt mplayer-cvs-hacked/DOCS/tech/libvo2.txt
--- mplayer-cvs/DOCS/tech/libvo2.txt	Mon Feb 24 00:55:59 2003
+++ mplayer-cvs-hacked/DOCS/tech/libvo2.txt	Sat Apr  3 10:30:36 2004
@@ -182,7 +182,7 @@
 
 > Maybe we should allow video driver to change the libin driver ? 
 forget libin. most input stuff is handled by libvo drivers.
-think of all X stuff (x11,xv,dga,xmga,gl), SDL, aalib, svgalib.
+think of all X stuff (x11,xv,dga,xmga,gl), SDL, aalib, libcaca, svgalib.
 only a few transparent drivers (fbdev, mga, tdfxfb, vesa) has not, but all
 of them are running on console (and maybe on second head) at fullscreen, so
 they may not need mouse events. console keyboard events are already catched
diff -ruN mplayer-cvs/DOCS/xml/en/documentation.xml mplayer-cvs-hacked/DOCS/xml/en/documentation.xml
--- mplayer-cvs/DOCS/xml/en/documentation.xml	Mon Feb  2 11:42:49 2004
+++ mplayer-cvs-hacked/DOCS/xml/en/documentation.xml	Sat Apr  3 10:30:36 2004
@@ -63,8 +63,8 @@
 <emphasis role="bold">DivX</emphasis> movies too (and you don't need the avifile
 library at all!). Another big feature of mplayer is the wide range of
 supported output drivers. It works with X11, Xv, DGA, OpenGL, SVGAlib,
-fbdev, AAlib, DirectFB, but you can use GGI and SDL (and this way all their
-drivers) and some lowlevel card-specific drivers (for Matrox, 3Dfx and
+fbdev, AAlib, libcaca, DirectFB, but you can use GGI and SDL (and this way all
+their drivers) and some lowlevel card-specific drivers (for Matrox, 3Dfx and
 Radeon, Mach64, Permedia3) too! Most of them supports software or hardware
 scaling, so you can enjoy movies in fullscreen.
 <application>MPlayer</application> supports displaying through some
diff -ruN mplayer-cvs/DOCS/xml/en/video.xml mplayer-cvs-hacked/DOCS/xml/en/video.xml
--- mplayer-cvs/DOCS/xml/en/video.xml	Fri Jan 30 19:42:22 2004
+++ mplayer-cvs-hacked/DOCS/xml/en/video.xml	Sat Apr  3 10:30:36 2004
@@ -1115,6 +1115,89 @@
 </sect4>
 
 
+<sect4 id="caca">
+<title>libcaca - Colour AsCii Art library</title>
+
+<para>
+The <ulink url="http://sam.zoy.org/projects/libcaca/">libcaca</ulink> library is
+a graphics library that outputs text instead of pixels, so that it can work on
+older video cards or text terminals. It is not unlike the famous AAlib library.
+libcaca needs a terminal to work, thus it should work on all Unix systems
+(including Mac OS X) using either the slang library or the ncurses library, on
+DOS using the conio.h library, and on Windows systems using either slang or
+ncurses (through Cygwin emulation) or conio.h. <filename>./configure</filename>
+detects libcaca installed, the caca libvo driver will be built.
+</para>
+
+<itemizedlist spacing="compact">
+<title>The differences with AAlib are the following:</title>
+<listitem><simpara>
+   16 available colours for character output (256 colour pairs)
+  </simpara></listitem>
+<listitem><simpara>
+   dithering of colour images
+  </simpara></listitem>
+</itemizedlist>
+
+<itemizedlist spacing="compact">
+<title>But libcaca also has the following limitations:</title>
+<listitem><simpara>
+   no support for brightness, contrast, gamma
+  </simpara></listitem>
+</itemizedlist>
+
+<para>
+You can use some keys in the caca window to change rendering options:
+</para>
+
+<informaltable>
+<tgroup cols="2">
+<thead>
+  <row><entry>Key</entry><entry>Action</entry></row>
+</thead>
+<tbody>
+<row><entry><keycap>d</keycap></entry><entry>
+  toggle libcaca dithering methods
+  </entry></row>
+<row><entry><keycap>a</keycap></entry><entry>
+  toggle libcaca antialiasing
+  </entry></row>
+<row><entry><keycap>b</keycap></entry><entry>
+  toggle libcaca background
+  </entry></row>
+</tbody>
+</tgroup>
+</informaltable>
+
+<variablelist>
+<title>libcaca will also look for a certain environment variables:</title>
+<varlistentry>
+  <term><option>CACA_DRIVER</option></term>
+  <listitem><simpara>
+    set recommended caca driver. e.g. ncurses, slang, x11
+    </simpara></listitem>
+</varlistentry>
+<varlistentry>
+  <term><option>CACA_GEOMETRY</option></term>
+  <listitem><simpara>
+    x11 only. Specifies the number of rows and columns. e.g. 128x50
+    </simpara></listitem>
+</varlistentry>
+<varlistentry>
+  <term><option>CACA_FONT</option></term>
+  <listitem><simpara>
+    x11 only. Specifies the font to use. e.g. fixed, nexus
+    </simpara></listitem>
+</varlistentry>
+</variablelist>
+
+<para>
+Use the <option>-framedrop</option> option if your computer isn't fast
+enough to render all frames!
+</para>
+
+</sect4>
+
 <sect4 id="vesa">
 <title>VESA - output to VESA BIOS</title>
 
diff -ruN mplayer-cvs/Makefile mplayer-cvs-hacked/Makefile
--- mplayer-cvs/Makefile	Wed Dec 10 23:03:54 2003
+++ mplayer-cvs-hacked/Makefile	Sat Mar 27 15:59:42 2004
@@ -32,7 +32,7 @@
 OBJS_MENCODER = $(SRCS_MENCODER:.c=.o)
 OBJS_MPLAYER = $(SRCS_MPLAYER:.c=.o)
 
-VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) 
+VO_LIBS = $(AA_LIB) $(X_LIB) $(SDL_LIB) $(GGI_LIB) $(MP1E_LIB) $(MLIB_LIB) $(SVGA_LIB) $(DIRECTFB_LIB) $(CACA_LIB)
 AO_LIBS = $(ARTS_LIB) $(ESD_LIB) $(NAS_LIB) $(SGIAUDIO_LIB)
 CODEC_LIBS = $(AV_LIB) $(FAME_LIB) $(MAD_LIB) $(VORBIS_LIB) $(THEORA_LIB) $(FAAD_LIB) $(LIBLZO_LIB) $(DECORE_LIB) $(XVID_LIB) $(PNG_LIB) $(Z_LIB) $(JPEG_LIB) $(ALSA_LIB) $(XMMS_LIB) $(MATROSKA_LIB) 
 COMMON_LIBS = libmpcodecs/libmpcodecs.a mp3lib/libMP3.a liba52/liba52.a libmpeg2/libmpeg2.a $(W32_LIB) $(DS_LIB) libaf/libaf.a libmpdemux/libmpdemux.a input/libinput.a postproc/libswscale.a osdep/libosdep.a $(DVDREAD_LIB) $(CODEC_LIBS) $(FREETYPE_LIB) $(TERMCAP_LIB) $(CDPARANOIA_LIB) $(MPLAYER_NETWORK_LIB) $(WIN32_LIB) $(GIF_LIB) $(MACOSX_FRAMEWORKS) $(SMBSUPPORT_LIB) $(FRIBIDI_LIB) $(FLAC_LIB) $(FONTCONFIG_LIB)
diff -ruN mplayer-cvs/configure mplayer-cvs-hacked/configure
--- mplayer-cvs/configure	Sat Apr  3 10:30:08 2004
+++ mplayer-cvs-hacked/configure	Sat Apr  3 10:30:36 2004
@@ -221,6 +221,7 @@
   --enable-svga          build with SVGAlib support [autodetect]
   --enable-sdl           build with SDL render support [autodetect]
   --enable-aa            build with AAlib render support [autodetect]
+  --enable-caca          build with CACA render support [autodetect]
   --enable-ggi           build with GGI render support [autodetect]
   --enable-directx       build with DirectX support [autodetect]
   --enable-dxr2          build with DXR2 render support [autodetect]
@@ -1136,6 +1137,7 @@
 _gl=auto
 _ggi=auto
 _aa=auto
+_caca=auto
 _svga=auto
 _vesa=auto
 _fbdev=auto
@@ -1281,6 +1283,8 @@
   --disable-ggi)	_ggi=no		;;
   --enable-aa)		_aa=yes		;;
   --disable-aa)		_aa=no		;;
+  --enable-caca)	_caca=yes	;;
+  --disable-caca)	_caca=no	;;
   --enable-svga)	_svga=yes	;;
   --disable-svga)	_svga=no	;;
   --enable-vesa)	_vesa=yes	;;
@@ -3285,6 +3289,26 @@
 fi
 echores "$_aa"
 
+echocheck "CACA"
+if test "$_caca" = auto ; then
+  cat > $TMPC << EOF
+#include <caca.h>
+int main(void) { (void) caca_init(); return 0; }
+EOF
+  _caca=no
+  cc_check `caca-config --libs` && _caca=yes
+fi
+if test "$_caca" = yes ; then
+  _def_caca='#define HAVE_CACA 1'
+  _ld_caca=`caca-config --libs`
+  _vosrc="$_vosrc vo_caca.c"
+  _vomodules="caca $_vomodules"
+else
+  _def_caca='#undef HAVE_CACA'
+  _novomodules="caca $_novomodules"
+fi
+echores "$_caca"
+
 
 echocheck "SVGAlib"
 if test "$_svga" = auto ; then
@@ -5922,6 +5946,7 @@
 SDL_LIB = $_ld_sdl
 SVGA_LIB = $_ld_svga
 AA_LIB = $_ld_aa
+CACA_LIB = $_ld_caca
 
 # audio output
 ALSA_LIB = $_ld_alsa
@@ -6568,6 +6593,7 @@
 $_def_vesa
 $_def_xdpms
 $_def_aa
+$_def_caca
 $_def_tga
 
 /* used by GUI: */
diff -ruN mplayer-cvs/libvo/video_out.c mplayer-cvs-hacked/libvo/video_out.c
--- mplayer-cvs/libvo/video_out.c	Sun Mar 14 03:48:52 2004
+++ mplayer-cvs-hacked/libvo/video_out.c	Sat Apr  3 10:30:36 2004
@@ -83,6 +83,7 @@
 extern vo_functions_t video_out_png;
 extern vo_functions_t video_out_ggi;
 extern vo_functions_t video_out_aa;
+extern vo_functions_t video_out_caca;
 extern vo_functions_t video_out_mpegpes;
 extern vo_functions_t video_out_yuv4mpeg;
 #ifdef HAVE_DIRECTX
@@ -177,6 +178,9 @@
 #endif
 #ifdef HAVE_AA
 	&video_out_aa,
+#endif
+#ifdef HAVE_CACA
+	&video_out_caca,
 #endif
 #ifdef HAVE_DXR2
 	&video_out_dxr2,
diff -ruN mplayer-cvs/libvo/vo_caca.c mplayer-cvs-hacked/libvo/vo_caca.c
--- mplayer-cvs/libvo/vo_caca.c	Thu Jan  1 10:00:00 1970
+++ mplayer-cvs-hacked/libvo/vo_caca.c	Sat Apr  3 10:30:36 2004
@@ -0,0 +1,411 @@
+/*
+ * MPlayer
+ * 
+ * Video driver for libcaca
+ * 
+ * by Pigeon <pigeon at pigeond.net>
+ *
+ * Some functions/codes/ideas are from x11 and aalib vo
+ *
+ * TODO: support those draw_alpha stuff?
+ * 
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <sys/stat.h>
+#include <unistd.h>
+
+#include <string.h>
+#include <time.h>
+#include <errno.h>
+
+#include "config.h"
+#include "video_out.h"
+#include "video_out_internal.h"
+#include "sub.h"
+
+#include "osdep/keycodes.h"
+#include "mp_msg.h"
+
+#include <caca.h>
+
+static vo_info_t info = {
+    "libcaca",
+    "caca",
+    "Pigeon <pigeon at pigeond.net>",
+    ""
+};
+
+LIBVO_EXTERN(caca)
+
+
+/* caca stuff */
+static struct caca_bitmap *cbitmap = NULL;
+
+
+/* image infos */
+static int image_format;
+static int image_width;
+static int image_height;
+
+
+static int screen_w, screen_h;
+
+
+/* We want 24bpp always for now */
+static unsigned int bpp = 24;
+static unsigned int depth = 3;
+static unsigned int rmask = 0xff0000;
+static unsigned int gmask = 0x00ff00;
+static unsigned int bmask = 0x0000ff;
+static unsigned int amask = 0;
+
+
+#define MESSAGE_SIZE 512
+#define MESSAGE_DURATION 5
+
+static time_t stoposd = 0;
+static int showosdmessage = 0;
+static char osdmessagetext[MESSAGE_SIZE];
+static char posbar[MESSAGE_SIZE];
+
+static int osdx = 0, osdy = 0;
+static int posbary = 2;
+
+
+static void
+osdmessage(int duration, char *fmt, ...)
+{
+    /*
+     * for outputting a centered string at the bottom
+     * of our window for a while
+     */
+    va_list ar;
+    char m[MESSAGE_SIZE];
+
+    va_start(ar, fmt);
+    vsprintf(m, fmt, ar);
+    va_end(ar);
+    strcpy(osdmessagetext, m);
+
+    showosdmessage = 1;
+    stoposd = time(NULL) + duration;
+    osdx = (screen_w - strlen(osdmessagetext)) / 2;
+    posbar[0] = '\0';
+}
+
+static void
+osdpercent(int duration, int min, int max, int val, char *desc, char *unit)
+{
+    /*
+     * prints a bar for setting values
+     */
+    float step;
+    int where;
+    int i;
+
+
+    step = (float) screen_w / (float) (max - min);
+    where = (val - min) * step;
+    osdmessage(duration, "%s: %i%s", desc, val, unit);
+    posbar[0] = '|';
+    posbar[screen_w - 1] = '|';
+
+    for(i = 0; i < screen_w; i++)
+    {
+        if(i == where)
+	{
+	    posbar[i] = '#';
+	}
+        else
+	{
+	    posbar[i] = '-';
+	}
+    }
+
+    if(where != 0)
+    {
+	posbar[0] = '|';
+    }
+
+    if(where != (screen_w - 1))
+    {
+	posbar[screen_w - 1] = '|';
+    }
+
+    posbar[screen_w] = '\0';
+
+}
+
+
+static int
+resize()
+{
+    screen_w = caca_get_width();
+    screen_h = caca_get_height();
+
+    if(cbitmap)
+    {
+	caca_free_bitmap(cbitmap);
+    }
+
+    cbitmap = caca_create_bitmap(bpp, image_width, image_height,
+	    depth * image_width, rmask, gmask, bmask, amask);
+
+    if(!cbitmap)
+    {
+	mp_msg(MSGT_VO, MSGL_FATAL, "vo_caca: caca_create_bitmap failed!\n");
+    }
+
+    return 0;
+}
+
+
+static uint32_t
+config(uint32_t width, uint32_t height, uint32_t d_width,
+	    uint32_t d_height, uint32_t fullscreen, char *title, 
+	    uint32_t format) {
+    /*
+     * main init
+     * called by mplayer
+     */
+
+    image_height = height;
+    image_width = width;
+    image_format = format;
+
+    showosdmessage = 0;
+    posbar[0] = '\0';
+
+    mp_msg(MSGT_VO, MSGL_INFO,
+	    "\n"
+	    "MPlayer libcaca\n"
+	    "\n"
+	    "\tSome keys you might want to know about:\n"
+	    "\td - toggle libcaca dithering methods\n"
+	    "\ta - toggle libcaca antialiasing\n"
+	    "\tb - toggle libcaca background\n"
+	    "\n"
+	    "\tYou may also want to set libcaca environment variables such as:\n"
+	    "\tCACA_DRIVER: ncurses, slang, x11\n"
+	    "\tCACA_GEOMETRY: XxY, e.g. 128x50 (x11 only)\n"
+	    "\tCACA_FONT: e.g. fixed, nexus (x11 only)\n"
+	    "\n"
+	  );
+
+    return resize();
+}
+
+
+static uint32_t 
+draw_frame(uint8_t *src[]) {
+    caca_draw_bitmap(0, 0, screen_w, screen_h, cbitmap, src[0]);
+    return 0;
+}
+
+static uint32_t 
+draw_slice(uint8_t *src[], int stride[], int w, int h, int x, int y) {
+    return 0;
+}
+
+
+static void 
+flip_page(void) {
+
+    if(showosdmessage)
+    {
+	if(time(NULL) >= stoposd)
+	{
+	    showosdmessage = 0;
+
+	    if(posbar)
+	    {
+		posbar[0] = '\0';
+	    }
+	}
+	else
+	{
+	    caca_putstr(osdx, osdy, osdmessagetext);
+	    
+	    if(posbar)
+	    {
+		caca_putstr(0, posbary, posbar);
+	    }
+	}
+    }
+
+    caca_refresh();
+}
+
+static void 
+check_events(void) {
+
+    unsigned int cev;
+
+    if((cev = caca_get_event(CACA_EVENT_ANY)))
+    {
+	if(cev & CACA_EVENT_RESIZE)
+	{
+	    caca_refresh();
+	    resize();
+	}
+	else if(cev & CACA_EVENT_KEY_RELEASE)
+	{
+	    int key = (cev & 0x00ffffff);
+	    enum caca_feature cf;
+
+	    switch(key)
+	    {
+		case 'd':
+		case 'D':
+		    /* Toggle dithering method */
+		    cf = 1 + caca_get_feature(CACA_DITHERING);
+		    if(cf > CACA_DITHERING_MAX)
+		    {
+			cf = CACA_DITHERING_MIN;
+		    }
+		    caca_set_feature(cf);
+		    osdmessage(MESSAGE_DURATION,
+			    "Using %s", caca_get_feature_name(cf));
+		    break;
+
+		case 'a':
+		case 'A':
+		    /* Toggle antialiasing method */
+		    cf = 1 + caca_get_feature(CACA_ANTIALIASING);
+		    if(cf > CACA_ANTIALIASING_MAX)
+		    {
+			cf = CACA_ANTIALIASING_MIN;
+		    }
+		    caca_set_feature(cf);
+		    osdmessage(MESSAGE_DURATION,
+			    "Using %s", caca_get_feature_name(cf));
+		    break;
+
+		case 'b':
+		case 'B':
+		    /* Toggle background method */
+		    cf = 1 + caca_get_feature(CACA_BACKGROUND);
+		    if(cf > CACA_BACKGROUND_MAX)
+		    {
+			cf = CACA_BACKGROUND_MIN;
+		    }
+		    caca_set_feature(cf);
+		    osdmessage(MESSAGE_DURATION,
+			    "Using %s", caca_get_feature_name(cf));
+		    break;
+
+		case CACA_KEY_UP:
+		    mplayer_put_key(KEY_UP);
+		    break;
+		case CACA_KEY_DOWN:
+		    mplayer_put_key(KEY_DOWN);
+		    break;
+		case CACA_KEY_LEFT:
+		    mplayer_put_key(KEY_LEFT);
+		    break;
+		case CACA_KEY_RIGHT:
+		    mplayer_put_key(KEY_RIGHT);
+		    break;
+		case CACA_KEY_ESCAPE:
+		    mplayer_put_key(KEY_ESC);
+		    break;
+		case CACA_KEY_PAGEUP:
+		    mplayer_put_key(KEY_PAGE_UP);
+		    break;
+		case CACA_KEY_PAGEDOWN:
+		    mplayer_put_key(KEY_PAGE_DOWN);
+		    break;
+		case CACA_KEY_RETURN:
+		    mplayer_put_key(KEY_ENTER);
+		    break;
+		case CACA_KEY_HOME:
+		    mplayer_put_key(KEY_HOME);
+		    break;
+		case CACA_KEY_END:
+		    mplayer_put_key(KEY_END);
+		    break;
+		default:
+		    if(key <= 255)
+		    {
+			mplayer_put_key(key);
+		    }
+		    break;
+	    }
+	}
+    }
+}
+
+static void 
+uninit(void) {
+    caca_free_bitmap(cbitmap);
+    cbitmap = NULL;
+    caca_end();
+}
+
+
+static void
+draw_osd(void){
+#ifdef USE_OSD
+    if(vo_osd_progbar_type != -1)
+    {
+	osdpercent(MESSAGE_DURATION, 0, 255,
+		vo_osd_progbar_value, __sub_osd_names[vo_osd_progbar_type], "");
+    }
+#endif
+}
+
+
+static uint32_t
+preinit(const char *arg)
+{
+    if(arg) 
+    {
+	mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: Unknown subdevice: %s\n",arg);
+	return ENOSYS;
+    }
+
+    if (caca_init())
+    {
+	mp_msg(MSGT_VO, MSGL_ERR, "vo_caca: failed to initialize\n");
+    }
+
+    caca_set_window_title("mplayer");
+
+    /* Default libcaca features */
+    caca_set_feature(CACA_ANTIALIASING_PREFILTER);
+    caca_set_feature(CACA_DITHERING_RANDOM);
+
+    return 0;
+}
+
+static uint32_t 
+query_format(uint32_t format) {
+
+    if(format == IMGFMT_BGR24)
+    {
+	return
+#ifdef USE_OSD
+	    VFCAP_OSD |
+#endif
+	    VFCAP_CSP_SUPPORTED;
+    }
+
+    return 0;
+}
+
+static uint32_t
+control(uint32_t request, void *data, ...)
+{
+    switch(request)
+    {
+	case VOCTRL_QUERY_FORMAT:
+	    return query_format(*((uint32_t *) data));
+	default:
+	    return VO_NOTIMPL;
+    }
+}
+
+


More information about the MPlayer-dev-eng mailing list