[vlc-devel] commit: drawable: handle the case that drawable is per-input ( Rémi Denis-Courmont )
git version control
git at videolan.org
Sat Feb 7 09:50:38 CET 2009
vlc | branch: master | Rémi Denis-Courmont <rdenis at simphalempin.com> | Sat Feb 7 10:47:45 2009 +0200| [ca6444e86645cb5a89d3e629e4c6d28ecd1e055b] | committer: Rémi Denis-Courmont
drawable: handle the case that drawable is per-input
It only works -properly- if there is only one video output. This is no
worse than earlier releases.
Pointed-out-by: brezhoneg1
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ca6444e86645cb5a89d3e629e4c6d28ecd1e055b
---
modules/video_output/drawable.c | 25 ++++++++++++++++++++-----
1 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/modules/video_output/drawable.c b/modules/video_output/drawable.c
index 113ddb1..b904ff9 100644
--- a/modules/video_output/drawable.c
+++ b/modules/video_output/drawable.c
@@ -63,22 +63,37 @@ static int Open (vlc_object_t *obj, const char *varname, bool ptr)
{
static vlc_mutex_t serializer = VLC_STATIC_MUTEX;
vout_window_t *wnd = (vout_window_t *)obj;
- vlc_value_t val;
+ vlc_value_t val, globval;
- if (var_Create (obj->p_libvlc, "drawable-busy", VLC_VAR_BOOL))
+ if (var_Create (obj->p_libvlc, "drawable-busy", VLC_VAR_BOOL)
+ || var_Create (obj, varname, VLC_VAR_DOINHERIT
+ | (ptr ? VLC_VAR_ADDRESS : VLC_VAR_INTEGER)))
return VLC_ENOMEM;
+ var_Get (obj, varname, &val);
vlc_mutex_lock (&serializer);
/* Note: We cannot simply clear the drawable variable.
* It would break libvlc_video_get_parent(). */
- if (!var_GetBool (obj->p_libvlc, "drawable-busy"))
+ var_Get (obj->p_libvlc, varname, &globval);
+ if (ptr ? (val.p_address == globval.p_address)
+ : (val.i_int == globval.i_int))
{
- var_Get (obj->p_libvlc, varname, &val);
- if (ptr ? (val.p_address != NULL): (val.i_int == 0))
+ if (var_GetBool (obj->p_libvlc, "drawable-busy"))
+ { /* LibVLC-wide drawable already in use */
+ if (ptr)
+ val.p_address = NULL;
+ else
+ val.i_int = 0;
+ }
+ else
var_SetBool (obj->p_libvlc, "drawable-busy", true);
}
+ /* If we got a drawable _not_ from the root object (from the input?),
+ * We assume it is not busy. This is a bug. */
vlc_mutex_unlock (&serializer);
+ var_Destroy (obj, varname);
+
if (ptr ? (val.p_address == NULL) : (val.i_int == 0))
{
var_Destroy (obj->p_libvlc, "drawable-busy");
More information about the vlc-devel
mailing list