Commit 4cff6916 authored by Pierre Baillet's avatar Pierre Baillet

- Added SDL sound support. Sounds a bit laggy sometimes but my streams are ill.

  please try.
- modified configure.in and all that stuff. Re-run configure
- SDL audio, video and interface are all part of the same .so now.
- remove YUV old files :->
parent 3a8481df
......@@ -291,7 +291,8 @@ PLUGIN_BEOS = plugins/beos/beos.o \
plugins/beos/vout_beos.o
PLUGIN_DSP = plugins/dsp/dsp.o \
plugins/dsp/aout_dsp.o \
plugins/dsp/aout_dsp.o
PLUGIN_DUMMY = plugins/dummy/dummy.o \
plugins/dummy/aout_dummy.o \
......@@ -311,9 +312,8 @@ PLUGIN_GGI = plugins/ggi/ggi.o \
PLUGIN_SDL = plugins/sdl/sdl.o \
plugins/sdl/intf_sdl.o \
plugins/sdl/vout_sdl.o
# plugins/sdl/video_yuv.o \
# plugins/sdl/video_yuvall.o
plugins/sdl/vout_sdl.o \
plugins/sdl/aout_sdl.o
PLUGIN_NULL = plugins/null/null.o
......
This diff is collapsed.
......@@ -22,6 +22,8 @@
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
#define MODULE_NAME sdl
/*****************************************************************************
* Preamble
*****************************************************************************/
......@@ -41,15 +43,27 @@
#include "video.h"
#include "video_output.h"
/* audio includes */
#include "modules.h"
#include "modules_inner.h"
/*****************************************************************************
* Building configuration tree
*****************************************************************************/
MODULE_CONFIG_START
ADD_WINDOW( "Configuration for sdl module" )
ADD_COMMENT( "For now, the sdl module cannot be configured" )
MODULE_CONFIG_END
/*****************************************************************************
* Exported prototypes
*****************************************************************************/
static void vout_GetPlugin( p_vout_thread_t p_vout );
static void intf_GetPlugin( p_intf_thread_t p_intf );
#if 0
static void yuv_GetPlugin( p_vout_thread_t p_vout );
#endif
/* Video output */
int vout_SDLCreate ( vout_thread_t *p_vout, char *psz_display,
......@@ -61,19 +75,17 @@ int vout_SDLManage ( p_vout_thread_t p_vout );
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 );
#if 0
/* 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 );
#endif
/* Interface */
int intf_SDLCreate ( p_intf_thread_t p_intf );
void intf_SDLDestroy ( p_intf_thread_t p_intf );
void intf_SDLManage ( p_intf_thread_t p_intf );
/*****************************************************************************
* * Capabilities defined in the other files.
******************************************************************************/
extern void aout_getfunctions( function_list_t * p_function_list );
/*****************************************************************************
* GetConfig: get the plugin structure and configuration
*****************************************************************************/
......@@ -88,17 +100,7 @@ plugin_info_t * GetConfig( void )
p_info->aout_GetPlugin = NULL;
p_info->vout_GetPlugin = vout_GetPlugin;
p_info->intf_GetPlugin = intf_GetPlugin;
/* TODO: before doing this, we have to know if the videoCard is capable of
* hardware YUV -> display acceleration....
*/
#if 0
p_info->yuv_GetPlugin = (void *) yuv_GetPlugin;
#else
p_info->yuv_GetPlugin = NULL;
#endif
/* if the SDL libraries are there, assume we can enter the
......@@ -138,12 +140,64 @@ static void intf_GetPlugin( p_intf_thread_t p_intf )
p_intf->p_sys_manage = intf_SDLManage;
}
#if 0
static void yuv_GetPlugin( p_vout_thread_t p_vout )
/*****************************************************************************
* Audio stuff: All the new modules things
*****************************************************************************/
/*****************************************************************************
* InitModule: get the module structure and configuration.
*****************************************************************************
* We have to fill psz_name, psz_longname and psz_version. These variables
* will be strdup()ed later by the main application because the module can
* be unloaded later to save memory, and we want to be able to access this
* data even after the module has been unloaded.
*****************************************************************************/
int InitModule( module_t * p_module )
{
p_module->psz_name = MODULE_STRING;
p_module->psz_longname = "Linux SDL audio module";
p_module->psz_version = VERSION;
p_module->i_capabilities = MODULE_CAPABILITY_NULL
| MODULE_CAPABILITY_AOUT;
return( 0 );
}
/*****************************************************************************
* ActivateModule: set the module to an usable state.
*****************************************************************************
* This function fills the capability functions and the configuration
* structure. Once ActivateModule() has been called, the i_usage can
* be set to 0 and calls to NeedModule() be made to increment it. To unload
* the module, one has to wait until i_usage == 0 and call DeactivateModule().
*****************************************************************************/
int ActivateModule( module_t * p_module )
{
p_vout->p_yuv_init = yuv_CInit;
p_vout->p_yuv_reset = yuv_CReset;
p_vout->p_yuv_end = yuv_CEnd;
p_module->p_functions = malloc( sizeof( module_functions_t ) );
if( p_module->p_functions == NULL )
{
return( -1 );
}
aout_getfunctions( &p_module->p_functions->aout );
p_module->p_config = p_config;
return( 0 );
}
/*****************************************************************************
* DeactivateModule: make sure the module can be unloaded.
*****************************************************************************
* This function must only be called when i_usage == 0. If it successfully
* returns, i_usage can be set to -1 and the module unloaded. Be careful to
* lock usage_lock during the whole process.
*****************************************************************************/
int DeactivateModule( module_t * p_module )
{
free( p_module->p_functions );
return( 0 );
}
#endif
/*****************************************************************************
* 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);
}
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