Commit 89a64c61 authored by Sam Hocevar's avatar Sam Hocevar

. fix� une erreur de syntaxe dans video_fb.c

 . *3dfx* devient *glide*
 . suppression de tabulations dans quelques fichiers
 . suppression des 2 warnings dans sam_synchro
 . video_* devient vout_* quand ce sont des m�thodes de vout
 . tentative de correction de la d�tection de MMX pour BeOS
 . nouvelle option vlc_vout_method (faute de mieux pour le moment)
 . modification du Makefile pour supporter plusieurs VIDEO_*

dor�navant on peut compiler plusieurs output diff�rents dans le
client. la pr�f�rence se fait dans l'ordre x11, fb, ggi, glide...

si on le compile avec x11 et fb, par d�faut il se lancera en X.
pour le lancer en framebuffer :
./vlc vlc_vout_method=fb

(il faut que je proprifie un peu le choix de l'output, et que je
facilite l'ajout d'un nouveau vout_*)
parent ce722764
......@@ -14,17 +14,16 @@
#SHELL=/bin/sh
# Video output settings
VIDEO=X11
#VIDEO=DUMMY
#VIDEO=FB
#VIDEO=GGI
VIDEO_X11=YES
VIDEO_FB=YES
#VIDEO_GGI=YES
# Highly experimental
#VIDEO=3DFX
#VIDEO_GLIDE=YES
# Not yet supported
#VIDEO=BEOS
#VIDEO=DGA
#VIDEO_BEOS=YES
#VIDEO_DGA=YES
# Target architecture
ARCH=X86
......@@ -56,8 +55,49 @@ DEBUG=1
# Program version - may only be changed by the project leader
PROGRAM_VERSION = 1.0-dev
# VIDEO_OPTIONS describes all used video options
VIDEO_OPTIONS = dummy
intf_method = interface/intf_dummy.o
vout_method = video_output/vout_dummy.o
ifeq ($(VIDEO_GLIDE), YES)
VIDEO_OPTIONS += glide
DEFINE += -DVIDEO_GLIDE
intf_method += interface/intf_glide.o
vout_method += video_output/vout_glide.o
endif
ifeq ($(VIDEO_X11), YES)
VIDEO_OPTIONS += x11
DEFINE += -DVIDEO_X11
intf_method += interface/intf_x11.o
vout_method += video_output/vout_x11.o
endif
ifeq ($(VIDEO_GGI), YES)
VIDEO_OPTIONS += ggi
DEFINE += -DVIDEO_GGI
intf_method += interface/intf_ggi.o
vout_method += video_output/vout_ggi.o
endif
ifeq ($(VIDEO_FB), YES)
VIDEO_OPTIONS += fb
DEFINE += -DVIDEO_FB
intf_method += interface/intf_fb.o
vout_method += video_output/vout_fb.o
endif
ifeq ($(VIDEO_BEOS), YES)
VIDEO_OPTIONS += beos
DEFINE += -DVIDEO_BEOS
intf_method += interface/intf_beos.o
vout_method += video_output/vout_beos.o
endif
ifeq ($(VIDEO_DGA), YES)
VIDEO_OPTIONS += dga
DEFINE += -DVIDEO_DGA
intf_method += interface/intf_dga.o
vout_method += video_output/vout_dga.o
endif
# PROGRAM_OPTIONS is an identification string of the compilation options
PROGRAM_OPTIONS = $(VIDEO) $(ARCH) $(SYS)
PROGRAM_OPTIONS = $(ARCH) $(SYS)
ifeq ($(DEBUG),1)
PROGRAM_OPTIONS += DEBUG
endif
......@@ -66,10 +106,10 @@ endif
PROGRAM_BUILD = `date -R` $(USER)@`hostname`
# DEFINE will contain some of the constants definitions decided in Makefile,
# including VIDEO_xx and ARCH_xx. It will be passed to C compiler.
DEFINE += -DVIDEO_$(VIDEO)
# including ARCH_xx and SYS_xx. It will be passed to C compiler.
DEFINE += -DARCH_$(ARCH)
DEFINE += -DSYS_$(SYS)
DEFINE += -DVIDEO_OPTIONS="\"$(VIDEO_OPTIONS)\""
DEFINE += -DPROGRAM_VERSION="\"$(PROGRAM_VERSION)\""
DEFINE += -DPROGRAM_OPTIONS="\"$(PROGRAM_OPTIONS)\""
DEFINE += -DPROGRAM_BUILD="\"$(PROGRAM_BUILD)\""
......@@ -81,7 +121,7 @@ endif
video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
################################################################################
# Tunning and other variables - do not change anything except if you know
# Tuning and other variables - do not change anything except if you know
# exactly what you are doing
################################################################################
......@@ -90,11 +130,11 @@ video = $(shell echo $(VIDEO) | tr 'A-Z' 'a-z')
#
INCLUDE += -Iinclude
ifeq ($(VIDEO),X11)
ifeq ($(VIDEO_X11),YES)
INCLUDE += -I/usr/X11R6/include
endif
ifeq ($(VIDEO),3DFX)
ifeq ($(VIDEO_GLIDE),YES)
INCLUDE += -I/usr/include/glide
endif
......@@ -104,15 +144,15 @@ endif
LIB += -lpthread
LIN += -lm
ifeq ($(VIDEO),X11)
ifeq ($(VIDEO_X11),YES)
LIB += -L/usr/X11R6/lib
LIB += -lX11
LIB += -lXext
endif
ifeq ($(VIDEO),GGI)
ifeq ($(VIDEO_GGI),YES)
LIB += -lggi
endif
ifeq ($(VIDEO),3DFX)
ifeq ($(VIDEO_GLIDE),YES)
LIB += -lglide2x
endif
......@@ -194,7 +234,7 @@ interface_obj = interface/main.o \
interface/intf_ctrl.o \
interface/control.o \
interface/intf_console.o \
interface/intf_$(video).o
$(intf_method)
input_obj = input/input_vlan.o \
input/input_file.o \
......@@ -209,9 +249,9 @@ audio_output_obj = audio_output/audio_output.o \
audio_output/audio_dsp.o
video_output_obj = video_output/video_output.o \
video_output/video_$(video).o \
video_output/video_text.o \
video_output/video_yuv.o
video_output/video_yuv.o \
$(vout_method)
ac3_decoder_obj = ac3_decoder/ac3_decoder.o \
ac3_decoder/ac3_parse.o \
......
This diff is collapsed.
......@@ -24,7 +24,7 @@
*****************************************************************************/
/* Program version and copyright message */
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
#define COPYRIGHT_MESSAGE "VideoLAN Client v" PROGRAM_VERSION " - (c)1999-2000 VideoLAN"
#define VERSION_MESSAGE "VideoLAN Client - (c)1999-2000 VideoLAN\n" \
"version " PROGRAM_VERSION " ( " PROGRAM_BUILD " )\n" \
"compilation options: " PROGRAM_OPTIONS
......@@ -97,7 +97,7 @@
*****************************************************************************/
/* Environment variable used to store startup script name and default value */
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_VAR "vlc_init"
#define INTF_INIT_SCRIPT_DEFAULT "vlc.init"
/* Environment variable used to store channels file and default value */
......@@ -226,6 +226,9 @@
* Default settings for video output threads
*/
/* Environment variable containing the display method */
#define VOUT_METHOD_VAR "vlc_vout_method"
/* Environment variable used in place of DISPLAY if available */
#define VOUT_DISPLAY_VAR "vlc_display"
......
......@@ -18,9 +18,10 @@
* in release program.
*****************************************************************************/
#ifdef DEBUG
#define ASSERT(p_Mem) \
if (!(p_Mem)) \
intf_ErrMsg("Void pointer error: %s line %d (variable %s at address %p)\n", \
#define ASSERT(p_Mem) \
if (!(p_Mem)) \
intf_ErrMsg("Void pointer error: " \
"%s line %d (variable %s at address %p)\n", \
__FILE__, __LINE__, #p_Mem, &p_Mem);
#else
......@@ -37,7 +38,7 @@ if (!(p_Mem)) \
* program is compiled with the debug option.
*****************************************************************************/
#ifdef DEBUG
#define RZERO(r_Var) \
#define RZERO(r_Var) \
bzero(&(r_Var), sizeof((r_Var)));
#else
......@@ -53,7 +54,7 @@ bzero(&(r_Var), sizeof((r_Var)));
* It has the same purpose than RZERO, but for pointers.
*****************************************************************************/
#ifdef DEBUG
#define PZERO(p_Mem) \
#define PZERO(p_Mem) \
bzero((p_Mem), sizeof(*(p_Mem)));
#else
......@@ -69,7 +70,7 @@ bzero((p_Mem), sizeof(*(p_Mem)));
* It has the same purpose than RZERO or PZERO, but for array
*****************************************************************************/
#ifdef DEBUG
#define AZERO(p_Array, i_Size) \
#define AZERO(p_Array, i_Size) \
bzero((p_Array), (i_Size)*sizeof(*(p_Array)));
#else
......
......@@ -39,7 +39,7 @@ static __inline__ void input_NetlistFreePES( input_thread_t *p_input,
p_ts_packet = p_pes_packet->p_first_ts;
for( i_dummy = 0; i_dummy < p_pes_packet->i_ts_packets; i_dummy++ )
{
ASSERT(p_ts_packet);
ASSERT(p_ts_packet);
#ifdef INPUT_LIFO_TS_NETLIST
p_input->netlist.i_ts_index--;
......
......@@ -26,6 +26,10 @@
* This structe describes all interface-specific data of the main (interface)
* thread.
*****************************************************************************/
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 intf_thread_s
{
boolean_t b_die; /* `die' flag */
......@@ -34,12 +38,18 @@ typedef struct intf_thread_s
p_intf_console_t p_console; /* console */
p_intf_sys_t p_sys; /* system interface */
/* method-specific functions */
intf_sys_create_t * p_sys_create; /* create interface thread */
intf_sys_manage_t * p_sys_manage; /* main loop */
intf_sys_destroy_t * p_sys_destroy; /* destroy interface */
/* Channels array - NULL if not used */
p_intf_channel_t p_channel; /* description of channels */
/* Main threads - NULL if not active */
p_vout_thread_t p_vout;
p_input_thread_t p_input;
} intf_thread_t;
/*****************************************************************************
......
......@@ -6,6 +6,37 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int intf_SysCreate ( p_intf_thread_t p_intf );
void intf_SysDestroy( p_intf_thread_t p_intf );
void intf_SysManage ( p_intf_thread_t p_intf );
int intf_DummySysCreate ( p_intf_thread_t p_intf );
void intf_DummySysDestroy ( p_intf_thread_t p_intf );
void intf_DummySysManage ( p_intf_thread_t p_intf );
#ifdef VIDEO_X11
int intf_X11SysCreate ( p_intf_thread_t p_intf );
void intf_X11SysDestroy ( p_intf_thread_t p_intf );
void intf_X11SysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_FB
int intf_FBSysCreate ( p_intf_thread_t p_intf );
void intf_FBSysDestroy ( p_intf_thread_t p_intf );
void intf_FBSysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_GLIDE
int intf_GlideSysCreate ( p_intf_thread_t p_intf );
void intf_GlideSysDestroy ( p_intf_thread_t p_intf );
void intf_GlideSysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_DGA
int intf_DGASysCreate ( p_intf_thread_t p_intf );
void intf_DGASysDestroy ( p_intf_thread_t p_intf );
void intf_DGASysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_GGI
int intf_GGISysCreate ( p_intf_thread_t p_intf );
void intf_GGISysDestroy ( p_intf_thread_t p_intf );
void intf_GGISysManage ( p_intf_thread_t p_intf );
#endif
#ifdef VIDEO_BEOS
int intf_BeSysCreate ( p_intf_thread_t p_intf );
void intf_BeSysDestroy ( p_intf_thread_t p_intf );
void intf_BeSysManage ( p_intf_thread_t p_intf );
#endif
......@@ -86,15 +86,15 @@ struct vdec_thread_s;
* shows that the values given below are the most effective.
*/
#define CONST_BITS 8 /* Jimmy chose this constant :) */
#define CONST_BITS 8 /* Jimmy chose this constant :) */
#ifdef EIGHT_BIT_SAMPLES
#define PASS1_BITS 2
#else
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#define PASS1_BITS 1 /* lose a little precision to avoid overflow */
#endif
#define ONE ((s32) 1)
#define ONE ((s32) 1)
#define CONST_SCALE (ONE << CONST_BITS)
......@@ -104,10 +104,10 @@ struct vdec_thread_s;
* the correct integer constant values and insert them by hand.
*/
#define FIX(x) ((s32) ((x) * CONST_SCALE + 0.5))
#define FIX(x) ((s32) ((x) * CONST_SCALE + 0.5))
/* When adding two opposite-signed fixes, the 0.5 cancels */
#define FIX2(x) ((s32) ((x) * CONST_SCALE))
#define FIX2(x) ((s32) ((x) * CONST_SCALE))
/* Descale and correctly round an s32 value that's scaled by N bits.
* We assume RIGHT_SHIFT rounds towards minus infinity, so adding
......@@ -128,15 +128,15 @@ struct vdec_thread_s;
*/
#ifdef EIGHT_BIT_SAMPLES
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#ifdef SHORTxSHORT_32 /* may work if 'int' is 32 bits */
#define MULTIPLY(var,const) (((INT16) (var)) * ((INT16) (const)))
#endif
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#ifdef SHORTxLCONST_32 /* known to work with Microsoft C 6.0 */
#define MULTIPLY(var,const) (((INT16) (var)) * ((s32) (const)))
#endif
#endif
#ifndef MULTIPLY /* default definition */
#ifndef MULTIPLY /* default definition */
#define MULTIPLY(var,const) ((var) * (const))
#endif
......
......@@ -140,7 +140,7 @@ static __inline__ void vpar_ReleaseMacroblock( video_fifo_t * p_fifo,
/* Unlink referenced pictures */
if( p_mb->p_forward != NULL )
{
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
vout_UnlinkPicture( p_fifo->p_vpar->p_vout, p_mb->p_forward );
}
if( p_mb->p_backward != NULL )
{
......
......@@ -61,7 +61,7 @@ typedef struct vout_yuv_s
* vout_buffer_t: rendering buffer
*****************************************************************************
* This structure store informations about a buffer. Buffers are not completely
* cleared between displays, and modified areas needs to be stored.
* cleared between displays, and modified areas need to be stored.
*****************************************************************************/
typedef struct vout_buffer_s
{
......@@ -82,11 +82,18 @@ typedef struct vout_buffer_s
* vout_thread_t: video output thread descriptor
*****************************************************************************
* Any independant video output device, such as an X11 window or a GGI device,
* is represented by a video output thread, and described using following
* is represented by a video output thread, and described using the following
* structure.
*****************************************************************************/
typedef void (vout_set_palette_t)( p_vout_thread_t p_vout,
u16 *red, u16 *green, u16 *blue, u16 *transp );
typedef int (vout_sys_create_t) ( p_vout_thread_t p_vout,
char *psz_display, int i_root_window );
typedef int (vout_sys_init_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_end_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_destroy_t) ( p_vout_thread_t p_vout );
typedef int (vout_sys_manage_t) ( p_vout_thread_t p_vout );
typedef void (vout_sys_display_t) ( p_vout_thread_t p_vout );
typedef void (vout_set_palette_t) ( p_vout_thread_t p_vout, u16 *red,
u16 *green, u16 *blue, u16 *transp );
typedef struct vout_thread_s
{
......@@ -100,6 +107,7 @@ typedef struct vout_thread_s
vlc_mutex_t change_lock; /* thread change lock */
int * pi_status; /* temporary status flag */
p_vout_sys_t p_sys; /* system output method */
int i_method; /* display method */
/* Current display properties */
u16 i_changes; /* changes made to the thread */
......@@ -127,12 +135,20 @@ typedef struct vout_thread_s
u32 i_gray_pixel; /* gray */
u32 i_blue_pixel; /* blue */
/* method-dependant functions */
vout_sys_create_t * p_sys_create; /* allocate output method */
vout_sys_init_t * p_sys_init; /* initialize output method */
vout_sys_end_t * p_sys_end; /* terminate output method */
vout_sys_destroy_t * p_sys_destroy; /* destroy output method */
vout_sys_manage_t * p_sys_manage; /* handle events */
vout_sys_display_t * p_sys_display; /* display rendered image */
vout_set_palette_t * p_set_palette; /* sets 8bpp palette */
/* Pictures and rendering properties */
boolean_t b_grayscale; /* color or grayscale display */
boolean_t b_info; /* print additionnal informations */
boolean_t b_interface; /* render interface */
boolean_t b_scale; /* allow picture scaling */
vout_set_palette_t *p_set_palette; /* sets 8bpp palette */
/* Idle screens management */
mtime_t last_display_date; /* last non idle display date */
......@@ -158,8 +174,45 @@ typedef struct vout_thread_s
/* Bitmap fonts */
p_vout_font_t p_default_font; /* default font */
p_vout_font_t p_large_font; /* large font */
} vout_thread_t;
/* Output methods */
#define VOUT_DUMMY_METHOD 0x0000 /* dummy video output */
#define VOUT_X11_METHOD 0x0001 /* X11 */
#define VOUT_GGI_METHOD 0x0002 /* General Graphics Interface */
#define VOUT_FB_METHOD 0x0003 /* Linux framebuffer */
#define VOUT_GLIDE_METHOD 0x0004 /* Voodoo 3dfx */
#define VOUT_DGA_METHOD 0x0005 /* X11 DGA extension */
#define VOUT_BEOS_METHOD 0x0006 /* BeOS rendering */
/* Get the fallback method */
#ifdef VIDEO_X11
#define VOUT_DEFAULT_METHOD "x11"
#else
#ifdef VIDEO_FB
#define VOUT_DEFAULT_METHOD "fb"
#else
#ifdef VIDEO_GGI
#define VOUT_DEFAULT_METHOD "ggi"
#else
#ifdef VIDEO_GLIDE
#define VOUT_DEFAULT_METHOD "glide"
#else
#ifdef VIDEO_DGA
#define VOUT_DEFAULT_METHOD "dga"
#else
#ifdef VIDEO_BEOS
#define VOUT_DEFAULT_METHOD "beos"
#else
#define VOUT_DEFAULT_METHOD "dummy"
#endif
#endif
#endif
#endif
#endif
#endif
/* Flags for changes - these flags are set in the i_changes field when another
* thread changed a variable */
#define VOUT_INFO_CHANGE 0x0001 /* b_info changed */
......@@ -187,7 +240,7 @@ typedef struct vout_thread_s
* Prototypes
*****************************************************************************/
vout_thread_t * vout_CreateThread ( char *psz_display, int i_root_window,
int i_width, int i_height, int *pi_status );
int i_width, int i_height, int *pi_status, int i_method );
void vout_DestroyThread ( vout_thread_t *p_vout, int *pi_status );
picture_t * vout_CreatePicture ( vout_thread_t *p_vout, int i_type,
int i_width, int i_height );
......
......@@ -115,7 +115,7 @@ typedef struct vpar_thread_s
/* Structure to store the tables B14 & B15 (ISO/CEI 13818-2 B.4) */
dct_lookup_t ppl_dct_coef[2][16384];
#ifdef STATS
/* Statistics */
......
......@@ -6,12 +6,58 @@
/*****************************************************************************
* Prototypes
*****************************************************************************/
int vout_SysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_SysInit ( p_vout_thread_t p_vout );
void vout_SysEnd ( p_vout_thread_t p_vout );
void vout_SysDestroy ( p_vout_thread_t p_vout );
int vout_SysManage ( p_vout_thread_t p_vout );
void vout_SysDisplay ( p_vout_thread_t p_vout );
int vout_DummySysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_DummySysInit ( p_vout_thread_t p_vout );
void vout_DummySysEnd ( p_vout_thread_t p_vout );
void vout_DummySysDestroy ( p_vout_thread_t p_vout );
int vout_DummySysManage ( p_vout_thread_t p_vout );
void vout_DummySysDisplay ( p_vout_thread_t p_vout );
#ifdef VIDEO_X11
int vout_X11SysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_X11SysInit ( p_vout_thread_t p_vout );
void vout_X11SysEnd ( p_vout_thread_t p_vout );
void vout_X11SysDestroy ( p_vout_thread_t p_vout );
int vout_X11SysManage ( p_vout_thread_t p_vout );
void vout_X11SysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_FB
int vout_FBSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_FBSysInit ( p_vout_thread_t p_vout );
void vout_FBSysEnd ( p_vout_thread_t p_vout );
void vout_FBSysDestroy ( p_vout_thread_t p_vout );
int vout_FBSysManage ( p_vout_thread_t p_vout );
void vout_FBSysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_GLIDE
int vout_GlideSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_GlideSysInit ( p_vout_thread_t p_vout );
void vout_GlideSysEnd ( p_vout_thread_t p_vout );
void vout_GlideSysDestroy ( p_vout_thread_t p_vout );
int vout_GlideSysManage ( p_vout_thread_t p_vout );
void vout_GlideSysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_DGA
int vout_DGASysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_DGASysInit ( p_vout_thread_t p_vout );
void vout_DGASysEnd ( p_vout_thread_t p_vout );
void vout_DGASysDestroy ( p_vout_thread_t p_vout );
int vout_DGASysManage ( p_vout_thread_t p_vout );
void vout_DGASysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_GGI
int vout_GGISysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_GGISysInit ( p_vout_thread_t p_vout );
void vout_GGISysEnd ( p_vout_thread_t p_vout );
void vout_GGISysDestroy ( p_vout_thread_t p_vout );
int vout_GGISysManage ( p_vout_thread_t p_vout );
void vout_GGISysDisplay ( p_vout_thread_t p_vout );
#endif
#ifdef VIDEO_BEOS
int vout_BeSysCreate ( p_vout_thread_t p_vout, char *psz_display, int i_root_window );
int vout_BeSysInit ( p_vout_thread_t p_vout );
void vout_BeSysEnd ( p_vout_thread_t p_vout );
void vout_BeSysDestroy ( p_vout_thread_t p_vout );
int vout_BeSysManage ( p_vout_thread_t p_vout );
void vout_BeSysDisplay ( p_vout_thread_t p_vout );
#endif
......@@ -47,7 +47,7 @@ typedef void *(*vlc_thread_func_t)(void *p_data);
*****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_thread, char *psz_name,
vlc_thread_func_t func, void *p_data );
vlc_thread_func_t func, void *p_data );
static __inline__ void vlc_thread_exit ( void );
static __inline__ void vlc_thread_join ( vlc_thread_t thread );
......@@ -66,8 +66,8 @@ static __inline__ int vlc_cond_wait ( vlc_cond_t *p_condvar, vlc_mutex_t *p_
* vlc_thread_create: create a thread
*****************************************************************************/
static __inline__ int vlc_thread_create( vlc_thread_t *p_thread,
char *psz_name, vlc_thread_func_t func,
void *p_data)
char *psz_name, vlc_thread_func_t func,
void *p_data)
{
return pthread_create( p_thread, NULL, func, p_data );
}
......
......@@ -68,13 +68,78 @@ static int ParseChannel ( intf_channel_t *p_channel, char *psz_str );
intf_thread_t* intf_Create( void )
{
intf_thread_t *p_intf;
char * psz_method;
/* Allocate structure */
p_intf = malloc( sizeof( intf_thread_t ) );
if( !p_intf )
{
intf_ErrMsg("error: %s\n", strerror( ENOMEM ) );
return( NULL );
return( NULL );
}
/* initialize method-dependent functions */
psz_method = main_GetPszVariable( VOUT_METHOD_VAR, VOUT_DEFAULT_METHOD );
if( !strcmp(psz_method, "dummy") )
{
p_intf->p_sys_create = intf_DummySysCreate;
p_intf->p_sys_manage = intf_DummySysManage;
p_intf->p_sys_destroy = intf_DummySysDestroy;
}
#ifdef VIDEO_X11
else if( !strcmp(psz_method, "x11") )
{
p_intf->p_sys_create = intf_X11SysCreate;
p_intf->p_sys_manage = intf_X11SysManage;
p_intf->p_sys_destroy = intf_X11SysDestroy;
}
#endif
#ifdef VIDEO_FB
else if( !strcmp(psz_method, "fb") )
{
p_intf->p_sys_create = intf_FBSysCreate;
p_intf->p_sys_manage = intf_FBSysManage;
p_intf->p_sys_destroy = intf_FBSysDestroy;
}
#endif
#ifdef VIDEO_GGI
else if( !strcmp(psz_method, "ggi") )
{
p_intf->p_sys_create = intf_GGISysCreate;
p_intf->p_sys_manage = intf_GGISysManage;
p_intf->p_sys_destroy = intf_GGISysDestroy;
}
#endif
#ifdef VIDEO_DGA
else if( !strcmp(psz_method, "dga") )
{
p_intf->p_sys_create = intf_DGASysCreate;
p_intf->p_sys_manage = intf_DGASysManage;
p_intf->p_sys_destroy = intf_DGASysDestroy;
}
#endif
#ifdef VIDEO_GLIDE
else if( !strcmp(psz_method, "glide") )
{
p_intf->p_sys_create = intf_GlideSysCreate;
p_intf->p_sys_manage = intf_GlideSysManage;
p_intf->p_sys_destroy = intf_GlideSysDestroy;
}
#endif
#ifdef VIDEO_BEOS
else if( !strcmp(psz_method, "beos") )
{
p_intf->p_sys_create = intf_BeSysCreate;
p_intf->p_sys_manage = intf_BeSysManage;
p_intf->p_sys_destroy = intf_BeSysDestroy;
}
#endif
else
{
intf_ErrMsg( "error: video output method not available\n" );
free( p_intf );
return( NULL );
}
/* Initialize structure */
......@@ -92,15 +157,15 @@ intf_thread_t* intf_Create( void )
if( p_intf->p_console == NULL )
{
intf_ErrMsg("error: can't create control console\n");
free( p_intf );
free( p_intf );
return( NULL );
}
if( intf_SysCreate( p_intf ) )
if( p_intf->p_sys_create( p_intf ) )
{
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
intf_ErrMsg("error: can't create interface\n");
intf_ConsoleDestroy( p_intf->p_console );
free( p_intf );
return( NULL );
}
intf_Msg("Interface initialized\n");
......@@ -118,7 +183,7 @@ void intf_Run( intf_thread_t *p_intf )
* the script could be executed but failed */
if( intf_ExecScript( main_GetPszVariable( INTF_INIT_SCRIPT_VAR, INTF_INIT_SCRIPT_DEFAULT ) ) > 0 )
{
intf_ErrMsg("warning: error(s) during startup script\n");
intf_ErrMsg("warning: error(s) during startup script\n");
}
/* Main loop */
......@@ -128,7 +193,7 @@ void intf_Run( intf_thread_t *p_intf )
intf_FlushMsg();
/* Manage specific interface */
intf_SysManage( p_intf );
p_intf->p_sys_manage( p_intf );
/* Check attached threads status */
if( (p_intf->p_vout != NULL) && p_intf->p_vout->b_error )
......@@ -157,7 +222,7 @@ void intf_Run( intf_thread_t *p_intf )
void intf_Destroy( intf_thread_t *p_intf )
{
/* Destroy interfaces */
intf_SysDestroy( p_intf );
p_intf->p_sys_destroy( p_intf );
intf_ConsoleDestroy( p_intf->p_console );
/* Unload channels */
......@@ -249,7 +314,7 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key )
case 'M': /* toggle mute */
case 'm':
// ??
break;
break;
case 'g': /* gamma - */
if( (p_intf->p_vout != NULL) && (p_intf->p_vout->f_gamma > -INTF_GAMMA_LIMIT) )
{
......
/*****************************************************************************
* intf_3dfx.c: 3dfx interface
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <signal.h>
#include <stdio.h> /* stderr */
#include <stdlib.h>
#include <string.h>
#include <termios.h>
#include <unistd.h> /* close() */
#include <sys/uio.h> /* for input.h */
#include <linutil.h> /* Glide kbhit() and getch() */
#include <sys/types.h> /* open() */
#include <sys/stat.h>
#include <fcntl.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "intf_sys.h"
#include "intf_msg.h"
#include "interface.h"
#include "main.h"
/*****************************************************************************
* intf_sys_t: description and status of 3dfx interface
*****************************************************************************/
typedef struct intf_sys_s
{
} intf_sys_t;
/*****************************************************************************
* intf_SysCreate: initialize 3dfx interface
*****************************************************************************/
int intf_SysCreate( intf_thread_t *p_intf )
{
/* Allocate instance and initialize some members */
p_intf->p_sys = malloc( sizeof( intf_sys_t ) );
if( p_intf->p_sys == NULL )
{
return( 1 );
};
intf_DbgMsg("0x%x\n", p_intf );
/* Spawn video output thread */
if( p_main->b_video )
{
p_intf->p_vout = vout_CreateThread( NULL, 0, 0, 0, NULL);
if( p_intf->p_vout == NULL ) /* error */
{
intf_ErrMsg("intf error: can't create output thread\n" );
return( 1 );
}
}
return( 0 );
}
/*****************************************************************************
* intf_SysDestroy: destroy 3dfx interface
*****************************************************************************/
void intf_SysDestroy( intf_thread_t *p_intf )
{
/* Close input thread, if any (blocking) */
if( p_intf->p_input )
{
input_DestroyThread( p_intf->p_input, NULL );
}
/* Close video output thread, if any (blocking) */
if( p_intf->p_vout )
{
vout_DestroyThread( p_intf->p_vout, NULL );
}
/* Destroy structure */
free( p_intf->p_sys );
}
/*****************************************************************************
* intf_SysManage: event loop
*****************************************************************************/
void intf_SysManage( intf_thread_t *p_intf )
{
unsigned int buf;
/* very Linux specific - see tlib.c in Glide for other versions */
while( kbhit() )
{
if( intf_ProcessKey(p_intf, (int)buf = getch()) )
{
printf("unhandled key '%c' (%i)\n", (char) buf, buf );
}
}
}
......@@ -435,7 +435,7 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
switch( p_argv[i_arg].i_index )
{
case 0:
// ?? useless
// ?? useless
i_input = p_argv[i_arg].i_num;
break;
case 1:
......@@ -448,7 +448,7 @@ static int SelectPID( int i_argc, intf_arg_t *p_argv )
/* Find to which input this command is destinated */
intf_IntfMsg( "Adding PID %d to input %d\n", i_pid, i_input );
//???? input_AddPgrmElem( p_main->p_intf->p_x11->p_input,
//???? i_pid );
//???? i_pid );
return( INTF_NO_ERROR );
}
......
......@@ -87,7 +87,7 @@ typedef struct intf_msg_s
*****************************************************************************/
static void QueueMsg ( intf_msg_t *p_msg, int i_type,
char *psz_format, va_list ap );
char *psz_format, va_list ap );
static void PrintMsg ( intf_msg_item_t *p_msg );
#ifdef DEBUG
static void QueueDbgMsg ( intf_msg_t *p_msg, char *psz_file,
......@@ -100,7 +100,7 @@ static void FlushLockedMsg ( intf_msg_t *p_msg );
/*****************************************************************************
* intf_MsgCreate: initialize messages interface (ok ?)
* intf_MsgCreate: initialize messages interface (ok ?)
*****************************************************************************
* This functions has to be called before any call to other intf_*Msg functions.
* It set up the locks and the message queue if it is used.
......@@ -113,7 +113,7 @@ p_intf_msg_t intf_MsgCreate( void )
p_msg = malloc( sizeof( intf_msg_t ) );
if( p_msg == NULL )
{
errno = ENOMEM;
errno = ENOMEM;
}
else
{
......@@ -124,10 +124,10 @@ p_intf_msg_t intf_MsgCreate( void )
#endif
#ifdef DEBUG_LOG
/* Log file initialization - on failure, file pointer will be null,
* and no log will be issued, but this is not considered as an
* error */
p_msg->i_log_file = open( DEBUG_LOG,
/* Log file initialization - on failure, file pointer will be null,
* and no log will be issued, but this is not considered as an
* error */
p_msg->i_log_file = open( DEBUG_LOG,
O_CREAT | O_TRUNC | O_SYNC | O_WRONLY,
0666 );
#endif
......@@ -150,7 +150,7 @@ void intf_MsgDestroy( void )
/* Close log file if any */
if( p_main->p_msg->i_log_file >= 0 )
{
close( p_main->p_msg->i_log_file );
close( p_main->p_msg->i_log_file );
}
#endif
......@@ -365,7 +365,7 @@ static void QueueMsg( intf_msg_t *p_msg, int i_type, char *psz_format, va_list a
*****************************************************************************/
#ifdef DEBUG
static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
int i_line, char *psz_format, va_list ap)
int i_line, char *psz_format, va_list ap)
{
char * psz_str; /* formatted message string */
intf_msg_item_t * p_msg_item; /* pointer to message */
......@@ -384,7 +384,7 @@ static void QueueDbgMsg(intf_msg_t *p_msg, char *psz_file, char *psz_function,
fprintf(stderr, "warning: can't store following message (%s): ",
strerror(errno) );
fprintf(stderr, INTF_MSG_DBG_FORMAT, psz_file, psz_function, i_line );
vfprintf(stderr, psz_format, ap );
vfprintf(stderr, psz_format, ap );
exit( errno );
}
......@@ -509,7 +509,7 @@ static void PrintMsg( intf_msg_item_t *p_msg )
/* Append all messages to log file */
if( p_main->p_msg->i_log_file >= 0 )
{
write( p_main->p_msg->i_log_file, psz_msg, strlen( psz_msg ) );
write( p_main->p_msg->i_log_file, psz_msg, strlen( psz_msg ) );
}
#endif
......
......@@ -107,7 +107,7 @@ static int TestMMX ( void );
* -openning of audio output device and some global modules
* -execution of interface, which exit on error or on user request
* -closing of audio output device and some global modules
* On error, the spawned threads are cancelled, and the openned devices closed.
* On error, the spawned threads are cancelled, and the open devices closed.
*****************************************************************************/
int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
{
......@@ -121,7 +121,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
if( !TestMMX() )
{
fprintf( stderr, "Sorry, this program needs an MMX processor. Please run the non-MMX version.\n" );
return(0);
return( 1 );
}
#endif
p_main->p_msg = intf_MsgCreate();
......@@ -131,7 +131,7 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
strerror(errno));
return(errno);
}
if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) )/* parse command line */
if( GetConfiguration( i_argc, ppsz_argv, ppsz_env ) ) /* parse cmd line */
{
intf_MsgDestroy();
return(errno);
......@@ -154,12 +154,12 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
if( main_data.b_audio )
{
main_data.p_aout = aout_CreateThread( NULL );
if( main_data.p_aout == NULL )
{
/* On error during audio initialization, switch of audio */
if( main_data.p_aout == NULL )
{
/* On error during audio initialization, switch of audio */
intf_Msg("Audio initialization failed : audio is desactivated\n");
main_data.b_audio = 0;
}
}
}
/*
......@@ -168,9 +168,9 @@ int main( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
main_data.p_intf = intf_Create();
if( main_data.p_intf != NULL )
{
InitSignalHandler(); /* prepare signals for interception */
intf_Run( main_data.p_intf );
intf_Destroy( main_data.p_intf );
InitSignalHandler(); /* prepare signals for interception */
intf_Run( main_data.p_intf );
intf_Destroy( main_data.p_intf );
}
/*
......@@ -216,7 +216,7 @@ int main_GetIntVariable( char *psz_name, int i_default )
{
return( i_value );
}
}
}
return( i_default );
}
......@@ -335,7 +335,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Audio options */
case OPT_NOAUDIO: /* --noaudio */
p_main->b_audio = 0;
p_main->b_audio = 0;
break;
case OPT_STEREO: /* --stereo */
main_PutIntVariable( AOUT_STEREO_VAR, 1 );
......@@ -375,7 +375,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
case OPT_PORT: /* --port */
main_PutPszVariable( INPUT_PORT_VAR, optarg );
break;
/* Internal error: unknown option */
case '?':
default:
......@@ -388,7 +388,7 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
/* Parse command line parameters - no check is made for these options */
for( i_opt = optind; i_opt < i_argc; i_opt++ )
{
putenv( ppsz_argv[ i_opt ] );
putenv( ppsz_argv[ i_opt ] );
}
return( 0 );
}
......@@ -419,34 +419,36 @@ static void Usage( void )
/* Interface parameters */
intf_Msg("Interface parameters:\n" \
" " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script\n" \
" " INTF_INIT_SCRIPT_VAR "=<filename> \tinitialization script\n" \
" " INTF_CHANNELS_VAR "=<filename> \tchannels list\n"\
);
);
/* Audio parameters */
intf_Msg("Audio parameters:\n" \
" " AOUT_DSP_VAR "=<filename> \tdsp device path\n" \
" " AOUT_STEREO_VAR "={1|0} \tstereo or mono output\n" \
" " AOUT_RATE_VAR "=<rate> \toutput rate\n" \
);
);
/* Video parameters */
intf_Msg("Video parameters:\n" \
" " VOUT_METHOD_VAR "=<method name> \tmethod used\n" \
" ( available: " VIDEO_OPTIONS " )\n" \
" " VOUT_DISPLAY_VAR "=<display name> \tdisplay used\n" \
" " VOUT_WIDTH_VAR "=<width> \tdisplay width\n" \
" " VOUT_HEIGHT_VAR "=<height> \tdislay height\n" \
" " VOUT_FB_DEV_VAR "=<filename> \tframebuffer device path\n" \
" " VOUT_GRAYSCALE_VAR "={1|0} \tgrayscale or color output\n" \
);
);
/* Input parameters */
intf_Msg("Input parameters:\n" \
" " INPUT_SERVER_VAR "=<hostname> \tvideo server\n" \
" " INPUT_PORT_VAR "=<port> \tvideo server port\n" \
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n" \
" " INPUT_IFACE_VAR "=<interface> \tnetwork interface\n" \
" " INPUT_VLAN_SERVER_VAR "=<hostname> \tvlan server\n" \
" " INPUT_VLAN_PORT_VAR "=<port> \tvlan server port\n"\
);
);
}
/*****************************************************************************
......@@ -513,7 +515,7 @@ static void SignalHandler( int i_signal )
*****************************************************************************/
static int TestMMX( void )
{
int reg, dummy;
int i_reg, i_dummy = 0;
/* test for a 386 cpu */
asm volatile ( "pushfl
......@@ -526,9 +528,9 @@ static int TestMMX( void )
popl %%eax
xorl %%ecx, %%eax
andl $0x40000, %%eax"
: "=a" ( reg ) );
: "=a" ( i_reg ) );
if( !reg )
if( !i_reg )
return( 0 );
/* test for a 486 cpu */
......@@ -542,33 +544,35 @@ static int TestMMX( void )
pushl %%ecx
popfl
andl $0x200000, %%eax"
: "=a" ( reg ) );
: "=a" ( i_reg ) );
if( !reg )
if( !i_reg )
return( 0 );
/* the cpu supports the CPUID instruction - get its level */
asm volatile ( "cpuid"
: "=a" ( reg ),
"=b" ( dummy ),
"=c" ( dummy ),
"=d" ( dummy )
: "a" ( 0 ) ); /* level 0 */
: "=a" ( i_reg ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_dummy )
: "a" ( 0 ), /* level 0 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
/* this shouldn't happen on a normal cpu */
if( !reg )
if( !i_reg )
return( 0 );
/* test for the MMX flag */
asm volatile ( "cpuid
andl $0x00800000, %%edx" /* X86_FEATURE_MMX */
: "=a" ( dummy ),
"=b" ( dummy ),
"=c" ( dummy ),
"=d" ( reg )
: "a" ( 1 ) ); /* level 1 */
if( !reg )
: "=a" ( i_dummy ),
"=b" ( i_dummy ),
"=c" ( i_dummy ),
"=d" ( i_reg )
: "a" ( 1 ), /* level 1 */
"b" ( i_dummy ) ); /* buggy compiler shouldn't complain */
if( !i_reg )
return( 0 );
return( 1 );
......
This diff is collapsed.
This diff is collapsed.
/*****************************************************************************
* vout_3dfx.c: 3dfx video output display method for 3dfx cards
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#ifndef __linux__
#include <conio.h> /* for glide ? */
#endif
#include <sys/uio.h> /* for input.h */
#include <glide.h>
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
#include "main.h"
#define WIDTH 640
#define HEIGHT 480
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: 3dfx video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the 3dfx specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
GrLfbInfo_t p_buffer_info; /* back buffer info */
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int GlideOpenDisplay ( vout_thread_t *p_vout );
static void GlideCloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocates 3dfx video thread output method
*****************************************************************************
* This function allocates and initializes a 3dfx vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( GlideOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize 3dfx video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate 3dfx video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy 3dfx video thread output method
*****************************************************************************
* Terminate an output method created by vout_CreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
GlideCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle 3dfx events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to 3dfx image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
grBufferSwap( 0 );
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_vout->p_sys->p_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" );
}
}
/* following functions are local */
/*****************************************************************************
* GlideOpenDisplay: open and initialize 3dfx device
*****************************************************************************/
static int GlideOpenDisplay( vout_thread_t *p_vout )
{
static char version[80];
GrHwConfiguration hwconfig;
GrScreenResolution_t resolution = GR_RESOLUTION_640x480;
GrLfbInfo_t p_front_buffer_info; /* front buffer info */
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = 1024 * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
p_vout->i_red_mask = 0xf800;
p_vout->i_green_mask = 0x07e0;
p_vout->i_blue_mask = 0x001f;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg( "vout error: can't map video memory (%s)\n", strerror(errno) );
return( 1 );
}
grGlideGetVersion( version );
grGlideInit();
if( !grSstQueryHardware(&hwconfig) )
{
intf_ErrMsg( "vout error: can't get 3dfx hardware config\n" );
return( 1 );
}
grSstSelect( 0 );
if( !grSstWinOpen(0, resolution, GR_REFRESH_60Hz,
GR_COLORFORMAT_ABGR, GR_ORIGIN_UPPER_LEFT, 2, 1) )
{
intf_ErrMsg( "vout error: can't open 3dfx screen\n" );
return( 1 );
}
/* disable dithering */
//grDitherMode( GR_DITHER_DISABLE );
/* clear both buffers */
grRenderBuffer( GR_BUFFER_BACKBUFFER );
grBufferClear( 0, 0, 0 );
grRenderBuffer( GR_BUFFER_FRONTBUFFER );
grBufferClear( 0, 0, 0 );
grRenderBuffer( GR_BUFFER_BACKBUFFER );
p_vout->p_sys->p_buffer_info.size = sizeof( GrLfbInfo_t );
p_front_buffer_info.size = sizeof( GrLfbInfo_t );
/* lock the buffers to find their adresses */
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_front_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx front buffer lock\n" );
grGlideShutdown();
return( 1 );
}
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_FRONTBUFFER );
if ( grLfbLock(GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER,
GR_LFBWRITEMODE_565, GR_ORIGIN_UPPER_LEFT, FXFALSE,
&p_vout->p_sys->p_buffer_info) == FXFALSE )
{
intf_ErrMsg( "vout error: can't take 3dfx back buffer lock\n" );
grGlideShutdown();
return( 1 );
}
grBufferClear( 0, 0, 0 );
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_buffer_info.lfbPtr,
p_front_buffer_info.lfbPtr );
return( 0 );
}
/*****************************************************************************
* GlideCloseDisplay: close and reset 3dfx device
*****************************************************************************
* Returns all resources allocated by GlideOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void GlideCloseDisplay( vout_thread_t *p_vout )
{
/* unlock the hidden buffer */
grLfbUnlock( GR_LFB_WRITE_ONLY, GR_BUFFER_BACKBUFFER );
/* shutdown Glide */
grGlideShutdown();
free( p_vout->p_sys->p_video );
}
/*****************************************************************************
* vout_dummy.c: Dummy video output display method for testing purposes
* (c)2000 VideoLAN
*****************************************************************************/
/*****************************************************************************
* Preamble
*****************************************************************************/
#include <errno.h>
#include <fcntl.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/uio.h> /* for input.h */
#include "config.h"
#include "common.h"
#include "mtime.h"
#include "vlc_thread.h"
#include "input.h"
#include "video.h"
#include "video_output.h"
#include "video_sys.h"
#include "intf_msg.h"
#include "main.h"
#define WIDTH 128
#define HEIGHT 64
#define BITS_PER_PLANE 16
#define BYTES_PER_PIXEL 2
/*****************************************************************************
* vout_sys_t: dummy video output method descriptor
*****************************************************************************
* This structure is part of the video output thread descriptor.
* It describes the dummy specific properties of an output thread.
*****************************************************************************/
typedef struct vout_sys_s
{
/* Dummy video memory */
byte_t * p_video; /* base adress */
size_t i_page_size; /* page size */
} vout_sys_t;
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static int DummyOpenDisplay ( vout_thread_t *p_vout );
static void DummyCloseDisplay ( vout_thread_t *p_vout );
/*****************************************************************************
* vout_SysCreate: allocates dummy video thread output method
*****************************************************************************
* This function allocates and initializes a dummy vout method.
*****************************************************************************/
int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, int i_root_window )
{
/* Allocate structure */
p_vout->p_sys = malloc( sizeof( vout_sys_t ) );
if( p_vout->p_sys == NULL )
{
intf_ErrMsg("error: %s\n", strerror(ENOMEM) );
return( 1 );
}
/* Open and initialize device */
if( DummyOpenDisplay( p_vout ) )
{
intf_ErrMsg("vout error: can't open display\n");
free( p_vout->p_sys );
return( 1 );
}
return( 0 );
}
/*****************************************************************************
* vout_SysInit: initialize dummy video thread output method
*****************************************************************************/
int vout_SysInit( vout_thread_t *p_vout )
{
return( 0 );
}
/*****************************************************************************
* vout_SysEnd: terminate dummy video thread output method
*****************************************************************************/
void vout_SysEnd( vout_thread_t *p_vout )
{
;
}
/*****************************************************************************
* vout_SysDestroy: destroy dummy video thread output method
*****************************************************************************
* Terminate an output method created by vout_DummyCreateOutputMethod
*****************************************************************************/
void vout_SysDestroy( vout_thread_t *p_vout )
{
DummyCloseDisplay( p_vout );
free( p_vout->p_sys );
}
/*****************************************************************************
* vout_SysManage: handle dummy events
*****************************************************************************
* This function should be called regularly by video output thread. It manages
* console events. It returns a non null value on error.
*****************************************************************************/
int vout_SysManage( vout_thread_t *p_vout )
{
return 0;
}
/*****************************************************************************
* vout_SysDisplay: displays previously rendered output
*****************************************************************************
* This function send the currently rendered image to dummy image, waits until
* it is displayed and switch the two rendering buffers, preparing next frame.
*****************************************************************************/
void vout_SysDisplay( vout_thread_t *p_vout )
{
;
}
/* following functions are local */
/*****************************************************************************
* DummyOpenDisplay: open and initialize dummy device
*****************************************************************************
* ?? The framebuffer mode is only provided as a fast and efficient way to
* display video, providing the card is configured and the mode ok. It is
* not portable, and is not supposed to work with many cards. Use at your
* own risk !
*****************************************************************************/
static int DummyOpenDisplay( vout_thread_t *p_vout )
{
p_vout->i_width = WIDTH;
p_vout->i_height = HEIGHT;
p_vout->i_screen_depth = BITS_PER_PLANE;
p_vout->i_bytes_per_pixel = BYTES_PER_PIXEL;
p_vout->i_bytes_per_line = WIDTH * BYTES_PER_PIXEL;
p_vout->p_sys->i_page_size = WIDTH * HEIGHT * BYTES_PER_PIXEL;
/* Map two framebuffers a the very beginning of the fb */
p_vout->p_sys->p_video = malloc( p_vout->p_sys->i_page_size * 2 );
if( (int)p_vout->p_sys->p_video == -1 )
{
intf_ErrMsg("vout error: can't map video memory (%s)\n", strerror(errno) );
return( 1 );
}
/* Set and initialize buffers */
vout_SetBuffers( p_vout, p_vout->p_sys->p_video,
p_vout->p_sys->p_video + p_vout->p_sys->i_page_size );
return( 0 );
}
/*****************************************************************************
* DummyCloseDisplay: close and reset dummy device
*****************************************************************************
* Returns all resources allocated by DummyOpenDisplay and restore the original
* state of the device.
*****************************************************************************/
static void DummyCloseDisplay( vout_thread_t *p_vout )
{
free( p_vout->p_sys->p_video );
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -500,7 +500,7 @@ do_next_8x2_block:
addl $16,%edi /* ih take 16 bytes (8 pixels-16 bit) */
addl $4,%ebx /* ? to take 4 pixels together
instead of 2 */
#endif
#endif
jl do_next_8x2_block
addl CCOSkipDistance(%esp),%edi /* go to begin of next line */
......
......@@ -76,7 +76,7 @@ int pi_default_intra_quant[] =
26, 27, 29, 32, 35, 40, 48, 58,
26, 27, 29, 34, 38, 46, 56, 69,
27, 29, 35, 38, 46, 56, 69, 83
};
};
#else
int pi_default_intra_quant[] =
{
......@@ -87,7 +87,7 @@ int pi_default_intra_quant[] =
5632, 9232, 9031, 8730, 8192, 7040, 5542, 3390,
5230, 7533, 7621, 7568, 7040, 6321, 5225, 3219,
3602, 5189, 5250, 5539, 5265, 5007, 4199, 2638,
1907, 2841, 3230, 3156, 3249, 3108, 2638, 1617
1907, 2841, 3230, 3156, 3249, 3108, 2638, 1617
};
#endif
......@@ -116,7 +116,7 @@ int pi_default_nonintra_quanit[] =
4096, 5680, 5344, 4816, 4096, 3216, 2224, 1136,
3216, 4464, 4208, 3792, 3216, 2528, 1744, 880,
2224, 3072, 2896, 2608, 2224, 1744, 1200, 608,
1136, 1568, 1472, 1328, 1136, 880, 608, 304
1136, 1568, 1472, 1328, 1136, 880, 608, 304
};
#endif
......
This diff is collapsed.
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