Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
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-1.1
Commits
7b5e02f6
Commit
7b5e02f6
authored
May 29, 2004
by
Yoann Peronneau
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a Mute OSD icon.
parent
dd57adf9
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
121 additions
and
55 deletions
+121
-55
include/osd.h
include/osd.h
+5
-0
modules/control/hotkeys.c
modules/control/hotkeys.c
+35
-23
src/video_output/video_widgets.c
src/video_output/video_widgets.c
+81
-32
No files found.
include/osd.h
View file @
7b5e02f6
...
...
@@ -31,8 +31,13 @@
#define OSD_ALIGN_TOP 0x4
#define OSD_ALIGN_BOTTOM 0x8
#define OSD_HOR_SLIDER 1
#define OSD_VERT_SLIDER 2
#define OSD_PLAY_ICON 1
#define OSD_PAUSE_ICON 2
#define OSD_SPEAKER_ICON 3
#define OSD_MUTE_ICON 4
/**
* Text style information.
...
...
modules/control/hotkeys.c
View file @
7b5e02f6
...
...
@@ -244,7 +244,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
i_newvol
*
100
/
AOUT_VOLUME_MAX
,
1
);
i_newvol
*
100
/
AOUT_VOLUME_MAX
,
OSD_VERT_SLIDER
);
}
else
{
...
...
@@ -262,7 +262,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
i_newvol
*
100
/
AOUT_VOLUME_MAX
,
1
);
i_newvol
*
100
/
AOUT_VOLUME_MAX
,
OSD_VERT_SLIDER
);
}
else
{
...
...
@@ -272,6 +272,33 @@ static void Run( intf_thread_t *p_intf )
}
}
else
if
(
i_action
==
ACTIONID_VOL_MUTE
)
{
audio_volume_t
i_newvol
=
-
1
;
aout_VolumeMute
(
p_intf
,
&
i_newvol
);
if
(
p_vout
)
{
if
(
i_newvol
==
0
)
{
vout_OSDMessage
(
p_intf
,
_
(
"Mute"
)
);
vout_OSDIcon
(
VLC_OBJECT
(
p_intf
),
OSD_MUTE_ICON
);
}
else
{
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
i_newvol
*
100
/
AOUT_VOLUME_MAX
,
OSD_VERT_SLIDER
);
}
else
{
vout_OSDMessage
(
p_intf
,
"Vol %d%%"
,
i_newvol
*
100
/
AOUT_VOLUME_MAX
);
}
}
}
}
else
if
(
i_action
==
ACTIONID_SUBDELAY_DOWN
)
{
int
i_delay
;
...
...
@@ -294,20 +321,6 @@ static void Run( intf_thread_t *p_intf )
vout_OSDMessage
(
p_intf
,
"Subtitle delay %i ms"
,
i_delay
*
100
);
}
}
else
if
(
i_action
==
ACTIONID_VOL_MUTE
)
{
audio_volume_t
i_newvol
=
-
1
;
aout_VolumeMute
(
p_intf
,
&
i_newvol
);
if
(
i_newvol
==
0
)
{
vout_OSDMessage
(
p_intf
,
_
(
"Mute"
)
);
}
else
{
vout_OSDMessage
(
p_intf
,
"Vol %d%%"
,
i_newvol
*
100
/
AOUT_VOLUME_MAX
);
}
}
else
if
(
i_action
==
ACTIONID_FULLSCREEN
&&
p_vout
)
{
var_Get
(
p_vout
,
"fullscreen"
,
&
val
);
...
...
@@ -365,7 +378,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
@@ -381,7 +394,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
@@ -398,7 +411,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
@@ -415,7 +428,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
@@ -425,7 +438,6 @@ static void Run( intf_thread_t *p_intf )
}
else
if
(
i_action
==
ACTIONID_JUMP_BACKWARD_5MIN
&&
b_seekable
)
{
vout_OSDMessage
(
p_intf
,
_
(
"Jump -5 minutes"
)
);
val
.
i_time
=
-
300000000
;
var_Set
(
p_input
,
"time-offset"
,
val
);
if
(
p_vout
)
...
...
@@ -433,7 +445,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
@@ -450,7 +462,7 @@ static void Run( intf_thread_t *p_intf )
if
(
!
p_vout
->
p_parent_intf
||
p_vout
->
b_fullscreen
)
{
vout_OSDSlider
(
VLC_OBJECT
(
p_intf
),
GetPosition
(
p_intf
),
0
);
GetPosition
(
p_intf
),
OSD_HOR_SLIDER
);
}
else
{
...
...
src/video_output/video_widgets.c
View file @
7b5e02f6
...
...
@@ -28,8 +28,8 @@
#include <vlc/vout.h>
#include <osd.h>
#define
RECT
_EMPTY 0
#define
RECT
_FILLED 1
#define
STYLE
_EMPTY 0
#define
STYLE
_FILLED 1
/*****************************************************************************
* Local prototypes
...
...
@@ -62,7 +62,7 @@ struct subpicture_sys_t
/*****************************************************************************
* Draws a rectangle at the given position in the subpic.
* It may be filled (fill ==
RECT_FILLED) or empty (fill == RECT
_EMPTY).
* It may be filled (fill ==
STYLE_FILLED) or empty (fill == STYLE
_EMPTY).
*****************************************************************************/
static
void
DrawRect
(
vout_thread_t
*
p_vout
,
subpicture_t
*
p_subpic
,
int
i_x1
,
int
i_y1
,
int
i_x2
,
int
i_y2
,
short
fill
)
...
...
@@ -70,7 +70,7 @@ static void DrawRect( vout_thread_t *p_vout, subpicture_t *p_subpic,
int
x
,
y
;
subpicture_sys_t
*
p_widget
=
p_subpic
->
p_sys
;
if
(
fill
==
RECT
_FILLED
)
if
(
fill
==
STYLE
_FILLED
)
{
for
(
y
=
i_y1
;
y
<=
i_y2
;
y
++
)
{
...
...
@@ -97,7 +97,7 @@ static void DrawRect( vout_thread_t *p_vout, subpicture_t *p_subpic,
/*****************************************************************************
* Draws a triangle at the given position in the subpic.
* It may be filled (fill ==
RECT_FILLED) or empty (fill == RECT
_EMPTY).
* It may be filled (fill ==
STYLE_FILLED) or empty (fill == STYLE
_EMPTY).
*****************************************************************************/
static
void
DrawTriangle
(
vout_thread_t
*
p_vout
,
subpicture_t
*
p_subpic
,
int
i_x1
,
int
i_y1
,
int
i_x2
,
int
i_y2
,
short
fill
)
...
...
@@ -107,27 +107,56 @@ static void DrawTriangle( vout_thread_t *p_vout, subpicture_t *p_subpic,
i_mid
=
i_y1
+
(
(
i_y2
-
i_y1
)
>>
1
);
if
(
fill
==
RECT_FILLED
)
if
(
i_x2
>=
i_x1
)
{
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
if
(
fill
==
STYLE_FILLED
)
{
h
=
y
-
i_y1
;
for
(
x
=
i_x1
;
x
<=
i_x1
+
h
&&
x
<=
i_x2
;
x
++
)
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
{
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
h
=
y
-
i_y1
;
for
(
x
=
i_x1
;
x
<=
i_x1
+
h
&&
x
<=
i_x2
;
x
++
)
{
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
}
}
}
else
{
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
{
h
=
y
-
i_y1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
h
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
h
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
}
}
}
else
{
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
if
(
fill
==
STYLE_FILLED
)
{
h
=
y
-
i_y1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
h
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
h
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
{
h
=
y
-
i_y1
;
for
(
x
=
i_x1
;
x
>=
i_x1
-
h
&&
x
>=
i_x2
;
x
--
)
{
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
x
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
}
}
}
else
{
for
(
y
=
i_y1
;
y
<=
i_mid
;
y
++
)
{
h
=
y
-
i_y1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
-
h
+
p_widget
->
i_width
*
y
]
=
1
;
p_widget
->
p_pic
[
i_x1
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
p_widget
->
p_pic
[
i_x1
-
h
+
p_widget
->
i_width
*
(
i_y2
-
h
)
]
=
1
;
}
}
}
}
...
...
@@ -378,7 +407,7 @@ subpicture_t *vout_CreateWidget( vout_thread_t *p_vout )
/*****************************************************************************
* Displays an OSD slider.
* Type
0 is position slider-like, and type 1 is volume slider-like
.
* Type
s are: OSD_HOR_SLIDER and OSD_VERT_SLIDER
.
*****************************************************************************/
void
vout_OSDSlider
(
vlc_object_t
*
p_caller
,
int
i_position
,
short
i_type
)
{
...
...
@@ -402,7 +431,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
i_y_margin
=
p_vout
->
render
.
i_height
/
10
;
i_x_margin
=
i_y_margin
;
if
(
i_type
==
0
)
if
(
i_type
==
OSD_HOR_SLIDER
)
{
p_widget
->
i_width
=
p_vout
->
render
.
i_width
-
2
*
i_x_margin
;
p_widget
->
i_height
=
p_vout
->
render
.
i_height
/
20
;
...
...
@@ -429,27 +458,27 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
}
memset
(
p_widget
->
p_pic
,
0
,
p_widget
->
i_width
*
p_widget
->
i_height
);
if
(
i_type
==
0
)
if
(
i_type
==
OSD_HOR_SLIDER
)
{
int
i_x_pos
=
(
p_widget
->
i_width
-
2
)
*
i_position
/
100
;
int
i_y_pos
=
p_widget
->
i_height
/
2
;
DrawRect
(
p_vout
,
p_subpic
,
i_x_pos
-
1
,
2
,
i_x_pos
+
1
,
p_widget
->
i_height
-
3
,
RECT
_FILLED
);
p_widget
->
i_height
-
3
,
STYLE
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
0
,
0
,
p_widget
->
i_width
-
1
,
p_widget
->
i_height
-
1
,
RECT
_EMPTY
);
p_widget
->
i_height
-
1
,
STYLE
_EMPTY
);
}
else
if
(
i_type
==
1
)
else
if
(
i_type
==
OSD_VERT_SLIDER
)
{
int
i_y_pos
=
p_widget
->
i_height
/
2
;
DrawRect
(
p_vout
,
p_subpic
,
2
,
p_widget
->
i_height
-
(
p_widget
->
i_height
-
2
)
*
i_position
/
100
,
p_widget
->
i_width
-
3
,
p_widget
->
i_height
-
3
,
RECT
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
1
,
i_y_pos
,
1
,
i_y_pos
,
RECT
_FILLED
);
STYLE
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
1
,
i_y_pos
,
1
,
i_y_pos
,
STYLE
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
p_widget
->
i_width
-
2
,
i_y_pos
,
p_widget
->
i_width
-
2
,
i_y_pos
,
RECT
_FILLED
);
p_widget
->
i_width
-
2
,
i_y_pos
,
STYLE
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
0
,
0
,
p_widget
->
i_width
-
1
,
p_widget
->
i_height
-
1
,
RECT
_EMPTY
);
p_widget
->
i_height
-
1
,
STYLE
_EMPTY
);
}
vlc_mutex_lock
(
&
p_vout
->
change_lock
);
...
...
@@ -469,7 +498,7 @@ void vout_OSDSlider( vlc_object_t *p_caller, int i_position, short i_type )
/*****************************************************************************
* Displays an OSD icon.
* Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON
* Types are: OSD_PLAY_ICON, OSD_PAUSE_ICON
, OSD_SPEAKER_ICON, OSD_MUTE_ICON
*****************************************************************************/
void
vout_OSDIcon
(
vlc_object_t
*
p_caller
,
short
i_type
)
{
...
...
@@ -493,7 +522,7 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
i_y_margin
=
p_vout
->
render
.
i_height
/
15
;
i_x_margin
=
i_y_margin
;
p_widget
->
i_width
=
p_vout
->
render
.
i_width
/
2
2
;
p_widget
->
i_width
=
p_vout
->
render
.
i_width
/
2
0
;
p_widget
->
i_height
=
p_widget
->
i_width
;
p_widget
->
i_x
=
p_vout
->
render
.
i_width
-
i_x_margin
-
p_widget
->
i_width
;
...
...
@@ -513,9 +542,9 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
{
int
i_bar_width
=
p_widget
->
i_width
/
3
;
DrawRect
(
p_vout
,
p_subpic
,
0
,
0
,
i_bar_width
-
1
,
p_widget
->
i_height
-
1
,
RECT
_FILLED
);
p_widget
->
i_height
-
1
,
STYLE
_FILLED
);
DrawRect
(
p_vout
,
p_subpic
,
p_widget
->
i_width
-
i_bar_width
,
0
,
p_widget
->
i_width
-
1
,
p_widget
->
i_height
-
1
,
RECT
_FILLED
);
p_widget
->
i_width
-
1
,
p_widget
->
i_height
-
1
,
STYLE
_FILLED
);
}
else
if
(
i_type
==
OSD_PLAY_ICON
)
{
...
...
@@ -523,7 +552,27 @@ void vout_OSDIcon( vlc_object_t *p_caller, short i_type )
int
i_delta
=
(
p_widget
->
i_width
-
i_mid
)
>>
1
;
int
i_y2
=
(
(
p_widget
->
i_height
-
1
)
>>
1
)
*
2
;
DrawTriangle
(
p_vout
,
p_subpic
,
i_delta
,
0
,
p_widget
->
i_width
-
i_delta
,
i_y2
,
RECT_FILLED
);
p_widget
->
i_width
-
i_delta
,
i_y2
,
STYLE_FILLED
);
}
else
if
(
i_type
==
OSD_SPEAKER_ICON
||
i_type
==
OSD_MUTE_ICON
)
{
int
i_mid
=
p_widget
->
i_height
>>
1
;
int
i_delta
=
(
p_widget
->
i_width
-
i_mid
)
>>
1
;
int
i_y2
=
(
(
p_widget
->
i_height
-
1
)
>>
1
)
*
2
;
DrawRect
(
p_vout
,
p_subpic
,
i_delta
,
i_mid
/
2
,
p_widget
->
i_width
-
i_delta
,
p_widget
->
i_height
-
1
-
i_mid
/
2
,
STYLE_FILLED
);
DrawTriangle
(
p_vout
,
p_subpic
,
p_widget
->
i_width
-
i_delta
,
0
,
i_delta
,
i_y2
,
STYLE_FILLED
);
if
(
i_type
==
OSD_MUTE_ICON
)
{
int
i
;
for
(
i
=
1
;
i
<
p_widget
->
i_width
;
i
++
)
{
int
k
=
i
+
(
p_widget
->
i_height
-
i
-
1
)
*
p_widget
->
i_width
;
p_widget
->
p_pic
[
k
]
=
1
-
p_widget
->
p_pic
[
k
];
}
}
}
vlc_mutex_lock
(
&
p_vout
->
change_lock
);
...
...
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