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
010ddefd
Commit
010ddefd
authored
Oct 30, 2005
by
Gildas Bazin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ALL: backport of 13001,13004,13005,13011,13012,13019,13020,13025 from trunk.
parent
a80a4353
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
227 additions
and
110 deletions
+227
-110
include/video_output.h
include/video_output.h
+0
-1
modules/codec/libmpeg2.c
modules/codec/libmpeg2.c
+18
-2
modules/misc/freetype.c
modules/misc/freetype.c
+6
-2
modules/video_output/directx/events.c
modules/video_output/directx/events.c
+6
-4
modules/video_output/wingdi.c
modules/video_output/wingdi.c
+68
-0
modules/video_output/x11/xcommon.c
modules/video_output/x11/xcommon.c
+43
-14
src/input/decoder.c
src/input/decoder.c
+1
-1
src/video_output/video_output.c
src/video_output/video_output.c
+4
-80
src/video_output/vout_intf.c
src/video_output/vout_intf.c
+77
-1
src/video_output/vout_pictures.c
src/video_output/vout_pictures.c
+4
-5
No files found.
include/video_output.h
View file @
010ddefd
...
...
@@ -84,7 +84,6 @@ struct vout_thread_t
vlc_bool_t
b_interface
;
/**< render interface */
vlc_bool_t
b_scale
;
/**< allow picture scaling */
vlc_bool_t
b_fullscreen
;
/**< toogle fullscreen display */
vlc_bool_t
b_override_aspect
;
/**< aspect ratio overriden */
uint32_t
render_time
;
/**< last picture render time */
unsigned
int
i_window_width
;
/**< video window width */
unsigned
int
i_window_height
;
/**< video window height */
...
...
modules/codec/libmpeg2.c
View file @
010ddefd
...
...
@@ -72,6 +72,8 @@ struct decoder_sys_t
*/
vout_synchro_t
*
p_synchro
;
int
i_aspect
;
int
i_sar_num
;
int
i_sar_den
;
mtime_t
i_last_frame_pts
;
};
...
...
@@ -581,6 +583,8 @@ static picture_t *GetNewPicture( decoder_t *p_dec, uint8_t **pp_buf )
p_dec
->
fmt_out
.
video
.
i_visible_height
=
p_sys
->
p_info
->
sequence
->
picture_height
;
p_dec
->
fmt_out
.
video
.
i_aspect
=
p_sys
->
i_aspect
;
p_dec
->
fmt_out
.
video
.
i_sar_num
=
p_sys
->
i_sar_num
;
p_dec
->
fmt_out
.
video
.
i_sar_den
=
p_sys
->
i_sar_den
;
if
(
p_sys
->
p_info
->
sequence
->
frame_period
>
0
)
{
...
...
@@ -632,17 +636,24 @@ static void GetAR( decoder_t *p_dec )
{
case
AR_3_4_PICTURE
:
p_sys
->
i_aspect
=
VOUT_ASPECT_FACTOR
*
4
/
3
;
p_sys
->
i_sar_num
=
p_sys
->
p_info
->
sequence
->
display_height
*
4
;
p_sys
->
i_sar_den
=
p_sys
->
p_info
->
sequence
->
display_width
*
3
;
break
;
case
AR_16_9_PICTURE
:
p_sys
->
i_aspect
=
VOUT_ASPECT_FACTOR
*
16
/
9
;
p_sys
->
i_sar_num
=
p_sys
->
p_info
->
sequence
->
display_height
*
16
;
p_sys
->
i_sar_den
=
p_sys
->
p_info
->
sequence
->
display_width
*
9
;
break
;
case
AR_221_1_PICTURE
:
p_sys
->
i_aspect
=
VOUT_ASPECT_FACTOR
*
221
/
100
;
p_sys
->
i_sar_num
=
p_sys
->
p_info
->
sequence
->
display_height
*
221
;
p_sys
->
i_sar_den
=
p_sys
->
p_info
->
sequence
->
display_width
*
100
;
break
;
case
AR_SQUARE_PICTURE
:
p_sys
->
i_aspect
=
VOUT_ASPECT_FACTOR
*
p_sys
->
p_info
->
sequence
->
width
/
p_sys
->
p_info
->
sequence
->
height
;
p_sys
->
i_sar_num
=
p_sys
->
i_sar_den
=
1
;
break
;
}
}
...
...
@@ -657,6 +668,8 @@ static void GetAR( decoder_t *p_dec )
VOUT_ASPECT_FACTOR
/
p_sys
->
p_info
->
sequence
->
display_height
/
p_sys
->
p_info
->
sequence
->
pixel_height
;
p_sys
->
i_sar_num
=
p_sys
->
p_info
->
sequence
->
pixel_width
;
p_sys
->
i_sar_den
=
p_sys
->
p_info
->
sequence
->
pixel_height
;
}
else
{
...
...
@@ -664,12 +677,15 @@ static void GetAR( decoder_t *p_dec )
* This shouldn't happen and if it does it is a bug
* in libmpeg2 (likely triggered by an invalid stream) */
p_sys
->
i_aspect
=
VOUT_ASPECT_FACTOR
*
4
/
3
;
p_sys
->
i_sar_num
=
p_sys
->
p_info
->
sequence
->
display_height
*
4
;
p_sys
->
i_sar_den
=
p_sys
->
p_info
->
sequence
->
display_width
*
3
;
}
}
msg_Dbg
(
p_dec
,
"%dx%d, aspect %d, %u.%03u fps"
,
msg_Dbg
(
p_dec
,
"%dx%d, aspect %d,
sar %i:%i,
%u.%03u fps"
,
p_sys
->
p_info
->
sequence
->
display_width
,
p_sys
->
p_info
->
sequence
->
display_height
,
p_sys
->
i_aspect
,
p_sys
->
p_info
->
sequence
->
display_height
,
p_sys
->
i_aspect
,
p_sys
->
i_sar_num
,
p_sys
->
i_sar_den
,
(
uint32_t
)((
uint64_t
)
1001000000
*
27
/
p_sys
->
p_info
->
sequence
->
frame_period
/
1001
),
(
uint32_t
)((
uint64_t
)
1001000000
*
27
/
...
...
modules/misc/freetype.c
View file @
010ddefd
...
...
@@ -420,7 +420,7 @@ static int Render( filter_t *p_filter, subpicture_region_t *p_region,
for
(
y
=
1
;
y
<
(
int
)
fmt
.
i_height
-
1
;
y
++
)
{
memcpy
(
p_top
,
p_dst
,
fmt
.
i_width
);
if
(
y
>
1
)
memcpy
(
p_top
,
p_dst
,
fmt
.
i_width
);
p_dst
+=
p_region
->
picture
.
Y_PITCH
;
left
=
0
;
...
...
@@ -615,7 +615,11 @@ static int RenderText( filter_t *p_filter, subpicture_region_t *p_region_out,
}
FT_Glyph_Get_CBox
(
tmp_glyph
,
ft_glyph_bbox_pixels
,
&
glyph_size
);
i_error
=
FT_Glyph_To_Bitmap
(
&
tmp_glyph
,
ft_render_mode_normal
,
0
,
1
);
if
(
i_error
)
continue
;
if
(
i_error
)
{
FT_Done_Glyph
(
tmp_glyph
);
continue
;
}
p_line
->
pp_glyphs
[
i
]
=
(
FT_BitmapGlyph
)
tmp_glyph
;
/* Do rest */
...
...
modules/video_output/directx/events.c
View file @
010ddefd
...
...
@@ -144,11 +144,13 @@ void E_(DirectXEventThread)( event_thread_t *p_event )
if
(
i_width
&&
i_height
)
{
val
.
i_int
=
(
GET_X_LPARAM
(
msg
.
lParam
)
-
i_x
)
*
p_event
->
p_vout
->
render
.
i_width
/
i_width
;
val
.
i_int
=
(
GET_X_LPARAM
(
msg
.
lParam
)
-
i_x
)
*
p_event
->
p_vout
->
fmt_in
.
i_visible_width
/
i_width
+
p_event
->
p_vout
->
fmt_in
.
i_x_offset
;
var_Set
(
p_event
->
p_vout
,
"mouse-x"
,
val
);
val
.
i_int
=
(
GET_Y_LPARAM
(
msg
.
lParam
)
-
i_y
)
*
p_event
->
p_vout
->
render
.
i_height
/
i_height
;
val
.
i_int
=
(
GET_Y_LPARAM
(
msg
.
lParam
)
-
i_y
)
*
p_event
->
p_vout
->
fmt_in
.
i_visible_height
/
i_height
+
p_event
->
p_vout
->
fmt_in
.
i_y_offset
;
var_Set
(
p_event
->
p_vout
,
"mouse-y"
,
val
);
val
.
b_bool
=
VLC_TRUE
;
...
...
modules/video_output/wingdi.c
View file @
010ddefd
...
...
@@ -29,6 +29,7 @@
#include <string.h>
#include <vlc/vlc.h>
#include <vlc/intf.h>
#include <vlc/vout.h>
#include <commctrl.h>
...
...
@@ -92,6 +93,7 @@
#define SetWindowLongPtr SetWindowLong
#define GetWindowLongPtr GetWindowLong
#define GWLP_USERDATA GWL_USERDATA
#define AdjustWindowRect(a,b,c)
#endif //UNDER_CE
#ifndef WS_NONAVDONEBUTTON
...
...
@@ -146,6 +148,7 @@ struct vout_sys_t
int
i_window_y
;
int
i_window_width
;
int
i_window_height
;
int
i_window_style
;
int
render_width
;
int
render_height
;
...
...
@@ -404,7 +407,11 @@ static int Init( vout_thread_t *p_vout )
#else
p_vout
->
output
.
i_width
=
p_vout
->
render
.
i_width
;
p_vout
->
output
.
i_height
=
p_vout
->
render
.
i_height
;
p_vout
->
fmt_out
=
p_vout
->
fmt_in
;
p_vout
->
fmt_out
.
i_chroma
=
p_vout
->
output
.
i_chroma
;
#endif
p_vout
->
output
.
i_aspect
=
p_vout
->
render
.
i_aspect
;
p_pic
->
p
->
p_pixels
=
p_vout
->
p_sys
->
p_pic_buffer
;
...
...
@@ -801,6 +808,8 @@ static void EventThread ( vlc_object_t *p_event )
else
i_style
=
WS_OVERLAPPEDWINDOW
|
WS_SIZEBOX
|
WS_VISIBLE
|
WS_CLIPCHILDREN
;
p_vout
->
p_sys
->
i_window_style
=
i_style
;
p_vout
->
p_sys
->
hwnd
=
CreateWindow
(
_T
(
"VLC WinGDI"
),
_T
(
VOUT_TITLE
),
i_style
,
(
p_vout
->
p_sys
->
i_window_x
<
0
)
?
CW_USEDEFAULT
:
...
...
@@ -1150,6 +1159,19 @@ static long FAR PASCAL WndProc( HWND hWnd, UINT message,
p_vout
->
p_sys
->
b_video_display
=
VLC_TRUE
;
break
;
/* the user wants to close the window */
case
WM_CLOSE
:
{
playlist_t
*
p_playlist
=
(
playlist_t
*
)
vlc_object_find
(
p_vout
,
VLC_OBJECT_PLAYLIST
,
FIND_ANYWHERE
);
if
(
p_playlist
==
NULL
)
return
0
;
playlist_Stop
(
p_playlist
);
vlc_object_release
(
p_playlist
);
return
0
;
}
case
WM_DESTROY
:
msg_Dbg
(
p_vout
,
"WinProc WM_DESTROY"
);
PostQuitMessage
(
0
);
...
...
@@ -1261,9 +1283,55 @@ static void InitBuffers( vout_thread_t *p_vout )
static
int
Control
(
vout_thread_t
*
p_vout
,
int
i_query
,
va_list
args
)
{
vlc_bool_t
b_bool
;
double
f_arg
;
RECT
rect_window
;
POINT
point
;
switch
(
i_query
)
{
case
VOUT_SET_ZOOM
:
if
(
p_vout
->
p_sys
->
hparent
)
return
vout_ControlWindow
(
p_vout
,
(
void
*
)
p_vout
->
p_sys
->
hparent
,
i_query
,
args
);
f_arg
=
va_arg
(
args
,
double
);
/* Update dimensions */
rect_window
.
top
=
rect_window
.
left
=
0
;
rect_window
.
right
=
p_vout
->
i_window_width
*
f_arg
;
rect_window
.
bottom
=
p_vout
->
i_window_height
*
f_arg
;
AdjustWindowRect
(
&
rect_window
,
p_vout
->
p_sys
->
i_window_style
,
0
);
SetWindowPos
(
p_vout
->
p_sys
->
hwnd
,
0
,
0
,
0
,
rect_window
.
right
-
rect_window
.
left
,
rect_window
.
bottom
-
rect_window
.
top
,
SWP_NOMOVE
);
return
VLC_SUCCESS
;
case
VOUT_CLOSE
:
ShowWindow
(
p_vout
->
p_sys
->
hwnd
,
SW_HIDE
);
case
VOUT_REPARENT
:
/* Change window style, borders and title bar */
//vlc_mutex_lock( &p_vout->p_sys->lock );
p_vout
->
p_sys
->
hparent
=
0
;
//vlc_mutex_unlock( &p_vout->p_sys->lock );
/* Retrieve the window position */
point
.
x
=
point
.
y
=
0
;
ClientToScreen
(
p_vout
->
p_sys
->
hwnd
,
&
point
);
SetParent
(
p_vout
->
p_sys
->
hwnd
,
0
);
p_vout
->
p_sys
->
i_window_style
=
WS_CLIPCHILDREN
|
WS_OVERLAPPEDWINDOW
|
WS_SIZEBOX
;
SetWindowLong
(
p_vout
->
p_sys
->
hwnd
,
GWL_STYLE
,
p_vout
->
p_sys
->
i_window_style
|
(
i_query
==
VOUT_CLOSE
?
0
:
WS_VISIBLE
)
);
SetWindowLong
(
p_vout
->
p_sys
->
hwnd
,
GWL_EXSTYLE
,
WS_EX_APPWINDOW
);
SetWindowPos
(
p_vout
->
p_sys
->
hwnd
,
0
,
point
.
x
,
point
.
y
,
0
,
0
,
SWP_NOSIZE
|
SWP_NOZORDER
|
SWP_FRAMECHANGED
);
return
vout_vaControlDefault
(
p_vout
,
i_query
,
args
);
case
VOUT_SET_FOCUS
:
b_bool
=
va_arg
(
args
,
vlc_bool_t
);
...
...
modules/video_output/x11/xcommon.c
View file @
010ddefd
...
...
@@ -405,11 +405,33 @@ static int InitVideo( vout_thread_t *p_vout )
vout_PlacePicture
(
p_vout
,
p_vout
->
p_sys
->
p_win
->
i_width
,
p_vout
->
p_sys
->
p_win
->
i_height
,
&
i_index
,
&
i_index
,
&
p_vout
->
output
.
i_width
,
&
p_vout
->
output
.
i_height
);
&
p_vout
->
fmt_out
.
i_visible_width
,
&
p_vout
->
fmt_out
.
i_visible_height
);
/* Assume we have square pixels */
p_vout
->
output
.
i_aspect
=
p_vout
->
output
.
i_width
*
VOUT_ASPECT_FACTOR
/
p_vout
->
output
.
i_height
;
p_vout
->
fmt_out
.
i_chroma
=
p_vout
->
output
.
i_chroma
;
p_vout
->
output
.
i_width
=
p_vout
->
fmt_out
.
i_width
=
p_vout
->
fmt_out
.
i_visible_width
*
p_vout
->
fmt_in
.
i_width
/
p_vout
->
fmt_in
.
i_visible_width
;
p_vout
->
output
.
i_height
=
p_vout
->
fmt_out
.
i_height
=
p_vout
->
fmt_out
.
i_visible_height
*
p_vout
->
fmt_in
.
i_height
/
p_vout
->
fmt_in
.
i_visible_height
;
p_vout
->
fmt_out
.
i_x_offset
=
p_vout
->
fmt_out
.
i_visible_width
*
p_vout
->
fmt_in
.
i_x_offset
/
p_vout
->
fmt_in
.
i_visible_width
;
p_vout
->
fmt_out
.
i_y_offset
=
p_vout
->
fmt_out
.
i_visible_height
*
p_vout
->
fmt_in
.
i_y_offset
/
p_vout
->
fmt_in
.
i_visible_height
;
p_vout
->
fmt_out
.
i_sar_num
=
p_vout
->
fmt_out
.
i_sar_den
=
1
;
p_vout
->
output
.
i_aspect
=
p_vout
->
fmt_out
.
i_aspect
=
p_vout
->
fmt_out
.
i_width
*
VOUT_ASPECT_FACTOR
/
p_vout
->
fmt_out
.
i_height
;
msg_Dbg
(
p_vout
,
"x11 image size %ix%i (%i,%i,%ix%i)"
,
p_vout
->
fmt_out
.
i_width
,
p_vout
->
fmt_out
.
i_height
,
p_vout
->
fmt_out
.
i_x_offset
,
p_vout
->
fmt_out
.
i_y_offset
,
p_vout
->
fmt_out
.
i_visible_width
,
p_vout
->
fmt_out
.
i_visible_height
);
#endif
/* Try to initialize up to MAX_DIRECTBUFFERS direct buffers */
...
...
@@ -486,8 +508,11 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
XShmPutImage
(
p_vout
->
p_sys
->
p_display
,
p_vout
->
p_sys
->
p_win
->
video_window
,
p_vout
->
p_sys
->
p_win
->
gc
,
p_pic
->
p_sys
->
p_image
,
0
/*src_x*/
,
0
/*src_y*/
,
0
/*dest_x*/
,
0
/*dest_y*/
,
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_height
,
p_vout
->
fmt_out
.
i_x_offset
,
p_vout
->
fmt_out
.
i_y_offset
,
0
/*dest_x*/
,
0
/*dest_y*/
,
p_vout
->
fmt_out
.
i_visible_width
,
p_vout
->
fmt_out
.
i_visible_height
,
False
/* Don't put True here ! */
);
# endif
}
...
...
@@ -508,8 +533,11 @@ static void DisplayVideo( vout_thread_t *p_vout, picture_t *p_pic )
XPutImage
(
p_vout
->
p_sys
->
p_display
,
p_vout
->
p_sys
->
p_win
->
video_window
,
p_vout
->
p_sys
->
p_win
->
gc
,
p_pic
->
p_sys
->
p_image
,
0
/*src_x*/
,
0
/*src_y*/
,
0
/*dest_x*/
,
0
/*dest_y*/
,
p_vout
->
output
.
i_width
,
p_vout
->
output
.
i_height
);
p_vout
->
fmt_out
.
i_x_offset
,
p_vout
->
fmt_out
.
i_y_offset
,
0
/*dest_x*/
,
0
/*dest_y*/
,
p_vout
->
fmt_out
.
i_visible_width
,
p_vout
->
fmt_out
.
i_visible_height
);
#endif
}
...
...
@@ -757,11 +785,13 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout
->
p_sys
->
p_win
->
i_height
,
&
i_x
,
&
i_y
,
&
i_width
,
&
i_height
);
val
.
i_int
=
(
xevent
.
xmotion
.
x
-
i_x
)
*
p_vout
->
render
.
i_width
/
i_width
;
val
.
i_int
=
(
xevent
.
xmotion
.
x
-
i_x
)
*
p_vout
->
fmt_in
.
i_visible_width
/
i_width
+
p_vout
->
fmt_in
.
i_x_offset
;
var_Set
(
p_vout
,
"mouse-x"
,
val
);
val
.
i_int
=
(
xevent
.
xmotion
.
y
-
i_y
)
*
p_vout
->
render
.
i_height
/
i_height
;
val
.
i_int
=
(
xevent
.
xmotion
.
y
-
i_y
)
*
p_vout
->
fmt_in
.
i_visible_height
/
i_height
+
p_vout
->
fmt_in
.
i_y_offset
;
var_Set
(
p_vout
,
"mouse-y"
,
val
);
val
.
b_bool
=
VLC_TRUE
;
...
...
@@ -847,7 +877,6 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout
->
i_changes
&=
~
VOUT_FULLSCREEN_CHANGE
;
}
#ifndef MODULE_NAME_IS_x11
if
(
p_vout
->
i_changes
&
VOUT_CROP_CHANGE
||
p_vout
->
i_changes
&
VOUT_ASPECT_CHANGE
)
{
...
...
@@ -862,9 +891,9 @@ static int ManageVideo( vout_thread_t *p_vout )
p_vout
->
fmt_out
.
i_sar_num
=
p_vout
->
fmt_in
.
i_sar_num
;
p_vout
->
fmt_out
.
i_sar_den
=
p_vout
->
fmt_in
.
i_sar_den
;
p_vout
->
output
.
i_aspect
=
p_vout
->
fmt_in
.
i_aspect
;
p_vout
->
i_changes
|=
VOUT_SIZE_CHANGE
;
}
#endif
/*
* Size change
...
...
src/input/decoder.c
View file @
010ddefd
...
...
@@ -946,7 +946,7 @@ static picture_t *vout_new_buffer( decoder_t *p_dec )
vlc_ureduce
(
&
p_dec
->
fmt_out
.
video
.
i_sar_num
,
&
p_dec
->
fmt_out
.
video
.
i_sar_den
,
p_dec
->
fmt_out
.
video
.
i_sar_num
,
p_dec
->
fmt_out
.
video
.
i_sar_den
,
0
);
p_dec
->
fmt_out
.
video
.
i_sar_den
,
5000
0
);
p_dec
->
fmt_out
.
video
.
i_chroma
=
p_dec
->
fmt_out
.
i_codec
;
p_sys
->
video
=
p_dec
->
fmt_out
.
video
;
...
...
src/video_output/video_output.c
View file @
010ddefd
...
...
@@ -59,7 +59,6 @@ static void DestroyThread ( vout_thread_t * );
static
void
AspectRatio
(
int
,
int
*
,
int
*
);
static
int
BinaryLog
(
uint32_t
);
static
void
MaskToShift
(
int
*
,
int
*
,
uint32_t
);
static
void
InitWindowSize
(
vout_thread_t
*
,
unsigned
*
,
unsigned
*
);
/* Object variables callbacks */
static
int
DeinterlaceCallback
(
vlc_object_t
*
,
char
const
*
,
...
...
@@ -174,8 +173,7 @@ vout_thread_t *__vout_Request( vlc_object_t *p_this, vout_thread_t *p_vout,
if
(
(
p_vout
->
fmt_render
.
i_width
!=
p_fmt
->
i_width
)
||
(
p_vout
->
fmt_render
.
i_height
!=
p_fmt
->
i_height
)
||
(
p_vout
->
fmt_render
.
i_chroma
!=
p_fmt
->
i_chroma
)
||
(
p_vout
->
fmt_render
.
i_aspect
!=
p_fmt
->
i_aspect
&&
!
p_vout
->
b_override_aspect
)
||
(
p_vout
->
fmt_render
.
i_aspect
!=
p_fmt
->
i_aspect
)
||
p_vout
->
b_filter_change
)
{
/* We are not interested in this format, close this vout */
...
...
@@ -247,12 +245,11 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
/* Initialize the rendering heap */
I_RENDERPICTURES
=
0
;
vlc_ureduce
(
&
p_fmt
->
i_sar_num
,
&
p_fmt
->
i_sar_den
,
p_fmt
->
i_sar_num
,
p_fmt
->
i_sar_den
,
50000
);
p_vout
->
fmt_render
=
*
p_fmt
;
/* FIXME palette */
p_vout
->
fmt_in
=
*
p_fmt
;
/* FIXME palette */
vlc_ureduce
(
&
p_vout
->
fmt_render
.
i_sar_num
,
&
p_vout
->
fmt_render
.
i_sar_den
,
p_vout
->
fmt_render
.
i_sar_num
,
p_vout
->
fmt_render
.
i_sar_den
,
0
);
vlc_ureduce
(
&
p_vout
->
fmt_in
.
i_sar_num
,
&
p_vout
->
fmt_in
.
i_sar_den
,
p_vout
->
fmt_in
.
i_sar_num
,
p_vout
->
fmt_in
.
i_sar_den
,
0
);
p_vout
->
render
.
i_width
=
i_width
;
p_vout
->
render
.
i_height
=
i_height
;
...
...
@@ -316,8 +313,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
/* Take care of some "interface/control" related initialisations */
vout_IntfInit
(
p_vout
);
p_vout
->
b_override_aspect
=
VLC_FALSE
;
/* If the parent is not a VOUT object, that means we are at the start of
* the video output pipe */
if
(
p_parent
->
i_object_type
!=
VLC_OBJECT_VOUT
)
...
...
@@ -358,12 +353,6 @@ vout_thread_t * __vout_Create( vlc_object_t *p_parent, video_format_t *p_fmt )
else
psz_plugin
=
strdup
(
p_vout
->
psz_filter_chain
);
}
/* Initialize the dimensions of the video window */
InitWindowSize
(
p_vout
,
&
p_vout
->
i_window_width
,
&
p_vout
->
i_window_height
);
msg_Dbg
(
p_vout
,
"Window size: %dx%d"
,
p_vout
->
i_window_width
,
p_vout
->
i_window_height
);
/* Create the vout thread */
p_vout
->
p_module
=
module_Need
(
p_vout
,
(
p_vout
->
psz_filter_chain
&&
*
p_vout
->
psz_filter_chain
)
?
...
...
@@ -1228,71 +1217,6 @@ static void MaskToShift( int *pi_left, int *pi_right, uint32_t i_mask )
*
pi_right
=
(
8
-
i_high
+
i_low
);
}
/*****************************************************************************
* InitWindowSize: find the initial dimensions the video window should have.
*****************************************************************************
* This function will check the "width", "height" and "zoom" config options and
* will calculate the size that the video window should have.
*****************************************************************************/
static
void
InitWindowSize
(
vout_thread_t
*
p_vout
,
unsigned
*
pi_width
,
unsigned
*
pi_height
)
{
vlc_value_t
val
;
int
i_width
,
i_height
;
uint64_t
ll_zoom
;
#define FP_FACTOR 1000
/* our fixed point factor */
var_Get
(
p_vout
,
"align"
,
&
val
);
p_vout
->
i_alignment
=
val
.
i_int
;
var_Get
(
p_vout
,
"width"
,
&
val
);
i_width
=
val
.
i_int
;
var_Get
(
p_vout
,
"height"
,
&
val
);
i_height
=
val
.
i_int
;
var_Get
(
p_vout
,
"zoom"
,
&
val
);
ll_zoom
=
(
uint64_t
)(
FP_FACTOR
*
val
.
f_float
);
if
(
i_width
>
0
&&
i_height
>
0
)
{
*
pi_width
=
(
int
)(
i_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
i_height
*
ll_zoom
/
FP_FACTOR
);
return
;
}
else
if
(
i_width
>
0
)
{
*
pi_width
=
(
int
)(
i_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
i_width
*
ll_zoom
*
VOUT_ASPECT_FACTOR
/
p_vout
->
fmt_in
.
i_aspect
/
FP_FACTOR
);
return
;
}
else
if
(
i_height
>
0
)
{
*
pi_height
=
(
int
)(
i_height
*
ll_zoom
/
FP_FACTOR
);
*
pi_width
=
(
int
)(
i_height
*
ll_zoom
*
p_vout
->
fmt_in
.
i_aspect
/
VOUT_ASPECT_FACTOR
/
FP_FACTOR
);
return
;
}
if
(
p_vout
->
fmt_in
.
i_visible_height
*
p_vout
->
fmt_in
.
i_aspect
>=
p_vout
->
fmt_in
.
i_visible_width
*
VOUT_ASPECT_FACTOR
)
{
*
pi_width
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_height
*
ll_zoom
*
p_vout
->
fmt_in
.
i_aspect
/
VOUT_ASPECT_FACTOR
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_height
*
ll_zoom
/
FP_FACTOR
);
}
else
{
*
pi_width
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_width
*
ll_zoom
*
VOUT_ASPECT_FACTOR
/
p_vout
->
fmt_in
.
i_aspect
/
FP_FACTOR
);
}
#undef FP_FACTOR
}
/*****************************************************************************
* vout_VarCallback: generic callback for intf variables
*****************************************************************************/
...
...
src/video_output/vout_intf.c
View file @
010ddefd
...
...
@@ -37,6 +37,7 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
void
InitWindowSize
(
vout_thread_t
*
,
unsigned
*
,
unsigned
*
);
/* Object variables callbacks */
static
int
ZoomCallback
(
vlc_object_t
*
,
char
const
*
,
...
...
@@ -184,6 +185,9 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Create
(
p_vout
,
"width"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_vout
,
"height"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_vout
,
"align"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Get
(
p_vout
,
"align"
,
&
val
);
p_vout
->
i_alignment
=
val
.
i_int
;
var_Create
(
p_vout
,
"video-x"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
var_Create
(
p_vout
,
"video-y"
,
VLC_VAR_INTEGER
|
VLC_VAR_DOINHERIT
);
...
...
@@ -261,7 +265,6 @@ void vout_IntfInit( vout_thread_t *p_vout )
vlc_ureduce
(
&
i_aspect_num
,
&
i_aspect_den
,
i_aspect
*
VOUT_ASPECT_FACTOR
,
VOUT_ASPECT_FACTOR
,
0
);
}
free
(
val
.
psz_string
);
if
(
!
i_aspect_num
||
!
i_aspect_den
)
i_aspect_num
=
i_aspect_den
=
1
;
p_vout
->
i_par_num
=
i_aspect_num
;
...
...
@@ -274,6 +277,7 @@ void vout_IntfInit( vout_thread_t *p_vout )
p_vout
->
i_par_num
,
p_vout
->
i_par_den
);
b_force_par
=
VLC_TRUE
;
}
if
(
val
.
psz_string
)
free
(
val
.
psz_string
);
/* Aspect-ratio object var */
var_Create
(
p_vout
,
"aspect-ratio"
,
VLC_VAR_STRING
|
...
...
@@ -301,6 +305,12 @@ void vout_IntfInit( vout_thread_t *p_vout )
var_Change
(
p_vout
,
"aspect-ratio"
,
VLC_VAR_TRIGGER_CALLBACKS
,
0
,
0
);
if
(
old_val
.
psz_string
)
free
(
old_val
.
psz_string
);
/* Initialize the dimensions of the video window */
InitWindowSize
(
p_vout
,
&
p_vout
->
i_window_width
,
&
p_vout
->
i_window_height
);
msg_Dbg
(
p_vout
,
"window size: %dx%d"
,
p_vout
->
i_window_width
,
p_vout
->
i_window_height
);
/* Add a variable to indicate if the window should be on top of others */
var_Create
(
p_vout
,
"video-on-top"
,
VLC_VAR_BOOL
|
VLC_VAR_DOINHERIT
);
text
.
psz_string
=
_
(
"Always on top"
);
...
...
@@ -524,6 +534,69 @@ int vout_vaControlDefault( vout_thread_t *p_vout, int i_query, va_list args )
}
}
/*****************************************************************************
* InitWindowSize: find the initial dimensions the video window should have.
*****************************************************************************
* This function will check the "width", "height" and "zoom" config options and
* will calculate the size that the video window should have.
*****************************************************************************/
static
void
InitWindowSize
(
vout_thread_t
*
p_vout
,
unsigned
*
pi_width
,
unsigned
*
pi_height
)
{
vlc_value_t
val
;
int
i_width
,
i_height
;
uint64_t
ll_zoom
;
#define FP_FACTOR 1000
/* our fixed point factor */
var_Get
(
p_vout
,
"width"
,
&
val
);
i_width
=
val
.
i_int
;
var_Get
(
p_vout
,
"height"
,
&
val
);
i_height
=
val
.
i_int
;
var_Get
(
p_vout
,
"zoom"
,
&
val
);
ll_zoom
=
(
uint64_t
)(
FP_FACTOR
*
val
.
f_float
);
if
(
i_width
>
0
&&
i_height
>
0
)
{
*
pi_width
=
(
int
)(
i_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
i_height
*
ll_zoom
/
FP_FACTOR
);
return
;
}
else
if
(
i_width
>
0
)
{
*
pi_width
=
(
int
)(
i_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_height
*
ll_zoom
*
p_vout
->
fmt_in
.
i_sar_den
*
i_width
/
p_vout
->
fmt_in
.
i_sar_num
/
FP_FACTOR
/
p_vout
->
fmt_in
.
i_visible_width
);
return
;
}
else
if
(
i_height
>
0
)
{
*
pi_height
=
(
int
)(
i_height
*
ll_zoom
/
FP_FACTOR
);
*
pi_width
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_width
*
ll_zoom
*
p_vout
->
fmt_in
.
i_sar_num
*
i_height
/
p_vout
->
fmt_in
.
i_sar_den
/
FP_FACTOR
/
p_vout
->
fmt_in
.
i_visible_height
);
return
;
}
if
(
p_vout
->
fmt_in
.
i_sar_num
>=
p_vout
->
fmt_in
.
i_sar_den
)
{
*
pi_width
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_width
*
ll_zoom
*
p_vout
->
fmt_in
.
i_sar_num
/
p_vout
->
fmt_in
.
i_sar_den
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_height
*
ll_zoom
/
FP_FACTOR
);
}
else
{
*
pi_width
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_width
*
ll_zoom
/
FP_FACTOR
);
*
pi_height
=
(
int
)(
p_vout
->
fmt_in
.
i_visible_height
*
ll_zoom
*
p_vout
->
fmt_in
.
i_sar_den
/
p_vout
->
fmt_in
.
i_sar_num
/
FP_FACTOR
);
}
#undef FP_FACTOR
}
/*****************************************************************************
* Object variables callbacks
*****************************************************************************/
...
...
@@ -577,6 +650,9 @@ static int CropCallback( vlc_object_t *p_this, char const *psz_cmd,
}
crop_end:
InitWindowSize
(
p_vout
,
&
p_vout
->
i_window_width
,
&
p_vout
->
i_window_height
);
p_vout
->
i_changes
|=
VOUT_CROP_CHANGE
;
msg_Dbg
(
p_vout
,
"cropping picture %ix%i to %i,%i,%ix%i"
,
...
...
src/video_output/vout_pictures.c
View file @
010ddefd
...
...
@@ -445,19 +445,18 @@ void vout_PlacePicture( vout_thread_t *p_vout,
}
if
(
p_vout
->
fmt_in
.
i_visible_width
*
(
int64_t
)
p_vout
->
fmt_in
.
i_sar_num
*
*
pi_height
/
(
p_vout
->
fmt_in
.
i_visible_height
*
p_vout
->
fmt_in
.
i_sar_den
)
>
*
pi_width
)
*
pi_height
/
p_vout
->
fmt_in
.
i_visible_height
/
p_vout
->
fmt_in
.
i_sar_den
>
*
pi_width
)
{
*
pi_height
=
p_vout
->
fmt_in
.
i_visible_height
*
(
int64_t
)
p_vout
->
fmt_in
.
i_sar_den
*
*
pi_width
/
(
p_vout
->
fmt_in
.
i_visible_width
*
p_vout
->
fmt_in
.
i_sar_num
)
;
p_vout
->
fmt_in
.
i_visible_width
/
p_vout
->
fmt_in
.
i_sar_num
;
}
else
{
*
pi_width
=
p_vout
->
fmt_in
.
i_visible_width
*
(
int64_t
)
p_vout
->
fmt_in
.
i_sar_num
*
*
pi_height
/
(
p_vout
->
fmt_in
.
i_visible_height
*
p_vout
->
fmt_in
.
i_sar_den
)
;
p_vout
->
fmt_in
.
i_visible_height
/
p_vout
->
fmt_in
.
i_sar_den
;
}
switch
(
p_vout
->
i_alignment
&
VOUT_ALIGN_HMASK
)
...
...
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