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
daed9da9
Commit
daed9da9
authored
Jan 11, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
vout_window: use custom entry callback
parent
b7de335c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
84 additions
and
94 deletions
+84
-94
include/vlc_vout_window.h
include/vlc_vout_window.h
+0
-5
modules/gui/hildon/maemo.c
modules/gui/hildon/maemo.c
+10
-12
modules/gui/qt4/qt4.cpp
modules/gui/qt4/qt4.cpp
+17
-25
modules/gui/skins2/src/skin_main.cpp
modules/gui/skins2/src/skin_main.cpp
+3
-6
modules/video_output/drawable.c
modules/video_output/drawable.c
+13
-15
modules/video_output/xcb/window.c
modules/video_output/xcb/window.c
+21
-27
src/video_output/window.c
src/video_output/window.c
+20
-4
No files found.
include/vlc_vout_window.h
View file @
daed9da9
...
...
@@ -79,11 +79,6 @@ typedef struct {
struct
vout_window_t
{
VLC_COMMON_MEMBERS
/* Initial state (reserved).
* Once the open function is called, it will be set to NULL
*/
const
vout_window_cfg_t
*
cfg
;
/* window handle (mandatory)
*
* It must be filled in the open function.
...
...
modules/gui/hildon/maemo.c
View file @
daed9da9
...
...
@@ -47,13 +47,13 @@
/*****************************************************************************
* Local prototypes
*****************************************************************************/
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
*
Thread
(
void
*
);
static
int
OpenWindow
(
vlc_object
_t
*
);
static
void
CloseWindow
(
vlc_object
_t
*
);
static
int
ControlWindow
(
vout_window_t
*
,
int
,
va_list
);
static
gboolean
interface_ready
(
gpointer
);
static
int
Open
(
vlc_object_t
*
);
static
void
Close
(
vlc_object_t
*
);
static
void
*
Thread
(
void
*
);
static
int
OpenWindow
(
vout_window_t
*
,
const
vout_window_cfg
_t
*
);
static
void
CloseWindow
(
vout_window
_t
*
);
static
int
ControlWindow
(
vout_window_t
*
,
int
,
va_list
);
static
gboolean
interface_ready
(
gpointer
);
/*****************************************************************************
* Module descriptor
...
...
@@ -283,13 +283,12 @@ static void *Thread( void *obj )
/**
* Video output window provider
*/
static
int
OpenWindow
(
v
lc_object_t
*
p_obj
)
static
int
OpenWindow
(
v
out_window_t
*
p_wnd
,
const
vout_window_cfg_t
*
cfg
)
{
vout_window_t
*
p_wnd
=
(
vout_window_t
*
)
p_obj
;
intf_thread_t
*
p_intf
;
vlc_value_t
val
;
if
(
p_wnd
->
cfg
->
is_standalone
)
if
(
cfg
->
is_standalone
)
return
VLC_EGENERIC
;
if
(
var_Get
(
p_obj
->
p_libvlc
,
"hildon-iface"
,
&
val
)
)
...
...
@@ -343,9 +342,8 @@ static int ControlWindow (vout_window_t *p_wnd, int query, va_list args)
}
}
static
void
CloseWindow
(
v
lc_object_t
*
p_obj
)
static
void
CloseWindow
(
v
out_window_t
*
p_wnd
)
{
vout_window_t
*
p_wnd
=
(
vout_window_t
*
)
p_obj
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
p_wnd
->
sys
;
if
(
p_intf
->
p_sys
->
b_fullscreen
)
...
...
modules/gui/qt4/qt4.cpp
View file @
daed9da9
...
...
@@ -46,6 +46,7 @@
#include "../../../share/icons/32x32/vlc.xpm"
#include "../../../share/icons/32x32/vlc-xmas.xpm"
#include <vlc_plugin.h>
#include <vlc_vout_window.h>
#ifdef WIN32
/* For static builds */
#include <QtPlugin>
...
...
@@ -60,8 +61,8 @@ static int OpenIntf ( vlc_object_t * );
static
int
OpenDialogs
(
vlc_object_t
*
);
static
int
Open
(
vlc_object_t
*
,
bool
);
static
void
Close
(
vlc_object_t
*
);
static
int
WindowOpen
(
v
lc_object
_t
*
);
static
void
WindowClose
(
v
lc_object
_t
*
);
static
int
WindowOpen
(
v
out_window_t
*
,
const
vout_window_cfg
_t
*
);
static
void
WindowClose
(
v
out_window
_t
*
);
static
void
*
Thread
(
void
*
);
static
void
ShowDialog
(
intf_thread_t
*
,
int
,
int
,
intf_dialog_args_t
*
);
...
...
@@ -607,31 +608,23 @@ static void ShowDialog( intf_thread_t *p_intf, int i_dialog_event, int i_arg,
*
* TODO move it out of here ?
*/
#include <vlc_vout_window.h>
static
int
WindowControl
(
vout_window_t
*
,
int
i_query
,
va_list
);
static
int
WindowOpen
(
v
lc_object_t
*
p_obj
)
static
int
WindowOpen
(
v
out_window_t
*
p_wnd
,
const
vout_window_cfg_t
*
cfg
)
{
vout_window_t
*
p_wnd
=
(
vout_window_t
*
)
p_obj
;
/* */
if
(
p_wnd
->
cfg
->
is_standalone
)
if
(
cfg
->
is_standalone
)
return
VLC_EGENERIC
;
#if defined (Q_WS_X11)
if
(
var_InheritBool
(
p_
obj
,
"video-wallpaper"
)
)
if
(
var_InheritBool
(
p_
wnd
,
"video-wallpaper"
)
)
return
VLC_EGENERIC
;
#endif
vlc_value_t
val
;
if
(
var_Inherit
(
p_obj
,
"qt4-iface"
,
VLC_VAR_ADDRESS
,
&
val
)
)
val
.
p_address
=
NULL
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
val
.
p_address
;
intf_thread_t
*
p_intf
=
(
intf_thread_t
*
)
var_InheritAddress
(
p_wnd
,
"qt4-iface"
);
if
(
!
p_intf
)
{
/* If another interface is used, this plugin cannot work */
msg_Dbg
(
p_
obj
,
"Qt4 interface not found"
);
msg_Dbg
(
p_
wnd
,
"Qt4 interface not found"
);
return
VLC_EGENERIC
;
}
...
...
@@ -640,12 +633,12 @@ static int WindowOpen( vlc_object_t *p_obj )
return
VLC_EGENERIC
;
MainInterface
*
p_mi
=
p_intf
->
p_sys
->
p_mi
;
msg_Dbg
(
p_
obj
,
"requesting video..."
);
msg_Dbg
(
p_
wnd
,
"requesting video..."
);
int
i_x
=
p_wnd
->
cfg
->
x
;
int
i_y
=
p_wnd
->
cfg
->
y
;
unsigned
i_width
=
p_wnd
->
cfg
->
width
;
unsigned
i_height
=
p_wnd
->
cfg
->
height
;
int
i_x
=
cfg
->
x
;
int
i_y
=
cfg
->
y
;
unsigned
i_width
=
cfg
->
width
;
unsigned
i_height
=
cfg
->
height
;
#if defined (Q_WS_X11)
p_wnd
->
handle
.
xid
=
p_mi
->
getVideo
(
&
i_x
,
&
i_y
,
&
i_width
,
&
i_height
);
...
...
@@ -684,9 +677,8 @@ static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
return
p_mi
->
controlVideo
(
i_query
,
args
);
}
static
void
WindowClose
(
v
lc_object_t
*
p_obj
)
static
void
WindowClose
(
v
out_window_t
*
p_wnd
)
{
vout_window_t
*
p_wnd
=
(
vout_window_t
*
)
p_obj
;
MainInterface
*
p_mi
=
(
MainInterface
*
)
p_wnd
->
sys
;
QMutexLocker
locker
(
&
lock
);
...
...
@@ -701,9 +693,9 @@ static void WindowClose( vlc_object_t *p_obj )
* XCB and Xlib-XCB are fine with that. Plain Xlib wouldn't, */
if
(
unlikely
(
!
active
))
{
msg_Warn
(
p_
obj
,
"video already released"
);
msg_Warn
(
p_
wnd
,
"video already released"
);
return
;
}
msg_Dbg
(
p_
obj
,
"releasing video..."
);
msg_Dbg
(
p_
wnd
,
"releasing video..."
);
p_mi
->
releaseVideo
();
}
modules/gui/skins2/src/skin_main.cpp
View file @
daed9da9
...
...
@@ -316,10 +316,8 @@ end:
static
vlc_mutex_t
serializer
=
VLC_STATIC_MUTEX
;
// Callbacks for vout requests
static
int
WindowOpen
(
v
lc_object_t
*
p_this
)
static
int
WindowOpen
(
v
out_window_t
*
pWnd
,
const
vout_window_cfg_t
*
cfg
)
{
vout_window_t
*
pWnd
=
(
vout_window_t
*
)
p_this
;
vlc_mutex_lock
(
&
skin_load
.
mutex
);
intf_thread_t
*
pIntf
=
skin_load
.
intf
;
if
(
pIntf
)
...
...
@@ -331,7 +329,7 @@ static int WindowOpen( vlc_object_t *p_this )
if
(
!
vlc_object_alive
(
pIntf
)
||
!
var_InheritBool
(
pIntf
,
"skinned-video"
)
||
pWnd
->
cfg
->
is_standalone
)
cfg
->
is_standalone
)
{
vlc_object_release
(
pIntf
);
return
VLC_EGENERIC
;
...
...
@@ -357,9 +355,8 @@ static int WindowOpen( vlc_object_t *p_this )
}
}
static
void
WindowClose
(
v
lc_object_t
*
p_this
)
static
void
WindowClose
(
v
out_window_t
*
pWnd
)
{
vout_window_t
*
pWnd
=
(
vout_window_t
*
)
p_this
;
intf_thread_t
*
pIntf
=
(
intf_thread_t
*
)
pWnd
->
sys
;
vlc_mutex_lock
(
&
serializer
);
...
...
modules/video_output/drawable.c
View file @
daed9da9
...
...
@@ -31,8 +31,8 @@
#include <vlc_plugin.h>
#include <vlc_vout_window.h>
static
int
Open
(
v
lc_object
_t
*
);
static
void
Close
(
v
lc_object
_t
*
);
static
int
Open
(
v
out_window_t
*
,
const
vout_window_cfg
_t
*
);
static
void
Close
(
v
out_window
_t
*
);
/*
* Module descriptor
...
...
@@ -54,23 +54,22 @@ static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
/**
* Find the drawable set by libvlc application.
*/
static
int
Open
(
v
lc_object_t
*
obj
)
static
int
Open
(
v
out_window_t
*
wnd
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
void
**
used
,
*
val
;
size_t
n
=
0
;
if
(
var_Create
(
obj
->
p_libvlc
,
"hwnd-in-use"
,
VLC_VAR_ADDRESS
)
||
var_Create
(
obj
,
"drawable-hwnd"
,
VLC_VAR_DOINHERIT
|
VLC_VAR_ADDRESS
))
if
(
var_Create
(
wnd
->
p_libvlc
,
"hwnd-in-use"
,
VLC_VAR_ADDRESS
)
||
var_Create
(
wnd
,
"drawable-hwnd"
,
VLC_VAR_DOINHERIT
|
VLC_VAR_ADDRESS
))
return
VLC_ENOMEM
;
val
=
var_GetAddress
(
obj
,
"drawable-hwnd"
);
var_Destroy
(
obj
,
"drawable-hwnd"
);
val
=
var_GetAddress
(
wnd
,
"drawable-hwnd"
);
var_Destroy
(
wnd
,
"drawable-hwnd"
);
/* Keep a list of busy drawables, so we don't overlap videos if there are
* more than one video track in the stream. */
vlc_mutex_lock
(
&
serializer
);
used
=
var_GetAddress
(
obj
->
p_libvlc
,
"hwnd-in-use"
);
used
=
var_GetAddress
(
wnd
->
p_libvlc
,
"hwnd-in-use"
);
if
(
used
!=
NULL
)
{
while
(
used
[
n
]
!=
NULL
)
...
...
@@ -86,7 +85,7 @@ static int Open (vlc_object_t *obj)
{
used
[
n
]
=
val
;
used
[
n
+
1
]
=
NULL
;
var_SetAddress
(
obj
->
p_libvlc
,
"hwnd-in-use"
,
used
);
var_SetAddress
(
wnd
->
p_libvlc
,
"hwnd-in-use"
,
used
);
}
else
{
...
...
@@ -108,15 +107,14 @@ skip:
/**
* Release the drawable.
*/
static
void
Close
(
v
lc_object_t
*
obj
)
static
void
Close
(
v
out_window_t
*
wnd
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
void
**
used
,
*
val
=
wnd
->
sys
;
size_t
n
=
0
;
/* Remove this drawable from the list of busy ones */
vlc_mutex_lock
(
&
serializer
);
used
=
var_GetAddress
(
obj
->
p_libvlc
,
"hwnd-in-use"
);
used
=
var_GetAddress
(
wnd
->
p_libvlc
,
"hwnd-in-use"
);
assert
(
used
);
while
(
used
[
n
]
!=
val
)
{
...
...
@@ -128,13 +126,13 @@ static void Close (vlc_object_t *obj)
while
(
used
[
++
n
]
!=
NULL
);
if
(
n
==
0
)
var_SetAddress
(
obj
->
p_libvlc
,
"hwnd-in-use"
,
NULL
);
var_SetAddress
(
wnd
->
p_libvlc
,
"hwnd-in-use"
,
NULL
);
vlc_mutex_unlock
(
&
serializer
);
if
(
n
==
0
)
free
(
used
);
/* Variables are reference-counted... */
var_Destroy
(
obj
->
p_libvlc
,
"hwnd-in-use"
);
var_Destroy
(
wnd
->
p_libvlc
,
"hwnd-in-use"
);
}
...
...
modules/video_output/xcb/window.c
View file @
daed9da9
...
...
@@ -45,10 +45,10 @@ typedef xcb_atom_t Atom;
"VLC can embed its video output in an existing X11 window. " \
"This is the X identifier of that window (0 means none).")
static
int
Open
(
v
lc_object
_t
*
);
static
void
Close
(
v
lc_object
_t
*
);
static
int
EmOpen
(
v
lc_object
_t
*
);
static
void
EmClose
(
v
lc_object
_t
*
);
static
int
Open
(
v
out_window_t
*
,
const
vout_window_cfg
_t
*
);
static
void
Close
(
v
out_window
_t
*
);
static
int
EmOpen
(
v
out_window_t
*
,
const
vout_window_cfg
_t
*
);
static
void
EmClose
(
v
out_window
_t
*
);
/*
* Module descriptor
...
...
@@ -208,9 +208,8 @@ static void CacheAtoms (vout_window_sys_t *p_sys)
/**
* Create an X11 window.
*/
static
int
Open
(
v
lc_object_t
*
obj
)
static
int
Open
(
v
out_window_t
*
wnd
,
const
vout_window_cfg_t
*
cfg
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
xcb_generic_error_t
*
err
;
xcb_void_cookie_t
ck
;
...
...
@@ -257,8 +256,7 @@ static int Open (vlc_object_t *obj)
xcb_window_t
window
=
xcb_generate_id
(
conn
);
ck
=
xcb_create_window_checked
(
conn
,
scr
->
root_depth
,
window
,
scr
->
root
,
wnd
->
cfg
->
x
,
wnd
->
cfg
->
y
,
wnd
->
cfg
->
width
,
wnd
->
cfg
->
height
,
0
,
cfg
->
x
,
cfg
->
y
,
cfg
->
width
,
cfg
->
height
,
0
,
XCB_WINDOW_CLASS_INPUT_OUTPUT
,
scr
->
root_visual
,
mask
,
values
);
err
=
xcb_request_check
(
conn
,
ck
);
...
...
@@ -275,8 +273,8 @@ static int Open (vlc_object_t *obj)
wnd
->
sys
=
p_sys
;
p_sys
->
conn
=
conn
;
if
(
var_InheritBool
(
obj
,
"keyboard-events"
))
p_sys
->
keys
=
CreateKeyHandler
(
obj
,
conn
);
if
(
var_InheritBool
(
wnd
,
"keyboard-events"
))
p_sys
->
keys
=
CreateKeyHandler
(
VLC_OBJECT
(
wnd
)
,
conn
);
else
p_sys
->
keys
=
NULL
;
p_sys
->
root
=
scr
->
root
;
...
...
@@ -342,7 +340,7 @@ static int Open (vlc_object_t *obj)
/* Make the window visible */
xcb_map_window
(
conn
,
window
);
if
(
var_InheritBool
(
obj
,
"video-wallpaper"
))
if
(
var_InheritBool
(
wnd
,
"video-wallpaper"
))
{
vout_window_SetState
(
wnd
,
VOUT_WINDOW_STATE_BELOW
);
vout_window_SetFullScreen
(
wnd
,
true
);
...
...
@@ -373,9 +371,8 @@ error:
/**
* Destroys the X11 window.
*/
static
void
Close
(
v
lc_object_t
*
obj
)
static
void
Close
(
v
out_window_t
*
wnd
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
vout_window_sys_t
*
p_sys
=
wnd
->
sys
;
xcb_connection_t
*
conn
=
p_sys
->
conn
;
...
...
@@ -607,15 +604,13 @@ static void ReleaseDrawable (vlc_object_t *obj, xcb_window_t window)
/**
* Wrap an existing X11 window to embed the video.
*/
static
int
EmOpen
(
v
lc_object_t
*
obj
)
static
int
EmOpen
(
v
out_window_t
*
wnd
,
const
vout_window_cfg_t
*
cfg
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
xcb_window_t
window
=
var_InheritInteger
(
obj
,
"drawable-xid"
);
xcb_window_t
window
=
var_InheritInteger
(
wnd
,
"drawable-xid"
);
if
(
window
==
0
)
return
VLC_EGENERIC
;
if
(
AcquireDrawable
(
obj
,
window
))
if
(
AcquireDrawable
(
VLC_OBJECT
(
wnd
)
,
window
))
return
VLC_EGENERIC
;
vout_window_sys_t
*
p_sys
=
malloc
(
sizeof
(
*
p_sys
));
...
...
@@ -635,15 +630,15 @@ static int EmOpen (vlc_object_t *obj)
xcb_get_geometry_reply
(
conn
,
xcb_get_geometry
(
conn
,
window
),
NULL
);
if
(
geo
==
NULL
)
{
msg_Err
(
obj
,
"bad X11 window 0x%08"
PRIx8
,
window
);
msg_Err
(
wnd
,
"bad X11 window 0x%08"
PRIx8
,
window
);
goto
error
;
}
p_sys
->
root
=
geo
->
root
;
free
(
geo
);
if
(
var_InheritBool
(
obj
,
"keyboard-events"
))
if
(
var_InheritBool
(
wnd
,
"keyboard-events"
))
{
p_sys
->
keys
=
CreateKeyHandler
(
obj
,
conn
);
p_sys
->
keys
=
CreateKeyHandler
(
VLC_OBJECT
(
wnd
)
,
conn
);
if
(
p_sys
->
keys
!=
NULL
)
{
const
uint32_t
mask
=
XCB_CW_EVENT_MASK
;
...
...
@@ -660,21 +655,20 @@ static int EmOpen (vlc_object_t *obj)
DestroyKeyHandler
(
p_sys
->
keys
);
xcb_flush
(
conn
);
(
void
)
cfg
;
return
VLC_SUCCESS
;
error:
xcb_disconnect
(
conn
);
free
(
p_sys
);
ReleaseDrawable
(
obj
,
window
);
ReleaseDrawable
(
VLC_OBJECT
(
wnd
)
,
window
);
return
VLC_EGENERIC
;
}
static
void
EmClose
(
v
lc_object_t
*
obj
)
static
void
EmClose
(
v
out_window_t
*
wnd
)
{
vout_window_t
*
wnd
=
(
vout_window_t
*
)
obj
;
xcb_window_t
window
=
wnd
->
handle
.
xid
;
Close
(
obj
);
ReleaseDrawable
(
obj
,
window
);
Close
(
wnd
);
ReleaseDrawable
(
VLC_OBJECT
(
wnd
)
,
window
);
}
src/video_output/window.c
View file @
daed9da9
...
...
@@ -42,6 +42,15 @@ typedef struct
vlc_inhibit_t
*
inhibit
;
}
window_t
;
static
int
vout_window_start
(
void
*
func
,
va_list
ap
)
{
int
(
*
activate
)(
vout_window_t
*
,
const
vout_window_cfg_t
*
)
=
func
;
vout_window_t
*
wnd
=
va_arg
(
ap
,
vout_window_t
*
);
const
vout_window_cfg_t
*
cfg
=
va_arg
(
ap
,
const
vout_window_cfg_t
*
);
return
activate
(
wnd
,
cfg
);
}
vout_window_t
*
vout_window_New
(
vlc_object_t
*
obj
,
const
char
*
module
,
const
vout_window_cfg_t
*
cfg
)
...
...
@@ -50,7 +59,6 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
window_t
*
w
=
vlc_custom_create
(
obj
,
sizeof
(
*
w
),
VLC_OBJECT_GENERIC
,
name
);
vout_window_t
*
window
=
&
w
->
wnd
;
window
->
cfg
=
cfg
;
memset
(
&
window
->
handle
,
0
,
sizeof
(
window
->
handle
));
window
->
control
=
NULL
;
window
->
sys
=
NULL
;
...
...
@@ -80,7 +88,8 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
assert
(
0
);
}
w
->
module
=
module_need
(
window
,
type
,
module
,
module
&&
*
module
!=
'\0'
);
w
->
module
=
vlc_module_load
(
window
,
type
,
module
,
module
&&
*
module
,
vout_window_start
,
window
,
cfg
);
if
(
!
w
->
module
)
{
vlc_object_release
(
window
);
return
NULL
;
...
...
@@ -100,6 +109,14 @@ vout_window_t *vout_window_New(vlc_object_t *obj,
return
window
;
}
static
void
vout_window_stop
(
void
*
func
,
va_list
ap
)
{
int
(
*
deactivate
)(
vout_window_t
*
)
=
func
;
vout_window_t
*
wnd
=
va_arg
(
ap
,
vout_window_t
*
);
deactivate
(
wnd
);
}
void
vout_window_Delete
(
vout_window_t
*
window
)
{
if
(
!
window
)
...
...
@@ -112,8 +129,7 @@ void vout_window_Delete(vout_window_t *window)
vlc_inhibit_Destroy
(
w
->
inhibit
);
}
module_unneed
(
window
,
w
->
module
);
vlc_module_unload
(
w
->
module
,
vout_window_stop
,
window
);
vlc_object_release
(
window
);
}
...
...
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