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
ab044cf5
Commit
ab044cf5
authored
Feb 02, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drawable: separate XIDs and HWNDs
Also partially (internally only) fix missing Win64 drawable bits
parent
248faa09
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
72 additions
and
38 deletions
+72
-38
modules/video_output/drawable.c
modules/video_output/drawable.c
+29
-20
src/control/libvlc_internal.h
src/control/libvlc_internal.h
+5
-1
src/control/media_player.c
src/control/media_player.c
+17
-11
src/control/video.c
src/control/video.c
+19
-5
src/libvlc.c
src/libvlc.c
+2
-1
No files found.
modules/video_output/drawable.c
View file @
ab044cf5
...
@@ -32,7 +32,8 @@
...
@@ -32,7 +32,8 @@
#include <vlc_vout.h>
#include <vlc_vout.h>
#include <vlc_window.h>
#include <vlc_window.h>
static
int
Open
(
vlc_object_t
*
);
static
int
OpenXID
(
vlc_object_t
*
);
static
int
OpenHWND
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
/*
/*
...
@@ -40,15 +41,16 @@ static void Close (vlc_object_t *);
...
@@ -40,15 +41,16 @@ static void Close (vlc_object_t *);
*/
*/
vlc_module_begin
()
vlc_module_begin
()
set_shortname
(
N_
(
"Drawable"
))
set_shortname
(
N_
(
"Drawable"
))
set_description
(
N_
(
"E
xternal embedded video window
"
))
set_description
(
N_
(
"E
mbedded X window video
"
))
set_category
(
CAT_VIDEO
)
set_category
(
CAT_VIDEO
)
set_subcategory
(
SUBCAT_VIDEO_VOUT
)
set_subcategory
(
SUBCAT_VIDEO_VOUT
)
#ifdef WIN32
set_capability
(
"hwnd"
,
70
)
#else
set_capability
(
"xwindow"
,
70
)
set_capability
(
"xwindow"
,
70
)
#endif
set_callbacks
(
OpenXID
,
Close
)
set_callbacks
(
Open
,
Close
)
add_submodule
()
set_description
(
N_
(
"Embedded Windows video"
))
set_capability
(
"hwnd"
,
70
)
set_callbacks
(
OpenHWND
,
Close
)
vlc_module_end
()
vlc_module_end
()
...
@@ -57,11 +59,11 @@ static int Control (vout_window_t *, int, va_list);
...
@@ -57,11 +59,11 @@ static int Control (vout_window_t *, int, va_list);
/**
/**
* Find the drawable set by libvlc application.
* Find the drawable set by libvlc application.
*/
*/
static
int
Open
(
vlc_object_t
*
obj
)
static
int
Open
(
vlc_object_t
*
obj
,
const
char
*
varname
,
bool
ptr
)
{
{
static
vlc_mutex_t
serializer
=
VLC_STATIC_MUTEX
;
static
vlc_mutex_t
serializer
=
VLC_STATIC_MUTEX
;
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
int
drawable
=
0
;
vlc_value_t
val
;
if
(
var_Create
(
obj
->
p_libvlc
,
"drawable-busy"
,
VLC_VAR_BOOL
))
if
(
var_Create
(
obj
->
p_libvlc
,
"drawable-busy"
,
VLC_VAR_BOOL
))
return
VLC_ENOMEM
;
return
VLC_ENOMEM
;
...
@@ -71,33 +73,40 @@ static int Open (vlc_object_t *obj)
...
@@ -71,33 +73,40 @@ static int Open (vlc_object_t *obj)
* It would break libvlc_video_get_parent(). */
* It would break libvlc_video_get_parent(). */
if
(
!
var_GetBool
(
obj
->
p_libvlc
,
"drawable-busy"
))
if
(
!
var_GetBool
(
obj
->
p_libvlc
,
"drawable-busy"
))
{
{
/* TODO: implement separate variables for XIDs and HWNDs */
var_Get
(
obj
->
p_libvlc
,
varname
,
&
val
);
drawable
=
var_GetInteger
(
obj
->
p_libvlc
,
"drawable"
);
if
(
ptr
?
(
val
.
p_address
!=
NULL
)
:
(
val
.
i_int
==
0
))
if
(
drawable
!=
0
)
var_SetBool
(
obj
->
p_libvlc
,
"drawable-busy"
,
true
);
var_SetBool
(
obj
->
p_libvlc
,
"drawable-busy"
,
true
);
}
}
vlc_mutex_unlock
(
&
serializer
);
vlc_mutex_unlock
(
&
serializer
);
if
(
drawable
==
0
)
if
(
ptr
?
(
val
.
p_address
==
NULL
)
:
(
val
.
i_int
==
0
)
)
{
{
var_Destroy
(
obj
->
p_libvlc
,
"drawable-busy"
);
var_Destroy
(
obj
->
p_libvlc
,
"drawable-busy"
);
return
VLC_EGENERIC
;
return
VLC_EGENERIC
;
}
}
#ifdef WIN32
if
(
ptr
)
/* FIXME: don't loose critical bits on Win64 */
wnd
->
handle
.
hwnd
=
val
.
p_address
;
wnd
->
handle
.
hwnd
=
(
void
*
)
drawable
;
else
#else
wnd
->
handle
.
xid
=
val
.
i_int
;
/* FIXME: check that X server matches --x11-display (if specified) */
/* FIXME: check that X server matches --x11-display (if specified) */
/* FIXME: get X drawable dimensions */
wnd
->
handle
.
xid
=
drawable
;
#endif
/* FIXME: get window size (in platform-dependent ways) */
/* FIXME: get window size (in platform-dependent ways) */
wnd
->
control
=
Control
;
wnd
->
control
=
Control
;
return
VLC_SUCCESS
;
return
VLC_SUCCESS
;
}
}
static
int
OpenXID
(
vlc_object_t
*
obj
)
{
return
Open
(
obj
,
"drawable-xid"
,
false
);
}
static
int
OpenHWND
(
vlc_object_t
*
obj
)
{
return
Open
(
obj
,
"drawable-hwnd"
,
true
);
}
/**
/**
* Release the drawable.
* Release the drawable.
...
...
src/control/libvlc_internal.h
View file @
ab044cf5
...
@@ -153,7 +153,11 @@ struct libvlc_media_player_t
...
@@ -153,7 +153,11 @@ struct libvlc_media_player_t
struct
libvlc_instance_t
*
p_libvlc_instance
;
/* Parent instance */
struct
libvlc_instance_t
*
p_libvlc_instance
;
/* Parent instance */
libvlc_media_t
*
p_md
;
/* current media descriptor */
libvlc_media_t
*
p_md
;
/* current media descriptor */
libvlc_event_manager_t
*
p_event_manager
;
libvlc_event_manager_t
*
p_event_manager
;
libvlc_drawable_t
drawable
;
union
{
void
*
hwnd
;
uint32_t
xid
;
}
drawable
;
bool
b_own_its_input_thread
;
bool
b_own_its_input_thread
;
};
};
...
...
src/control/media_player.c
View file @
ab044cf5
...
@@ -89,7 +89,8 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
...
@@ -89,7 +89,8 @@ static void release_input_thread( libvlc_media_player_t *p_mi )
input_StopThread
(
p_input_thread
);
input_StopThread
(
p_input_thread
);
vlc_thread_join
(
p_input_thread
);
vlc_thread_join
(
p_input_thread
);
var_Destroy
(
p_input_thread
,
"drawable"
);
var_Destroy
(
p_input_thread
,
"drawable-hwnd"
);
var_Destroy
(
p_input_thread
,
"drawable-xid"
);
}
}
vlc_object_release
(
p_input_thread
);
vlc_object_release
(
p_input_thread
);
...
@@ -257,7 +258,11 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
...
@@ -257,7 +258,11 @@ libvlc_media_player_new( libvlc_instance_t * p_libvlc_instance,
return
NULL
;
return
NULL
;
}
}
p_mi
->
p_md
=
NULL
;
p_mi
->
p_md
=
NULL
;
p_mi
->
drawable
=
0
;
#ifndef WIN32
p_mi
->
drawable
.
xid
=
0
;
#else
p_mi
->
drawable
.
hwnd
=
NULL
;
#endif
p_mi
->
p_libvlc_instance
=
p_libvlc_instance
;
p_mi
->
p_libvlc_instance
=
p_libvlc_instance
;
p_mi
->
p_input_thread
=
NULL
;
p_mi
->
p_input_thread
=
NULL
;
/* refcount strategy:
/* refcount strategy:
...
@@ -592,13 +597,14 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
...
@@ -592,13 +597,14 @@ void libvlc_media_player_play( libvlc_media_player_t *p_mi,
p_input_thread
=
p_mi
->
p_input_thread
;
p_input_thread
=
p_mi
->
p_input_thread
;
if
(
p_mi
->
drawable
)
var_Create
(
p_input_thread
,
"drawable-xid"
,
VLC_VAR_INTEGER
);
{
var_Create
(
p_input_thread
,
"drawable-hwnd"
,
VLC_VAR_ADDRESS
);
vlc_value_t
val
;
val
.
i_int
=
p_mi
->
drawable
;
#ifndef WIN32
var_Create
(
p_input_thread
,
"drawable"
,
VLC_VAR_DOINHERIT
);
var_SetInteger
(
p_input_thread
,
"drawable-xid"
,
p_mi
->
drawable
.
xid
);
var_Set
(
p_input_thread
,
"drawable"
,
val
);
#else
}
var_SetInteger
(
p_input_thread
,
"drawable-hwnd"
,
p_mi
->
drawable
.
hwnd
);
#endif
var_AddCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-seek"
,
input_seekable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
var_AddCallback
(
p_input_thread
,
"can-pause"
,
input_pausable_changed
,
p_mi
);
...
@@ -703,7 +709,7 @@ void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
...
@@ -703,7 +709,7 @@ void libvlc_media_player_set_drawable( libvlc_media_player_t *p_mi,
input_thread_t
*
p_input_thread
;
input_thread_t
*
p_input_thread
;
vout_thread_t
*
p_vout
=
NULL
;
vout_thread_t
*
p_vout
=
NULL
;
p_mi
->
drawable
=
drawable
;
p_mi
->
drawable
.
xid
=
drawable
;
/* Allow on the fly drawable changing. This is tricky has this may
/* Allow on the fly drawable changing. This is tricky has this may
* not be supported by every vout. We though can't disable it
* not be supported by every vout. We though can't disable it
...
@@ -732,7 +738,7 @@ libvlc_drawable_t
...
@@ -732,7 +738,7 @@ libvlc_drawable_t
libvlc_media_player_get_drawable
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
libvlc_media_player_get_drawable
(
libvlc_media_player_t
*
p_mi
,
libvlc_exception_t
*
p_e
)
{
{
VLC_UNUSED
(
p_e
);
VLC_UNUSED
(
p_e
);
return
p_mi
->
drawable
;
return
p_mi
->
drawable
.
xid
;
}
}
/**************************************************************************
/**************************************************************************
...
...
src/control/video.c
View file @
ab044cf5
...
@@ -236,7 +236,16 @@ void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d
...
@@ -236,7 +236,16 @@ void libvlc_video_set_parent( libvlc_instance_t *p_instance, libvlc_drawable_t d
libvlc_exception_t
*
p_e
)
libvlc_exception_t
*
p_e
)
{
{
/* set as default for future vout instances */
/* set as default for future vout instances */
var_SetInteger
(
p_instance
->
p_libvlc_int
,
"drawable"
,
(
int
)
d
);
#ifdef WIN32
vlc_value_t
val
;
if
(
sizeof
(
HWND
)
>
sizeof
(
libvlc_drawable_t
)
)
return
;
/* BOOM! we told you not to use this function! */
val
.
p_address
=
(
void
*
)(
uintptr_t
)
d
;
var_Set
(
p_instance
->
p_libvlc_int
,
"drawable-hwnd"
,
val
);
#else
var_SetInteger
(
p_instance
->
p_libvlc_int
,
"drawable-xid"
,
d
);
#endif
libvlc_media_player_t
*
p_mi
=
libvlc_playlist_get_media_player
(
p_instance
,
p_e
);
libvlc_media_player_t
*
p_mi
=
libvlc_playlist_get_media_player
(
p_instance
,
p_e
);
if
(
p_mi
)
if
(
p_mi
)
...
@@ -251,11 +260,16 @@ libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc
...
@@ -251,11 +260,16 @@ libvlc_drawable_t libvlc_video_get_parent( libvlc_instance_t *p_instance, libvlc
{
{
VLC_UNUSED
(
p_e
);
VLC_UNUSED
(
p_e
);
libvlc_drawable_t
result
;
#ifdef WIN32
vlc_value_t
val
;
result
=
var_GetInteger
(
p_instance
->
p_libvlc_int
,
"drawable"
);
return
result
;
if
(
sizeof
(
HWND
)
>
sizeof
(
libvlc_drawable_t
)
)
return
0
;
var_Get
(
p_instance
->
p_libvlc_int
,
"drawable-hwnd"
,
&
val
);
return
(
uintptr_t
)
val
.
p_address
;
#else
return
var_GetInteger
(
p_instance
->
p_libvlc_int
,
"drawable-xid"
);
#endif
}
}
...
...
src/libvlc.c
View file @
ab044cf5
...
@@ -983,7 +983,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
...
@@ -983,7 +983,8 @@ int libvlc_InternalInit( libvlc_int_t *p_libvlc, int i_argc,
/*
/*
* FIXME: kludge to use a p_libvlc-local variable for the Mozilla plugin
* FIXME: kludge to use a p_libvlc-local variable for the Mozilla plugin
*/
*/
var_Create
(
p_libvlc
,
"drawable"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-xid"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-hwnd"
,
VLC_VAR_ADDRESS
);
var_Create
(
p_libvlc
,
"drawable-view-top"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-view-top"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-view-left"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-view-left"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-view-bottom"
,
VLC_VAR_INTEGER
);
var_Create
(
p_libvlc
,
"drawable-view-bottom"
,
VLC_VAR_INTEGER
);
...
...
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