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
dd50e81c
Commit
dd50e81c
authored
May 10, 2010
by
Laurent Aimar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up crop/aspect ratio changes and associated video format.
parent
27fa51a4
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
202 additions
and
382 deletions
+202
-382
src/video_output/control.h
src/video_output/control.h
+5
-26
src/video_output/display.c
src/video_output/display.c
+2
-4
src/video_output/video_output.c
src/video_output/video_output.c
+137
-52
src/video_output/vout_internal.h
src/video_output/vout_internal.h
+5
-17
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+52
-215
src/video_output/vout_wrapper.c
src/video_output/vout_wrapper.c
+1
-68
No files found.
src/video_output/control.h
View file @
dd50e81c
...
@@ -40,10 +40,6 @@ enum {
...
@@ -40,10 +40,6 @@ enum {
/* Controls */
/* Controls */
VOUT_CONTROL_SOURCE_ASPECT,
VOUT_CONTROL_SOURCE_CROP_BORDER,
VOUT_CONTROL_SOURCE_CROP_RATIO,
VOUT_CONTROL_SOURCE_CROP_WINDOW,
/* OSD */
/* OSD */
VOUT_CONTROL_OSD_MESSAGE,
VOUT_CONTROL_OSD_MESSAGE,
...
@@ -64,6 +60,11 @@ enum {
...
@@ -64,6 +60,11 @@ enum {
VOUT_CONTROL_ON_TOP
,
/* bool */
VOUT_CONTROL_ON_TOP
,
/* bool */
VOUT_CONTROL_DISPLAY_FILLED
,
/* bool */
VOUT_CONTROL_DISPLAY_FILLED
,
/* bool */
VOUT_CONTROL_ZOOM
,
/* pair */
VOUT_CONTROL_ZOOM
,
/* pair */
VOUT_CONTROL_ASPECT_RATIO
,
/* pair */
VOUT_CONTROL_CROP_BORDER
,
/* border */
VOUT_CONTROL_CROP_RATIO
,
/* pair */
VOUT_CONTROL_CROP_WINDOW
,
/* window */
};
};
typedef
struct
{
typedef
struct
{
...
@@ -86,17 +87,6 @@ typedef struct {
...
@@ -86,17 +87,6 @@ typedef struct {
int
channel
;
int
channel
;
char
*
string
;
char
*
string
;
}
message
;
}
message
;
#if 0
struct {
int channel;
char *string;
text_style_t *style;
int flags;
int hmargin;
int vmargin;
mtime_t start;
mtime_t stop;
} text;
struct
{
struct
{
unsigned
left
;
unsigned
left
;
unsigned
top
;
unsigned
top
;
...
@@ -109,17 +99,6 @@ typedef struct {
...
@@ -109,17 +99,6 @@ typedef struct {
unsigned
width
;
unsigned
width
;
unsigned
height
;
unsigned
height
;
}
window
;
}
window
;
struct {
int channel;
int type;
float position;
} slider;
struct {
int channel;
int icon;
} icon;
subpicture_t *subpicture;
#endif
}
u
;
}
u
;
}
vout_control_cmd_t
;
}
vout_control_cmd_t
;
...
...
src/video_output/display.c
View file @
dd50e81c
...
@@ -525,9 +525,6 @@ static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
...
@@ -525,9 +525,6 @@ static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
if
(
!
vd
->
info
.
has_hide_mouse
)
if
(
!
vd
->
info
.
has_hide_mouse
)
osys
->
mouse
.
last_moved
=
mdate
();
osys
->
mouse
.
last_moved
=
mdate
();
/* */
vlc_mutex_unlock
(
&
osys
->
lock
);
/* */
/* */
vout_SendEventMouseVisible
(
osys
->
vout
);
vout_SendEventMouseVisible
(
osys
->
vout
);
#ifdef ALLOW_DUMMY_VOUT
#ifdef ALLOW_DUMMY_VOUT
...
@@ -535,6 +532,7 @@ static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
...
@@ -535,6 +532,7 @@ static void VoutDisplayEventMouse(vout_display_t *vd, int event, va_list args)
#else
#else
vout_SendDisplayEventMouse
(
osys
->
vout
,
&
m
);
vout_SendDisplayEventMouse
(
osys
->
vout
,
&
m
);
#endif
#endif
vlc_mutex_unlock
(
&
osys
->
lock
);
}
}
static
void
VoutDisplayEvent
(
vout_display_t
*
vd
,
int
event
,
va_list
args
)
static
void
VoutDisplayEvent
(
vout_display_t
*
vd
,
int
event
,
va_list
args
)
...
@@ -1412,7 +1410,7 @@ void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
...
@@ -1412,7 +1410,7 @@ void vout_SendDisplayEventMouse(vout_thread_t *vout, const vlc_mouse_t *m)
vlc_mouse_t
tmp
;
vlc_mouse_t
tmp
;
/* The check on p_spu is needed as long as ALLOW_DUMMY_VOUT is defined */
/* The check on p_spu is needed as long as ALLOW_DUMMY_VOUT is defined */
if
(
vout
->
p
->
p_spu
&&
spu_ProcessMouse
(
vout
->
p
->
p_spu
,
m
,
&
vout
->
p
->
fmt_out
))
if
(
vout
->
p
->
p_spu
&&
spu_ProcessMouse
(
vout
->
p
->
p_spu
,
m
,
&
vout
->
p
->
display
.
vd
->
source
))
return
;
return
;
vlc_mutex_lock
(
&
vout
->
p
->
vfilter_lock
);
vlc_mutex_lock
(
&
vout
->
p
->
vfilter_lock
);
...
...
src/video_output/video_output.c
View file @
dd50e81c
This diff is collapsed.
Click to expand it.
src/video_output/vout_internal.h
View file @
dd50e81c
...
@@ -49,9 +49,7 @@ struct vout_thread_sys_t
...
@@ -49,9 +49,7 @@ struct vout_thread_sys_t
config_chain_t
*
p_cfg
;
config_chain_t
*
p_cfg
;
/* */
/* */
video_format_t
fmt_render
;
/* render format (from the decoder) */
video_format_t
original
;
/* Original format ie coming from the decoder */
video_format_t
fmt_in
;
/* input (modified render) format */
video_format_t
fmt_out
;
/* output format (for the video output) */
/* Thread & synchronization */
/* Thread & synchronization */
vlc_thread_t
thread
;
vlc_thread_t
thread
;
...
@@ -129,27 +127,17 @@ struct vout_thread_sys_t
...
@@ -129,27 +127,17 @@ struct vout_thread_sys_t
vout_chrono_t
render
;
/**< picture render time estimator */
vout_chrono_t
render
;
/**< picture render time estimator */
vlc_mutex_t
change_lock
;
/**< thread change lock */
vlc_mutex_t
change_lock
;
/**< thread change lock */
uint16_t
i_changes
;
/**< changes made to the thread.
\see \ref vout_changes */
};
};
/** \defgroup vout_changes Flags for changes
* These flags are set in the vout_thread_t::i_changes field when another
* thread changed a variable
* @{
*/
/** cropping parameters changed */
#define VOUT_CROP_CHANGE 0x1000
/** aspect ratio changed */
#define VOUT_ASPECT_CHANGE 0x2000
/**@}*/
/* TODO to move them to vlc_vout.h */
/* TODO to move them to vlc_vout.h */
void
vout_ControlChangeFullscreen
(
vout_thread_t
*
,
bool
fullscreen
);
void
vout_ControlChangeFullscreen
(
vout_thread_t
*
,
bool
fullscreen
);
void
vout_ControlChangeOnTop
(
vout_thread_t
*
,
bool
is_on_top
);
void
vout_ControlChangeOnTop
(
vout_thread_t
*
,
bool
is_on_top
);
void
vout_ControlChangeDisplayFilled
(
vout_thread_t
*
,
bool
is_filled
);
void
vout_ControlChangeDisplayFilled
(
vout_thread_t
*
,
bool
is_filled
);
void
vout_ControlChangeZoom
(
vout_thread_t
*
,
int
num
,
int
den
);
void
vout_ControlChangeZoom
(
vout_thread_t
*
,
int
num
,
int
den
);
void
vout_ControlChangeSampleAspectRatio
(
vout_thread_t
*
,
unsigned
num
,
unsigned
den
);
void
vout_ControlChangeCropRatio
(
vout_thread_t
*
,
unsigned
num
,
unsigned
den
);
void
vout_ControlChangeCropWindow
(
vout_thread_t
*
,
int
x
,
int
y
,
int
width
,
int
height
);
void
vout_ControlChangeCropBorder
(
vout_thread_t
*
,
int
left
,
int
top
,
int
right
,
int
bottom
);
/* */
/* */
void
vout_IntfInit
(
vout_thread_t
*
);
void
vout_IntfInit
(
vout_thread_t
*
);
...
...
src/video_output/vout_intf.c
View file @
dd50e81c
This diff is collapsed.
Click to expand it.
src/video_output/vout_wrapper.c
View file @
dd50e81c
...
@@ -66,7 +66,7 @@ int vout_OpenWrapper(vout_thread_t *vout, const char *name)
...
@@ -66,7 +66,7 @@ int vout_OpenWrapper(vout_thread_t *vout, const char *name)
sys
->
display
.
title
=
var_CreateGetNonEmptyString
(
vout
,
"video-title"
);
sys
->
display
.
title
=
var_CreateGetNonEmptyString
(
vout
,
"video-title"
);
/* */
/* */
video_format_t
source
=
vout
->
p
->
fmt_render
;
video_format_t
source
=
vout
->
p
->
original
;
source
.
i_visible_width
=
source
.
i_width
;
source
.
i_visible_width
=
source
.
i_width
;
source
.
i_visible_height
=
source
.
i_height
;
source
.
i_visible_height
=
source
.
i_height
;
source
.
i_x_offset
=
0
;
source
.
i_x_offset
=
0
;
...
@@ -131,37 +131,8 @@ int vout_InitWrapper(vout_thread_t *vout)
...
@@ -131,37 +131,8 @@ int vout_InitWrapper(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
;
/* */
video_format_t
source
=
vd
->
source
;
video_format_t
source
=
vd
->
source
;
vout
->
p
->
fmt_out
.
i_chroma
=
source
.
i_chroma
;
vout
->
p
->
fmt_out
.
i_width
=
vout
->
p
->
fmt_out
.
i_visible_width
=
source
.
i_width
;
vout
->
p
->
fmt_out
.
i_height
=
vout
->
p
->
fmt_out
.
i_visible_height
=
source
.
i_height
;
if
(
source
.
i_sar_num
>
0
&&
source
.
i_sar_den
>
0
)
{
vlc_ureduce
(
&
vout
->
p
->
fmt_out
.
i_sar_num
,
&
vout
->
p
->
fmt_out
.
i_sar_den
,
source
.
i_sar_num
,
source
.
i_sar_den
,
0
);
}
else
{
vout
->
p
->
fmt_out
.
i_sar_num
=
1
;
vout
->
p
->
fmt_out
.
i_sar_den
=
1
;
}
vout
->
p
->
fmt_out
.
i_sar_num
=
source
.
i_sar_num
;
vout
->
p
->
fmt_out
.
i_sar_den
=
source
.
i_sar_den
;
vout
->
p
->
fmt_out
.
i_x_offset
=
0
;
vout
->
p
->
fmt_out
.
i_y_offset
=
0
;
vout
->
p
->
fmt_out
.
i_rmask
=
source
.
i_rmask
;
vout
->
p
->
fmt_out
.
i_gmask
=
source
.
i_gmask
;
vout
->
p
->
fmt_out
.
i_bmask
=
source
.
i_bmask
;
video_format_FixRgb
(
&
vout
->
p
->
fmt_out
);
if
(
vout
->
p
->
fmt_in
.
i_visible_width
!=
source
.
i_visible_width
||
vout
->
p
->
fmt_in
.
i_visible_height
!=
source
.
i_visible_height
||
vout
->
p
->
fmt_in
.
i_x_offset
!=
source
.
i_x_offset
||
vout
->
p
->
fmt_in
.
i_y_offset
!=
source
.
i_y_offset
)
sys
->
i_changes
|=
VOUT_CROP_CHANGE
;
/* 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.
...
@@ -213,44 +184,6 @@ int vout_ManageWrapper(vout_thread_t *vout)
...
@@ -213,44 +184,6 @@ 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_ASPECT_CHANGE
|
VOUT_CROP_CHANGE
))
{
/* */
if
(
sys
->
i_changes
&
VOUT_ASPECT_CHANGE
)
{
vout
->
p
->
fmt_out
.
i_sar_num
=
vout
->
p
->
fmt_in
.
i_sar_num
;
vout
->
p
->
fmt_out
.
i_sar_den
=
vout
->
p
->
fmt_in
.
i_sar_den
;
vout_SetDisplayAspect
(
vd
,
vout
->
p
->
fmt_in
.
i_sar_num
,
vout
->
p
->
fmt_in
.
i_sar_den
);
sys
->
i_changes
&=
~
VOUT_ASPECT_CHANGE
;
}
if
(
sys
->
i_changes
&
VOUT_CROP_CHANGE
)
{
const
video_format_t
crop
=
vout
->
p
->
fmt_in
;
const
video_format_t
org
=
vout
->
p
->
fmt_render
;
/* FIXME because of rounding errors, the reconstructed ratio is wrong */
unsigned
num
=
0
;
unsigned
den
=
0
;
if
(
crop
.
i_x_offset
==
org
.
i_x_offset
&&
crop
.
i_visible_width
==
org
.
i_visible_width
&&
crop
.
i_y_offset
==
org
.
i_y_offset
+
(
org
.
i_visible_height
-
crop
.
i_visible_height
)
/
2
)
{
vlc_ureduce
(
&
num
,
&
den
,
crop
.
i_visible_width
*
crop
.
i_sar_num
,
crop
.
i_visible_height
*
crop
.
i_sar_den
,
0
);
}
else
if
(
crop
.
i_y_offset
==
org
.
i_y_offset
&&
crop
.
i_visible_height
==
org
.
i_visible_height
&&
crop
.
i_x_offset
==
org
.
i_x_offset
+
(
org
.
i_visible_width
-
crop
.
i_visible_width
)
/
2
)
{
vlc_ureduce
(
&
num
,
&
den
,
crop
.
i_visible_width
*
crop
.
i_sar_num
,
crop
.
i_visible_height
*
crop
.
i_sar_den
,
0
);
}
vout_SetDisplayCrop
(
vd
,
num
,
den
,
crop
.
i_x_offset
,
crop
.
i_y_offset
,
crop
.
i_visible_width
,
crop
.
i_visible_height
);
sys
->
i_changes
&=
~
VOUT_CROP_CHANGE
;
}
}
bool
reset_display_pool
=
sys
->
display
.
use_dr
&&
vout_AreDisplayPicturesInvalid
(
vd
);
bool
reset_display_pool
=
sys
->
display
.
use_dr
&&
vout_AreDisplayPicturesInvalid
(
vd
);
vout_ManageDisplay
(
vd
,
!
sys
->
display
.
use_dr
||
reset_display_pool
);
vout_ManageDisplay
(
vd
,
!
sys
->
display
.
use_dr
||
reset_display_pool
);
...
...
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