Commit 9ac8c0ec authored by Pierre Baillet's avatar Pierre Baillet

A few new things:

	. 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.
parent c45d7219
......@@ -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)
......
......@@ -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,6 +64,7 @@ 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 */
......@@ -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);
......@@ -158,6 +158,11 @@ int intf_BeCreate( intf_thread_t *p_intf )
return( 1 );
}
}
/* Bind normal keys. */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -190,6 +190,9 @@ int intf_FBCreate( intf_thread_t *p_intf )
}
}
/* bind keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -107,6 +107,10 @@ int intf_GGICreate( intf_thread_t *p_intf )
return( 1 );
}
/* Assign basic keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -75,6 +75,10 @@ int intf_GlideCreate( intf_thread_t *p_intf )
return( 1 );
}
}
/* bind keys */
intf_AssignNormalKeys( p_intf );
return( 0 );
}
......
......@@ -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 );
......
......@@ -143,6 +143,10 @@ 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 );
......
......@@ -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) ) {
switch (event.type) {
case SDL_KEYDOWN: /* if a key is pressed */
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 */
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');
}
......@@ -4,6 +4,8 @@
* 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
......@@ -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,18 +78,28 @@ 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;
}
/*****************************************************************************
* 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;
}
}
}
/*****************************************************************************
* 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 );
This diff is collapsed.
/*****************************************************************************
* 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);
}
......@@ -154,6 +154,10 @@ int vout_SDLManage( vout_thread_t *p_vout )
*****************************************************************************/
void vout_SDLDisplay( vout_thread_t *p_vout )
{
SDL_Overlay * screen;
SDL_Rect disp;
if(1)
{
/* Change display frame */
if( p_vout->p_sys->b_must_acquire )
{
......@@ -164,6 +168,21 @@ void vout_SDLDisplay( vout_thread_t *p_vout )
{
SDL_LockSurface ( p_vout->p_sys->p_display );
}
}
else
{
/*
* 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,18 +203,19 @@ 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 )
/* 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 |
SDL_FULLSCREEN );
}
else
{
p_vout->p_sys->p_display =
SDL_SetVideoMode( p_vout->i_width, p_vout->i_height, 15,
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 );
}
......@@ -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 */
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 ] );
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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,
......
......@@ -97,6 +97,7 @@ 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
vdec_IDCT:
......
......@@ -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 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment