From 9c24f64dd035fee44608410f08b5c966a217afd9 Mon Sep 17 00:00:00 2001 From: Vincent Seguin Date: Wed, 19 Jan 2000 18:43:17 +0000 Subject: [PATCH] =?utf8?q?D=EF=BF=BDbut=20du=20changement=20de=20chaine.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- include/config.h | 25 ++++++------- include/interface.h | 2 +- src/interface/interface.c | 62 +++++++++++++++++++++++++++------ src/interface/intf_ctrl.c | 7 ++-- src/interface/main.c | 11 +++--- src/video_output/video_ggi.c | 20 ++++++++--- src/video_output/video_output.c | 30 +++++++++------- src/video_output/video_yuv.c | 2 +- 8 files changed, 104 insertions(+), 55 deletions(-) diff --git a/include/config.h b/include/config.h index edee7c718f..d51ad0cf65 100644 --- a/include/config.h +++ b/include/config.h @@ -123,9 +123,6 @@ #define INTF_GAMMA_STEP .1 #define INTF_GAMMA_LIMIT 3 -/* Scaling modifier limits */ -#define INTF_SCALE_LIMIT 10 - /* * X11 settings */ @@ -133,9 +130,6 @@ /* Title of the X11 window */ #define VOUT_TITLE "VideoLAN Client" -/* Environment variable used in place of DISPLAY if available */ -#define ENV_VLC_DISPLAY "vlc_DISPLAY" - /******************************************************************************* * Input thread configuration *******************************************************************************/ @@ -235,10 +229,15 @@ * Default settings for video output threads */ -/* Default dimensions for display window - these dimensions are the standard - * width and height for broadcasted MPEG-2 */ -#define VOUT_WIDTH 544 -#define VOUT_HEIGHT 576 +/* Environment variable used in place of DISPLAY if available */ +#define VOUT_DISPLAY_VAR "vlc_DISPLAY" + +/* Default dimensions for display window - these dimensions are enough for the + * standard width and height broadcasted MPEG-2 streams */ +#define VOUT_WIDTH_VAR "vlc_width" +#define VOUT_HEIGHT_VAR "vlc_height" +#define VOUT_WIDTH_DEFAULT 640 +#define VOUT_HEIGHT_DEFAULT 480 /* Default video heap size - remember that a decompressed picture is big * (~1 Mbyte) before using huge values */ @@ -248,10 +247,6 @@ #define VOUT_GRAYSCALE_VAR "vlc_grayscale" #define VOUT_GRAYSCALE_DEFAULT 0 -/* Environment variable for fullscreen output mode, and default value */ -#define VOUT_FULLSCREEN_VAR "vlc_fullscreen" -#define VOUT_FULLSCREEN_DEFAULT 0 - /* Default gamma */ #define VOUT_GAMMA 0. @@ -341,7 +336,7 @@ /* Define to enable messages queues - disabling messages queue can be usefull * when debugging, since it allows messages which would not otherwise be printed, * due to a crash, to be printed anyway */ -#define INTF_MSG_QUEUE +//#define INTF_MSG_QUEUE /* Format of the header for debug messages. The arguments following this header * are the file (char *), the function (char *) and the line (int) in which the diff --git a/include/interface.h b/include/interface.h index 160c7d45e5..b15869b48a 100644 --- a/include/interface.h +++ b/include/interface.h @@ -46,6 +46,6 @@ intf_thread_t * intf_Create ( void ); void intf_Run ( intf_thread_t * p_intf ); void intf_Destroy ( intf_thread_t * p_intf ); -int intf_SelectInput ( intf_thread_t * p_intf, p_input_cfg_t p_cfg ); +int intf_SelectInput ( intf_thread_t * p_intf, int i_index ); int intf_ProcessKey ( intf_thread_t * p_intf, int i_key ); diff --git a/src/interface/interface.c b/src/interface/interface.c index 3e49549e37..14925e8235 100644 --- a/src/interface/interface.c +++ b/src/interface/interface.c @@ -31,6 +31,41 @@ #include "intf_sys.h" +/******************************************************************************* + * Constants + *******************************************************************************/ + +/* INTF_INPUT_CFG: pre-configured inputs */ +#define INTF_MAX_INPUT_CFG 10 +static const input_cfg_t INTF_INPUT_CFG[] = +{ + /* properties method + * file host ip port vlan */ + + /* Local input (unicast) */ + { INPUT_CFG_METHOD | INPUT_CFG_IP, INPUT_METHOD_TS_UCAST, + NULL, NULL, "127.0.0.1", 0, 0 }, + + /* Broadcasts */ + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 0 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 1 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 2 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 3 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 4 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 5 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 6 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 7 }, + { INPUT_CFG_METHOD | INPUT_CFG_VLAN, INPUT_METHOD_TS_VLAN_BCAST, + NULL, NULL, NULL, 0, 8 } +}; /******************************************************************************* * intf_Create: prepare interface before main loop @@ -135,10 +170,10 @@ void intf_Destroy( intf_thread_t *p_intf ) /******************************************************************************* * intf_SelectInput: change input stream ******************************************************************************* - * Kill existing input, if any, and try to open a new one. If p_cfg is NULL, - * no new input will be openned. + * Kill existing input, if any, and try to open a new one, using an input + * configuration table. *******************************************************************************/ -int intf_SelectInput( intf_thread_t * p_intf, input_cfg_t *p_cfg ) +int intf_SelectInput( intf_thread_t * p_intf, int i_index ) { intf_DbgMsg("0x%x\n", p_intf ); @@ -146,16 +181,18 @@ int intf_SelectInput( intf_thread_t * p_intf, input_cfg_t *p_cfg ) if( p_intf->p_input != NULL ) { input_DestroyThread( p_intf->p_input /*??, NULL*/ ); - p_intf->p_input = NULL; } - - /* Open new one */ - if( p_cfg != NULL ) + + /* Check that input index is valid */ + if( (i_index < 0) || (INTF_MAX_INPUT_CFG < i_index) ) { - p_intf->p_input = input_CreateThread( p_cfg /*??, NULL*/ ); - } + p_intf->p_input = NULL; + return( 1 ); + } - return( (p_cfg != NULL) && (p_intf->p_input == NULL) ); + /* Open a new input */ + p_intf->p_input = input_CreateThread( &INTF_INPUT_CFG[ i_index ] /*??, NULL*/ ); + return( p_intf->p_input == NULL ); } /******************************************************************************* @@ -183,7 +220,10 @@ int intf_ProcessKey( intf_thread_t *p_intf, int i_key ) case '7': case '8': case '9': - // ?? + if( intf_SelectInput( p_intf, i_key - '0' ) ) + { + intf_ErrMsg("error: can not open channel %d\n", i_key - '0'); + } break; case '+': /* volume + */ // ?? diff --git a/src/interface/intf_ctrl.c b/src/interface/intf_ctrl.c index 140064e11f..dcd8e0a025 100644 --- a/src/interface/intf_ctrl.c +++ b/src/interface/intf_ctrl.c @@ -524,11 +524,12 @@ static int SpawnInput( int i_argc, intf_arg_t *p_argv ) cfg.p_aout = p_main->p_aout; /* Create the input thread */ - if( intf_SelectInput( p_main->p_intf, &cfg ) == -1) - { - return( INTF_OTHER_ERROR ); + if( p_main->p_intf->p_input != NULL ) + { + input_DestroyThread( p_main->p_intf->p_input /*??, NULL*/ ); } + p_main->p_intf->p_input = input_CreateThread( &cfg /*??,NULL*/ ); return( INTF_NO_ERROR ); } diff --git a/src/interface/main.c b/src/interface/main.c index fc15df910b..4540b37d77 100644 --- a/src/interface/main.c +++ b/src/interface/main.c @@ -61,7 +61,6 @@ static const struct option longopts[] = { "novideo", 0, 0, OPT_NOVIDEO }, { "grayscale", 0, 0, 'g' }, { "color", 0, 0, OPT_COLOR }, - { "fullscreen", 0, 0, 'f' }, /* VLAN management options */ { "novlans", 0, 0, OPT_NOVLANS }, @@ -70,7 +69,7 @@ static const struct option longopts[] = }; /* Short options */ -static const char *psz_shortopts = "hgf"; +static const char *psz_shortopts = "hg"; /******************************************************************************* * Global variable program_data - this is the one and only, see main.h @@ -351,9 +350,6 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] ) case OPT_COLOR: /* --color */ main_PutIntVariable( VOUT_GRAYSCALE_VAR, 0 ); break; - case 'f': /* -f, --fullscreen */ - main_PutIntVariable( VOUT_FULLSCREEN_VAR, 1 ); - break; /* VLAN management options */ case OPT_NOVLANS: /* --novlans */ @@ -418,6 +414,9 @@ static void Usage( void ) /* Video parameters */ intf_Msg("Video parameters:\n" \ + " " VOUT_DISPLAY_VAR "= display used\n" + " " VOUT_WIDTH_VAR "= display width\n" + " " VOUT_HEIGHT_VAR "= dislay height\n" " " VOUT_FB_DEV_VAR "= framebuffer device path\n" \ " " VOUT_GRAYSCALE_VAR "={1|0} grayscale or color output\n" \ ); @@ -428,7 +427,7 @@ static void Usage( void ) ); /* Interfaces keys */ - intf_Msg("Interface keys: most interface accept the following commands:\n" \ + intf_Msg("Interface keys: most interfaces accept the following commands:\n" \ " [esc], q quit\n" \ " +, -, m change volume, mute\n" \ " g, G, c change gamma, toggle grayscale\n" \ diff --git a/src/video_output/video_ggi.c b/src/video_output/video_ggi.c index c549ecb056..45f2f56d97 100644 --- a/src/video_output/video_ggi.c +++ b/src/video_output/video_ggi.c @@ -45,7 +45,7 @@ typedef struct vout_sys_s /******************************************************************************* * Local prototypes *******************************************************************************/ -static int GGIOpenDisplay ( vout_thread_t *p_vout ); +static int GGIOpenDisplay ( vout_thread_t *p_vout, char *psz_display ); static void GGICloseDisplay ( vout_thread_t *p_vout ); /******************************************************************************* @@ -55,7 +55,7 @@ static void GGICloseDisplay ( vout_thread_t *p_vout ); * vout properties to choose the correct mode, and change them according to the * mode actually used. *******************************************************************************/ -int vout_SysCreate( vout_thread_t *p_vout ) +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 ) ); @@ -66,7 +66,7 @@ int vout_SysCreate( vout_thread_t *p_vout ) } /* Open and initialize device */ - if( GGIOpenDisplay( p_vout ) ) + if( GGIOpenDisplay( p_vout, psz_display ) ) { intf_ErrMsg("error: can't initialize GGI display\n"); free( p_vout->p_sys ); @@ -220,7 +220,7 @@ ggi_visual_t vout_SysGetVisual( vout_thread_t *p_vout ) * Open and initialize display according to preferences specified in the vout * thread fields. *******************************************************************************/ -static int GGIOpenDisplay( vout_thread_t *p_vout ) +static int GGIOpenDisplay( vout_thread_t *p_vout, char *psz_display ) { ggi_mode mode; /* mode descriptor */ ggi_color col_fg; /* foreground color */ @@ -235,7 +235,7 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) } /* Open display */ - p_vout->p_sys->p_display = ggiOpen( NULL ); + p_vout->p_sys->p_display = ggiOpen( psz_display, NULL ); if( p_vout->p_sys->p_display == NULL ) { intf_ErrMsg("error: can't open GGI default display\n"); @@ -333,6 +333,16 @@ static int GGIOpenDisplay( vout_thread_t *p_vout ) return( 1 ); } + /* Set clipping for text */ + if( ggiSetGCClipping(p_vout->p_sys->p_display, 0, 0, + mode.visible.x, mode.visible.y ) ) + { + intf_ErrMsg("error: can't set clipping\n"); + ggiClose( p_vout->p_sys->p_display ); + ggiExit(); + return( 1 ); + } + /* Set thread information */ p_vout->i_width = mode.visible.x; p_vout->i_height = mode.visible.y; diff --git a/src/video_output/video_output.c b/src/video_output/video_output.c index 0fb8afab45..ca28485ad2 100644 --- a/src/video_output/video_output.c +++ b/src/video_output/video_output.c @@ -268,11 +268,12 @@ void vout_DisplayPicture( vout_thread_t *p_vout, picture_t *p_pic ) break; #endif } - vlc_mutex_unlock( &p_vout->picture_lock ); #ifdef DEBUG_VIDEO intf_DbgMsg("picture %p\n", p_pic ); #endif + + vlc_mutex_unlock( &p_vout->picture_lock ); } /******************************************************************************* @@ -300,11 +301,12 @@ void vout_DatePicture( vout_thread_t *p_vout, picture_t *p_pic, mtime_t date ) break; #endif } - vlc_mutex_unlock( &p_vout->picture_lock ); #ifdef DEBUG_VIDEO intf_DbgMsg("picture %p\n", p_pic); #endif + + vlc_mutex_unlock( &p_vout->picture_lock ); } /******************************************************************************* @@ -490,11 +492,12 @@ void vout_LinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) { vlc_mutex_lock( &p_vout->picture_lock ); p_pic->i_refcount++; - vlc_mutex_unlock( &p_vout->picture_lock ); #ifdef DEBUG_VIDEO - intf_DbgMsg("picture %p\n", p_pic); + intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount ); #endif + + vlc_mutex_unlock( &p_vout->picture_lock ); } /******************************************************************************* @@ -519,11 +522,12 @@ void vout_UnlinkPicture( vout_thread_t *p_vout, picture_t *p_pic ) { p_pic->i_status = DESTROYED_PICTURE; } - vlc_mutex_unlock( &p_vout->picture_lock ); #ifdef DEBUG_VIDEO - intf_DbgMsg("picture %p\n", p_pic); + intf_DbgMsg("picture %p refcount=%d\n", p_pic, p_pic->i_refcount ); #endif + + vlc_mutex_unlock( &p_vout->picture_lock ); } /* following functions are local */ @@ -635,10 +639,10 @@ static void RunThread( vout_thread_t *p_vout) * go to next picture */ vlc_mutex_lock( &p_vout->picture_lock ); p_pic->i_status = p_pic->i_refcount ? DISPLAYED_PICTURE : DESTROYED_PICTURE; - vlc_mutex_unlock( &p_vout->picture_lock ); #ifdef DEBUG_VIDEO - intf_DbgMsg( "warning: late picture %p skipped\n", p_pic ); + intf_DbgMsg( "warning: late picture %p skipped refcount=%d\n", p_pic, p_pic->i_refcount ); #endif + vlc_mutex_unlock( &p_vout->picture_lock ); p_pic = NULL; } else if( pic_date > current_date + VOUT_DISPLAY_DELAY ) @@ -800,15 +804,15 @@ static void EndThread( vout_thread_t *p_vout ) static void RenderBlank( vout_thread_t *p_vout ) { //?? toooooo slow - int i_index; /* current 32 bits sample */ - int i_width; /* number of 32 bits samples */ - u32 *p_pic; /* pointer to 32 bits samples */ + int i_index; /* current 64 bits sample */ + int i_width; /* number of 64 bits samples */ + u64 *p_pic; /* pointer to 64 bits samples */ /* Initialize variables */ p_pic = vout_SysGetPicture( p_vout ); - i_width = p_vout->i_bytes_per_line * p_vout->i_height / 128; + i_width = p_vout->i_bytes_per_line * p_vout->i_height / 256; - /* Clear beginning of screen by 128 bytes blocks */ + /* Clear beginning of screen by 256 bytes blocks */ for( i_index = 0; i_index < i_width; i_index++ ) { *p_pic++ = 0; *p_pic++ = 0; diff --git a/src/video_output/video_yuv.c b/src/video_output/video_yuv.c index fdfb8e013a..fd57966518 100644 --- a/src/video_output/video_yuv.c +++ b/src/video_output/video_yuv.c @@ -810,7 +810,7 @@ static void ConvertYUV444RGB32( p_vout_thread_t p_vout, u32 *p_pic, CONVERT_YUV_RGB( 444 ) } -//-------------------- walken code follow -------------------------------- +//-------------------- walken code follow --------------------------------------- /* * YUV to RGB routines. -- 2.39.2