Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-gpu
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-gpu
Commits
0f282618
Commit
0f282618
authored
May 21, 2009
by
Geoffroy Couprie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32 vout: factorize code
parent
b1501cfe
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
363 deletions
+159
-363
modules/video_output/msw/direct3d.c
modules/video_output/msw/direct3d.c
+13
-101
modules/video_output/msw/directx.c
modules/video_output/msw/directx.c
+4
-94
modules/video_output/msw/events.c
modules/video_output/msw/events.c
+113
-0
modules/video_output/msw/glwin32.c
modules/video_output/msw/glwin32.c
+10
-66
modules/video_output/msw/vout.h
modules/video_output/msw/vout.h
+4
-0
modules/video_output/msw/wingdi.c
modules/video_output/msw/wingdi.c
+15
-102
No files found.
modules/video_output/msw/direct3d.c
View file @
0f282618
...
...
@@ -202,71 +202,21 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout
->
p_sys
->
i_window_width
=
p_vout
->
i_window_width
;
p_vout
->
p_sys
->
i_window_height
=
p_vout
->
i_window_height
;
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg
(
p_vout
,
"creating Vout EventThread"
);
p_vout
->
p_sys
->
p_event
=
vlc_object_create
(
p_vout
,
sizeof
(
event_thread_t
)
);
p_vout
->
p_sys
->
p_event
->
p_vout
=
p_vout
;
p_vout
->
p_sys
->
p_event
->
window_ready
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
vlc_thread_create
(
p_vout
->
p_sys
->
p_event
,
"Vout Events Thread"
,
EventThread
,
0
)
)
if
(
CreateEventThread
(
p_vout
)
)
{
msg_Err
(
p_vout
,
"cannot create Vout EventThread"
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
p_vout
->
p_sys
->
p_event
=
NULL
;
goto
error
;
}
WaitForSingleObject
(
p_vout
->
p_sys
->
p_event
->
window_ready
,
INFINITE
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
if
(
p_vout
->
p_sys
->
p_event
->
b_error
)
{
msg_Err
(
p_vout
,
"Vout EventThread failed"
);
goto
error
;
}
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
vlc_object_attach
(
p_vout
->
p_sys
->
p_event
,
p_vout
);
DisableScreensaver
(
p_vout
);
msg_Dbg
(
p_vout
,
"Vout EventThread running"
);
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
/* disable screensaver by temporarily changing system settings */
p_vout
->
p_sys
->
i_spi_lowpowertimeout
=
0
;
p_vout
->
p_sys
->
i_spi_powerofftimeout
=
0
;
p_vout
->
p_sys
->
i_spi_screensavetimeout
=
0
;
if
(
var_GetBool
(
p_vout
,
"disable-screensaver"
)
)
{
msg_Dbg
(
p_vout
,
"disabling screen saver"
);
SystemParametersInfo
(
SPI_GETLOWPOWERTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_lowpowertimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETPOWEROFFTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_powerofftimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETSCREENSAVETIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_screensavetimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
0
,
NULL
,
0
);
}
return
VLC_SUCCESS
;
}
else
{
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
}
return
VLC_SUCCESS
;
error:
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
}
/*****************************************************************************
...
...
@@ -280,47 +230,9 @@ static void CloseVideo( vlc_object_t *p_this )
Direct3DVoutRelease
(
p_vout
);
if
(
p_vout
->
b_fullscreen
)
{
msg_Dbg
(
p_vout
,
"Quitting fullscreen"
);
Win32ToggleFullscreen
(
p_vout
);
/* Force fullscreen in the core for the next video */
var_SetBool
(
p_vout
,
"fullscreen"
,
true
);
}
if
(
p_vout
->
p_sys
->
p_event
)
{
vlc_object_detach
(
p_vout
->
p_sys
->
p_event
);
/* Kill Vout EventThread */
vlc_object_kill
(
p_vout
->
p_sys
->
p_event
);
StopEventThread
(
p_vout
);
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if
(
p_vout
->
p_sys
->
hwnd
)
{
PostMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_NULL
,
0
,
0
);
}
vlc_thread_join
(
p_vout
->
p_sys
->
p_event
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
}
vlc_mutex_destroy
(
&
p_vout
->
p_sys
->
lock
);
/* restore screensaver system settings */
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
p_vout
->
p_sys
->
i_spi_lowpowertimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
p_vout
->
p_sys
->
i_spi_powerofftimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
p_vout
->
p_sys
->
i_spi_screensavetimeout
,
NULL
,
0
);
}
RestoreScreensaver
(
p_vout
);
free
(
p_vout
->
p_sys
);
p_vout
->
p_sys
=
NULL
;
...
...
modules/video_output/msw/directx.c
View file @
0f282618
...
...
@@ -266,39 +266,8 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout
->
p_sys
->
i_window_width
=
p_vout
->
i_window_width
;
p_vout
->
p_sys
->
i_window_height
=
p_vout
->
i_window_height
;
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* DirectXEventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg
(
p_vout
,
"creating DirectXEventThread"
);
p_vout
->
p_sys
->
p_event
=
vlc_object_create
(
p_vout
,
sizeof
(
event_thread_t
)
);
p_vout
->
p_sys
->
p_event
->
p_vout
=
p_vout
;
p_vout
->
p_sys
->
p_event
->
window_ready
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
vlc_thread_create
(
p_vout
->
p_sys
->
p_event
,
"Vout Events Thread"
,
EventThread
,
0
)
)
{
msg_Err
(
p_vout
,
"cannot create Vout EventThread"
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
p_vout
->
p_sys
->
p_event
=
NULL
;
if
(
!
CreateEventThread
(
p_vout
)
)
goto
error
;
}
WaitForSingleObject
(
p_vout
->
p_sys
->
p_event
->
window_ready
,
INFINITE
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
if
(
p_vout
->
p_sys
->
p_event
->
b_error
)
{
msg_Err
(
p_vout
,
"Vout EventThread failed"
);
goto
error
;
}
vlc_object_attach
(
p_vout
->
p_sys
->
p_event
,
p_vout
);
msg_Dbg
(
p_vout
,
"Vout EventThread running"
);
/* Initialise DirectDraw */
if
(
DirectXInitDDraw
(
p_vout
)
)
...
...
@@ -326,28 +295,7 @@ static int OpenVideo( vlc_object_t *p_this )
var_AddCallback
(
p_vout
,
"directx-wallpaper"
,
WallpaperCallback
,
NULL
);
var_TriggerCallback
(
p_vout
,
"directx-wallpaper"
);
/* disable screensaver by temporarily changing system settings */
p_vout
->
p_sys
->
i_spi_lowpowertimeout
=
0
;
p_vout
->
p_sys
->
i_spi_powerofftimeout
=
0
;
p_vout
->
p_sys
->
i_spi_screensavetimeout
=
0
;
if
(
var_GetBool
(
p_vout
,
"disable-screensaver"
)
)
{
msg_Dbg
(
p_vout
,
"disabling screen saver"
);
SystemParametersInfo
(
SPI_GETLOWPOWERTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_lowpowertimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETPOWEROFFTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_powerofftimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETSCREENSAVETIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_screensavetimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
0
,
NULL
,
0
);
}
}
DisableScreensaver
(
p_vout
);
return
VLC_SUCCESS
;
...
...
@@ -482,50 +430,12 @@ static void CloseVideo( vlc_object_t *p_this )
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
if
(
p_vout
->
b_fullscreen
)
{
msg_Dbg
(
p_vout
,
"Quitting fullscreen"
);
Win32ToggleFullscreen
(
p_vout
);
/* Force fullscreen in the core for the next video */
var_SetBool
(
p_vout
,
"fullscreen"
,
true
);
}
if
(
p_vout
->
p_sys
->
p_event
)
{
vlc_object_detach
(
p_vout
->
p_sys
->
p_event
);
/* Kill Vout EventThread */
vlc_object_kill
(
p_vout
->
p_sys
->
p_event
);
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if
(
p_vout
->
p_sys
->
hwnd
)
{
PostMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_NULL
,
0
,
0
);
}
vlc_thread_join
(
p_vout
->
p_sys
->
p_event
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
}
vlc_mutex_destroy
(
&
p_vout
->
p_sys
->
lock
);
StopEventThread
(
p_vout
);
/* Make sure the wallpaper is restored */
SwitchWallpaperMode
(
p_vout
,
false
);
/* restore screensaver system settings */
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
p_vout
->
p_sys
->
i_spi_lowpowertimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
p_vout
->
p_sys
->
i_spi_powerofftimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
p_vout
->
p_sys
->
i_spi_screensavetimeout
,
NULL
,
0
);
}
RestoreScreensaver
(
p_vout
);
free
(
p_vout
->
p_sys
);
p_vout
->
p_sys
=
NULL
;
...
...
modules/video_output/msw/events.c
View file @
0f282618
...
...
@@ -1211,3 +1211,116 @@ void Win32ToggleFullscreen( vout_thread_t *p_vout )
/* Update the object variable and trigger callback */
var_SetBool
(
p_vout
,
"fullscreen"
,
p_vout
->
b_fullscreen
);
}
void
DisableScreensaver
(
vout_thread_t
*
p_vout
)
{
/* disable screensaver by temporarily changing system settings */
p_vout
->
p_sys
->
i_spi_lowpowertimeout
=
0
;
p_vout
->
p_sys
->
i_spi_powerofftimeout
=
0
;
p_vout
->
p_sys
->
i_spi_screensavetimeout
=
0
;
if
(
var_GetBool
(
p_vout
,
"disable-screensaver"
)
)
{
msg_Dbg
(
p_vout
,
"disabling screen saver"
);
SystemParametersInfo
(
SPI_GETLOWPOWERTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_lowpowertimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETPOWEROFFTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_powerofftimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETSCREENSAVETIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_screensavetimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
0
,
NULL
,
0
);
}
}
}
void
RestoreScreensaver
(
vout_thread_t
*
p_vout
)
{
/* restore screensaver system settings */
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
p_vout
->
p_sys
->
i_spi_lowpowertimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
p_vout
->
p_sys
->
i_spi_powerofftimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
p_vout
->
p_sys
->
i_spi_screensavetimeout
,
NULL
,
0
);
}
}
int
CreateEventThread
(
vout_thread_t
*
p_vout
)
{
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg
(
p_vout
,
"creating Vout EventThread"
);
p_vout
->
p_sys
->
p_event
=
vlc_object_create
(
p_vout
,
sizeof
(
event_thread_t
)
);
p_vout
->
p_sys
->
p_event
->
p_vout
=
p_vout
;
p_vout
->
p_sys
->
p_event
->
window_ready
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
vlc_thread_create
(
p_vout
->
p_sys
->
p_event
,
"Vout Events Thread"
,
EventThread
,
0
)
)
{
msg_Err
(
p_vout
,
"cannot create Vout EventThread"
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
p_vout
->
p_sys
->
p_event
=
NULL
;
return
0
;
}
WaitForSingleObject
(
p_vout
->
p_sys
->
p_event
->
window_ready
,
INFINITE
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
if
(
p_vout
->
p_sys
->
p_event
->
b_error
)
{
msg_Err
(
p_vout
,
"Vout EventThread failed"
);
return
0
;
}
vlc_object_attach
(
p_vout
->
p_sys
->
p_event
,
p_vout
);
msg_Dbg
(
p_vout
,
"Vout EventThread running"
);
return
1
;
}
void
StopEventThread
(
vout_thread_t
*
p_vout
)
{
if
(
p_vout
->
b_fullscreen
)
{
msg_Dbg
(
p_vout
,
"Quitting fullscreen"
);
Win32ToggleFullscreen
(
p_vout
);
/* Force fullscreen in the core for the next video */
var_SetBool
(
p_vout
,
"fullscreen"
,
true
);
}
if
(
p_vout
->
p_sys
->
p_event
)
{
vlc_object_detach
(
p_vout
->
p_sys
->
p_event
);
/* Kill Vout EventThread */
vlc_object_kill
(
p_vout
->
p_sys
->
p_event
);
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if
(
p_vout
->
p_sys
->
hwnd
)
{
PostMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_NULL
,
0
,
0
);
}
vlc_thread_join
(
p_vout
->
p_sys
->
p_event
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
}
vlc_mutex_destroy
(
&
p_vout
->
p_sys
->
lock
);
}
modules/video_output/msw/glwin32.c
View file @
0f282618
...
...
@@ -121,49 +121,19 @@ static int OpenVideo( vlc_object_t *p_this )
p_vout
->
p_sys
->
i_window_width
=
p_vout
->
i_window_width
;
p_vout
->
p_sys
->
i_window_height
=
p_vout
->
i_window_height
;
/* Create the Vout EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg
(
p_vout
,
"creating Vout EventThread"
);
p_vout
->
p_sys
->
p_event
=
vlc_object_create
(
p_vout
,
sizeof
(
event_thread_t
)
);
p_vout
->
p_sys
->
p_event
->
p_vout
=
p_vout
;
p_vout
->
p_sys
->
p_event
->
window_ready
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
vlc_thread_create
(
p_vout
->
p_sys
->
p_event
,
"Vout Events Thread"
,
EventThread
,
0
)
)
if
(
CreateEventThread
(
p_vout
)
)
{
msg_Err
(
p_vout
,
"cannot create Vout EventThread"
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
p_vout
->
p_sys
->
p_event
=
NULL
;
goto
error
;
}
WaitForSingleObject
(
p_vout
->
p_sys
->
p_event
->
window_ready
,
INFINITE
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
if
(
p_vout
->
p_sys
->
p_event
->
b_error
)
return
VLC_SUCCESS
;
}
else
{
msg_Err
(
p_vout
,
"Vout EventThread failed"
);
goto
error
;
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
}
vlc_object_attach
(
p_vout
->
p_sys
->
p_event
,
p_vout
);
msg_Dbg
(
p_vout
,
"Vout EventThread running"
);
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
return
VLC_SUCCESS
;
error:
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
}
/*****************************************************************************
...
...
@@ -221,33 +191,7 @@ static void CloseVideo( vlc_object_t *p_this )
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
if
(
p_vout
->
b_fullscreen
)
{
msg_Dbg
(
p_vout
,
"Quitting fullscreen"
);
Win32ToggleFullscreen
(
p_vout
);
/* Force fullscreen in the core for the next video */
var_SetBool
(
p_vout
,
"fullscreen"
,
true
);
}
if
(
p_vout
->
p_sys
->
p_event
)
{
vlc_object_detach
(
p_vout
->
p_sys
->
p_event
);
/* Kill Vout EventThread */
vlc_object_kill
(
p_vout
->
p_sys
->
p_event
);
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if
(
p_vout
->
p_sys
->
hwnd
)
{
PostMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_NULL
,
0
,
0
);
}
vlc_thread_join
(
p_vout
->
p_sys
->
p_event
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
}
vlc_mutex_destroy
(
&
p_vout
->
p_sys
->
lock
);
StopEventThread
(
p_vout
);
free
(
p_vout
->
p_sys
);
p_vout
->
p_sys
=
NULL
;
...
...
modules/video_output/msw/vout.h
View file @
0f282618
...
...
@@ -256,6 +256,10 @@ int DirectDrawUpdateOverlay( vout_thread_t *p_vout );
void
*
EventThread
(
vlc_object_t
*
p_this
);
void
UpdateRects
(
vout_thread_t
*
p_vout
,
bool
b_force
);
void
Win32ToggleFullscreen
(
vout_thread_t
*
p_vout
);
void
DisableScreensaver
(
vout_thread_t
*
p_vout
);
void
RestoreScreensaver
(
vout_thread_t
*
p_vout
);
int
CreateEventThread
(
vout_thread_t
*
p_vout
);
void
StopEventThread
(
vout_thread_t
*
p_vout
);
/*****************************************************************************
* Constants
...
...
modules/video_output/msw/wingdi.c
View file @
0f282618
...
...
@@ -231,73 +231,23 @@ static int OpenVideo ( vlc_object_t *p_this )
p_vout
->
p_sys
->
i_window_width
=
p_vout
->
i_window_width
;
p_vout
->
p_sys
->
i_window_height
=
p_vout
->
i_window_height
;
/* Create the EventThread, this thread is created by us to isolate
* the Win32 PeekMessage function calls. We want to do this because
* Windows can stay blocked inside this call for a long time, and when
* this happens it thus blocks vlc's video_output thread.
* Vout EventThread will take care of the creation of the video
* window (because PeekMessage has to be called from the same thread which
* created the window). */
msg_Dbg
(
p_vout
,
"creating Vout EventThread"
);
p_vout
->
p_sys
->
p_event
=
vlc_object_create
(
p_vout
,
sizeof
(
event_thread_t
)
);
p_vout
->
p_sys
->
p_event
->
p_vout
=
p_vout
;
p_vout
->
p_sys
->
p_event
->
window_ready
=
CreateEvent
(
NULL
,
TRUE
,
FALSE
,
NULL
);
if
(
vlc_thread_create
(
p_vout
->
p_sys
->
p_event
,
"Vout Events Thread"
,
EventThread
,
0
)
)
if
(
CreateEventThread
(
p_vout
)
)
{
msg_Err
(
p_vout
,
"cannot create Vout EventThread"
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
p_vout
->
p_sys
->
p_event
=
NULL
;
goto
error
;
}
WaitForSingleObject
(
p_vout
->
p_sys
->
p_event
->
window_ready
,
INFINITE
);
CloseHandle
(
p_vout
->
p_sys
->
p_event
->
window_ready
);
if
(
p_vout
->
p_sys
->
p_event
->
b_error
)
{
msg_Err
(
p_vout
,
"Vout EventThread failed"
);
goto
error
;
}
vlc_object_attach
(
p_vout
->
p_sys
->
p_event
,
p_vout
);
msg_Dbg
(
p_vout
,
"Vout EventThread running"
);
#ifndef UNDER_CE
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
/* disable screensaver by temporarily changing system settings */
p_vout
->
p_sys
->
i_spi_lowpowertimeout
=
0
;
p_vout
->
p_sys
->
i_spi_powerofftimeout
=
0
;
p_vout
->
p_sys
->
i_spi_screensavetimeout
=
0
;
if
(
var_GetBool
(
p_vout
,
"disable-screensaver"
)
)
{
msg_Dbg
(
p_vout
,
"disabling screen saver"
);
SystemParametersInfo
(
SPI_GETLOWPOWERTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_lowpowertimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETPOWEROFFTIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_powerofftimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
0
,
NULL
,
0
);
}
SystemParametersInfo
(
SPI_GETSCREENSAVETIMEOUT
,
0
,
&
(
p_vout
->
p_sys
->
i_spi_screensavetimeout
),
0
);
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
0
,
NULL
,
0
);
}
}
#endif
return
VLC_SUCCESS
;
/* Variable to indicate if the window should be on top of others */
/* Trigger a callback right now */
var_TriggerCallback
(
p_vout
,
"video-on-top"
);
error:
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
DisableScreensaver
(
p_vout
);
#endif
return
VLC_SUCCESS
;
}
else
{
CloseVideo
(
VLC_OBJECT
(
p_vout
)
);
return
VLC_EGENERIC
;
}
}
/*****************************************************************************
...
...
@@ -307,47 +257,10 @@ static void CloseVideo ( vlc_object_t *p_this )
{
vout_thread_t
*
p_vout
=
(
vout_thread_t
*
)
p_this
;
if
(
p_vout
->
b_fullscreen
)
{
msg_Dbg
(
p_vout
,
"Quitting fullscreen"
);
Win32ToggleFullscreen
(
p_vout
);
/* Force fullscreen in the core for the next video */
var_SetBool
(
p_vout
,
"fullscreen"
,
true
);
}
if
(
p_vout
->
p_sys
->
p_event
)
{
vlc_object_detach
(
p_vout
->
p_sys
->
p_event
);
/* Kill Vout EventThread */
vlc_object_kill
(
p_vout
->
p_sys
->
p_event
);
/* we need to be sure Vout EventThread won't stay stuck in
* GetMessage, so we send a fake message */
if
(
p_vout
->
p_sys
->
hwnd
)
{
PostMessage
(
p_vout
->
p_sys
->
hwnd
,
WM_NULL
,
0
,
0
);
}
vlc_thread_join
(
p_vout
->
p_sys
->
p_event
);
vlc_object_release
(
p_vout
->
p_sys
->
p_event
);
}
vlc_mutex_destroy
(
&
p_vout
->
p_sys
->
lock
);
StopEventThread
(
p_vout
);
#ifndef UNDER_CE
/* restore screensaver system settings */
if
(
0
!=
p_vout
->
p_sys
->
i_spi_lowpowertimeout
)
{
SystemParametersInfo
(
SPI_SETLOWPOWERTIMEOUT
,
p_vout
->
p_sys
->
i_spi_lowpowertimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_powerofftimeout
)
{
SystemParametersInfo
(
SPI_SETPOWEROFFTIMEOUT
,
p_vout
->
p_sys
->
i_spi_powerofftimeout
,
NULL
,
0
);
}
if
(
0
!=
p_vout
->
p_sys
->
i_spi_screensavetimeout
)
{
SystemParametersInfo
(
SPI_SETSCREENSAVETIMEOUT
,
p_vout
->
p_sys
->
i_spi_screensavetimeout
,
NULL
,
0
);
}
RestoreScreensaver
(
p_vout
);
#endif
#ifdef MODULE_NAME_IS_wingapi
...
...
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