]> git.sesse.net Git - vlc/commitdiff
* modules/video_output/x11/xcommon.*: endianness patch + arrow keys are
authorChristophe Massiot <massiot@videolan.org>
Mon, 28 Jul 2003 18:02:06 +0000 (18:02 +0000)
committerChristophe Massiot <massiot@videolan.org>
Mon, 28 Jul 2003 18:02:06 +0000 (18:02 +0000)
  now used to browse through the DVD menus.

NEWS
modules/video_output/x11/xcommon.c
modules/video_output/x11/xcommon.h

diff --git a/NEWS b/NEWS
index fc300767863a0106b0696c6a1ddcc493cbbdc2af..8b0be5dd18610b3c75174bfabb57795974680137 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,4 +1,4 @@
-$Id: NEWS,v 1.58 2003/07/27 14:10:02 massiot Exp $
+$Id: NEWS,v 1.59 2003/07/28 18:02:06 massiot Exp $
 
 Changes between 0.6.0 and 0.6.1:
 ---------------------------------
@@ -20,8 +20,10 @@ Win32 port:
  * Fixed 5.1 audio support for the sblive/audigy soundcards.
  * Fixed sound on Windows NT.
 
-Linux ports:
- * Fixed/improved alsa support and enabled multi-channel audio output.
+UNIX ports:
+ * Fixed/improved ALSA support and enabled multi-channel audio output.
+ * X11/Xvideo: Should now work on big endian machines, and you can now
+   use the arrow keys to browse through the DVD menus.
 
 Interfaces:
  * Small updates/fixes to the wxWindows interface.
index 5bd6f1e7c679aea1c362f148c2da345f1bc51bad..217c287b09d1d54d46a836affcbabdc886d6047d 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.c: Functions common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.c,v 1.22 2003/07/16 15:25:32 sam Exp $
+ * $Id: xcommon.c,v 1.23 2003/07/28 18:02:06 massiot Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -173,11 +173,9 @@ int E_(Activate) ( vlc_object_t *p_this )
     {
         if( strlen( psz_chroma ) >= 4 )
         {
-            i_chroma  = (unsigned char)psz_chroma[0] <<  0;
-            i_chroma |= (unsigned char)psz_chroma[1] <<  8;
-            i_chroma |= (unsigned char)psz_chroma[2] << 16;
-            i_chroma |= (unsigned char)psz_chroma[3] << 24;
-
+            /* Do not use direct assignment because we are not sure of the
+             * alignment. */
+            memcpy(&i_chroma, psz_chroma, 4);
             b_chroma = 1;
         }
 
@@ -195,7 +193,7 @@ int E_(Activate) ( vlc_object_t *p_this )
     }
 
     /* Check that we have access to an XVideo port providing this chroma */
-    p_vout->p_sys->i_xvport = XVideoGetPort( p_vout, i_chroma,
+    p_vout->p_sys->i_xvport = XVideoGetPort( p_vout, VLC2X11_FOURCC(i_chroma),
                                              &p_vout->output.i_chroma );
     if( p_vout->p_sys->i_xvport < 0 )
     {
@@ -212,7 +210,7 @@ int E_(Activate) ( vlc_object_t *p_this )
          * XVideo port for an YUY2 picture. We'll need to do an YUV
          * conversion, but at least it has got scaling. */
         p_vout->p_sys->i_xvport =
-                        XVideoGetPort( p_vout, VLC_FOURCC('Y','U','Y','2'),
+                        XVideoGetPort( p_vout, X11_FOURCC('Y','U','Y','2'),
                                                &p_vout->output.i_chroma );
         if( p_vout->p_sys->i_xvport < 0 )
         {
@@ -220,7 +218,7 @@ int E_(Activate) ( vlc_object_t *p_this )
              * XVideo port for a simple 16bpp RGB picture. We'll need to do
              * an YUV conversion, but at least it has got scaling. */
             p_vout->p_sys->i_xvport =
-                            XVideoGetPort( p_vout, VLC_FOURCC('R','V','1','6'),
+                            XVideoGetPort( p_vout, X11_FOURCC('R','V','1','6'),
                                                    &p_vout->output.i_chroma );
             if( p_vout->p_sys->i_xvport < 0 )
             {
@@ -230,6 +228,7 @@ int E_(Activate) ( vlc_object_t *p_this )
             }
         }
     }
+    p_vout->output.i_chroma = X112VLC_FOURCC(p_vout->output.i_chroma);
 #endif
 
     /* Create blank cursor (for mouse cursor autohiding) */
@@ -555,16 +554,29 @@ static int ManageVideo( vout_thread_t *p_vout )
                 }
                 break;
             case XK_Left:
-                input_Seek( p_vout, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+/*                input_Seek( p_vout, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "LEFT";
+                var_Set( p_vout, "key-pressed", val );
                 break;
             case XK_Right:
-                input_Seek( p_vout, 5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+/*                input_Seek( p_vout, 5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "RIGHT";
+                var_Set( p_vout, "key-pressed", val );
                 break;
             case XK_Up:
-                input_Seek( p_vout, 60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+/*                input_Seek( p_vout, 60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "UP";
+                var_Set( p_vout, "key-pressed", val );
                 break;
             case XK_Down:
-                input_Seek( p_vout, -60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+/*                input_Seek( p_vout, -60, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR ); */
+                val.psz_string = "DOWN";
+                var_Set( p_vout, "key-pressed", val );
+                break;
+            case XK_Return:
+            case XK_KP_Enter:
+                val.psz_string = "ENTER";
+                var_Set( p_vout, "key-pressed", val );
                 break;
             case XK_Home:
                 input_Seek( p_vout, 0, INPUT_SEEK_BYTES | INPUT_SEEK_SET );
@@ -573,10 +585,10 @@ static int ManageVideo( vout_thread_t *p_vout )
                 input_Seek( p_vout, 0, INPUT_SEEK_BYTES | INPUT_SEEK_END );
                 break;
             case XK_Page_Up:
-                input_Seek( p_vout, 900, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+                input_Seek( p_vout, 5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
                 break;
             case XK_Page_Down:
-                input_Seek( p_vout, -900, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
+                input_Seek( p_vout, -5, INPUT_SEEK_SECONDS | INPUT_SEEK_CUR );
                 break;
             case XK_space:
                 input_SetStatus( p_vout, INPUT_STATUS_PAUSE );
@@ -1864,16 +1876,17 @@ static int XVideoGetPort( vout_thread_t *p_vout,
 
     if( i_selected_port == -1 )
     {
+        int i_chroma_tmp = X112VLC_FOURCC( i_chroma );
         if( i_requested_adaptor == -1 )
         {
             msg_Warn( p_vout, "no free XVideo port found for format "
-                       "0x%.8x (%4.4s)", i_chroma, (char*)&i_chroma );
+                      "0x%.8x (%4.4s)", i_chroma_tmp, (char*)&i_chroma_tmp );
         }
         else
         {
             msg_Warn( p_vout, "XVideo adaptor %i does not have a free "
-                       "XVideo port for format 0x%.8x (%4.4s)",
-                       i_requested_adaptor, i_chroma, (char*)&i_chroma );
+                      "XVideo port for format 0x%.8x (%4.4s)",
+                      i_requested_adaptor, i_chroma_tmp, (char*)&i_chroma_tmp );
         }
     }
 
index cd88ae0d5ced7bcd7f59cd16ecff7bfc9cc33299..7c29fda1995907a294deaaf910cf8c6960824d2b 100644 (file)
@@ -2,7 +2,7 @@
  * xcommon.h: Defines common to the X11 and XVideo plugins
  *****************************************************************************
  * Copyright (C) 1998-2001 VideoLAN
- * $Id: xcommon.h,v 1.5 2003/05/25 19:24:53 gbazin Exp $
+ * $Id: xcommon.h,v 1.6 2003/07/28 18:02:06 massiot Exp $
  *
  * Authors: Vincent Seguin <seguin@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
 #   define IMAGE_FREE     XDestroyImage
 #endif
 
+#define X11_FOURCC( a, b, c, d ) \
+        ( ((uint32_t)a) | ( ((uint32_t)b) << 8 ) \
+           | ( ((uint32_t)c) << 16 ) | ( ((uint32_t)d) << 24 ) )
+#define VLC2X11_FOURCC( i ) \
+        X11_FOURCC( ((char *)&i)[0], ((char *)&i)[1], ((char *)&i)[2], \
+                    ((char *)&i)[3] )
+#define X112VLC_FOURCC( i ) \
+        VLC_FOURCC( i & 0xff, (i >> 8) & 0xff, (i >> 16) & 0xff, \
+                    (i >> 24) & 0xff )
+
 /*****************************************************************************
  * x11_window_t: X11 window descriptor
  *****************************************************************************