/*****************************************************************************
* aa.c: "vout display" module using aalib
*****************************************************************************
- * Copyright (C) 2002-2009 the VideoLAN team
+ * Copyright (C) 2002-2009 VLC authors and VideoLAN
* $Id$
*
* Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
*
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/
/*****************************************************************************
#include <assert.h>
#include <aalib.h>
+#ifndef _WIN32
+# ifdef X_DISPLAY_MISSING
+# error Xlib required due to XInitThreads
+# endif
+# include <vlc_xlib.h>
+#endif
+
/* TODO
* - what about RGB palette ?
*/
set_category(CAT_VIDEO)
set_subcategory(SUBCAT_VIDEO_VOUT)
set_description(N_("ASCII-art video output"))
- set_capability("vout display", 10)
+ set_capability("vout display", /*10*/0)
add_shortcut("aalib")
set_callbacks(Open, Close)
vlc_module_end()
/*****************************************************************************
* Local prototypes
*****************************************************************************/
-static picture_t *Get (vout_display_t *);
-static void Prepare(vout_display_t *, picture_t *);
-static void Display(vout_display_t *, picture_t *);
-static int Control(vout_display_t *, int, va_list);
+static picture_pool_t *Pool (vout_display_t *, unsigned);
+static void Prepare(vout_display_t *, picture_t *, subpicture_t *);
+static void PictureDisplay(vout_display_t *, picture_t *, subpicture_t *);
+static int Control(vout_display_t *, int, va_list);
/* */
static void Manage(vout_display_t *);
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys;
+#ifndef _WIN32
+ if (!vlc_xlib_init (object))
+ return VLC_EGENERIC;
+#endif
+
/* Allocate structure */
vd->sys = sys = calloc(1, sizeof(*sys));
if (!sys)
msg_Err(vd, "cannot initialize aalib");
goto error;
}
+ vout_display_DeleteWindow(vd, NULL);
aa_autoinitkbd(sys->aa_context, 0);
aa_autoinitmouse(sys->aa_context, AA_MOUSEALLMASK);
vd->fmt = fmt;
vd->info = info;
- vd->get = Get;
+ vd->pool = Pool;
vd->prepare = Prepare;
- vd->display = Display;
+ vd->display = PictureDisplay;
vd->control = Control;
- vd->manage = Manage;
+ vd->manage = Manage;
/* Inspect initial configuration and send correction events
* FIXME how to handle aspect ratio with aa ? */
sys->state = *vd->cfg;
sys->state.is_fullscreen = false;
vout_display_SendEventFullscreen(vd, false);
- vout_display_SendEventDisplaySize(vd, fmt.i_width, fmt.i_height);
+ vout_display_SendEventDisplaySize(vd, fmt.i_width, fmt.i_height, false);
return VLC_SUCCESS;
}
/**
- * Return a direct buffer
+ * Return a pool of direct buffers
*/
-static picture_t *Get(vout_display_t *vd)
+static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
{
vout_display_sys_t *sys = vd->sys;
+ VLC_UNUSED(count);
if (!sys->pool) {
picture_resource_t rsc;
return NULL;
sys->pool = picture_pool_New(1, &p_picture);
- if (!sys->pool)
- return NULL;
}
-
- return picture_pool_Get(sys->pool);
+ return sys->pool;
}
/**
* Prepare a picture for display */
-static void Prepare(vout_display_t *vd, picture_t *picture)
+static void Prepare(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
vout_display_sys_t *sys = vd->sys;
red[ i ], green[ i ], blue[ i ]);
}
}
+#else
+ VLC_UNUSED(picture);
#endif
+ VLC_UNUSED(subpicture);
aa_fastrender(sys->aa_context, 0, 0,
vd->fmt.i_width, vd->fmt.i_height);
/**
* Display a picture
*/
-static void Display(vout_display_t *vd, picture_t *picture)
+static void PictureDisplay(vout_display_t *vd, picture_t *picture, subpicture_t *subpicture)
{
vout_display_sys_t *sys = vd->sys;
aa_flush(sys->aa_context);
picture_Release(picture);
+ VLC_UNUSED(subpicture);
}
/**
*/
static int Control(vout_display_t *vd, int query, va_list args)
{
+ VLC_UNUSED(args);
vout_display_sys_t *sys = vd->sys;
switch (query) {
aa_resize(sys->aa_context);
vout_display_SendEventDisplaySize(vd,
aa_imgwidth(sys->aa_context),
- aa_imgheight(sys->aa_context));
+ aa_imgheight(sys->aa_context), false);
break;
/* TODO keys support to complete */
case AA_ESC:
vout_display_SendEventKey(vd, KEY_ESC);
break;
- case 0x20:
- vout_display_SendEventKey(vd, KEY_SPACE);
- break;
default:
if (event >= 0x20 && event <= 0x7f)
vout_display_SendEventKey(vd, event);