]> git.sesse.net Git - vlc/blobdiff - modules/video_output/directfb.c
Qt: Close #2906
[vlc] / modules / video_output / directfb.c
index 28deb8018ebc67fd421767748755883189742e87..77fa243a4adb2e8a3c7583f00a2a7b7dfbf1f689 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * directfb.c: DirectFB video output display method
  *****************************************************************************
- * Copyright (C) 2005 the VideoLAN team
+ * Copyright (C) 2005-2009 the VideoLAN team
  *
  * Authors: Iuri Diniz <iuri@digizap.com.br>
  *
@@ -31,7 +31,8 @@
 # include "config.h"
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
+#include <vlc_plugin.h>
 #include <vlc_vout.h>
 #include <directfb.h>
 
@@ -58,21 +59,21 @@ struct vout_sys_t
     int i_width;
     int i_height;
 
-    byte_t* p_pixels;
+    uint8_t* p_pixels;
 };
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
-vlc_module_begin();
-    set_shortname( "DirectFB" );
-    set_category( CAT_VIDEO );
-    set_subcategory( SUBCAT_VIDEO_VOUT );
-    set_description( _("DirectFB video output http://www.directfb.org/") );
-    set_capability( "video output", 60 );
-    add_shortcut( "directfb" );
-    set_callbacks( Create, Destroy );
-vlc_module_end();
+vlc_module_begin ()
+    set_shortname( "DirectFB" )
+    set_category( CAT_VIDEO )
+    set_subcategory( SUBCAT_VIDEO_VOUT )
+    set_description( N_("DirectFB video output http://www.directfb.org/") )
+    set_capability( "video output", 60 )
+    add_shortcut( "directfb" )
+    set_callbacks( Create, Destroy )
+vlc_module_end ()
 
 
 static int Create( vlc_object_t *p_this )
@@ -88,10 +89,7 @@ static int Create( vlc_object_t *p_this )
     /* Allocate structure */
     p_vout->p_sys = p_sys = malloc( sizeof( vout_sys_t ) );
     if( !p_sys )
-    {
-        msg_Err( p_vout, "out of memory" );
         return VLC_ENOMEM;
-    }
 
     p_sys->p_directfb = NULL;
     p_sys->p_primary = NULL;
@@ -103,6 +101,7 @@ static int Create( vlc_object_t *p_this )
     if( DirectFBInit(NULL,NULL) != DFB_OK )
     {
         msg_Err(p_vout, "Cannot init DirectFB");
+        free( p_sys );
         return VLC_EGENERIC;
     }
 
@@ -120,7 +119,7 @@ static int Init( vout_thread_t *p_vout )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
     IDirectFBSurface *p_primary = (IDirectFBSurface *) p_vout->p_sys->p_primary;
-    byte_t* p_pixels = NULL;
+    uint8_t* p_pixels = NULL;
     picture_t *p_pic = NULL;
     int i_rlength, i_glength, i_blength;
     int i_roffset, i_goffset, i_boffset;
@@ -141,7 +140,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 2;
             i_blength = 2;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','G','B','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB8;
             break;
 
         case DSPF_RGB16:
@@ -153,7 +152,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 5;
             i_blength = 5;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','1','6');
+            p_vout->output.i_chroma = VLC_CODEC_RGB16;
             break;
 
         case DSPF_RGB24:
@@ -165,7 +164,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 8;
             i_blength = 8;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','2','4');
+            p_vout->output.i_chroma = VLC_CODEC_RGB24;
             break;
 
         case DSPF_RGB32:
@@ -177,7 +176,7 @@ static int Init( vout_thread_t *p_vout )
             i_goffset = 8;
             i_blength = 8;
             i_boffset = 0;
-            p_vout->output.i_chroma = VLC_FOURCC('R','V','3','2');
+            p_vout->output.i_chroma = VLC_CODEC_RGB32;
             break;
 
         default:
@@ -220,7 +219,7 @@ static int Init( vout_thread_t *p_vout )
 
     /* allocate p_pixels */
     i_size = i_line_pitch * p_sys->i_height;
-    p_sys->p_pixels = malloc( sizeof(byte_t) * i_size );
+    p_sys->p_pixels = malloc( i_size );
     if( p_sys->p_pixels == NULL )
     {
         p_primary->Unlock(p_primary);
@@ -255,8 +254,7 @@ static void End( vout_thread_t *p_vout )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
 
-    if( p_sys->p_pixels )
-        free( p_sys->p_pixels );
+    free( p_sys->p_pixels );
 }
 
 static void Destroy( vlc_object_t *p_this )
@@ -265,7 +263,7 @@ static void Destroy( vlc_object_t *p_this )
     vout_sys_t *p_sys = p_vout->p_sys;
 
     CloseDisplay( p_vout );
-    if( p_sys ) free( p_sys );
+    free( p_sys );
     p_sys = NULL;
 }
 
@@ -278,7 +276,7 @@ static void Display( vout_thread_t *p_vout, picture_t *p_pic )
 {
     vout_sys_t *p_sys = p_vout->p_sys;
     IDirectFBSurface *p_primary = (IDirectFBSurface *) p_sys->p_primary;
-    byte_t* p_pixels = NULL;
+    uint8_t* p_pixels = NULL;
     int i_size;
     int i_line_pitch;