/*****************************************************************************
* 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 <vlc_plugin.h>
#include <vlc_vout_display.h>
#include <vlc_picture_pool.h>
-#include "keythread.h"
#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_pool_t *Pool (vout_display_t *, unsigned);
-static void Prepare(vout_display_t *, picture_t *);
-static void Display(vout_display_t *, picture_t *);
+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);
/* */
vout_display_cfg_t state;
picture_pool_t *pool;
- key_thread_t *keys;
};
/**
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)
vd->pool = Pool;
vd->prepare = Prepare;
- vd->display = Display;
+ vd->display = PictureDisplay;
vd->control = Control;
vd->manage = Manage;
vout_display_SendEventFullscreen(vd, false);
vout_display_SendEventDisplaySize(vd, fmt.i_width, fmt.i_height, false);
- sys->keys = vlc_CreateKeyThread(vd);
return VLC_SUCCESS;
error:
vout_display_t *vd = (vout_display_t *)object;
vout_display_sys_t *sys = vd->sys;
- vlc_DestroyKeyTread(sys->keys);
if (sys->pool)
picture_pool_Delete(sys->pool);
aa_close(sys->aa_context);
/**
* 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;
#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);
}
/**
/* TODO keys support to complete */
case AA_UP:
- vlc_EmitKey(sys->keys, KEY_UP);
+ vout_display_SendEventKey(vd, KEY_UP);
break;
case AA_DOWN:
- vlc_EmitKey(sys->keys, KEY_DOWN);
+ vout_display_SendEventKey(vd, KEY_DOWN);
break;
case AA_RIGHT:
- vlc_EmitKey(sys->keys, KEY_RIGHT);
+ vout_display_SendEventKey(vd, KEY_RIGHT);
break;
case AA_LEFT:
- vlc_EmitKey(sys->keys, KEY_LEFT);
+ vout_display_SendEventKey(vd, KEY_LEFT);
break;
case AA_BACKSPACE:
- vlc_EmitKey(sys->keys, KEY_BACKSPACE);
+ vout_display_SendEventKey(vd, KEY_BACKSPACE);
break;
case AA_ESC:
- vlc_EmitKey(sys->keys, KEY_ESC);
+ vout_display_SendEventKey(vd, KEY_ESC);
break;
default:
if (event >= 0x20 && event <= 0x7f)
- vlc_EmitKey(sys->keys, event);
+ vout_display_SendEventKey(vd, event);
break;
}
}