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
c8209ec1
Commit
c8209ec1
authored
Apr 26, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Converted more commands to vout_control.
parent
e4e3c67e
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
85 additions
and
85 deletions
+85
-85
src/video_output/control.h
src/video_output/control.h
+5
-4
src/video_output/video_output.c
src/video_output/video_output.c
+65
-1
src/video_output/vout_internal.h
src/video_output/vout_internal.h
+5
-10
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+9
-26
src/video_output/vout_wrapper.c
src/video_output/vout_wrapper.c
+1
-44
No files found.
src/video_output/control.h
View file @
c8209ec1
...
@@ -39,10 +39,6 @@ enum {
...
@@ -39,10 +39,6 @@ enum {
VOUT_CONTROL_STOP,
VOUT_CONTROL_STOP,
/* Controls */
/* Controls */
VOUT_CONTROL_FULLSCREEN,
VOUT_CONTROL_DISPLAY_FILLED,
VOUT_CONTROL_ZOOM,
VOUT_CONTROL_ON_TOP,
VOUT_CONTROL_SOURCE_ASPECT,
VOUT_CONTROL_SOURCE_ASPECT,
VOUT_CONTROL_SOURCE_CROP_BORDER,
VOUT_CONTROL_SOURCE_CROP_BORDER,
...
@@ -63,6 +59,11 @@ enum {
...
@@ -63,6 +59,11 @@ enum {
VOUT_CONTROL_RESET
,
VOUT_CONTROL_RESET
,
VOUT_CONTROL_FLUSH
,
/* time */
VOUT_CONTROL_FLUSH
,
/* time */
VOUT_CONTROL_STEP
,
/* time_ptr */
VOUT_CONTROL_STEP
,
/* time_ptr */
VOUT_CONTROL_FULLSCREEN
,
/* bool */
VOUT_CONTROL_ON_TOP
,
/* bool */
VOUT_CONTROL_DISPLAY_FILLED
,
/* bool */
VOUT_CONTROL_ZOOM
,
/* pair */
};
};
typedef
struct
{
typedef
struct
{
...
...
src/video_output/video_output.c
View file @
c8209ec1
...
@@ -51,6 +51,7 @@
...
@@ -51,6 +51,7 @@
#include "vout_internal.h"
#include "vout_internal.h"
#include "interlacing.h"
#include "interlacing.h"
#include "postprocessing.h"
#include "postprocessing.h"
#include "display.h"
/*****************************************************************************
/*****************************************************************************
* Local prototypes
* Local prototypes
...
@@ -283,7 +284,6 @@ vout_thread_t * (vout_Create)( vlc_object_t *p_parent, video_format_t *p_fmt )
...
@@ -283,7 +284,6 @@ vout_thread_t * (vout_Create)( vlc_object_t *p_parent, video_format_t *p_fmt )
/* Initialize misc stuff */
/* Initialize misc stuff */
vout_control_Init
(
&
p_vout
->
p
->
control
);
vout_control_Init
(
&
p_vout
->
p
->
control
);
p_vout
->
p
->
i_changes
=
0
;
p_vout
->
p
->
i_changes
=
0
;
p_vout
->
p
->
b_fullscreen
=
0
;
vout_chrono_Init
(
&
p_vout
->
p
->
render
,
5
,
10000
);
/* Arbitrary initial time */
vout_chrono_Init
(
&
p_vout
->
p
->
render
,
5
,
10000
);
/* Arbitrary initial time */
vout_statistic_Init
(
&
p_vout
->
p
->
statistic
);
vout_statistic_Init
(
&
p_vout
->
p
->
statistic
);
p_vout
->
p
->
b_filter_change
=
0
;
p_vout
->
p
->
b_filter_change
=
0
;
...
@@ -560,6 +560,28 @@ spu_t *vout_GetSpu( vout_thread_t *p_vout )
...
@@ -560,6 +560,28 @@ spu_t *vout_GetSpu( vout_thread_t *p_vout )
return
p_vout
->
p
->
p_spu
;
return
p_vout
->
p
->
p_spu
;
}
}
/* vout_Control* are usable by anyone at anytime */
void
vout_ControlChangeFullscreen
(
vout_thread_t
*
vout
,
bool
fullscreen
)
{
vout_control_PushBool
(
&
vout
->
p
->
control
,
VOUT_CONTROL_FULLSCREEN
,
fullscreen
);
}
void
vout_ControlChangeOnTop
(
vout_thread_t
*
vout
,
bool
is_on_top
)
{
vout_control_PushBool
(
&
vout
->
p
->
control
,
VOUT_CONTROL_ON_TOP
,
is_on_top
);
}
void
vout_ControlChangeDisplayFilled
(
vout_thread_t
*
vout
,
bool
is_filled
)
{
vout_control_PushBool
(
&
vout
->
p
->
control
,
VOUT_CONTROL_DISPLAY_FILLED
,
is_filled
);
}
void
vout_ControlChangeZoom
(
vout_thread_t
*
vout
,
int
num
,
int
den
)
{
vout_control_PushPair
(
&
vout
->
p
->
control
,
VOUT_CONTROL_ZOOM
,
num
,
den
);
}
/*****************************************************************************
/*****************************************************************************
* InitThread: initialize video output thread
* InitThread: initialize video output thread
*****************************************************************************
*****************************************************************************
...
@@ -938,6 +960,36 @@ static void ThreadStep(vout_thread_t *vout, mtime_t *duration)
...
@@ -938,6 +960,36 @@ static void ThreadStep(vout_thread_t *vout, mtime_t *duration)
}
}
}
}
static
void
ThreadChangeFullscreen
(
vout_thread_t
*
vout
,
bool
fullscreen
)
{
/* FIXME not sure setting "fullscreen" is good ... */
var_SetBool
(
vout
,
"fullscreen"
,
fullscreen
);
vout_SetDisplayFullscreen
(
vout
->
p
->
display
.
vd
,
fullscreen
);
}
static
void
ThreadChangeOnTop
(
vout_thread_t
*
vout
,
bool
is_on_top
)
{
vout_SetWindowState
(
vout
->
p
->
display
.
vd
,
is_on_top
?
VOUT_WINDOW_STATE_ABOVE
:
VOUT_WINDOW_STATE_NORMAL
);
}
static
void
ThreadChangeDisplayFilled
(
vout_thread_t
*
vout
,
bool
is_filled
)
{
vout_SetDisplayFilled
(
vout
->
p
->
display
.
vd
,
is_filled
);
}
static
void
ThreadChangeZoom
(
vout_thread_t
*
vout
,
int
num
,
int
den
)
{
if
(
num
*
10
<
den
)
{
num
=
den
;
den
*=
10
;
}
else
if
(
num
>
den
*
10
)
{
num
=
den
*
10
;
}
vout_SetDisplayZoom
(
vout
->
p
->
display
.
vd
,
num
,
den
);
}
/*****************************************************************************
/*****************************************************************************
* Thread: video output thread
* Thread: video output thread
...
@@ -1013,6 +1065,18 @@ static void *Thread(void *object)
...
@@ -1013,6 +1065,18 @@ static void *Thread(void *object)
case
VOUT_CONTROL_STEP
:
case
VOUT_CONTROL_STEP
:
ThreadStep
(
vout
,
cmd
.
u
.
time_ptr
);
ThreadStep
(
vout
,
cmd
.
u
.
time_ptr
);
break
;
break
;
case
VOUT_CONTROL_FULLSCREEN
:
ThreadChangeFullscreen
(
vout
,
cmd
.
u
.
boolean
);
break
;
case
VOUT_CONTROL_ON_TOP
:
ThreadChangeOnTop
(
vout
,
cmd
.
u
.
boolean
);
break
;
case
VOUT_CONTROL_DISPLAY_FILLED
:
ThreadChangeDisplayFilled
(
vout
,
cmd
.
u
.
boolean
);
break
;
case
VOUT_CONTROL_ZOOM
:
ThreadChangeZoom
(
vout
,
cmd
.
u
.
pair
.
a
,
cmd
.
u
.
pair
.
b
);
break
;
default:
default:
break
;
break
;
}
}
...
...
src/video_output/vout_internal.h
View file @
c8209ec1
...
@@ -130,8 +130,6 @@ struct vout_thread_sys_t
...
@@ -130,8 +130,6 @@ struct vout_thread_sys_t
uint16_t
i_changes
;
/**< changes made to the thread.
uint16_t
i_changes
;
/**< changes made to the thread.
\see \ref vout_changes */
\see \ref vout_changes */
unsigned
b_fullscreen
:
1
;
/**< toogle fullscreen display */
unsigned
b_on_top
:
1
;
/**< stay always on top of other windows */
};
};
/** \defgroup vout_changes Flags for changes
/** \defgroup vout_changes Flags for changes
...
@@ -139,20 +137,17 @@ struct vout_thread_sys_t
...
@@ -139,20 +137,17 @@ struct vout_thread_sys_t
* thread changed a variable
* thread changed a variable
* @{
* @{
*/
*/
/** b_autoscale changed */
#define VOUT_SCALE_CHANGE 0x0008
/** b_on_top changed */
#define VOUT_ON_TOP_CHANGE 0x0010
/** b_fullscreen changed */
#define VOUT_FULLSCREEN_CHANGE 0x0040
/** i_zoom changed */
#define VOUT_ZOOM_CHANGE 0x0080
/** cropping parameters changed */
/** cropping parameters changed */
#define VOUT_CROP_CHANGE 0x1000
#define VOUT_CROP_CHANGE 0x1000
/** aspect ratio changed */
/** aspect ratio changed */
#define VOUT_ASPECT_CHANGE 0x2000
#define VOUT_ASPECT_CHANGE 0x2000
/**@}*/
/**@}*/
/* TODO to move them to vlc_vout.h */
void
vout_ControlChangeFullscreen
(
vout_thread_t
*
,
bool
fullscreen
);
void
vout_ControlChangeOnTop
(
vout_thread_t
*
,
bool
is_on_top
);
void
vout_ControlChangeDisplayFilled
(
vout_thread_t
*
,
bool
is_filled
);
void
vout_ControlChangeZoom
(
vout_thread_t
*
,
int
num
,
int
den
);
/* */
/* */
void
vout_IntfInit
(
vout_thread_t
*
);
void
vout_IntfInit
(
vout_thread_t
*
);
...
...
src/video_output/vout_intf.c
View file @
c8209ec1
...
@@ -334,16 +334,14 @@ void vout_IntfInit( vout_thread_t *p_vout )
...
@@ -334,16 +334,14 @@ void vout_IntfInit( vout_thread_t *p_vout )
text
.
psz_string
=
_
(
"Always on top"
);
text
.
psz_string
=
_
(
"Always on top"
);
var_Change
(
p_vout
,
"video-on-top"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_Change
(
p_vout
,
"video-on-top"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_AddCallback
(
p_vout
,
"video-on-top"
,
OnTopCallback
,
NULL
);
var_AddCallback
(
p_vout
,
"video-on-top"
,
OnTopCallback
,
NULL
);
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
/* Add a variable to indicate whether we want window decoration or not */
/* Add a variable to indicate whether we want window decoration or not */
var_Create
(
p_vout
,
"video-deco"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_vout
,
"video-deco"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
/* Add a fullscreen variable */
/* Add a fullscreen variable */
if
(
var_CreateGetBoolCommand
(
p_vout
,
"fullscreen"
)
)
var_Create
(
p_vout
,
"fullscreen"
,
{
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
|
VLC_VAR_ISCOMMAND
);
/* user requested fullscreen */
p_vout
->
p
->
i_changes
|=
VOUT_FULLSCREEN_CHANGE
;
}
text
.
psz_string
=
_
(
"Fullscreen"
);
text
.
psz_string
=
_
(
"Fullscreen"
);
var_Change
(
p_vout
,
"fullscreen"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_Change
(
p_vout
,
"fullscreen"
,
VLC_VAR_SETTEXT
,
&
text
,
NULL
);
var_AddCallback
(
p_vout
,
"fullscreen"
,
FullscreenCallback
,
NULL
);
var_AddCallback
(
p_vout
,
"fullscreen"
,
FullscreenCallback
,
NULL
);
...
@@ -855,18 +853,10 @@ static int ScalingCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -855,18 +853,10 @@ static int ScalingCallback( vlc_object_t *p_this, char const *psz_cmd,
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
(
void
)
oldval
;
(
void
)
newval
;
(
void
)
p_data
;
(
void
)
oldval
;
(
void
)
newval
;
(
void
)
p_data
;
vlc_mutex_lock
(
&
p_vout
->
p
->
change_lock
);
if
(
!
strcmp
(
psz_cmd
,
"autoscale"
)
)
if
(
!
strcmp
(
psz_cmd
,
"autoscale"
)
)
{
vout_ControlChangeDisplayFilled
(
p_vout
,
newval
.
b_bool
);
p_vout
->
p
->
i_changes
|=
VOUT_SCALE_CHANGE
;
}
else
if
(
!
strcmp
(
psz_cmd
,
"scale"
)
)
else
if
(
!
strcmp
(
psz_cmd
,
"scale"
)
)
{
vout_ControlChangeZoom
(
p_vout
,
1000
*
newval
.
f_float
,
1000
);
p_vout
->
p
->
i_changes
|=
VOUT_ZOOM_CHANGE
;
}
vlc_mutex_unlock
(
&
p_vout
->
p
->
change_lock
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -875,13 +865,9 @@ static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -875,13 +865,9 @@ static int OnTopCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vlc_mutex_lock
(
&
p_vout
->
p
->
change_lock
);
p_vout
->
p
->
i_changes
|=
VOUT_ON_TOP_CHANGE
;
p_vout
->
p
->
b_on_top
=
newval
.
b_bool
;
vlc_mutex_unlock
(
&
p_vout
->
p
->
change_lock
);
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
p_data
;
(
void
)
psz_cmd
;
(
void
)
oldval
;
(
void
)
p_data
;
vout_ControlChangeOnTop
(
p_vout
,
newval
.
b_bool
);
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
@@ -889,13 +875,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
...
@@ -889,13 +875,10 @@ static int FullscreenCallback( vlc_object_t *p_this, char const *psz_cmd,
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
vlc_value_t
oldval
,
vlc_value_t
newval
,
void
*
p_data
)
{
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
vlc_value_t
val
;
(
void
)
psz_cmd
;
(
void
)
p_data
;
(
void
)
psz_cmd
;
(
void
)
p_data
;
if
(
oldval
.
b_bool
==
newval
.
b_bool
)
if
(
oldval
.
b_bool
!=
newval
.
b_bool
)
return
VLC_SUCCESS
;
/* no-op */
vout_ControlChangeFullscreen
(
p_vout
,
newval
.
b_bool
);
p_vout
->
p
->
i_changes
|=
VOUT_FULLSCREEN_CHANGE
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
...
...
src/video_output/vout_wrapper.c
View file @
c8209ec1
...
@@ -162,10 +162,6 @@ int vout_InitWrapper(vout_thread_t *vout)
...
@@ -162,10 +162,6 @@ int vout_InitWrapper(vout_thread_t *vout)
vout
->
fmt_in
.
i_y_offset
!=
source
.
i_y_offset
)
vout
->
fmt_in
.
i_y_offset
!=
source
.
i_y_offset
)
sys
->
i_changes
|=
VOUT_CROP_CHANGE
;
sys
->
i_changes
|=
VOUT_CROP_CHANGE
;
#warning "vout_InitWrapper: vout_SetWindowState should NOT be called there"
if
(
sys
->
b_on_top
)
vout_SetWindowState
(
vd
,
VOUT_WINDOW_STATE_ABOVE
);
/* XXX For non dr case, the current vout implementation force us to
/* XXX For non dr case, the current vout implementation force us to
* create at most 1 direct picture (otherwise the buffers will be kept
* create at most 1 direct picture (otherwise the buffers will be kept
* referenced even through the Init/End.
* referenced even through the Init/End.
...
@@ -217,20 +213,9 @@ int vout_ManageWrapper(vout_thread_t *vout)
...
@@ -217,20 +213,9 @@ int vout_ManageWrapper(vout_thread_t *vout)
vout_thread_sys_t
*
sys
=
vout
->
p
;
vout_thread_sys_t
*
sys
=
vout
->
p
;
vout_display_t
*
vd
=
sys
->
display
.
vd
;
vout_display_t
*
vd
=
sys
->
display
.
vd
;
while
(
sys
->
i_changes
&
(
VOUT_FULLSCREEN_CHANGE
|
while
(
sys
->
i_changes
&
(
VOUT_ASPECT_CHANGE
|
VOUT_ASPECT_CHANGE
|
VOUT_ZOOM_CHANGE
|
VOUT_SCALE_CHANGE
|
VOUT_ON_TOP_CHANGE
|
VOUT_CROP_CHANGE
))
{
VOUT_CROP_CHANGE
))
{
/* */
/* */
if
(
sys
->
i_changes
&
VOUT_FULLSCREEN_CHANGE
)
{
sys
->
b_fullscreen
=
!
sys
->
b_fullscreen
;
var_SetBool
(
vout
,
"fullscreen"
,
sys
->
b_fullscreen
);
vout_SetDisplayFullscreen
(
vd
,
sys
->
b_fullscreen
);
sys
->
i_changes
&=
~
VOUT_FULLSCREEN_CHANGE
;
}
if
(
sys
->
i_changes
&
VOUT_ASPECT_CHANGE
)
{
if
(
sys
->
i_changes
&
VOUT_ASPECT_CHANGE
)
{
vout
->
fmt_out
.
i_sar_num
=
vout
->
fmt_in
.
i_sar_num
;
vout
->
fmt_out
.
i_sar_num
=
vout
->
fmt_in
.
i_sar_num
;
vout
->
fmt_out
.
i_sar_den
=
vout
->
fmt_in
.
i_sar_den
;
vout
->
fmt_out
.
i_sar_den
=
vout
->
fmt_in
.
i_sar_den
;
...
@@ -239,34 +224,6 @@ int vout_ManageWrapper(vout_thread_t *vout)
...
@@ -239,34 +224,6 @@ int vout_ManageWrapper(vout_thread_t *vout)
sys
->
i_changes
&=
~
VOUT_ASPECT_CHANGE
;
sys
->
i_changes
&=
~
VOUT_ASPECT_CHANGE
;
}
}
if
(
sys
->
i_changes
&
VOUT_ZOOM_CHANGE
)
{
const
float
zoom
=
var_GetFloat
(
vout
,
"scale"
);
unsigned
den
=
ZOOM_FP_FACTOR
;
unsigned
num
=
den
*
zoom
;
if
(
num
<
(
ZOOM_FP_FACTOR
+
9
)
/
10
)
num
=
(
ZOOM_FP_FACTOR
+
9
)
/
10
;
else
if
(
num
>
ZOOM_FP_FACTOR
*
10
)
num
=
ZOOM_FP_FACTOR
*
10
;
vout_SetDisplayZoom
(
vd
,
num
,
den
);
sys
->
i_changes
&=
~
VOUT_ZOOM_CHANGE
;
}
if
(
sys
->
i_changes
&
VOUT_SCALE_CHANGE
)
{
const
bool
is_display_filled
=
var_GetBool
(
vout
,
"autoscale"
);
vout_SetDisplayFilled
(
vd
,
is_display_filled
);
sys
->
i_changes
&=
~
VOUT_SCALE_CHANGE
;
}
if
(
sys
->
i_changes
&
VOUT_ON_TOP_CHANGE
)
{
vout_SetWindowState
(
vd
,
sys
->
b_on_top
?
VOUT_WINDOW_STATE_ABOVE
:
VOUT_WINDOW_STATE_NORMAL
);
sys
->
i_changes
&=
~
VOUT_ON_TOP_CHANGE
;
}
if
(
sys
->
i_changes
&
VOUT_CROP_CHANGE
)
{
if
(
sys
->
i_changes
&
VOUT_CROP_CHANGE
)
{
const
video_format_t
crop
=
vout
->
fmt_in
;
const
video_format_t
crop
=
vout
->
fmt_in
;
const
video_format_t
org
=
vout
->
fmt_render
;
const
video_format_t
org
=
vout
->
fmt_render
;
...
...
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