Commit f71c76a9 authored by Pierre Baillet's avatar Pierre Baillet

. Added a 'f' shortcut to the SDL output (fullscreen/windowed)

. Modified the Idle screen of the vlc (seems to suck a lot of CPU anyway :/)
. Prayed for a good indentation ;).
parent 534979f9
* Added a 'f' shortcut to switch between Windowed and Fullscreened
mode.
Mon, 28 Aug 2000 02:34:18 +0200 Mon, 28 Aug 2000 02:34:18 +0200
O.1.99i : O.1.99i :
......
...@@ -7,6 +7,14 @@ ...@@ -7,6 +7,14 @@
# #
# Urgency values: Wishlist, Normal, Important, Critical # Urgency values: Wishlist, Normal, Important, Critical
Task: 0x39
Difficulty: Medium
Urgency: Wishlist
Description: Rewrite the font display routines
The current font display routines aren't powerful enough. There
should be a way to display a big String at once, without needing
to compute the size of the string and its coordinates beforehand.
Task: 0x38 Task: 0x38
Difficulty: Medium Difficulty: Medium
Urgency: Important Urgency: Important
...@@ -28,9 +36,18 @@ Status: Done 27 Aug 2000 (Meuuh) ...@@ -28,9 +36,18 @@ Status: Done 27 Aug 2000 (Meuuh)
Task: 0x36 Task: 0x36
Difficulty: Medium Difficulty: Medium
Urgency: Normal Urgency: Normal
Description: Finish the new keyboard input interface to support Description:
interfaces that allow modifiers. This will allow the SDL to run . Finish the new keyboard input interface to support
properly. interfaces that allow modifiers. This will allow the SDL to run
properly.
. Here are some details:
Allow any interface to have its own set of keys:
- allow the 'discovery' of the main interface of the binding
created by each interface:
what key ("control-C", what action (INTF...))
- extend the interface by a specific struct (meta+modifier+ascii)
- implement an interface specific getKey function.
Status: Todo Status: Todo
Task: 0x35 Task: 0x35
......
...@@ -42,6 +42,7 @@ ...@@ -42,6 +42,7 @@
#include "video.h" #include "video.h"
#include "video_output.h" #include "video_output.h"
#include "interface.h" #include "interface.h"
#include "intf_msg.h" #include "intf_msg.h"
#include "keystrokes.h" #include "keystrokes.h"
...@@ -54,13 +55,23 @@ ...@@ -54,13 +55,23 @@
typedef struct intf_sys_s typedef struct intf_sys_s
{ {
/* SDL system information */ /* SDL system information */
SDL_Surface * p_display; /* display */ SDL_Surface * p_display;
int isFullscreen;
} intf_sys_t; } intf_sys_t;
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;
/* local prototype */ /* local prototype */
void intf_SDL_Keymap( intf_thread_t * p_intf ); void intf_SDL_Keymap( intf_thread_t * p_intf );
void intf_SDL_Fullscreen(intf_thread_t * p_intf);
/***************************************************************************** /*****************************************************************************
* intf_SDLCreate: initialize and create SDL interface * intf_SDLCreate: initialize and create SDL interface
...@@ -137,32 +148,103 @@ void intf_SDLManage( intf_thread_t *p_intf ) ...@@ -137,32 +148,103 @@ void intf_SDLManage( intf_thread_t *p_intf )
while ( SDL_PollEvent(&event) ) while ( SDL_PollEvent(&event) )
{ {
i_key = event.key.keysym.sym; /* forward it */ i_key = event.key.keysym.sym; /* forward it */
switch (event.type) { switch (event.type) {
case SDL_KEYDOWN: /* if a key is pressed */ case SDL_KEYDOWN: /* if a key is pressed */
if( intf_ProcessKey( p_intf, (char ) i_key ) ) switch(i_key) {
{ /* switch to fullscreen */
intf_DbgMsg( "unhandled key '%c' (%i)\n", case SDLK_f:
(char) i_key, i_key ); intf_SDL_Fullscreen(p_intf);
break;
default :
if( intf_ProcessKey( p_intf, (char ) i_key ) )
{
intf_DbgMsg( "unhandled key '%c' (%i)\n",
(char) i_key, i_key );
}
break;
} }
break; break;
case SDL_QUIT: case SDL_QUIT:
intf_ProcessKey( p_intf, INTF_KEY_QUIT ); intf_ProcessKey( p_intf, INTF_KEY_QUIT );
break; break;
default: default:
break; break;
} }
} }
} }
void intf_SDL_Fullscreen(intf_thread_t * p_intf)
{
SDL_FreeSurface( p_intf->p_vout->p_sys->p_display );
if(p_intf->p_sys->isFullscreen == 1)
{
p_intf->p_vout->p_sys->p_display =
SDL_SetVideoMode(
p_intf->p_vout->i_width,
p_intf->p_vout->i_height,
15,
SDL_ANYFORMAT |
SDL_HWSURFACE |
SDL_DOUBLEBUF);
p_intf->p_sys->isFullscreen = 0;
}
else
{
p_intf->p_vout->p_sys->p_display =
SDL_SetVideoMode(
p_intf->p_vout->i_width,
p_intf->p_vout->i_height,
15,
SDL_ANYFORMAT |
SDL_HWSURFACE |
SDL_DOUBLEBUF |
SDL_FULLSCREEN );
p_intf->p_sys->isFullscreen = 1;
}
SDL_EventState(SDL_KEYUP , SDL_IGNORE);
p_intf->p_vout->p_sys->p_buffer[ 0 ] = p_intf->p_vout->p_sys->p_display->pixels;
SDL_Flip(p_intf->p_vout->p_sys->p_display);
p_intf->p_vout->p_sys->p_buffer[ 1 ] = p_intf->p_vout->p_sys->p_display->pixels;
SDL_Flip(p_intf->p_vout->p_sys->p_display);
SDL_SetClipping(p_intf->p_vout->p_sys->p_display, 0, 0,
p_intf->p_vout->p_sys->p_display->w,
p_intf->p_vout->p_sys->p_display->h );
p_intf->p_vout->i_width = p_intf->p_vout->p_sys->p_display->w;
p_intf->p_vout->i_height = p_intf->p_vout->p_sys->p_display->h;
p_intf->p_vout->i_bytes_per_line =
p_intf->p_vout->p_sys->p_display->format->BytesPerPixel
*
p_intf->p_vout->p_sys->p_display->w ;
p_intf->p_vout->i_screen_depth =
p_intf->p_vout->p_sys->p_display->format->BitsPerPixel;
p_intf->p_vout->i_bytes_per_pixel =
p_intf->p_vout->p_sys->p_display->format->BytesPerPixel;
p_intf->p_vout->i_red_mask =
p_intf->p_vout->p_sys->p_display->format->Rmask;
p_intf->p_vout->i_green_mask =
p_intf->p_vout->p_sys->p_display->format->Gmask;
p_intf->p_vout->i_blue_mask =
p_intf->p_vout->p_sys->p_display->format->Bmask;
}
void intf_SDL_Keymap(intf_thread_t * p_intf ) void intf_SDL_Keymap(intf_thread_t * p_intf )
{ {
p_intf->p_intf_get_key = intf_GetKey; //p_intf->p_intf_getKey = intf_getKey;
intf_AssignKey(p_intf, SDLK_q, INTF_KEY_QUIT, NULL); intf_AssignKey(p_intf, SDLK_q, INTF_KEY_QUIT, 0);
intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, NULL); intf_AssignKey(p_intf, SDLK_ESCAPE, INTF_KEY_QUIT, 0);
/* intf_AssignKey(p_intf,3,'Q'); */ /* intf_AssignKey(p_intf,3,'Q'); */
intf_AssignKey(p_intf, SDLK_0, INTF_KEY_SET_CHANNEL,0); intf_AssignKey(p_intf, SDLK_0, INTF_KEY_SET_CHANNEL,0);
intf_AssignKey(p_intf, SDLK_1, INTF_KEY_SET_CHANNEL,1); intf_AssignKey(p_intf, SDLK_1, INTF_KEY_SET_CHANNEL,1);
...@@ -174,16 +256,16 @@ void intf_SDL_Keymap(intf_thread_t * p_intf ) ...@@ -174,16 +256,16 @@ void intf_SDL_Keymap(intf_thread_t * p_intf )
intf_AssignKey(p_intf, SDLK_7, INTF_KEY_SET_CHANNEL,7); intf_AssignKey(p_intf, SDLK_7, INTF_KEY_SET_CHANNEL,7);
intf_AssignKey(p_intf, SDLK_8, INTF_KEY_SET_CHANNEL,8); intf_AssignKey(p_intf, SDLK_8, INTF_KEY_SET_CHANNEL,8);
intf_AssignKey(p_intf, SDLK_9, INTF_KEY_SET_CHANNEL,9); intf_AssignKey(p_intf, SDLK_9, INTF_KEY_SET_CHANNEL,9);
intf_AssignKey(p_intf, SDLK_PLUS, INTF_KEY_INC_VOLUME, NULL); intf_AssignKey(p_intf, SDLK_PLUS, INTF_KEY_INC_VOLUME, 0);
intf_AssignKey(p_intf, SDLK_MINUS, INTF_KEY_DEC_VOLUME, NULL); intf_AssignKey(p_intf, SDLK_MINUS, INTF_KEY_DEC_VOLUME, 0);
intf_AssignKey(p_intf, SDLK_m, INTF_KEY_TOGGLE_VOLUME, NULL); intf_AssignKey(p_intf, SDLK_m, INTF_KEY_TOGGLE_VOLUME, 0);
/* intf_AssignKey(p_intf,'M','M'); */ /* intf_AssignKey(p_intf,'M','M'); */
intf_AssignSKey(p_intf, SDLK_g, INTF_KEY_DEC_GAMMA, NULL); intf_AssignKey(p_intf, SDLK_g, INTF_KEY_DEC_GAMMA, 0);
/* intf_AssignKey(p_intf,'G','G'); */ /* intf_AssignKey(p_intf,'G','G'); */
intf_AssignSKey(p_intf, SDLK_c, INTF_KEY_TOGGLE_GRAYSCALE, NULL); intf_AssignKey(p_intf, SDLK_c, INTF_KEY_TOGGLE_GRAYSCALE, 0);
intf_AssignSKey(p_intf, SDLK_SPACE, INTF_KEY_TOGGLE_INTERFACE, NULL); intf_AssignKey(p_intf, SDLK_SPACE, INTF_KEY_TOGGLE_INTERFACE, 0);
intf_AssignSKey(p_intf, 'i', INTF_KEY_TOGGLE_INFO, NULL); intf_AssignKey(p_intf, 'i', INTF_KEY_TOGGLE_INFO, 0);
intf_AssignSKey(p_intf, SDLK_s, INTF_KEY_TOGGLE_SCALING, NULL); intf_AssignKey(p_intf, SDLK_s, INTF_KEY_TOGGLE_SCALING, 0);
} }
...@@ -161,6 +161,7 @@ void vout_SDLDisplay( vout_thread_t *p_vout ) ...@@ -161,6 +161,7 @@ void vout_SDLDisplay( vout_thread_t *p_vout )
/* Change display frame */ /* Change display frame */
if( p_vout->p_sys->b_must_acquire ) if( p_vout->p_sys->b_must_acquire )
{ {
SDL_Flip( p_vout->p_sys->p_display ); SDL_Flip( p_vout->p_sys->p_display );
} }
/* Swap buffers and change write frame */ /* Swap buffers and change write frame */
...@@ -212,6 +213,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat ...@@ -212,6 +213,7 @@ static int SDLOpenDisplay( vout_thread_t *p_vout, char *psz_display, void *p_dat
p_vout->i_height, p_vout->i_height,
15, 15,
SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN ); SDL_ANYFORMAT | SDL_HWSURFACE | SDL_DOUBLEBUF | SDL_FULLSCREEN );
} else { } else {
p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->i_width, p_vout->p_sys->p_display = SDL_SetVideoMode(p_vout->i_width,
p_vout->i_height, p_vout->i_height,
......
...@@ -930,6 +930,10 @@ static int InitThread( vout_thread_t *p_vout ) ...@@ -930,6 +930,10 @@ static int InitThread( vout_thread_t *p_vout )
/* Mark thread as running and return */ /* Mark thread as running and return */
p_vout->b_active = 1; p_vout->b_active = 1;
*p_vout->pi_status = THREAD_READY; *p_vout->pi_status = THREAD_READY;
/* cheats the clock so that the display come as soon as the thread is run */
p_vout->last_display_date = mdate()-5000000;
intf_DbgMsg("thread ready\n"); intf_DbgMsg("thread ready\n");
return( 0 ); return( 0 );
} }
...@@ -1297,7 +1301,7 @@ void Print( vout_thread_t *p_vout, int i_x, int i_y, int i_h_align, int i_v_alig ...@@ -1297,7 +1301,7 @@ void Print( vout_thread_t *p_vout, int i_x, int i_y, int i_h_align, int i_v_alig
i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel, i_y * p_vout->i_bytes_per_line + i_x * p_vout->i_bytes_per_pixel,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line, p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
p_vout->i_white_pixel, 0, 0, p_vout->i_white_pixel, 0, 0,
0, psz_text ); 0, psz_text, 100 );
} }
} }
...@@ -1743,25 +1747,42 @@ static int RenderIdle( vout_thread_t *p_vout ) ...@@ -1743,25 +1747,42 @@ static int RenderIdle( vout_thread_t *p_vout )
int i_x = 0, i_y = 0; /* text position */ int i_x = 0, i_y = 0; /* text position */
int i_width, i_height; /* text size */ int i_width, i_height; /* text size */
mtime_t current_date; /* current date */ mtime_t current_date; /* current date */
const char *psz_text = "waiting for stream ..."; /* text to display */ int i_amount = 0; /* amount to draw */
char *psz_text = "Waiting for stream"; /* text to display */
char *psz_wtext = "[................]";
memset( p_vout->p_buffer[ p_vout->i_buffer_index ].p_data,
p_vout->i_bytes_per_line * p_vout->i_height, 12);
current_date = mdate(); current_date = mdate();
if( (current_date - p_vout->last_display_date) > VOUT_IDLE_DELAY && if( (current_date - p_vout->last_display_date) > VOUT_IDLE_DELAY
(current_date - p_vout->last_idle_date) > VOUT_IDLE_DELAY ) // && (current_date - p_vout->last_idle_date) > VOUT_IDLE_DELAY
)
{ {
SetBufferPicture( p_vout, NULL ); SetBufferPicture( p_vout, NULL );
vout_TextSize( p_vout->p_large_font, WIDE_TEXT | OUTLINED_TEXT, psz_text, vout_TextSize( p_vout->p_large_font, WIDE_TEXT | OUTLINED_TEXT, psz_text,
&i_width, &i_height ); &i_width, &i_height );
if( !Align( p_vout, &i_x, &i_y, i_width, i_height, CENTER_RALIGN, CENTER_RALIGN ) ) if( !Align( p_vout, &i_x, &i_y, i_width, i_height, CENTER_RALIGN, CENTER_RALIGN ) )
{ {
i_amount = (int) ((current_date - p_vout->last_display_date- VOUT_IDLE_DELAY) / 5000LL);
vout_Print( p_vout->p_large_font, vout_Print( p_vout->p_large_font,
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data + p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
i_x * p_vout->i_bytes_per_pixel + i_y * p_vout->i_bytes_per_line, i_x * p_vout->i_bytes_per_pixel + i_y * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line, p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
p_vout->i_white_pixel, p_vout->i_gray_pixel, 0, p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
WIDE_TEXT | OUTLINED_TEXT, psz_text ); WIDE_TEXT | OUTLINED_TEXT, psz_text, i_amount );
SetBufferArea( p_vout, i_x, i_y, i_width, i_height );
vout_Print( p_vout->p_large_font,
p_vout->p_buffer[ p_vout->i_buffer_index ].p_data +
i_x * p_vout->i_bytes_per_pixel + (i_y + 16) * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
p_vout->i_white_pixel, p_vout->i_gray_pixel, 0,
WIDE_TEXT | OUTLINED_TEXT, psz_wtext, (i_amount/2)%110 );
SetBufferArea( p_vout, i_x, i_y, i_width, i_height + 16 );
} }
return( 1 ); return( 1 );
} }
...@@ -1862,7 +1883,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic ) ...@@ -1862,7 +1883,7 @@ static void RenderSubPicture( vout_thread_t *p_vout, subpicture_t *p_subpic )
p_subpic->type.text.i_char_color, p_subpic->type.text.i_char_color,
p_subpic->type.text.i_border_color, p_subpic->type.text.i_border_color,
p_subpic->type.text.i_bg_color, p_subpic->type.text.i_bg_color,
p_subpic->type.text.i_style, p_subpic->p_data ); p_subpic->type.text.i_style, p_subpic->p_data, 100 );
SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y, SetBufferArea( p_vout, p_subpic->i_x, p_subpic->i_y,
i_width, i_height ); i_width, i_height );
} }
...@@ -1913,7 +1934,7 @@ static void RenderInterface( vout_thread_t *p_vout ) ...@@ -1913,7 +1934,7 @@ static void RenderInterface( vout_thread_t *p_vout )
(p_vout->i_height - i_height) * p_vout->i_bytes_per_line, (p_vout->i_height - i_height) * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line, p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
p_vout->i_white_pixel, p_vout->i_black_pixel, 0, p_vout->i_white_pixel, p_vout->i_black_pixel, 0,
OUTLINED_TEXT, psz_text_1 ); OUTLINED_TEXT, psz_text_1, 100 );
} }
if( i_width_2 < p_vout->i_width ) if( i_width_2 < p_vout->i_width )
{ {
...@@ -1921,7 +1942,7 @@ static void RenderInterface( vout_thread_t *p_vout ) ...@@ -1921,7 +1942,7 @@ static void RenderInterface( vout_thread_t *p_vout )
(p_vout->i_height - i_height + i_text_height) * p_vout->i_bytes_per_line, (p_vout->i_height - i_height + i_text_height) * p_vout->i_bytes_per_line,
p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line, p_vout->i_bytes_per_pixel, p_vout->i_bytes_per_line,
p_vout->i_white_pixel, p_vout->i_black_pixel, 0, p_vout->i_white_pixel, p_vout->i_black_pixel, 0,
OUTLINED_TEXT, psz_text_2 ); OUTLINED_TEXT, psz_text_2, 100 );
} }
/* Activate modified area */ /* Activate modified area */
......
...@@ -359,7 +359,7 @@ void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int ...@@ -359,7 +359,7 @@ void vout_TextSize( vout_font_t *p_font, int i_style, const char *psz_text, int
* previously loaded bitmap font. * previously loaded bitmap font.
*****************************************************************************/ *****************************************************************************/
void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int i_bytes_per_line, void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int i_bytes_per_line,
u32 i_char_color, u32 i_border_color, u32 i_bg_color, int i_style, const char *psz_text ) u32 i_char_color, u32 i_border_color, u32 i_bg_color, int i_style, const char *psz_text, int i_percent)
{ {
byte_t *p_char, *p_border; /* character and border mask data */ byte_t *p_char, *p_border; /* character and border mask data */
int i_char_mask, i_border_mask, i_bg_mask; /* masks */ int i_char_mask, i_border_mask, i_bg_mask; /* masks */
...@@ -367,6 +367,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -367,6 +367,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
int i_byte; /* current byte in character */ int i_byte; /* current byte in character */
int i_interspacing; /* offset between two chars */ int i_interspacing; /* offset between two chars */
int i_font_bytes_per_line, i_font_height; /* font properties */ int i_font_bytes_per_line, i_font_height; /* font properties */
int i_position, i_end; /* current position */
vout_put_byte_t *p_PutByte; /* PutByte function */ vout_put_byte_t *p_PutByte; /* PutByte function */
/* FIXME: background: can be something else that whole byte ?? */ /* FIXME: background: can be something else that whole byte ?? */
...@@ -400,8 +401,14 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -400,8 +401,14 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
p_font->i_interspacing * 2 : p_font->i_interspacing * 2 :
p_font->i_interspacing); p_font->i_interspacing);
/* compute where to stop... */
i_end = (int) (i_percent * strlen(psz_text) / 100LL);
if(i_end > strlen(psz_text))
i_end = strlen(psz_text);
/* Print text */ /* Print text */
for( ; *psz_text != '\0'; psz_text++ ) for( i_position = 0; i_position < i_end; i_position++ ,psz_text++ )
{ {
/* Check that the character is valid */ /* Check that the character is valid */
if( (*psz_text >= p_font->i_first) && (*psz_text <= p_font->i_last) ) if( (*psz_text >= p_font->i_first) && (*psz_text <= p_font->i_last) )
...@@ -453,6 +460,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int ...@@ -453,6 +460,7 @@ void vout_Print( vout_font_t *p_font, byte_t *p_pic, int i_bytes_per_pixel, int
#endif #endif
} }
} }
} }
} }
......
...@@ -40,7 +40,7 @@ void vout_TextSize ( p_vout_font_t p_font, int i_style, ...@@ -40,7 +40,7 @@ void vout_TextSize ( p_vout_font_t p_font, int i_style,
void vout_Print ( p_vout_font_t p_font, byte_t *p_pic, void vout_Print ( p_vout_font_t p_font, byte_t *p_pic,
int i_bytes_per_pixel, int i_bytes_per_line, int i_bytes_per_pixel, int i_bytes_per_line,
u32 i_char_color, u32 i_border_color, u32 i_bg_color, u32 i_char_color, u32 i_border_color, u32 i_bg_color,
int i_style, const char *psz_text ); int i_style, const char *psz_text, int i_percent );
......
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