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
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 \
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 \
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)
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
[ --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)],
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 */
/* 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 */
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);
+
return( 1 );
}
}
+ /* Bind normal keys. */
+ intf_AssignNormalKeys( p_intf );
+
+
+
return( 0 );
}
return( 1 );
}
}
-
+
+ /* bind keys */
+ intf_AssignNormalKeys( p_intf );
+
return( 0 );
}
free( p_intf->p_sys );
return( 1 );
}
+
+ /* Assign basic keys */
+ intf_AssignNormalKeys( p_intf );
+
return( 0 );
}
return( 1 );
}
}
+
+ /* bind keys */
+ intf_AssignNormalKeys( p_intf );
+
return( 0 );
}
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 );
}
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 );
} intf_sys_t;
+/* local prototype */
+void intf_SDL_Keymap( intf_thread_t * p_intf );
+
/*****************************************************************************
* intf_SDLCreate: initialize and create SDL interface
free( p_intf->p_sys );
return( 1 );
}
-
+ intf_SDL_Keymap( p_intf );
return( 0 );
}
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",
}
}
+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');
+
+}
* 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
*****************************************************************************/
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,
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 );
{
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" ) )
{
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;
+}
+
+
--- /dev/null
+/*****************************************************************************
+ * 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;
+ }
+ }
+}
--- /dev/null
+/*****************************************************************************
+ * 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 );
+
--- /dev/null
+/*****************************************************************************
+ * 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; \
+ } \
+
--- /dev/null
+/*****************************************************************************
+ * 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);
+
+}
+
*****************************************************************************/
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 */
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 )
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 */
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 ] );
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 );
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
*****************************************************************************/
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 );
/* 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 );
}
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 */
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;
/* Video calculus */
SEEK_PLUGIN( "yuvmmx" );
SEEK_PLUGIN( "yuv" );
+ SEEK_PLUGIN( "yuvsdl" );
/* Audio pluins */
SEEK_PLUGIN( "dsp" );
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 );
}
/* 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,
.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
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++ )
/* ... 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 );
}