]> git.sesse.net Git - vlc/blobdiff - modules/video_output/aa.c
Merge branch 1.0-bugfix
[vlc] / modules / video_output / aa.c
index 05c34bf09ac75ca33805191584178d51c065a6a6..a46998fb0259a8397ede28b656b068f7068205c0 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * vout_aa.c: Aa video output display method for testing purposes
  *****************************************************************************
- * Copyright (C) 2002 the VideoLAN team
+ * Copyright (C) 2002-2009 the VideoLAN team
  * $Id$
  *
  * Authors: Sigmund Augdal Helberg <dnumgis@videolan.org>
  *
  * 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., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
 #include <errno.h>                                                 /* ENOMEM */
-#include <stdlib.h>                                                /* free() */
-#include <string.h>                                            /* strerror() */
 
 #include <aalib.h>
 
-#include <vlc/vlc.h>
-#include <vlc/vout.h>
-#include <vlc/intf.h>
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <vlc_common.h>
+#include <vlc_plugin.h>
+#include <vlc_vout.h>
+#include <vlc_interface.h>
 
 /*****************************************************************************
  * Local prototypes
@@ -51,15 +54,15 @@ static void SetPalette     ( vout_thread_t *, uint16_t *, uint16_t *, uint16_t *
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_shortname( _("Ascii Art"));
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VOUT );
-    set_description( _("ASCII-art video output") );
-    set_capability( "video output", 10 );
-    add_shortcut( "aalib" );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+vlc_module_begin ()
+    set_shortname( N_("ASCII Art"))
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VOUT )
+    set_description( N_("ASCII-art video output") )
+    set_capability( "video output", 10 )
+    add_shortcut( "aalib" )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 /*****************************************************************************
  * vout_sys_t: aa video output method descriptor
@@ -87,10 +90,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( 1 );
-    }
+        return VLC_ENOMEM;
 
     /* Don't parse any options, but take $AAOPTS into account */
     aa_parseoptions( NULL, NULL, NULL, NULL );
@@ -98,7 +98,8 @@ static int Create( vlc_object_t *p_this )
     if (!(p_vout->p_sys->aa_context = aa_autoinit(&aa_defparams)))
     {
         msg_Err( p_vout, "cannot initialize aalib" );
-        return( 1 );
+        free( p_vout->p_sys );
+        return VLC_EGENERIC;
     }
 
     p_vout->pf_init = Init;
@@ -112,7 +113,8 @@ static int Create( vlc_object_t *p_this )
     aa_autoinitkbd( p_vout->p_sys->aa_context, 0 );
     aa_autoinitmouse( p_vout->p_sys->aa_context, AA_MOUSEPRESSMASK );
     aa_hidemouse( p_vout->p_sys->aa_context );
-    return( 0 );
+
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -125,7 +127,7 @@ static int Init( vout_thread_t *p_vout )
 
     I_OUTPUTPICTURES = 0;
 
-    p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+    p_vout->output.i_chroma = VLC_CODEC_RGB8;
     p_vout->output.i_width = p_vout->p_sys->i_width;
     p_vout->output.i_height = p_vout->p_sys->i_height;
     p_vout->output.i_aspect = p_vout->p_sys->i_width
@@ -143,9 +145,7 @@ static int Init( vout_thread_t *p_vout )
     }
 
     if( p_pic == NULL )
-    {
-        return -1;
-    }
+        return VLC_EGENERIC;
 
     /* Allocate the picture */
     p_pic->p->p_pixels = aa_image( p_vout->p_sys->aa_context );
@@ -162,7 +162,7 @@ static int Init( vout_thread_t *p_vout )
     PP_OUTPUTPICTURE[ I_OUTPUTPICTURES ] = p_pic;
     I_OUTPUTPICTURES++;
 
-    return 0;
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -201,15 +201,7 @@ static int Manage( vout_thread_t *p_vout )
     case AA_MOUSE:
         aa_getmouse( p_vout->p_sys->aa_context, &x, &y, &b );
         if ( b & AA_BUTTON3 )
-        {
-            intf_thread_t *p_intf;
-            p_intf = vlc_object_find( p_vout, VLC_OBJECT_INTF, FIND_ANYWHERE );
-            if( p_intf )
-            {
-                p_intf->b_menu_change = 1;
-                vlc_object_release( p_intf );
-            }
-        }
+            var_SetBool( p_vout->p_libvlc, "intf-popupmenu", true );
         break;
     case AA_RESIZE:
         p_vout->i_changes |= VOUT_SIZE_CHANGE;
@@ -220,7 +212,7 @@ static int Manage( vout_thread_t *p_vout )
     default:
         break;
     }
-    return( 0 );
+    return VLC_SUCCESS;
 }
 
 /*****************************************************************************
@@ -239,7 +231,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 )
 {
     /* No need to do anything, the fake direct buffers stay as they are */
-    int i_width, i_height, i_x, i_y;
+    unsigned int i_width, i_height, i_x, i_y;
 
     vout_PlacePicture( p_vout, p_vout->p_sys->i_width, p_vout->p_sys->i_height,
                        &i_x, &i_y, &i_width, &i_height );