Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
27e0b63d
Commit
27e0b63d
authored
Jan 19, 2000
by
Vincent Seguin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nettoyage.
parent
6dcda4bb
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
348 additions
and
111 deletions
+348
-111
include/config.h
include/config.h
+7
-2
include/interface.h
include/interface.h
+1
-0
include/video_output.h
include/video_output.h
+7
-9
include/video_sys.h
include/video_sys.h
+1
-5
src/interface/interface.c
src/interface/interface.c
+135
-0
src/interface/main.c
src/interface/main.c
+5
-5
src/video_output/video_output.c
src/video_output/video_output.c
+172
-76
src/video_output/video_x11.c
src/video_output/video_x11.c
+17
-6
src/video_output/video_yuv.c
src/video_output/video_yuv.c
+3
-8
No files found.
include/config.h
View file @
27e0b63d
...
...
@@ -119,10 +119,15 @@
/* Base delay in micro second for interface sleeps */
#define INTF_IDLE_SLEEP 100000
/*
Factor
for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_
FACTOR
.1
/*
Step
for changing gamma, and minimum and maximum values */
#define INTF_GAMMA_
STEP
.1
#define INTF_GAMMA_MAX 3
/* Factor for changing aspect ratio, and minimum and maximum values */
#define INTF_RATIO_FACTOR 1.1
#define INTF_RATIO_MIN .1
#define INTF_RATIO_MAX 10
/*
* X11 settings
*/
...
...
include/interface.h
View file @
27e0b63d
...
...
@@ -47,4 +47,5 @@ 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_ProcessKey
(
intf_thread_t
*
p_intf
,
int
i_key
);
include/video_output.h
View file @
27e0b63d
...
...
@@ -87,6 +87,7 @@ typedef struct vout_thread_s
vlc_thread_t
thread_id
;
/* id for pthread functions */
vlc_mutex_t
picture_lock
;
/* picture heap lock */
vlc_mutex_t
subtitle_lock
;
/* subtitle heap lock */
vlc_mutex_t
change_lock
;
/* thread change lock */
int
*
pi_status
;
/* temporary status flag */
p_vout_sys_t
p_sys
;
/* system output method */
...
...
@@ -105,15 +106,15 @@ typedef struct vout_thread_s
#ifdef STATS
/* Statistics - these numbers are not supposed to be accurate, but are a
* good indication of the thread status */
mtime_t
loop_time
;
/* last picture loop
time */
count_t
c_fps_samples
;
/* picture counts */
mtime_t
render_time
;
/* last picture render
time */
count_t
c_fps_samples
;
/* picture counts */
mtime_t
fps_sample
[
VOUT_FPS_SAMPLES
];
/* FPS samples dates */
#endif
/* Running properties */
u16
i_changes
;
/* changes made to the thread */
mtime_t
last_picture_date
;
/* last picture display date */
mtime_t
last_
idle_date
;
/* last idle screen display
date */
mtime_t
last_
display_date
;
/* last screen display
date */
/* Videos heap and translation tables */
picture_t
p_picture
[
VOUT_MAX_PICTURES
];
/* pictures */
...
...
@@ -133,16 +134,13 @@ typedef struct vout_thread_s
#define VOUT_DEPTH_CHANGE 0x0008
/* depth changed */
#define VOUT_RATIO_CHANGE 0x0010
/* display ratio changed */
#define VOUT_GAMMA_CHANGE 0x0020
/* gamma changed */
#define VOUT_NODISPLAY_CHANGE 0xffdc
/* changes which forbiden the display */
/*******************************************************************************
* Prototypes
*******************************************************************************/
vout_thread_t
*
vout_CreateThread
(
#ifdef VIDEO_X11
char
*
psz_display
,
Window
root_window
,
#endif
int
i_width
,
int
i_height
,
int
*
pi_status
);
vout_thread_t
*
vout_CreateThread
(
char
*
psz_display
,
int
i_root_window
,
int
i_width
,
int
i_height
,
int
*
pi_status
);
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
);
...
...
include/video_sys.h
View file @
27e0b63d
...
...
@@ -6,11 +6,7 @@
/*******************************************************************************
* Prototypes
*******************************************************************************/
int
vout_SysCreate
(
p_vout_thread_t
p_vout
#ifdef VIDEO_X11
,
char
*
psz_display
,
Window
root_window
#endif
);
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
);
...
...
src/interface/interface.c
View file @
27e0b63d
...
...
@@ -26,6 +26,8 @@
#include "intf_cmd.h"
#include "intf_console.h"
#include "main.h"
#include "video.h"
#include "video_output.h"
#include "intf_sys.h"
...
...
@@ -96,6 +98,19 @@ void intf_Run( intf_thread_t *p_intf )
/* Manage specific interface */
intf_SysManage
(
p_intf
);
/* Check attached threads status */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
p_intf
->
p_vout
->
b_error
)
{
//?? add aout error detection
p_intf
->
b_die
=
1
;
}
if
(
(
p_intf
->
p_input
!=
NULL
)
&&
p_intf
->
p_input
->
b_error
)
{
input_DestroyThread
(
p_intf
->
p_input
/*, NULL */
);
p_intf
->
p_input
=
NULL
;
intf_DbgMsg
(
"Input thread destroyed
\n
"
);
}
/* Sleep to avoid using all CPU - since some interfaces needs to access
* keyboard events, a 100ms delay is a good compromise */
msleep
(
INTF_IDLE_SLEEP
);
...
...
@@ -143,4 +158,124 @@ int intf_SelectInput( intf_thread_t * p_intf, input_cfg_t *p_cfg )
return
(
(
p_cfg
!=
NULL
)
&&
(
p_intf
->
p_input
==
NULL
)
);
}
/*******************************************************************************
* intf_ProcessKey: process standard keys
*******************************************************************************
* This function will process standard keys and return non 0 if the key was
* unknown.
*******************************************************************************/
int
intf_ProcessKey
(
intf_thread_t
*
p_intf
,
int
i_key
)
{
switch
(
i_key
)
{
case
'Q'
:
/* quit order */
case
'q'
:
case
27
:
p_intf
->
b_die
=
1
;
break
;
case
'0'
:
/* source change */
case
'1'
:
case
'2'
:
case
'3'
:
case
'4'
:
case
'5'
:
case
'6'
:
case
'7'
:
case
'8'
:
case
'9'
:
// ??
break
;
case
'+'
:
/* volume + */
// ??
break
;
case
'-'
:
/* volume - */
// ??
break
;
case
'M'
:
/* toggle mute */
case
'm'
:
// ??
break
;
case
'g'
:
/* gamma - */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_gamma
>
-
INTF_GAMMA_MAX
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_gamma
-=
INTF_GAMMA_STEP
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_GAMMA_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'G'
:
/* gamma + */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_gamma
<
INTF_GAMMA_MAX
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_gamma
+=
INTF_GAMMA_STEP
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_GAMMA_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'c'
:
/* toggle grayscale */
if
(
p_intf
->
p_vout
!=
NULL
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
b_grayscale
=
!
p_intf
->
p_vout
->
b_grayscale
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_GRAYSCALE_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'x'
:
/* horizontal aspect ratio - */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_x_ratio
>
INTF_RATIO_MIN
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_x_ratio
/=
INTF_RATIO_FACTOR
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_RATIO_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'X'
:
/* horizontal aspect ratio + */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_x_ratio
<
INTF_RATIO_MAX
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_x_ratio
*=
INTF_RATIO_FACTOR
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_RATIO_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'y'
:
/* vertical aspect ratio - */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_y_ratio
>
INTF_RATIO_MIN
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_y_ratio
/=
INTF_RATIO_FACTOR
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_RATIO_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'Y'
:
/* horizontal aspect ratio + */
if
(
(
p_intf
->
p_vout
!=
NULL
)
&&
(
p_intf
->
p_vout
->
f_y_ratio
<
INTF_RATIO_MAX
)
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
f_y_ratio
*=
INTF_RATIO_FACTOR
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_RATIO_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
case
'f'
:
/* toggle fullscreen */
//??
break
;
case
' '
:
/* toggle info */
if
(
p_intf
->
p_vout
!=
NULL
)
{
vlc_mutex_lock
(
&
p_intf
->
p_vout
->
change_lock
);
p_intf
->
p_vout
->
b_info
=
!
p_intf
->
p_vout
->
b_info
;
p_intf
->
p_vout
->
i_changes
|=
VOUT_INFO_CHANGE
;
vlc_mutex_unlock
(
&
p_intf
->
p_vout
->
change_lock
);
}
break
;
default:
/* unknown key */
return
(
1
);
}
return
(
0
);
}
src/interface/main.c
View file @
27e0b63d
...
...
@@ -380,7 +380,8 @@ static int GetConfiguration( int i_argc, char *ppsz_argv[], char *ppsz_env[] )
*******************************************************************************/
static
void
Usage
(
void
)
{
intf_Msg
(
COPYRIGHT_MESSAGE
);
intf_Msg
(
COPYRIGHT_MESSAGE
"
\n
"
);
/* Usage */
intf_Msg
(
"usage: vlc [options...] [parameters]
\n
"
\
" parameters can be passed using environment variables
\n
"
\
...
...
@@ -425,12 +426,11 @@ static void Usage( void )
/* Interfaces keys */
intf_Msg
(
"Interface keys: most interface accept the following commands:
\n
"
\
" [esc], q quit
\n
"
\
" +, -
change volum
e
\n
"
\
"
m mut
e
\n
"
\
"
f fullscreen
\n
"
\
" +, -
, m change volume, mut
e
\n
"
\
"
g, G, c change gamma, toggle grayscal
e
\n
"
\
"
x, X, y, Y, f change aspect ratio, toggle fullscreen
\n
"
\
" 0 - 9 select channel
\n
"
\
" [space] toggle info printing
\n
"
\
" g, G change gamma
\n
"
\
);
}
...
...
src/video_output/video_output.c
View file @
27e0b63d
This diff is collapsed.
Click to expand it.
src/video_output/video_x11.c
View file @
27e0b63d
...
...
@@ -82,7 +82,7 @@ static void X11DestroyShmImage ( vout_thread_t *p_vout, XImage *p_ximage,
* vout properties to choose the window size, and change them according to the
* actual properties of the display.
*******************************************************************************/
int
vout_SysCreate
(
vout_thread_t
*
p_vout
,
char
*
psz_display
,
Window
root_window
)
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
)
);
...
...
@@ -96,7 +96,7 @@ int vout_SysCreate( vout_thread_t *p_vout, char *psz_display, Window root_window
* Since XLib is usually not thread-safe, we can't use the same display
* pointer than the interface or another thread. However, the root window
* id is still valid. */
if
(
X11OpenDisplay
(
p_vout
,
psz_display
,
root_window
)
)
if
(
X11OpenDisplay
(
p_vout
,
psz_display
,
i_
root_window
)
)
{
intf_ErrMsg
(
"error: can't initialize X11 display
\n
"
);
free
(
p_vout
->
p_sys
);
...
...
@@ -259,7 +259,7 @@ void vout_SysDisplay( vout_thread_t *p_vout )
p_vout
->
p_sys
->
p_ximage
[
p_vout
->
p_sys
->
i_buffer_index
]
->
height
);
/* Send the order to the X server */
XFlush
(
p_vout
->
p_sys
->
p_display
);
/* ?? not needed ? */
XFlush
(
p_vout
->
p_sys
->
p_display
);
}
/* Swap buffers */
...
...
@@ -291,17 +291,19 @@ void vout_SysPrint( vout_thread_t *p_vout, int i_x, int i_y, int i_halign,
int
i_byte
;
/* byte offset in character line */
int
i_height
;
/* character height */
int
i_char_bytes_per_line
;
/* total bytes per line */
int
i_text_width
;
/* total text width */
byte_t
*
pi_pic
;
/* picture data */
byte_t
*
pi_char
;
/* character data */
/* Update upper left coordinates according to alignment */
i_text_width
=
p_vout
->
p_sys
->
i_char_interspacing
*
strlen
(
psz_text
);
switch
(
i_halign
)
{
case
0
:
/* centered */
i_x
-=
p_vout
->
p_sys
->
i_char_interspacing
*
strlen
(
psz_text
)
/
2
;
i_x
-=
i_text_width
/
2
;
break
;
case
1
:
/* right aligned */
i_x
-=
p_vout
->
p_sys
->
i_char_interspacing
*
strlen
(
psz_text
)
;
i_x
-=
i_text_width
;
break
;
}
switch
(
i_valign
)
...
...
@@ -318,11 +320,20 @@ void vout_SysPrint( vout_thread_t *p_vout, int i_x, int i_y, int i_halign,
i_height
=
p_vout
->
p_sys
->
i_char_height
;
i_char_bytes_per_line
=
p_vout
->
p_sys
->
i_char_bytes_per_line
;
/* Check that the text is in the screen vertically and horizontally */
if
(
(
i_y
<
0
)
||
(
i_y
+
i_height
>
p_vout
->
i_height
)
||
(
i_x
<
0
)
||
(
i_x
+
i_text_width
>
p_vout
->
i_width
)
)
{
intf_DbgMsg
(
"text '%s' would print outside the screen
\n
"
,
psz_text
);
return
;
}
/* Print text */
for
(
;
*
psz_text
!=
'\0'
;
psz_text
++
)
{
/* Check that the character is valid and in the screen horizontally */
if
(
(
*
psz_text
>=
VOUT_MIN_CHAR
)
&&
(
*
psz_text
<
VOUT_MAX_CHAR
)
)
{
{
/* Select character */
pi_char
=
p_vout
->
p_sys
->
pi_font
+
(
*
psz_text
-
VOUT_MIN_CHAR
)
*
i_height
*
i_char_bytes_per_line
;
...
...
src/video_output/video_yuv.c
View file @
27e0b63d
...
...
@@ -15,10 +15,6 @@
#include <string.h>
#include <stdlib.h>
#ifdef VIDEO_X11
#include <X11/Xlib.h>
/* for video_sys.h in X11 mode */
#endif
#include "common.h"
#include "config.h"
#include "mtime.h"
...
...
@@ -319,9 +315,8 @@ int vout_InitTables( vout_thread_t *p_vout )
*******************************************************************************/
int
vout_ResetTables
(
vout_thread_t
*
p_vout
)
{
// ?? realloc if b_grayscale or i_screen_depth changed
SetTables
(
p_vout
);
return
(
0
);
vout_EndTables
(
p_vout
);
return
(
vout_InitTables
(
p_vout
)
);
}
/*******************************************************************************
...
...
@@ -413,7 +408,7 @@ static void SetTables( vout_thread_t *p_vout )
*/
for
(
i_index
=
0
;
i_index
<
256
;
i_index
++
)
{
i_gamma
[
i_index
]
=
255
.
*
exp
(
(
double
)
i_index
*
p_vout
->
f_gamma
/
255
.
);
i_gamma
[
i_index
]
=
255
.
*
pow
(
(
double
)
i_index
/
255
.,
exp
(
p_vout
->
f_gamma
)
);
}
/*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment