]> git.sesse.net Git - vlc/commitdiff
A few new things:
authorPierre Baillet <octplane@videolan.org>
Mon, 21 Aug 2000 09:33:42 +0000 (09:33 +0000)
committerPierre Baillet <octplane@videolan.org>
Mon, 21 Aug 2000 09:33:42 +0000 (09:33 +0000)
. The interface part:
. created intf_AssignKey, intf_getKey and intf_AssignNormalKeys
these new function are a first abstraction of the the key handling system. It makes use of a new structure in the interface : p_keys.

. AssignNormalKeys is commonly used in all the interface plugins.
AssignKey is used to allow the SDL interface to react nicely.

. Now the plugin struct element psz_filename is filled (and freed
at the end of the program).

. the SDL plugin:
works but does only display a green screen for now. so don't use it !

. Please try and compile the client on your box with this version.
I've tried a few output plugin but not all.

22 files changed:
Makefile.in
configure
configure.in
include/interface.h
plugins/beos/intf_beos.cpp
plugins/fb/intf_fb.c
plugins/ggi/intf_ggi.c
plugins/glide/intf_glide.c
plugins/gnome/intf_gnome.c
plugins/mga/intf_mga.c
plugins/sdl/intf_sdl.c
plugins/sdl/sdl.c
plugins/sdl/video_yuv.c [new file with mode: 0644]
plugins/sdl/video_yuv.h [new file with mode: 0644]
plugins/sdl/video_yuv_macros.h [new file with mode: 0644]
plugins/sdl/video_yuvall.c [new file with mode: 0644]
plugins/sdl/vout_sdl.c
plugins/x11/intf_x11.c
src/interface/interface.c
src/misc/plugins.c
src/video_decoder/vdec_idctmmx.S
src/video_output/video_yuv.c

index 359568864b59b42795a806b106b9bbae7c4fca57..0a5047514035189f16d79ee98f93f3597d100cde 100644 (file)
@@ -29,7 +29,7 @@ prefix=@prefix@
 PROGRAM_OPTIONS = $(SYS) $(ARCH)
 ifeq ($(DEBUG),1)
 PROGRAM_OPTIONS += DEBUG
-DEFINE += -DDEBUG
+DEFINE += -DDEBUG -g
 endif
 
 # PROGRAM_BUILD is a complete identification of the build
@@ -293,7 +293,10 @@ PLUGIN_GGI    = plugins/ggi/ggi.o \
 
 PLUGIN_SDL    = plugins/sdl/sdl.o \
                plugins/sdl/intf_sdl.o \
-               plugins/sdl/vout_sdl.o
+               plugins/sdl/vout_sdl.o \
+               plugins/sdl/video_yuv.o \
+               plugins/sdl/video_yuvall.o
+
 
 PLUGIN_GLIDE  = plugins/glide/glide.o \
                plugins/glide/intf_glide.o \
@@ -322,6 +325,7 @@ PLUGIN_YUV    = plugins/yuv/yuv.o \
                plugins/yuv/video_yuv24.o \
                plugins/yuv/video_yuv32.o
 
+
 PLUGIN_YUVMMX = plugins/yuvmmx/yuvmmx.o \
                plugins/yuvmmx/video_yuv.o \
                plugins/yuvmmx/video_yuv8.o \
@@ -512,7 +516,7 @@ else
        ld -shared -o $@ $^
 endif
 $(PLUGIN_YUV): %.o: %.c
-       $(CC) $(CFLAGS) -c -o $@ $<
+       $(CC) $(CCFLAGS) $(CFLAGS) -c -o $@ $<
 
 lib/yuvmmx.so: $(PLUGIN_YUVMMX)
 ifeq ($(SYS),beos)
index 2c1b95d50c237e94b714b77810593749e89edac1..625a635f021f9d3ac3f4f919aa284eb2386b9df2 100755 (executable)
--- a/configure
+++ b/configure
@@ -26,7 +26,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   --enable-ggi            GGI support (default disabled)"
 ac_help="$ac_help
-  --enable-sdl                  SDL support (default disabled)"
+  --enable-sdl            SDL support (default disabled)"
 ac_help="$ac_help
   --enable-glide          Glide (3dfx) support (default disabled)"
 ac_help="$ac_help
index 7398bbedc983b2f6ca19e728c006b9c4d27c83b2..6d1dd086b888386a083be4e9de1e6679d4d6b57f 100644 (file)
@@ -94,7 +94,7 @@ AC_ARG_ENABLE(ggi,
   [  --enable-ggi            GGI support (default disabled)],
   [if test x$enable_ggi = xyes; then PLUGINS=${PLUGINS}"ggi "; fi])
 AC_ARG_ENABLE(sdl,
-  [  --enable-sdl                       SDL support (default disabled)],
+  [  --enable-sdl            SDL support (default disabled)],
   [if test x$enable_sdl = xyes; then PLUGINS=${PLUGINS}"sdl "; fi])
 AC_ARG_ENABLE(glide,
   [  --enable-glide          Glide (3dfx) support (default disabled)],
index 1b75eef038ffcac26fc9859646b1ee058a15a6a6..99e98b7684b8220a67ec795f0acb4d9d91f6d5dc 100644 (file)
@@ -48,6 +48,15 @@ typedef int   ( intf_sys_create_t )   ( p_intf_thread_t p_intf );
 typedef void  ( intf_sys_destroy_t )  ( p_intf_thread_t p_intf );
 typedef void  ( intf_sys_manage_t )   ( p_intf_thread_t p_intf );
 
+typedef struct _key
+{
+    int received_key;
+    int forwarded_key;
+    struct _key *  next;
+} intf_key;
+
+typedef intf_key * p_intf_key;
+
 typedef struct intf_thread_s
 {
     boolean_t           b_die;                                 /* `die' flag */
@@ -55,7 +64,8 @@ typedef struct intf_thread_s
     /* Specific interfaces */
     p_intf_console_t    p_console;                                /* console */
     p_intf_sys_t        p_sys;                           /* system interface */
-
+    p_intf_key          p_keys;
+    
     /* Plugin */
     intf_sys_create_t *     p_sys_create;         /* create interface thread */
     intf_sys_manage_t *     p_sys_manage;                       /* main loop */
@@ -83,3 +93,9 @@ void            intf_Destroy            ( intf_thread_t * p_intf );
 int             intf_SelectChannel      ( intf_thread_t * p_intf, int i_channel );
 int             intf_ProcessKey         ( intf_thread_t * p_intf, int i_key );
 
+void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key);
+
+int intf_getKey( intf_thread_t *p_intf, int r_key);
+
+void intf_AssignNormalKeys( intf_thread_t *p_intf);
+
index 711841019067505c7f7c00578388a8718b890d64..2677b74e8cdded5d045f2113d54b1be5ccd6b49c 100644 (file)
@@ -158,6 +158,11 @@ int intf_BeCreate( intf_thread_t *p_intf )
             return( 1 );
         }
     }
+    /* Bind normal keys. */
+    intf_AssignNormalKeys( p_intf );
+
+
+
     return( 0 );
 }
 
index 87c57b9967dd67aef133ab47592a6921bf6f65da..bb1ef6640f564a5506b2d39d7a085e91598d51f4 100644 (file)
@@ -189,7 +189,10 @@ int intf_FBCreate( intf_thread_t *p_intf )
             return( 1 );
         }
     }
-
+    
+    /* bind keys */
+    intf_AssignNormalKeys( p_intf );
+    
     return( 0 );
 }
 
index 46f4217d4cb1387089a0fb93a4c9804d5960c747..cb50e87b97434ac557b1637c332aaa283a61a3e6 100644 (file)
@@ -106,7 +106,11 @@ int intf_GGICreate( intf_thread_t *p_intf )
         free( p_intf->p_sys );
         return( 1 );
     }
+    
+    /* Assign basic keys */
+    intf_AssignNormalKeys( p_intf );
 
+    
     return( 0 );
 }
 
index c3fbd1a23baaec78013c8164f6235a93dd74394d..c4bc5211e7554f06db42342be6ec3c7013c4c0e7 100644 (file)
@@ -75,6 +75,10 @@ int intf_GlideCreate( intf_thread_t *p_intf )
             return( 1 );
         }
     }
+    
+    /* bind keys */
+    intf_AssignNormalKeys( p_intf );
+
     return( 0 );
 }
 
index 6fb12070323ffe99d2357b2c4e6178fc596d2d75..b470090f43189699b4abe19f2bb1a9b5f09570e6 100644 (file)
@@ -136,6 +136,10 @@ int intf_GnomeCreate( intf_thread_t *p_intf )
     vlc_thread_create( &p_intf->p_sys->p_gnome->thread_id, "gnome",
                        (void *)GnomeThread, p_intf->p_sys->p_gnome );
 
+    /* create basic key bindings */
+    intf_AssignNormalKeys( p_intf );
+    
+
     /* Disable screen saver and return */
     p_intf->p_sys->i_ss_count = 1;
     GnomeDisableScreenSaver( p_intf );
index 3cc607ec683439f1885e236d2123bc93bf7f7914..8f560ff70e8226293f5b27d59e8b939fcf541271 100644 (file)
@@ -142,7 +142,11 @@ int intf_MGACreate( intf_thread_t *p_intf )
     }
 
     p_intf->p_sys->b_mouse = 1;
+    
+    /* bind keys */
+    intf_AssignNormalKeys( p_intf );
 
+    
     /* Disable screen saver and return */
     p_intf->p_sys->i_ss_count = 1;
     X11DisableScreenSaver( p_intf );
index 5f2fa49431e225a9f979b5e709ce67ba6360cdf6..4164f00ef2eb73b071e28765a8fab53158deecb8 100644 (file)
@@ -57,6 +57,9 @@ typedef struct intf_sys_s
        
 } intf_sys_t;
 
+/* local prototype */
+void    intf_SDL_Keymap( intf_thread_t * p_intf );
+    
 
 /*****************************************************************************
  * intf_SDLCreate: initialize and create SDL interface
@@ -94,7 +97,7 @@ int intf_SDLCreate( intf_thread_t *p_intf )
         free( p_intf->p_sys );
         return( 1 );
     }
-
+    intf_SDL_Keymap( p_intf );
     return( 0 );
 }
 
@@ -131,11 +134,14 @@ void intf_SDLManage( intf_thread_t *p_intf )
        SDL_Event event;                                                                                /*      SDL event        */
     Uint8   i_key;
     
-    while ( SDL_PollEvent(&event) ) {
+    while ( SDL_PollEvent(&event) ) 
+    {
+        
+        i_key = event.key.keysym.sym;                  /* forward it */
+        intf_ErrMsgImm("key :%c:\n",(char) i_key);
+        
         switch (event.type) {           
             case SDL_KEYDOWN:                         /* if a key is pressed */
-                i_key = event.key.keysym.sym;                  /* forward it */
-                
                 if( intf_ProcessKey( p_intf, (char ) i_key ) )
                 {
                     intf_DbgMsg( "unhandled key '%c' (%i)\n", 
@@ -151,3 +157,30 @@ void intf_SDLManage( intf_thread_t *p_intf )
     }
 }
 
+void intf_SDL_Keymap(intf_thread_t * p_intf )
+{ 
+    intf_AssignKey(p_intf, SDLK_q,      'Q');
+    intf_AssignKey(p_intf, SDLK_ESCAPE, 'Q');
+    /* intf_AssignKey(p_intf,3,'Q'); */
+    intf_AssignKey(p_intf, SDLK_0,      '0');
+    intf_AssignKey(p_intf, SDLK_1,      '1');
+    intf_AssignKey(p_intf, SDLK_2,      '2');
+    intf_AssignKey(p_intf, SDLK_3,      '3');
+    intf_AssignKey(p_intf, SDLK_4,      '4');
+    intf_AssignKey(p_intf, SDLK_5,      '5');
+    intf_AssignKey(p_intf, SDLK_6,      '6');
+    intf_AssignKey(p_intf, SDLK_7,      '7');
+    intf_AssignKey(p_intf, SDLK_8,      '8');
+    intf_AssignKey(p_intf, SDLK_9,      '9');
+    intf_AssignKey(p_intf, SDLK_PLUS,   '+');
+    intf_AssignKey(p_intf, SDLK_MINUS,  '-');
+    intf_AssignKey(p_intf, SDLK_m,      'M');
+    /* intf_AssignKey(p_intf,'M','M'); */
+    intf_AssignKey(p_intf, SDLK_g,      'g');
+    /* intf_AssignKey(p_intf,'G','G'); */
+    intf_AssignKey(p_intf, SDLK_c,      'c');
+    intf_AssignKey(p_intf, SDLK_SPACE,  ' ');
+    intf_AssignKey(p_intf, 'i',      'i');
+    intf_AssignKey(p_intf, SDLK_s,      's');
+
+}
index 6c161765e70e060baac363a05223e9dc3f9146da..2e40b9a6c2ee1702b65a2efcc3f75a155dd7289c 100644 (file)
@@ -4,7 +4,9 @@
  * Copyright (C) 2000 VideoLAN
  *
  * Authors:
- *
+ *      . Initial plugin code by Samuel Hocevar <sam@via.ecp.fr>
+ *      . Modified to use the SDL by Pierre Baillet <octplane@via.ecp.fr>
+ *      
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
@@ -44,6 +46,7 @@
  *****************************************************************************/
 static void vout_GetPlugin( p_vout_thread_t p_vout );
 static void intf_GetPlugin( p_intf_thread_t p_intf );
+static void yuv_GetPlugin( p_vout_thread_t p_vout );
 
 /* Video output */
 int     vout_SDLCreate       ( vout_thread_t *p_vout, char *psz_display,
@@ -56,6 +59,13 @@ void    vout_SDLDisplay      ( p_vout_thread_t p_vout );
 void    vout_SDLSetPalette   ( p_vout_thread_t p_vout,
                                u16 *red, u16 *green, u16 *blue, u16 *transp );
 
+
+/* YUV transformations */
+int     yuv_CInit          ( p_vout_thread_t p_vout );
+int     yuv_CReset         ( p_vout_thread_t p_vout );
+void    yuv_CEnd           ( p_vout_thread_t p_vout );
+
+
 /* Interface */
 int     intf_SDLCreate       ( p_intf_thread_t p_intf );
 void    intf_SDLDestroy      ( p_intf_thread_t p_intf );
@@ -68,19 +78,29 @@ plugin_info_t * GetConfig( void )
 {
     plugin_info_t * p_info = (plugin_info_t *) malloc( sizeof(plugin_info_t) );
 
-    p_info->psz_name    = "SDL";
+    p_info->psz_name    = "SDL (video yuv conversion?, audio?)";
     p_info->psz_version = VERSION;
     p_info->psz_author  = "the VideoLAN team <vlc@videolan.org>";
 
     p_info->aout_GetPlugin = NULL;
     p_info->vout_GetPlugin = vout_GetPlugin;
     p_info->intf_GetPlugin = intf_GetPlugin;
-    p_info->yuv_GetPlugin  = NULL;
-
+    
+    
+    /* TODO: before doing this, we have to know if the videoCard is capable of 
+     * hardware YUV -> display acceleration....
+     */
+
+    
+    p_info->yuv_GetPlugin  = (void *) yuv_GetPlugin;
+    
     /* if the SDL libraries are there, assume we can enter the
      * initialization part at least, even if we fail afterwards */
-    p_info->i_score = 0x100;
-
+    
+    p_info->i_score = 0x50;
+    
+    
+    
     /* If this plugin was requested, score it higher */
     if( TestMethod( VOUT_METHOD_VAR, "sdl" ) )
     {
@@ -111,3 +131,11 @@ static void intf_GetPlugin( p_intf_thread_t p_intf )
     p_intf->p_sys_manage  = intf_SDLManage;
 }
 
+static void yuv_GetPlugin( p_vout_thread_t p_vout )
+{
+    p_vout->p_yuv_init   = yuv_CInit;
+    p_vout->p_yuv_reset  = yuv_CReset;
+    p_vout->p_yuv_end    = yuv_CEnd;
+}
+
+
diff --git a/plugins/sdl/video_yuv.c b/plugins/sdl/video_yuv.c
new file mode 100644 (file)
index 0000000..9089bbf
--- /dev/null
@@ -0,0 +1,150 @@
+/*****************************************************************************
+ * video_yuv.c: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * 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-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+/*****************************************************************************
+ * vout_InitYUV: allocate and initialize translations tables
+ *****************************************************************************
+ * This function will allocate memory to store translation tables, depending
+ * of the screen depth.
+ *****************************************************************************/
+int yuv_CInit( vout_thread_t *p_vout )
+{
+
+    /* Initialize tables */
+    SetSDLYUV( p_vout );
+    return( 0 );
+}
+
+/*****************************************************************************
+ * yuv_CEnd: destroy translations tables
+ *****************************************************************************
+ * Free memory allocated by yuv_CCreate.
+ *****************************************************************************/
+void yuv_CEnd( vout_thread_t *p_vout )
+{
+    free( p_vout->yuv.p_base );
+    free( p_vout->yuv.p_buffer );
+    free( p_vout->yuv.p_offset );
+}
+
+/*****************************************************************************
+ * yuv_CReset: re-initialize translations tables
+ *****************************************************************************
+ * This function will initialize the tables allocated by vout_CreateTables and
+ * set functions pointers.
+ *****************************************************************************/
+int yuv_CReset( vout_thread_t *p_vout )
+{
+    yuv_CEnd( p_vout );
+    return( yuv_CInit( p_vout ) );
+}
+
+/* following functions are local */
+
+/*****************************************************************************
+ * SetYUV: compute tables and set function pointers
++ *****************************************************************************/
+void SetSDLYUV( vout_thread_t *p_vout )
+{
+    /*
+     * Set functions pointers
+     */
+    if( p_vout->b_grayscale )
+    {
+        /* Grayscale */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert16;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert16;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert24;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert24;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) Convert32;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) Convert32;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) Convert32;
+            break;
+        }
+    }
+    else
+    {
+        /* Color */
+        switch( p_vout->i_bytes_per_pixel )
+        {
+        case 1:
+            p_vout->yuv.p_Convert420 = (vout_yuv_convert_t *) ConvertRGB8;
+            p_vout->yuv.p_Convert422 = (vout_yuv_convert_t *) ConvertRGB8;
+            p_vout->yuv.p_Convert444 = (vout_yuv_convert_t *) ConvertRGB8;
+            break;
+        case 2:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertRGB16;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertRGB16;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertRGB16;
+            break;
+        case 3:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertRGB24;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertRGB24;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertRGB24;
+            break;
+        case 4:
+            p_vout->yuv.p_Convert420 =   (vout_yuv_convert_t *) ConvertRGB32;
+            p_vout->yuv.p_Convert422 =   (vout_yuv_convert_t *) ConvertRGB32;
+            p_vout->yuv.p_Convert444 =   (vout_yuv_convert_t *) ConvertRGB32;
+            break;
+        }
+    }
+}
diff --git a/plugins/sdl/video_yuv.h b/plugins/sdl/video_yuv.h
new file mode 100644 (file)
index 0000000..cbe3fe9
--- /dev/null
@@ -0,0 +1,87 @@
+/*****************************************************************************
+ * video_yuv.h: YUV transformation functions
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * 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-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Constants
+ *****************************************************************************/
+
+/* Margins and offsets in conversion tables - Margins are used in case a RGB
+ * RGB conversion would give a value outside the 0-255 range. Offsets have been
+ * calculated to avoid using the same cache line for 2 tables. conversion tables
+ * are 2*MARGIN + 256 long and stores pixels.*/
+#define RED_MARGIN      178
+#define GREEN_MARGIN    135
+#define BLUE_MARGIN     224
+#define RED_OFFSET      1501                                 /* 1323 to 1935 */
+#define GREEN_OFFSET    135                                      /* 0 to 526 */
+#define BLUE_OFFSET     818                                   /* 594 to 1298 */
+#define RGB_TABLE_SIZE  1935                             /* total table size */
+
+#define GRAY_MARGIN     384
+#define GRAY_TABLE_SIZE 1024                             /* total table size */
+
+#define PALETTE_TABLE_SIZE 2176          /* YUV -> 8bpp palette lookup table */
+
+/* macros used for YUV pixel conversions */
+#define SHIFT 20
+#define U_GREEN_COEF    ((int)(-0.391 * (1<<SHIFT) / 1.164))
+#define U_BLUE_COEF     ((int)(2.018 * (1<<SHIFT) / 1.164))
+#define V_RED_COEF      ((int)(1.596 * (1<<SHIFT) / 1.164))
+#define V_GREEN_COEF    ((int)(-0.813 * (1<<SHIFT) / 1.164))
+
+/* argument lists for YUV functions */
+#define YUV_ARGS( word_size ) p_vout_thread_t p_vout, word_size *p_pic, \
+yuv_data_t *p_y, yuv_data_t *p_u, yuv_data_t *p_v, int i_width, int i_height, \
+int i_pic_width, int i_pic_height, int i_pic_line_width, \
+int i_matrix_coefficients
+
+#define YUV_ARGS_8BPP    YUV_ARGS( u8 )
+#define YUV_ARGS_16BPP   YUV_ARGS( u16 )
+#define YUV_ARGS_24BPP   YUV_ARGS( u32 )
+#define YUV_ARGS_32BPP   YUV_ARGS( u32 )
+
+/*****************************************************************************
+ * Local prototypes
+ *****************************************************************************/
+void SetGammaTable        ( int *pi_table, double f_gamma );
+void SetYUV               ( vout_thread_t *p_vout );
+void SetOffset            ( int i_width, int i_height, int i_pic_width,
+                            int i_pic_height, boolean_t *pb_h_scaling,
+                            int *pi_v_scaling, int *p_offset,
+                            boolean_t b_double );
+
+void Convert8       ( YUV_ARGS_8BPP );
+void ConvertRGB8    ( YUV_ARGS_8BPP );
+
+void Convert16      ( YUV_ARGS_16BPP );
+void ConvertRGB16   ( YUV_ARGS_16BPP );
+
+void Convert24      ( YUV_ARGS_24BPP );
+void ConvertRGB24   ( YUV_ARGS_24BPP );
+
+void Convert32      ( YUV_ARGS_32BPP );
+void ConvertRGB32   ( YUV_ARGS_32BPP );
+
diff --git a/plugins/sdl/video_yuv_macros.h b/plugins/sdl/video_yuv_macros.h
new file mode 100644 (file)
index 0000000..0aab9dd
--- /dev/null
@@ -0,0 +1,161 @@
+/*****************************************************************************
+ * video_yuv_macros_truecolor.h: YUV transformation macros for truecolor
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * 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-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * CONVERT_YUV_PIXEL, CONVERT_Y_PIXEL: pixel conversion blocks
+ *****************************************************************************
+ * These conversion routines are used by YUV conversion functions.
+ * conversion are made from p_y, p_u, p_v, which are modified, to p_buffer,
+ * which is also modified.
+ *****************************************************************************/
+#define CONVERT_Y_PIXEL( BPP )                                                \
+    /* Only Y sample is present */                                            \
+    p_ybase = p_yuv + *p_y++;                                                 \
+    *p_buffer++ = p_ybase[RED_OFFSET-((V_RED_COEF*128)>>SHIFT) + i_red] |     \
+        p_ybase[GREEN_OFFSET-(((U_GREEN_COEF+V_GREEN_COEF)*128)>>SHIFT)       \
+        + i_green ] | p_ybase[BLUE_OFFSET-((U_BLUE_COEF*128)>>SHIFT) + i_blue];
+
+#define CONVERT_YUV_PIXEL( BPP )                                              \
+    /* Y, U and V samples are present */                                      \
+    i_uval =    *p_u++;                                                       \
+    i_vval =    *p_v++;                                                       \
+    i_red =     (V_RED_COEF * i_vval) >> SHIFT;                               \
+    i_green =   (U_GREEN_COEF * i_uval + V_GREEN_COEF * i_vval) >> SHIFT;     \
+    i_blue =    (U_BLUE_COEF * i_uval) >> SHIFT;                              \
+    CONVERT_Y_PIXEL( BPP )                                                    \
+
+/*****************************************************************************
+ * SCALE_WIDTH: scale a line horizontally
+ *****************************************************************************
+ * This macro scales a line using rendering buffer and offset array. It works
+ * for 1, 2 and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_WIDTH                                                           \
+    if( b_horizontal_scaling )                                                \
+    {                                                                         \
+        /* Horizontal scaling, conversion has been done to buffer.            \
+         * Rewind buffer and offset, then copy and scale line */              \
+        p_buffer = p_buffer_start;                                            \
+        p_offset = p_offset_start;                                            \
+        for( i_x = i_pic_width / 16; i_x--; )                                 \
+        {                                                                     \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+            *p_pic++ = *p_buffer;   p_buffer += *p_offset++;                  \
+        }                                                                     \
+        p_pic += i_pic_line_width;                                            \
+    }                                                                         \
+    else                                                                      \
+    {                                                                         \
+        /* No scaling, conversion has been done directly in picture memory.   \
+         * Increment of picture pointer to end of line is still needed */     \
+        p_pic += i_pic_width + i_pic_line_width;                              \
+    }                                                                         \
+
+/*****************************************************************************
+ * SCALE_HEIGHT: handle vertical scaling
+ *****************************************************************************
+ * This macro handle vertical scaling for a picture. CHROMA may be 420, 422 or
+ * 444 for RGB conversion, or 400 for gray conversion. It works for 1, 2, 3
+ * and 4 Bpp.
+ *****************************************************************************/
+#define SCALE_HEIGHT( CHROMA, BPP )                                           \
+    /* If line is odd, rewind 4:2:0 U and V samples */                        \
+    if( ((CHROMA == 420) || (CHROMA == 422)) && !(i_y & 0x1) )                \
+    {                                                                         \
+        p_u -= i_chroma_width;                                                \
+        p_v -= i_chroma_width;                                                \
+    }                                                                         \
+                                                                              \
+    /*                                                                        \
+     * Handle vertical scaling. The current line can be copied or next one    \
+     * can be ignored.                                                        \
+     */                                                                       \
+    switch( i_vertical_scaling )                                              \
+    {                                                                         \
+    case -1:                             /* vertical scaling factor is < 1 */ \
+        while( (i_scale_count -= i_pic_height) > 0 )                          \
+        {                                                                     \
+            /* Height reduction: skip next source line */                     \
+            p_y += i_width;                                                   \
+            i_y++;                                                            \
+            if( (CHROMA == 420) || (CHROMA == 422) )                          \
+            {                                                                 \
+                if( i_y & 0x1 )                                               \
+                {                                                             \
+                    p_u += i_chroma_width;                                    \
+                    p_v += i_chroma_width;                                    \
+                }                                                             \
+            }                                                                 \
+            else if( CHROMA == 444 )                                          \
+            {                                                                 \
+                p_u += i_width;                                               \
+                p_v += i_width;                                               \
+            }                                                                 \
+        }                                                                     \
+        i_scale_count += i_height;                                            \
+        break;                                                                \
+    case 1:                              /* vertical scaling factor is > 1 */ \
+        while( (i_scale_count -= i_height) > 0 )                              \
+        {                                                                     \
+            /* Height increment: copy previous picture line */                \
+            for( i_x = i_pic_width / 16; i_x--; )                             \
+            {                                                                 \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );           \
+                if( BPP > 1 )                               /* 2, 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 2 )                                  /* 3, 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+                if( BPP > 3 )                                     /* 4 Bpp */ \
+                {                                                             \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                    *(((u64 *) p_pic)++) = *(((u64 *) p_pic_start)++ );       \
+                }                                                             \
+            }                                                                 \
+            p_pic +=        i_pic_line_width;                                 \
+            p_pic_start +=  i_pic_line_width;                                 \
+        }                                                                     \
+        i_scale_count += i_pic_height;                                        \
+        break;                                                                \
+    }                                                                         \
+
diff --git a/plugins/sdl/video_yuvall.c b/plugins/sdl/video_yuvall.c
new file mode 100644 (file)
index 0000000..91d6f9c
--- /dev/null
@@ -0,0 +1,113 @@
+/*****************************************************************************
+ * video_yuv32.c: YUV transformation functions for 32 bpp
+ * Provides functions to perform the YUV conversion. The functions provided here
+ * are a complete and portable C implementation, and may be replaced in certain
+ * case by optimized functions.
+ *****************************************************************************
+ * Copyright (C) 1999, 2000 VideoLAN
+ *
+ * Authors:
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * 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-1307, USA.
+ *****************************************************************************/
+
+/*****************************************************************************
+ * Preamble
+ *****************************************************************************/
+#include "defs.h"
+
+#include <math.h>                                            /* exp(), pow() */
+#include <errno.h>                                                 /* ENOMEM */
+#include <stdlib.h>                                                /* free() */
+#include <string.h>                                            /* strerror() */
+
+#include "config.h"
+#include "common.h"
+#include "threads.h"
+#include "mtime.h"
+#include "plugins.h"
+#include "video.h"
+#include "video_output.h"
+#include "video_yuv.h"
+
+#include "intf_msg.h"
+
+#include "SDL/SDL.h"
+
+
+typedef struct vout_sys_s
+{
+        SDL_Surface *   p_display;                             /* display device */
+        Uint8   *   p_buffer[2];
+                                                                 /* Buffers informations */
+        boolean_t   b_must_acquire;           /* must be acquired before writing */
+}   vout_sys_t;
+
+
+
+void Convert8( YUV_ARGS_8BPP )
+{
+}
+
+void Convert16( YUV_ARGS_16BPP )
+{
+}
+
+void Convert24( YUV_ARGS_24BPP )
+{
+}
+
+void Convert32( YUV_ARGS_32BPP )
+{
+}
+
+void ConvertRGB8( YUV_ARGS_8BPP )
+{
+}
+
+void ConvertRGB16( YUV_ARGS_16BPP )
+{
+}
+
+void ConvertRGB24( YUV_ARGS_24BPP )
+{
+}
+
+void ConvertRGB32( YUV_ARGS_32BPP )
+{
+    /* for now, the only function filled because I use 32bpp display :P */
+    SDL_Overlay * screen;
+    SDL_Rect    disp;
+    screen=SDL_CreateYUVOverlay( i_width, i_height,SDL_IYUV_OVERLAY,  p_vout->p_sys->p_display );
+    SDL_LockYUVOverlay(screen);
+    
+    memcpy(screen->pixels, p_vout->yuv.p_buffer, screen->h * screen->pitch );
+    
+    SDL_UnlockYUVOverlay(screen);
+    disp.x=0;
+    disp.y=0;
+    disp.w= i_width;
+    disp.h= i_height;
+    
+    SDL_DisplayYUVOverlay(screen,&disp);
+    
+    //memcpy(p_pic, p_vout->p_sys->p_display->pixels, screen->h * screen->pitch );
+        
+    
+    SDL_FreeYUVOverlay(screen); 
+
+}
+
index 3299bce6ddbed8d7c2c89bc6d52f0b970ce91756..d915421652704ec0e83e1688ff2fa61f076d3b93 100644 (file)
@@ -154,16 +154,35 @@ int vout_SDLManage( vout_thread_t *p_vout )
  *****************************************************************************/
 void vout_SDLDisplay( vout_thread_t *p_vout )
 {
-    /* Change display frame */
-    if( p_vout->p_sys->b_must_acquire )
+    SDL_Overlay * screen;
+    SDL_Rect    disp;
+    if(1)
     {
-        SDL_Flip( p_vout->p_sys->p_display );
-    }
-    /* Swap buffers and change write frame */
-    if( p_vout->p_sys->b_must_acquire )
+        /* Change display frame */
+        if( p_vout->p_sys->b_must_acquire )
+        {
+            SDL_Flip( p_vout->p_sys->p_display );
+        }
+        /* Swap buffers and change write frame */
+        if( p_vout->p_sys->b_must_acquire )
+        {
+            SDL_LockSurface ( p_vout->p_sys->p_display );
+        }
+    } 
+    else 
     {
-        SDL_LockSurface ( p_vout->p_sys->p_display );
-    }
+        /*
+         * p_vout->yuv.p_buffer contains the YUV buffer to render 
+         */
+        
+        screen = SDL_CreateYUVOverlay( p_vout->i_width, p_vout->i_height , SDL_IYUV_OVERLAY, p_vout->p_sys->p_display );
+        screen->pixels = p_vout->yuv.p_buffer;
+        disp.x = 0;
+        disp.y = 0;
+        disp.w = p_vout->i_width;
+        disp.h = p_vout->i_height;
+        SDL_DisplayYUVOverlay( screen , &disp );
+    }        
 }
 
 /* following functions are local */
@@ -184,19 +203,20 @@ static int SDLOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
         return( 1 );
     }
 
-    /* Open display */
-    if( psz_display != NULL && strcmp(psz_display,"fullscreen") == 0 )
-    {
-        p_vout->p_sys->p_display =
-            SDL_SetVideoMode( p_vout->i_width, p_vout->i_height, 15, 
-                              SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF |
-                              SDL_FULLSCREEN );
-    }
-    else
+    /* Open display 
+     * TODO: Check that we can request for a DOUBLEBUF HWSURFACE display
+     */
+    if(psz_display != NULL && strcmp(psz_display,"fullscreen")==0)
     {
-        p_vout->p_sys->p_display =
-            SDL_SetVideoMode( p_vout->i_width, p_vout->i_height, 15, 
-                              SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF );
+        p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->i_width, 
+            p_vout->i_height, 
+            15, 
+            SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN );
+    } else {
+        p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->i_width, 
+            p_vout->i_height, 
+            15, 
+            SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF );
     }
        
     if( p_vout->p_sys->p_display == NULL )
@@ -205,19 +225,15 @@ static int SDLOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
         return( 1 );
     }
     SDL_EventState(SDL_KEYUP , SDL_IGNORE);    /* ignore keys up */
-    //SDL_EventState(SDL_ACTIVEEVENT , SDL_IGNORE);
 
-    /* Check buffers properties */
-       
+    /* Check buffers properties */     
     p_vout->p_sys->b_must_acquire = 1;         /* always acquire */
-       
        p_vout->p_sys->p_buffer[ 0 ] =
              p_vout->p_sys->p_display->pixels;
        
        SDL_Flip(p_vout->p_sys->p_display);
        p_vout->p_sys->p_buffer[ 1 ] =
              p_vout->p_sys->p_display->pixels;
-       
        SDL_Flip(p_vout->p_sys->p_display);
 
     /* Set graphic context colors */
@@ -258,8 +274,6 @@ static int SDLOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
     p_vout->i_blue_mask =       p_vout->p_sys->p_display->format->Bmask;
 
     /* FIXME: palette in 8bpp ?? */
-
-    
     /* Set and initialize buffers */
     vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer[ 0 ],
                              p_vout->p_sys->p_buffer[ 1 ] );
index 6be9c9cbebee57ddfc04a85944d0a834ab3e5ffc..261faf2c22713aff40024620e35693b67bdda7a4 100644 (file)
@@ -146,6 +146,9 @@ int intf_X11Create( intf_thread_t *p_intf )
 
     p_intf->p_sys->b_mouse = 1;
 
+    /* bind keys */
+    intf_AssignNormalKeys( p_intf );
+    
     /* Disable screen saver and return */
     p_intf->p_sys->i_ss_count = 1;
     X11DisableScreenSaver( p_intf );
index ee4370453e73feb5140a33036857b23898850cd6..ce8aa8a7bc8dcbb601088d9f13d23138a8ebc6f0 100644 (file)
@@ -137,6 +137,7 @@ intf_thread_t* intf_Create( void )
     p_intf->b_die =     0;
     p_intf->p_vout =    NULL;
     p_intf->p_input =   NULL;
+    p_intf->p_keys =    NULL;
 
     /* Load channels - the pointer will be set to NULL on failure. The
      * return value is ignored since the program can work without
@@ -216,6 +217,8 @@ void intf_Run( intf_thread_t *p_intf )
  *****************************************************************************/
 void intf_Destroy( intf_thread_t *p_intf )
 {
+    p_intf_key  p_cur;
+    p_intf_key  p_next;
     /* Destroy interfaces */
     p_intf->p_sys_destroy( p_intf );
     intf_ConsoleDestroy( p_intf->p_console );
@@ -223,6 +226,17 @@ void intf_Destroy( intf_thread_t *p_intf )
     /* Unload channels */
     UnloadChannels( p_intf );
 
+    /* Destroy keymap */
+    
+    p_cur = p_intf->p_keys;
+    while( p_cur != NULL)
+    {
+        p_next = p_cur->next;
+        free(p_cur);
+        p_cur = p_next;
+     }
+     
+    
     /* Free structure */
     free( p_intf );
 }
@@ -270,22 +284,108 @@ int intf_SelectChannel( intf_thread_t * p_intf, int i_channel )
     return( 1 );
 }
 
+/*****************************************************************************
+ * intf_AssignKey: assign standartkeys                                       *
+ *****************************************************************************
+ * This function fills in the associative array that links the key pressed   *
+ * and the key we use internally.                                            *
+ ****************************************************************************/
+
+void intf_AssignKey( intf_thread_t *p_intf, int r_key, int f_key)
+{
+    p_intf_key  p_cur =  p_intf->p_keys;
+  
+    if( p_cur == NULL )
+    {
+        p_cur = (p_intf_key )(malloc ( sizeof( intf_key ) ) );
+        p_cur->received_key = r_key;
+        p_cur->forwarded_key = f_key;
+        p_cur->next = NULL;
+        p_intf->p_keys = p_cur;
+    } else {
+        while( p_cur->next != NULL && p_cur ->received_key != r_key)
+        {
+            p_cur = p_cur->next;
+        }
+        if( p_cur->next == NULL )
+        {   
+            p_cur->next  = ( p_intf_key )( malloc( sizeof( intf_key ) ) );
+            p_cur = p_cur->next;
+            p_cur->next = NULL;
+            p_cur->received_key = r_key;
+        }
+        p_cur->forwarded_key = f_key;
+    }        
+}
+
+
+int intf_getKey( intf_thread_t *p_intf, int r_key)
+{
+    p_intf_key current = p_intf->p_keys;
+    while(current != NULL && current->received_key != r_key)
+    {
+        
+        current = current->next;
+    }
+    if(current == NULL)
+       /* didn't find any key in the array */ 
+        return( -1 );
+    else
+        return( current->forwarded_key );
+    /* well, something went wrong */
+    return( -1 );
+}
+
+
+/*****************************************************************************
+ * intf_AssignNormalKeys: used for normal interfaces.
+ *****************************************************************************
+ * This function assign the basic key to the normal keys.
+ *****************************************************************************/
+
+void intf_AssignNormalKeys( intf_thread_t *p_intf)
+{
+     intf_AssignKey( p_intf , 'Q', 'Q');
+     intf_AssignKey( p_intf ,  27, 'Q');
+     intf_AssignKey( p_intf ,   3, 'Q');
+     intf_AssignKey( p_intf , '0', '0');
+     intf_AssignKey( p_intf , '1', '1');
+     intf_AssignKey( p_intf , '2', '2');
+     intf_AssignKey( p_intf , '3', '3');
+     intf_AssignKey( p_intf , '4', '4');
+     intf_AssignKey( p_intf , '5', '5');
+     intf_AssignKey( p_intf , '6', '6');
+     intf_AssignKey( p_intf , '7', '7');
+     intf_AssignKey( p_intf , '8', '8');
+     intf_AssignKey( p_intf , '9', '9');
+     intf_AssignKey( p_intf , '0', '0');
+     intf_AssignKey( p_intf , '+', '+');
+     intf_AssignKey( p_intf , '-', '-');
+     intf_AssignKey( p_intf , 'm', 'M');
+     intf_AssignKey( p_intf , 'M', 'M');
+     intf_AssignKey( p_intf , 'g', 'g');
+     intf_AssignKey( p_intf , 'G', 'G');
+     intf_AssignKey( p_intf , 'c', 'c');
+     intf_AssignKey( p_intf , ' ', ' ');
+     intf_AssignKey( p_intf , 'i', 'i');
+     intf_AssignKey( p_intf , 's', 's');
+}   
+
 /*****************************************************************************
  * intf_ProcessKey: process standard keys
  *****************************************************************************
  * This function will process standard keys and return non 0 if the key was
  * unknown.
  *****************************************************************************/
-int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
+int intf_ProcessKey( intf_thread_t *p_intf, int g_key )
 {
     static int i_volbackup;
+    int i_key;
     
+    i_key = intf_getKey( p_intf, g_key); 
     switch( i_key )
     {
     case 'Q':                                                  /* quit order */
-    case 'q':
-    case 27:                                                   /* escape key */
-    case 3:                                                            /* ^C */
         p_intf->b_die = 1;
         break;
     case '0':                                               /* source change */
@@ -311,7 +411,6 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
             p_main->p_aout->vol -= VOLSTEP;
         break;
     case 'M':                                                 /* toggle mute */
-    case 'm':
         if( (p_main->p_aout != NULL) && (p_main->p_aout->vol))
         {
             i_volbackup = p_main->p_aout->vol;
index bec5b9de48d796fba51295d9bc8277afdd9703d7..6ec5da0ea7b2fc90f82b3a519c5a0a3b61b987a3 100644 (file)
@@ -103,6 +103,7 @@ void bank_Init( plugin_bank_t * p_bank )
     /* Video calculus */
     SEEK_PLUGIN( "yuvmmx" );
     SEEK_PLUGIN( "yuv" );
+    SEEK_PLUGIN( "yuvsdl" );
 
     /* Audio pluins */
     SEEK_PLUGIN( "dsp" );
@@ -116,6 +117,15 @@ void bank_Init( plugin_bank_t * p_bank )
 
 void bank_Destroy( plugin_bank_t * p_bank )
 {
+    int i;
+    for( i = 0 ; i < p_bank->i_plugin_count ; i++ )
+    {
+        if( p_bank->p_info[ i ] != NULL )
+        {
+            free( p_bank->p_info[ i ]-> psz_filename );
+        }
+    }
+
     free( p_bank );
 }
 
@@ -214,6 +224,8 @@ int AllocatePlugin( plugin_id_t plugin_id, plugin_bank_t * p_bank,
     /* run the plugin function to initialize the structure */
     p_bank->p_info[ i ]            = p_func( );
     p_bank->p_info[ i ]->plugin_id = plugin_id;
+    p_bank->p_info[ i ]->psz_filename = strdup( psz_filename );
+
 
     /* Tell the world we found it */
     intf_Msg( "Plugin %i: %s %s [0x%x]\n", i,
index 3ed560a04cc13949af3a9183559d6cf97a4f217a..4897cfa62631008ddec8825c22a7dfee2326eaea 100644 (file)
@@ -97,8 +97,9 @@ x0:
         .align 8
 .text
         .align 4
+/* this seems to annoy the compiler in -g mode, is it normal ? */
 .globl vdec_IDCT
-        .type    vdec_IDCT,@function
+        .type    vdec_IDCT,@function 
 vdec_IDCT:
         pushl %ebp
         movl %esp,%ebp
index 2fea550ca8a544b7becee68bce1384efcbc1e87c..4d46a41f338ec58c7587981a759450c8679ca76e 100644 (file)
@@ -54,7 +54,9 @@
 int vout_InitYUV( vout_thread_t *p_vout )
 {
     typedef void ( yuv_getplugin_t ) ( vout_thread_t * p_vout );
+    
     int          i_index;
+    int          i_best_index = 0, i_best_score = 0;
 
     /* Get a suitable YUV plugin */
     for( i_index = 0 ; i_index < p_main->p_bank->i_plugin_count ; i_index++ )
@@ -65,13 +67,28 @@ int vout_InitYUV( vout_thread_t *p_vout )
             /* ... and if this plugin provides the functions we want ... */
             if( p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin != NULL )
             {
-                /* ... then get these functions */
-                ( (yuv_getplugin_t *)
-                  p_main->p_bank->p_info[ i_index ]->yuv_GetPlugin )( p_vout );
+                /* ... and if this plugin has a good score ... */
+                if(  p_main->p_bank->p_info[ i_index ]->i_score > i_best_score )
+                {
+                    /* ... then take it */
+                    i_best_score = p_main->p_bank->p_info[ i_index ]->i_score;
+                    i_best_index = i_index;
+                }
             }
         }
     }
 
+    if( i_best_score == 0 )
+    {
+        /* this should NEVER happen ! */
+        free( p_vout );
+        return( 12 ); 
+    }
+
+    /* Get the plugin functions */
+    ( ( yuv_getplugin_t * ) p_main->p_bank->p_info[ i_best_index ]->yuv_GetPlugin)( p_vout );
+    
     return p_vout->p_yuv_init( p_vout );
 }