]> git.sesse.net Git - vlc/blobdiff - modules/video_output/omapfb.c
Remove useless <errno.h> inclusions
[vlc] / modules / video_output / omapfb.c
index 2367a432975878d63a2b9aa4b09286ad3bfd9c71..08105b8562a76bd514b4ea44c2d8f1e71149ec0e 100644 (file)
@@ -27,7 +27,6 @@
 # include "config.h"
 #endif
 
-#include <errno.h>                                                 /* ENOMEM */
 #include <fcntl.h>                                                 /* open() */
 #include <unistd.h>                                               /* close() */
 
 /* Embedded window handling */
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
-#include <X11/keysym.h>
-
-#ifdef HAVE_OSSO
-#include <libosso.h>
-#endif
 
 #include <vlc_common.h>
 #include <vlc_plugin.h>
-#include <vlc_keys.h>
 #include <vlc_vout.h>
 #include <vlc_vout_window.h>
 #include <vlc_playlist.h>
+#include <vlc_charset.h>
 
 /*****************************************************************************
 * Local prototypes
@@ -76,10 +70,6 @@ static int  InitWindow       ( vout_thread_t * );
 static void CreateWindow     ( vout_sys_t * );
 static void ToggleFullScreen ( vout_thread_t * );
 
-#ifdef HAVE_OSSO
-static const int i_backlight_on_interval = 300;
-#endif
-
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
@@ -167,11 +157,6 @@ struct vout_sys_t
     /* Dummy memory */
     int        i_null_fd;
     uint8_t   *p_null;
-
-#ifdef HAVE_OSSO
-    osso_context_t      *p_octx;
-    int                 i_backlight_on_counter;
-#endif
 };
 
 /*****************************************************************************
@@ -213,16 +198,6 @@ static int Create( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
-#ifdef HAVE_OSSO
-    p_vout->p_sys->i_backlight_on_counter = i_backlight_on_interval;
-    p_vout->p_sys->p_octx = osso_initialize( "vlc", VERSION, 0, NULL );
-    if ( p_vout->p_sys->p_octx == NULL ) {
-        msg_Err( p_vout, "Could not get osso context" );
-    } else {
-        msg_Dbg( p_vout, "Initialized osso context" );
-    }
-#endif
-
     return VLC_SUCCESS;
 }
 
@@ -243,13 +218,6 @@ static void Destroy( vlc_object_t *p_this )
         XCloseDisplay( p_vout->p_sys->p_display );
     }
 
-#ifdef HAVE_OSSO
-    if ( p_vout->p_sys->p_octx != NULL ) {
-        msg_Dbg( p_vout, "Deinitializing osso context" );
-        osso_deinitialize( p_vout->p_sys->p_octx );
-    }
-#endif
-
     /* Destroy structure */
     free( p_vout->p_sys );
 }
@@ -263,7 +231,9 @@ static int Init( vout_thread_t *p_vout )
     vout_sys_t *p_sys = (vout_sys_t *)p_vout->p_sys;
 
     // We want to keep the same aspect
-    p_vout->fmt_out.i_aspect = p_vout->output.i_aspect = p_vout->render.i_aspect;
+    p_vout->output.i_aspect = p_vout->render.i_aspect;
+    p_vout->fmt_out.i_sar_num = p_vout->render.i_aspect * p_vout->render.i_height;
+    p_vout->fmt_out.i_sar_den = VOUT_ASPECT_FACTOR      * p_vout->render.i_width;
     // We ask where the video should be displayed in the video area
     vout_PlacePicture( p_vout, p_sys->main_window.i_width,
                        p_sys->main_window.i_height,
@@ -302,7 +272,7 @@ static int Init( vout_thread_t *p_vout )
     }
 
     p_vout->output.i_chroma =
-    p_vout->fmt_out.i_chroma = VLC_CODEC_I420;
+    p_vout->fmt_out.i_chroma = VLC_FOURCC( 'Y','4','2','0' );
     p_sys->i_color_format = OMAPFB_COLOR_YUV420;
 
     // place in the framebuffer where we have to write
@@ -404,50 +374,9 @@ static int Manage( vout_thread_t *p_vout )
             p_vout->p_sys->i_time_button_last_pressed =
                         ((XButtonEvent *)&xevent)->time;
         }
-        else if( xevent.type == KeyPress )
-        {
-            KeySym x_key_symbol;
-            vlc_value_t val;
-
-            x_key_symbol = XKeycodeToKeysym( p_vout->p_sys->p_display,
-                                             xevent.xkey.keycode, 0 );
-
-            switch( x_key_symbol )
-            {
-            case XK_Return:
-                val.i_int = ACTIONID_PLAY_PAUSE; break;
-            case XK_Escape:
-                val.i_int = ACTIONID_QUIT; break;
-            case XK_Down:
-                val.i_int = ACTIONID_JUMP_BACKWARD_MEDIUM; break;
-            case XK_Up:
-                val.i_int = ACTIONID_JUMP_FORWARD_MEDIUM; break;
-            case XK_Right:
-                val.i_int = ACTIONID_JUMP_FORWARD_SHORT; break;
-            case XK_Left:
-                val.i_int = ACTIONID_JUMP_BACKWARD_SHORT; break;
-            case XK_F6:
-                val.i_int = ACTIONID_TOGGLE_FULLSCREEN; break;
-            case XK_F7:
-                val.i_int = ACTIONID_VOL_UP; break;
-            case XK_F8:
-                val.i_int = ACTIONID_VOL_DOWN; break;
-            }
-            var_SetInteger( p_vout->p_libvlc, "key-action", val.i_int );
-        }
-        else if( ( xevent.type == VisibilityNotify &&
-                 xevent.xvisibility.state == VisibilityUnobscured ) ||
-                 xevent.type == FocusIn )
-        {
-            p_vout->p_sys->b_video_enabled = true;
-            p_vout->p_sys->p_output_picture->p->p_pixels =
-                p_vout->p_sys->p_center;
-            XSetInputFocus( p_vout->p_sys->p_display, p_vout->p_sys->window,
-                            RevertToParent, CurrentTime );
-        }
         else if( ( xevent.type == VisibilityNotify &&
                  xevent.xvisibility.state != VisibilityUnobscured ) ||
-                 xevent.type == FocusOut || xevent.type == UnmapNotify )
+                 xevent.type == UnmapNotify )
         {
             UpdateScreen( p_vout, 0, 0,
                           p_vout->p_sys->fb_vinfo.xres,
@@ -482,23 +411,6 @@ static int Manage( vout_thread_t *p_vout )
             return VLC_EGENERIC;
         }
     }
-
-
-#ifdef HAVE_OSSO
-    if ( p_vout->p_sys->p_octx != NULL ) {
-        if ( p_vout->p_sys->i_backlight_on_counter == i_backlight_on_interval ) {
-            if ( osso_display_blanking_pause( p_vout->p_sys->p_octx ) != OSSO_OK ) {
-                msg_Err( p_vout, "Could not disable backlight blanking" );
-        } else {
-                msg_Dbg( p_vout, "Backlight blanking disabled" );
-            }
-            p_vout->p_sys->i_backlight_on_counter = 0;
-        } else {
-            p_vout->p_sys->i_backlight_on_counter ++;
-        }
-    }
-#endif
-
     return VLC_SUCCESS;
 }
 
@@ -543,7 +455,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
         return VLC_EGENERIC;
     }
 
-    p_sys->i_fd = open( psz_device, O_RDWR );
+    p_sys->i_fd = utf8_open( psz_device, O_RDWR );
     if( p_sys->i_fd == -1 )
     {
         msg_Err( p_vout, "cannot open %s (%m)", psz_device );
@@ -568,13 +480,13 @@ static int OpenDisplay( vout_thread_t *p_vout )
 
     if( ioctl( p_sys->i_fd, FBIOGET_VSCREENINFO, &p_sys->fb_vinfo ) )
     {
-        msg_Err( p_vout, "Can't get VSCREENINFO: %s", strerror(errno) );
+        msg_Err( p_vout, "Can't get VSCREENINFO: %m" );
         close( p_sys->i_fd );
         return VLC_EGENERIC;
     }
     if( ioctl( p_sys->i_fd, FBIOGET_FSCREENINFO, &p_sys->fb_finfo ) )
     {
-        msg_Err( p_vout, "Can't get FSCREENINFO: %s", strerror(errno) );
+        msg_Err( p_vout, "Can't get FSCREENINFO: %m" );
         close( p_sys->i_fd );
         return VLC_EGENERIC;
     }
@@ -586,7 +498,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     if( (p_sys->p_video = (uint8_t *)mmap( 0, p_sys->i_page_size, PROT_READ | PROT_WRITE, MAP_SHARED,
                                             p_sys->i_fd, 0 )) == MAP_FAILED )
     {
-        msg_Err( p_vout, "Can't mmap: %s", strerror(errno) );
+        msg_Err( p_vout, "Can't mmap: %m" );
         close( p_sys->i_fd );
         return VLC_EGENERIC;
     }
@@ -594,7 +506,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     p_sys->p_display = XOpenDisplay( NULL );
 
     /* Open /dev/null and map it */
-    p_sys->i_null_fd = open( "/dev/zero", O_RDWR );
+    p_sys->i_null_fd = utf8_open( "/dev/zero", O_RDWR );
     if( p_sys->i_null_fd == -1 )
     {
         msg_Err( p_vout, "cannot open /dev/zero (%m)" );
@@ -606,7 +518,7 @@ static int OpenDisplay( vout_thread_t *p_vout )
     if( (p_sys->p_null = (uint8_t *)mmap( 0, p_sys->i_page_size, PROT_READ | PROT_WRITE,
                                           MAP_PRIVATE, p_sys->i_null_fd, 0 )) == MAP_FAILED )
     {
-        msg_Err( p_vout, "Can't mmap 2: %s", strerror(errno) );
+        msg_Err( p_vout, "Can't mmap 2: %m" );
         munmap( p_sys->p_video, p_sys->i_page_size );
         close( p_sys->i_null_fd );
         close( p_sys->i_fd );
@@ -675,7 +587,6 @@ static int InitWindow( vout_thread_t *p_vout )
         p_sys->main_window = p_sys->embedded_window;
 
         // We have to create a new window to get some events
-        // (ButtonPress for example)
         CreateWindow( p_sys );
     }
     else
@@ -697,9 +608,10 @@ static void CreateWindow( vout_sys_t *p_sys )
     xwindow_attributes.backing_store = Always;
     xwindow_attributes.background_pixel =
         BlackPixel( p_sys->p_display, DefaultScreen(p_sys->p_display) );
-    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask;
+    xwindow_attributes.event_mask = ExposureMask | StructureNotifyMask
+                                  | VisibilityChangeMask;
     p_sys->window = XCreateWindow( p_sys->p_display,
-                                   p_sys->owner_window->handle.xid,
+                                   p_sys->owner_window->xid,
                                    0, 0,
                                    p_sys->main_window.i_width,
                                    p_sys->main_window.i_height,
@@ -709,11 +621,7 @@ static void CreateWindow( vout_sys_t *p_sys )
                                    &xwindow_attributes );
 
     XMapWindow( p_sys->p_display, p_sys->window );
-    XSelectInput( p_sys->p_display, p_sys->window,
-                  KeyPressMask | ButtonPressMask | StructureNotifyMask |
-                  VisibilityChangeMask | FocusChangeMask );
-    XSelectInput( p_sys->p_display, p_sys->owner_window->handle.xid,
+    XSelectInput( p_sys->p_display, p_sys->owner_window->xid,
                   StructureNotifyMask );
-    XSetInputFocus( p_sys->p_display, p_sys->window, RevertToParent, CurrentTime );
 }