]> git.sesse.net Git - vlc/blobdiff - modules/video_output/aa.c
MSW/DirectX: keep only picture_sys_t * instead of picture_resource_t
[vlc] / modules / video_output / aa.c
index f691ba53f4206127d6eae69c77a69dd62be5af9f..5a848cf6b57636d9982aba93473c8420cedc7455 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
  * 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 ?
  */
@@ -51,7 +57,7 @@ vlc_module_begin()
     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()
@@ -60,8 +66,8 @@ 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);
 
 /* */
@@ -74,7 +80,6 @@ struct vout_display_sys_t {
 
     vout_display_cfg_t  state;
     picture_pool_t      *pool;
-    key_thread_t        *keys;
 };
 
 /**
@@ -85,6 +90,11 @@ static int Open(vlc_object_t *object)
     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)
@@ -120,7 +130,7 @@ static int Open(vlc_object_t *object)
 
     vd->pool    = Pool;
     vd->prepare = Prepare;
-    vd->display = Display;
+    vd->display = PictureDisplay;
     vd->control = Control;
     vd->manage  = Manage;
 
@@ -131,7 +141,6 @@ static int Open(vlc_object_t *object)
     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:
@@ -149,7 +158,6 @@ static void Close(vlc_object_t *object)
     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);
@@ -183,7 +191,7 @@ static picture_pool_t *Pool(vout_display_t *vd, unsigned count)
 
 /**
  * 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;
 
@@ -200,6 +208,7 @@ static void Prepare(vout_display_t *vd, picture_t *picture)
 #else
     VLC_UNUSED(picture);
 #endif
+    VLC_UNUSED(subpicture);
 
     aa_fastrender(sys->aa_context, 0, 0,
                   vd->fmt.i_width, vd->fmt.i_height);
@@ -208,12 +217,13 @@ static void Prepare(vout_display_t *vd, picture_t *picture)
 /**
  * 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);
 }
 
 /**
@@ -292,26 +302,26 @@ static void Manage(vout_display_t *vd)
 
         /* 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;
         }
     }