]> git.sesse.net Git - vlc/blobdiff - modules/video_output/caca.c
use OK instead of Ok
[vlc] / modules / video_output / caca.c
index 66e2452db06a9658a511f4c8981c1a7538647b3b..888414a9eaa1784566a5f279e637396f9b66e89b 100644 (file)
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <errno.h>                                                 /* ENOMEM */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_vout.h>
+#include <vlc_interface.h>
+#include <vlc_playlist.h>
+#include <vlc_keys.h>
 
 #include <caca.h>
 
 #   define caca_set_display_title(x,y) caca_set_window_title(y)
 #endif
 
-#include <vlc/vlc.h>
-#include <vlc_vout.h>
-#include <vlc_interface.h>
-#include <vlc_playlist.h>
-#include <vlc_keys.h>
-
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
@@ -76,7 +80,7 @@ vlc_module_begin();
     set_shortname( "Caca" );
     set_category( CAT_VIDEO );
     set_subcategory( SUBCAT_VIDEO_VOUT );
-    set_description( _("Color ASCII art video output") );
+    set_description( N_("Color ASCII art video output") );
     set_capability( "video output", 12 );
     set_callbacks( Create, Destroy );
 vlc_module_end();
@@ -159,10 +163,7 @@ static int Create( vlc_object_t *p_this )
     /* Allocate structure */
     p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
     if( p_vout->p_sys == NULL )
-    {
-        msg_Err( p_vout, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     p_vout->p_sys->p_cv = cucul_create_canvas(0, 0);
     if( !p_vout->p_sys->p_cv )
@@ -305,14 +306,22 @@ static int Manage( vout_thread_t *p_vout )
         vlc_value_t val;
 
 #ifdef CACA_API_VERSION_1
+#ifdef CACA_EVENT_OPAQUE
+        switch( caca_get_event_type( &ev ) )
+#else
         switch( ev.type )
+#endif /* CACA_EVENT_OPAQUE */
 #else
         switch( ev )
 #endif
         {
         case CACA_EVENT_KEY_RELEASE:
 #ifdef CACA_API_VERSION_1
+#ifdef CACA_EVENT_OPAQUE
+            switch( caca_get_event_key_ch( &ev ) )
+#else
             switch( ev.data.key.ch )
+#endif /* CACA_EVENT_OPAQUE */
 #else
             switch( ev & 0x00ffffff )
 #endif
@@ -335,23 +344,35 @@ static int Manage( vout_thread_t *p_vout )
             break;
 #ifdef CACA_API_VERSION_1
         case  CACA_EVENT_MOUSE_MOTION:
-            val.i_int = ev.data.mouse.x * p_vout->render.i_width
+            val.i_int =
+#ifdef CACA_EVENT_OPAQUE
+                caca_get_event_mouse_x( &ev )
+#else
+                ev.data.mouse.x
+#endif /* CACA_EVENT_OPAQUE */
+                * p_vout->render.i_width
                          / cucul_get_canvas_width( p_vout->p_sys->p_cv );
             var_Set( p_vout, "mouse-x", val );
-            val.i_int = ev.data.mouse.y * p_vout->render.i_height
+            val.i_int =
+#ifdef CACA_EVENT_OPAQUE
+                caca_get_event_mouse_y( &ev ) 
+#else
+                ev.data.mouse.y
+#endif /* CACA_EVENT_OPAQUE */
+                * p_vout->render.i_height
                          / cucul_get_canvas_height( p_vout->p_sys->p_cv );
             var_Set( p_vout, "mouse-y", val );
-            val.b_bool = VLC_TRUE;
+            val.b_bool = true;
             var_Set( p_vout, "mouse-moved", val );
             break;
         case CACA_EVENT_MOUSE_RELEASE:
-            val.b_bool = VLC_TRUE;
+            val.b_bool = true;
             var_Set( p_vout, "mouse-clicked", val );
             break;
         case CACA_EVENT_QUIT:
         {
             p_playlist = vlc_object_find( p_vout,
-                                          VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
+                                         VLC_OBJECT_PLAYLIST, FIND_ANYWHERE );
             if( p_playlist )
             {
                 playlist_Stop( p_playlist );
@@ -374,7 +395,7 @@ static int Manage( vout_thread_t *p_vout )
  *****************************************************************************/
 static void Render( vout_thread_t *p_vout, picture_t *p_pic )
 {
-    cucul_set_color( p_vout->p_sys->p_cv,
+    cucul_set_color_ansi( p_vout->p_sys->p_cv,
                      CUCUL_COLOR_DEFAULT, CUCUL_COLOR_BLACK );
     cucul_clear_canvas( p_vout->p_sys->p_cv );
     cucul_dither_bitmap( p_vout->p_sys->p_cv, 0, 0,
@@ -388,6 +409,7 @@ static void Render( vout_thread_t *p_vout, picture_t *p_pic )
  *****************************************************************************/
 static void Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
+    VLC_UNUSED(p_pic);
     caca_refresh_display( p_vout->p_sys->p_dp );
 }