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
e87593bb
Commit
e87593bb
authored
Nov 28, 2009
by
Jakob Leben
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
subtitles/hotkeys: hotkey accessible subtitle position adjustment
parent
3bc199ab
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
63 additions
and
1 deletion
+63
-1
include/vlc_keys.h
include/vlc_keys.h
+2
-0
modules/control/hotkeys.c
modules/control/hotkeys.c
+20
-0
src/input/var.c
src/input/var.c
+2
-0
src/libvlc-module.c
src/libvlc-module.c
+14
-0
src/video_output/vout_subpictures.c
src/video_output/vout_subpictures.c
+25
-1
No files found.
include/vlc_keys.h
View file @
e87593bb
...
...
@@ -142,6 +142,8 @@ typedef enum vlc_key {
/* end of contiguous zone */
ACTIONID_SUBDELAY_UP
,
ACTIONID_SUBDELAY_DOWN
,
ACTIONID_SUBPOS_UP
,
ACTIONID_SUBPOS_DOWN
,
ACTIONID_HISTORY_BACK
,
ACTIONID_HISTORY_FORWARD
,
ACTIONID_AUDIO_TRACK
,
...
...
modules/control/hotkeys.c
View file @
e87593bb
...
...
@@ -790,6 +790,26 @@ static int PutAction( intf_thread_t *p_intf, int i_action )
_
(
"Subtitle delay %i ms"
),
(
int
)(
i_delay
/
1000
)
);
}
else
if
(
i_action
==
ACTIONID_SUBPOS_DOWN
)
{
int
i_pos
=
var_GetInteger
(
p_input
,
"sub-margin"
);
--
i_pos
;
var_SetInteger
(
p_input
,
"sub-margin"
,
i_pos
);
ClearChannels
(
p_intf
,
p_vout
);
vout_OSDMessage
(
p_intf
,
DEFAULT_CHAN
,
_
(
"Subtitle position %i px"
),
(
int
)(
i_pos
)
);
}
else
if
(
i_action
==
ACTIONID_SUBPOS_UP
)
{
int
i_pos
=
var_GetInteger
(
p_input
,
"sub-margin"
);
++
i_pos
;
var_SetInteger
(
p_input
,
"sub-margin"
,
i_pos
);
ClearChannels
(
p_intf
,
p_vout
);
vout_OSDMessage
(
p_intf
,
DEFAULT_CHAN
,
_
(
"Subtitle position %i px"
),
(
int
)(
i_pos
)
);
}
else
if
(
i_action
==
ACTIONID_AUDIODELAY_DOWN
)
{
int64_t
i_delay
=
var_GetTime
(
p_input
,
"audio-delay"
);
...
...
src/input/var.c
View file @
e87593bb
...
...
@@ -216,6 +216,8 @@ void input_ControlVarInit ( input_thread_t *p_input )
text
.
psz_string
=
_
(
"Subtitles Track"
);
var_Change
(
p_input
,
"spu-es"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_Create
(
p_input
,
"sub-margin"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
/* Special read only objects variables for intf */
var_Create
(
p_input
,
"bookmarks"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
...
...
src/libvlc-module.c
View file @
e87593bb
...
...
@@ -1359,6 +1359,10 @@ static const char *const ppsz_albumart_descriptions[] =
#define SUBDELAY_UP_KEY_LONGTEXT N_("Select the key to increase the subtitle delay.")
#define SUBDELAY_DOWN_KEY_TEXT N_("Subtitle delay down")
#define SUBDELAY_DOWN_KEY_LONGTEXT N_("Select the key to decrease the subtitle delay.")
#define SUBPOS_UP_KEY_TEXT N_("Subtitle position up")
#define SUBPOS_UP_KEY_LONGTEXT N_("Select the key to move subtitles higher.")
#define SUBPOS_DOWN_KEY_TEXT N_("Subtitle position down")
#define SUBPOS_DOWN_KEY_LONGTEXT N_("Select the key to move subtitles lower.")
#define AUDIODELAY_UP_KEY_TEXT N_("Audio delay up")
#define AUDIODELAY_UP_KEY_LONGTEXT N_("Select the key to increase the audio delay.")
#define AUDIODELAY_DOWN_KEY_TEXT N_("Audio delay down")
...
...
@@ -2241,6 +2245,8 @@ vlc_module_begin ()
# define KEY_VOL_MUTE KEY_MODIFIER_COMMAND|KEY_MODIFIER_ALT|KEY_DOWN
# define KEY_SUBDELAY_UP 'j'
# define KEY_SUBDELAY_DOWN 'h'
# define KEY_SUBPOS_DOWN KEY_UNSET
# define KEY_SUBPOS_UP KEY_UNSET
# define KEY_AUDIODELAY_UP 'g'
# define KEY_AUDIODELAY_DOWN 'f'
# define KEY_AUDIO_TRACK 'l'
...
...
@@ -2356,6 +2362,8 @@ vlc_module_begin ()
# define KEY_VOL_MUTE 'm'
# define KEY_SUBDELAY_UP 'h'
# define KEY_SUBDELAY_DOWN 'g'
# define KEY_SUBPOS_DOWN KEY_UNSET
# define KEY_SUBPOS_UP KEY_UNSET
# define KEY_AUDIODELAY_UP 'k'
# define KEY_AUDIODELAY_DOWN 'j'
# define KEY_RANDOM 'r'
...
...
@@ -2517,6 +2525,10 @@ vlc_module_begin ()
SUBDELAY_UP_KEY_TEXT
,
SUBDELAY_UP_KEY_LONGTEXT
,
true
)
add_key
(
"key-subdelay-down"
,
KEY_SUBDELAY_DOWN
,
NULL
,
SUBDELAY_DOWN_KEY_TEXT
,
SUBDELAY_DOWN_KEY_LONGTEXT
,
true
)
add_key
(
"key-subpos-up"
,
KEY_SUBPOS_UP
,
NULL
,
SUBPOS_UP_KEY_TEXT
,
SUBPOS_UP_KEY_LONGTEXT
,
true
)
add_key
(
"key-subpos-down"
,
KEY_SUBPOS_DOWN
,
NULL
,
SUBPOS_DOWN_KEY_TEXT
,
SUBPOS_DOWN_KEY_LONGTEXT
,
true
)
add_key
(
"key-audiodelay-up"
,
KEY_AUDIODELAY_UP
,
NULL
,
AUDIODELAY_UP_KEY_TEXT
,
AUDIODELAY_UP_KEY_LONGTEXT
,
true
)
add_key
(
"key-audiodelay-down"
,
KEY_AUDIODELAY_DOWN
,
NULL
,
...
...
@@ -2810,6 +2822,8 @@ const struct action libvlc_actions[] =
{
"key-vol-mute"
,
ACTIONID_VOL_MUTE
,
},
{
"key-subdelay-down"
,
ACTIONID_SUBDELAY_DOWN
,
},
{
"key-subdelay-up"
,
ACTIONID_SUBDELAY_UP
,
},
{
"key-subpos-down"
,
ACTIONID_SUBPOS_DOWN
,
},
{
"key-subpos-up"
,
ACTIONID_SUBPOS_UP
,
},
{
"key-audiodelay-down"
,
ACTIONID_AUDIODELAY_DOWN
,
},
{
"key-audiodelay-up"
,
ACTIONID_AUDIODELAY_UP
,
},
{
"key-audio-track"
,
ACTIONID_AUDIO_TRACK
,
},
...
...
src/video_output/vout_subpictures.c
View file @
e87593bb
...
...
@@ -156,6 +156,8 @@ static void SpuRenderRegion( spu_t *,
static
void
UpdateSPU
(
spu_t
*
,
vlc_object_t
*
);
static
int
CropCallback
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
MarginCallback
(
vlc_object_t
*
,
char
const
*
,
vlc_value_t
,
vlc_value_t
,
void
*
);
static
int
SpuControl
(
spu_t
*
,
int
,
va_list
);
...
...
@@ -243,7 +245,10 @@ int spu_Init( spu_t *p_spu )
spu_private_t
*
p_sys
=
p_spu
->
p
;
/* If the user requested a sub margin, we force the position. */
p_sys
->
i_margin
=
var_CreateGetInteger
(
p_spu
,
"sub-margin"
);
/* NOTE position is initialized from "sub-margin" belonging to
input_thread_t in UpdateSPU() */
p_sys
->
i_margin
=
0
;
//obsolete: p_sys->i_margin = var_CreateGetInteger( p_spu, "sub-margin" );
var_Create
(
p_spu
,
"sub-filter"
,
VLC_VAR_STRING
|
VLC_VAR_DOINHERIT
);
var_AddCallback
(
p_spu
,
"sub-filter"
,
SubFilterCallback
,
p_spu
);
...
...
@@ -304,12 +309,14 @@ void spu_Attach( spu_t *p_spu, vlc_object_t *p_this, bool b_attach )
{
UpdateSPU
(
p_spu
,
VLC_OBJECT
(
p_input
)
);
var_AddCallback
(
p_input
,
"highlight"
,
CropCallback
,
p_spu
);
var_AddCallback
(
p_input
,
"sub-margin"
,
MarginCallback
,
p_spu
->
p
);
vlc_object_release
(
p_input
);
}
else
{
/* Delete callback */
var_DelCallback
(
p_input
,
"highlight"
,
CropCallback
,
p_spu
);
var_DelCallback
(
p_input
,
"sub-margin"
,
MarginCallback
,
p_spu
->
p
);
vlc_object_release
(
p_input
);
}
}
...
...
@@ -1758,6 +1765,7 @@ static void UpdateSPU( spu_t *p_spu, vlc_object_t *p_object )
p_sys
->
i_crop_y
=
var_GetInteger
(
p_object
,
"y-start"
);
p_sys
->
i_crop_width
=
var_GetInteger
(
p_object
,
"x-end"
)
-
p_sys
->
i_crop_x
;
p_sys
->
i_crop_height
=
var_GetInteger
(
p_object
,
"y-end"
)
-
p_sys
->
i_crop_y
;
p_sys
->
i_margin
=
var_GetInteger
(
p_object
,
"sub-margin"
);
if
(
var_Get
(
p_object
,
"menu-palette"
,
&
val
)
==
VLC_SUCCESS
)
{
...
...
@@ -1786,6 +1794,22 @@ static int CropCallback( vlc_object_t *p_object, char const *psz_var,
return
VLC_SUCCESS
;
}
/*****************************************************************************
* MarginCallback: called when requested subtitle position has changed *
*****************************************************************************/
static
int
MarginCallback
(
vlc_object_t
*
p_object
,
char
const
*
psz_var
,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
VLC_UNUSED
(
psz_var
);
VLC_UNUSED
(
oldval
);
VLC_UNUSED
(
p_object
);
spu_private_t
*
p_sys
=
(
spu_private_t
*
)
p_data
;
vlc_mutex_lock
(
&
p_sys
->
lock
);
p_sys
->
i_margin
=
newval
.
i_int
;
vlc_mutex_unlock
(
&
p_sys
->
lock
);
return
VLC_SUCCESS
;
}
/*****************************************************************************
* Buffers allocation callbacks for the filters
*****************************************************************************/
...
...
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