[vlc-commits] commit: Qt4: cosmetic + comment ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
13:30:38 2010 +0200| [6088b41ddc3a01d634e4b18fe95f468e12e4a864] | committer: 
Rémi Denis-Courmont 

Qt4: cosmetic + comment

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=6088b41ddc3a01d634e4b18fe95f468e12e4a864
---

 modules/gui/qt4/qt4.cpp |6 --
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 9e7519e..168670b 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -359,12 +359,14 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
 }
 #endif
 
-/* */
+/* Wait for the interface to be ready. This prevents the main
+ * LibVLC thread from starting video playback before we can create
+ * an embedded video window. */
 vlc_sem_wait (ready);
 vlc_sem_destroy (ready);
 
 #ifndef Q_WS_MAC
-if( !p_sys-b_isDialogProvider )
+if( !isDialogProvider )
 {
 RegisterIntf( p_this );
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Qt4: do not crash if the video window is released after the interface ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
13:45:19 2010 +0200| [841eb240885cbea14245dfd832c9f1ab31d12bf4] | committer: 
Rémi Denis-Courmont 

Qt4: do not crash if the video window is released after the interface

This should fix #3359.

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=841eb240885cbea14245dfd832c9f1ab31d12bf4
---

 modules/gui/qt4/main_interface.cpp |   10 --
 modules/gui/qt4/qt4.cpp|   66 +++
 2 files changed, 50 insertions(+), 26 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp 
b/modules/gui/qt4/main_interface.cpp
index 5554aca..ddf568d 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -267,7 +267,8 @@ MainInterface::~MainInterface()
 if( stackCentralOldWidget == videoWidget )
 showTab( bgWidget );
 
-releaseVideoSlot();
+if( videoWidget )
+releaseVideoSlot();
 
 #ifdef WIN32
 if( himl )
@@ -601,8 +602,11 @@ void MainInterface::releaseVideo( void )
 /* Function that is CONNECTED to the previous emit */
 void MainInterface::releaseVideoSlot( void )
 {
-if( videoWidget )
-videoWidget-release();
+/* This function is called when the embedded video window is destroyed,
+ * or in the rare case that the embedded window is still here but the
+ * Qt4 interface exits. */
+assert( videoWidget );
+videoWidget-release();
 setVideoOnTop( false );
 setVideoFullScreen( false );
 
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 168670b..136995c 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -28,6 +28,7 @@
 
 #include QApplication
 #include QDate
+#include QMutex
 
 #include qt4.hpp
 
@@ -271,11 +272,9 @@ static vlc_sem_t ready;
 #ifdef Q_WS_X11
 static char *x11_display = NULL;
 #endif
-static struct
-{
-vlc_mutex_t lock;
-bool busy;
-} one = { VLC_STATIC_MUTEX, false };
+static QMutex lock;
+static bool busy = false;
+static bool active = false;
 
 /*
  * Module callbacks
@@ -321,11 +320,7 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
 char *display = NULL;
 #endif
 
-bool busy;
-vlc_mutex_lock (one.lock);
-busy = one.busy;
-one.busy = true;
-vlc_mutex_unlock (one.lock);
+QMutexLocker locker (lock);
 if (busy)
 {
 msg_Err (p_this, cannot start Qt4 multiple times);
@@ -352,9 +347,6 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
 {
 delete p_sys;
 free (display);
-vlc_mutex_lock (one.lock);
-one.busy = false;
-vlc_mutex_unlock (one.lock);
 return VLC_ENOMEM;
 }
 #endif
@@ -364,6 +356,7 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
  * an embedded video window. */
 vlc_sem_wait (ready);
 vlc_sem_destroy (ready);
+busy = active = true;
 
 #ifndef Q_WS_MAC
 if( !isDialogProvider )
@@ -416,8 +409,9 @@ static void Close( vlc_object_t *p_this )
 #endif
 delete p_sys;
 
-vlc_mutex_locker locker (one.lock);
-one.busy = false;
+QMutexLocker locker (lock);
+assert (busy);
+busy = false;
 }
 
 static void *Thread( void *obj )
@@ -487,15 +481,17 @@ static void *Thread( void *obj )
 
 /* Create the normal interface in non-DP mode */
 if( !p_intf-p_sys-b_isDialogProvider )
+{
 p_mi = new MainInterface( p_intf );
+p_intf-p_sys-p_mi = p_mi;
+}
 else
 p_mi = NULL;
-p_intf-p_sys-p_mi = p_mi;
 
 /* Explain how to show a dialog :D */
 p_intf-pf_show_dialog = ShowDialog;
 
-/* */
+/* Tell the main LibVLC thread we are ready */
 vlc_sem_post (ready);
 
 #ifdef Q_WS_MAC
@@ -525,9 +521,8 @@ static void *Thread( void *obj )
 msg_Dbg( p_intf, QApp exec() finished );
 if (p_mi != NULL)
 {
-#warning BUG!
-/* FIXME: the video window may still be registerd at this point */
-/* See LP#448082 as an example. */
+QMutexLocker locker (lock);
+active = false;
 
 p_intf-p_sys-p_mi = NULL;
 /* Destroy first the main interface because it is connected to some
@@ -602,6 +597,10 @@ static int WindowOpen( vlc_object_t *p_obj )
 return VLC_EGENERIC;
 }
 
+QMutexLocker locker (lock);
+if (unlikely(!active))
+return VLC_EGENERIC;
+
 MainInterface *p_mi = p_intf-p_sys-p_mi;
 msg_Dbg( p_obj, requesting video... );
 
@@ -637,6 +636,13 @@ static int WindowOpen( vlc_object_t *p_obj )
 static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
 {
 MainInterface *p_mi = (MainInterface *)p_wnd-sys;
+QMutexLocker locker (lock);
+
+if (unlikely(!active))
+{
+msg_Warn (p_wnd, video already released before control);
+return VLC_EGENERIC;
+}
 return p_mi-controlVideo( i_query, args );
 }
 
@@ -644,8 +650,22 

[vlc-commits] commit: Qt4: do not crash if the video window is released after the interface ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 
21 14:08:14 2010 +0200| [269b9f1bc1a31d5cc7f709f3398a6686cbb7bd45] | committer: 
Rémi Denis-Courmont 

Qt4: do not crash if the video window is released after the interface

This should fix #3359.
(cherry picked from commit 841eb240885cbea14245dfd832c9f1ab31d12bf4)

Conflicts:

modules/gui/qt4/main_interface.cpp
modules/gui/qt4/qt4.cpp

 http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=269b9f1bc1a31d5cc7f709f3398a6686cbb7bd45
---

 modules/gui/qt4/main_interface.cpp |   11 --
 modules/gui/qt4/qt4.cpp|   68 +++-
 2 files changed, 52 insertions(+), 27 deletions(-)

diff --git a/modules/gui/qt4/main_interface.cpp 
b/modules/gui/qt4/main_interface.cpp
index 1bd3e63..a3ad197 100644
--- a/modules/gui/qt4/main_interface.cpp
+++ b/modules/gui/qt4/main_interface.cpp
@@ -264,7 +264,9 @@ MainInterface::~MainInterface()
 if( stackCentralOldWidget == videoWidget )
 showTab( bgWidget );
 
-releaseVideoSlot();
+if( videoWidget )
+releaseVideoSlot();
+
 #ifdef WIN32
 if( himl )
 ImageList_Destroy( himl );
@@ -586,8 +588,11 @@ void MainInterface::releaseVideo( void )
 /* Function that is CONNECTED to the previous emit */
 void MainInterface::releaseVideoSlot( void )
 {
-if( videoWidget )
-videoWidget-release();
+/* This function is called when the embedded video window is destroyed,
+ * or in the rare case that the embedded window is still here but the
+ * Qt4 interface exits. */
+assert( videoWidget );
+videoWidget-release();
 setVideoOnTop( false );
 setVideoFullScreen( false );
 
diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 5ed7682..98d8aa6 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -28,6 +28,7 @@
 
 #include QApplication
 #include QDate
+#include QMutex
 
 #include qt4.hpp
 
@@ -267,11 +268,9 @@ static vlc_sem_t ready;
 #ifdef Q_WS_X11
 static char *x11_display = NULL;
 #endif
-static struct
-{
-vlc_mutex_t lock;
-bool busy;
-} one = { VLC_STATIC_MUTEX, false };
+static QMutex lock;
+static bool busy = false;
+static bool active = false;
 
 /*
  * Module callbacks
@@ -299,11 +298,7 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
 char *display = NULL;
 #endif
 
-bool busy;
-vlc_mutex_lock (one.lock);
-busy = one.busy;
-one.busy = true;
-vlc_mutex_unlock (one.lock);
+QMutexLocker locker (lock);
 if (busy)
 {
 msg_Err (p_this, cannot start Qt4 multiple times);
@@ -326,15 +321,13 @@ static int Open( vlc_object_t *p_this, bool 
isDialogProvider )
 {
 delete p_sys;
 free (display);
-vlc_mutex_lock (one.lock);
-one.busy = false;
-vlc_mutex_unlock (one.lock);
 return VLC_ENOMEM;
 }
 
 /* */
 vlc_sem_wait (ready);
 vlc_sem_destroy (ready);
+busy = active = true;
 
 if( !p_sys-b_isDialogProvider )
 {
@@ -379,9 +372,10 @@ static void Close( vlc_object_t *p_this )
 x11_display = NULL;
 #endif
 delete p_sys;
-vlc_mutex_lock (one.lock);
-one.busy = false;
-vlc_mutex_unlock (one.lock);
+
+QMutexLocker locker (lock);
+assert (busy);
+busy = false;
 }
 
 static void *Thread( void *obj )
@@ -449,15 +443,17 @@ static void *Thread( void *obj )
 
 /* Create the normal interface in non-DP mode */
 if( !p_intf-p_sys-b_isDialogProvider )
+{
 p_mi = new MainInterface( p_intf );
+p_intf-p_sys-p_mi = p_mi;
+}
 else
 p_mi = NULL;
-p_intf-p_sys-p_mi = p_mi;
 
 /* Explain how to show a dialog :D */
 p_intf-pf_show_dialog = ShowDialog;
 
-/* */
+/* Tell the main LibVLC thread we are ready */
 vlc_sem_post (ready);
 
 /* Last settings */
@@ -478,9 +474,8 @@ static void *Thread( void *obj )
 msg_Dbg( p_intf, Exec finished() );
 if (p_mi != NULL)
 {
-#warning BUG!
-/* FIXME: the video window may still be registerd at this point */
-/* See LP#448082 as an example. */
+QMutexLocker locker (lock);
+active = false;
 
 p_intf-p_sys-p_mi = NULL;
 /* Destroy first the main interface because it is connected to some
@@ -555,6 +550,10 @@ static int WindowOpen( vlc_object_t *p_obj )
 return VLC_EGENERIC;
 }
 
+QMutexLocker locker (lock);
+if (unlikely(!active))
+return VLC_EGENERIC;
+
 MainInterface *p_mi = p_intf-p_sys-p_mi;
 msg_Dbg( p_obj, requesting video... );
 
@@ -585,6 +584,13 @@ static int WindowOpen( vlc_object_t *p_obj )
 static int WindowControl( vout_window_t *p_wnd, int i_query, va_list args )
 {
 MainInterface *p_mi = (MainInterface *)p_wnd-sys;
+QMutexLocker locker (lock);
+
+if (unlikely(!active))
+{
+msg_Warn (p_wnd, 

[vlc-commits] commit: vmem: set the video format via callback ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
15:50:10 2010 +0200| [0e4caf6d4a776bd62ac1ff7bee3838ec51f281bb] | committer: 
Rémi Denis-Courmont 

vmem: set the video format via callback

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=0e4caf6d4a776bd62ac1ff7bee3838ec51f281bb
---

 modules/video_output/vmem.c |  189 ---
 1 files changed, 122 insertions(+), 67 deletions(-)

diff --git a/modules/video_output/vmem.c b/modules/video_output/vmem.c
index ea2528a..06ed182 100644
--- a/modules/video_output/vmem.c
+++ b/modules/video_output/vmem.c
@@ -86,14 +86,24 @@ struct picture_sys_t {
 void *id;
 };
 
+/* NOTE: the callback prototypes must match those of LibVLC */
 struct vout_display_sys_t {
 picture_pool_t *pool;
+unsignedcount;
+
+void *opaque;
 void *(*lock)(void *sys, void **plane);
 void (*unlock)(void *sys, void *id, void *const *plane);
 void (*display)(void *sys, void *id);
-void *opaque;
+void (*cleanup)(void *sys);
+
+unsigned pitches[PICTURE_PLANE_MAX];
+unsigned lines[PICTURE_PLANE_MAX];
 };
 
+typedef unsigned (*vlc_format_cb)(void **, char *, unsigned *, unsigned *,
+  unsigned *, unsigned *);
+
 static picture_pool_t *Pool  (vout_display_t *, unsigned);
 static void   Display(vout_display_t *, picture_t *);
 static intControl(vout_display_t *, int, va_list);
@@ -110,25 +120,71 @@ static void   Unlock(picture_t *);
 static int Open(vlc_object_t *object)
 {
 vout_display_t *vd = (vout_display_t *)object;
+vout_display_sys_t *sys = malloc(sizeof(*sys));
+if (unlikely(!sys))
+return VLC_ENOMEM;
 
-/* */
-char *chroma_format = var_InheritString(vd, vmem-chroma);
-const vlc_fourcc_t chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, 
chroma_format);
-free(chroma_format);
-if (!chroma) {
-msg_Err(vd, vmem-chroma should be 4 characters long);
+/* Get the callbacks */
+vlc_format_cb setup = var_InheritAddress(vd, vmem-setup);
+
+sys-lock = var_InheritAddress(vd, vmem-lock);
+if (sys-lock == NULL) {
+msg_Err(vd, missing lock callback);
+free(sys);
 return VLC_EGENERIC;
 }
+sys-unlock = var_InheritAddress(vd, vmem-unlock);
+sys-display = var_InheritAddress(vd, vmem-display);
+sys-cleanup = var_InheritAddress(vd, vmem-cleanup);
+sys-opaque = var_InheritAddress(vd, vmem-data);
+sys-pool = NULL;
 
-/* */
+/* Define the video format */
 video_format_t fmt = vd-fmt;
 
-fmt.i_chroma = chroma;
-fmt.i_width  = var_InheritInteger(vd, vmem-width);
-fmt.i_height = var_InheritInteger(vd, vmem-height);
+if (setup != NULL) {
+char chroma[5];
+
+memcpy(chroma, fmt.i_chroma, 4);
+chroma[4] = '\0';
+memset(sys-pitches, 0, sizeof(sys-pitches));
+memset(sys-lines, 0, sizeof(sys-lines));
+
+sys-count = setup(sys-opaque, chroma, fmt.i_width, fmt.i_height,
+   sys-pitches, sys-lines);
+if (sys-count == 0) {
+msg_Err(vd, video format setup failure (no pictures));
+free(sys);
+return VLC_EGENERIC;
+}
+fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+
+} else {
+char *chroma = var_InheritString(vd, vmem-chroma);
+fmt.i_chroma = vlc_fourcc_GetCodecFromString(VIDEO_ES, chroma);
+free(chroma);
+
+fmt.i_width  = var_InheritInteger(vd, vmem-width);
+fmt.i_height = var_InheritInteger(vd, vmem-height);
+sys-pitches[0] = var_InheritInteger(vd, vmem-pitch);
+sys-lines[0] = fmt.i_height;
+for (size_t i = 1; i  PICTURE_PLANE_MAX; i++)
+{
+sys-pitches[i] = sys-pitches[0];
+sys-lines[i] = sys-lines[0];
+}
+sys-count = 1;
+sys-cleanup = NULL;
+}
+
+if (!fmt.i_chroma) {
+msg_Err(vd, vmem-chroma should be 4 characters long);
+free(sys);
+return VLC_EGENERIC;
+}
 
 /* Define the bitmasks */
-switch (chroma)
+switch (fmt.i_chroma)
 {
 case VLC_CODEC_RGB15:
 fmt.i_rmask = 0x001f;
@@ -154,63 +210,11 @@ static int Open(vlc_object_t *object)
 }
 
 /* */
-vout_display_sys_t *sys;
-vd-sys = sys = calloc(1, sizeof(*sys));
-if (unlikely(!sys))
-return VLC_ENOMEM;
-
-sys-lock = var_InheritAddress(vd, vmem-lock);
-if (sys-lock == NULL) {
-msg_Err(vd, Invalid lock callback);
-free(sys);
-return VLC_EGENERIC;
-}
-sys-unlock = var_InheritAddress(vd, vmem-unlock);
-sys-display = var_InheritAddress(vd, vmem-display);
-sys-opaque = var_InheritAddress(vd, vmem-data);
-
-/* */
-const int pitch = var_InheritInteger(vd, vmem-pitch);
-picture_resource_t rsc;
-rsc.p_sys = malloc(sizeof(*rsc.p_sys));
-if(unlikely(!rsc.p_sys)) {

[vlc-commits] commit: libvlc_set_format_callbacks: dynamic video format selection ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
15:54:13 2010 +0200| [55d09264802ef94593806a206e36fb8b4b8a6977] | committer: 
Rémi Denis-Courmont 

libvlc_set_format_callbacks: dynamic video format selection

LibVLC applications can now select their video memory format when the
video output is created. In particular, this allows preservation of the
original pixel dimensions.

While untested, this should also enable planar YCbCr rendering. Until
this, vmem assumed that all planes had equal pitches, so that subsampled
planes would not really work.

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=55d09264802ef94593806a206e36fb8b4b8a6977
---

 include/vlc/libvlc_media_player.h |   68 ++--
 src/control/media_player.c|   10 +
 2 files changed, 74 insertions(+), 4 deletions(-)

diff --git a/include/vlc/libvlc_media_player.h 
b/include/vlc/libvlc_media_player.h
index 205ffaf..8ac784a 100644
--- a/include/vlc/libvlc_media_player.h
+++ b/include/vlc/libvlc_media_player.h
@@ -260,8 +260,50 @@ typedef void (*libvlc_video_unlock_cb)(void *opaque, void 
*picture,
 typedef void (*libvlc_video_display_cb)(void *opaque, void *picture);
 
 /**
+ * Callback prototype to configure picture buffers format.
+ * This callback gets the format of the video as output by the video decoder
+ * and the chain of video filters (if any). It can opt to change any parameter
+ * as it needs. In that case, LibVLC will attempt to convert the video format
+ * (rescaling and chroma conversion) but these operations can be CPU intensive.
+ *
+ * \param opaque pointer to the private pointer passed to
+ *   libvlc_video_set_callbacks() [IN/OUT]
+ * \param chroma pointer to the 4 bytes video format identifier [IN/OUT]
+ * \param width pointer to the pixel width [IN/OUT]
+ * \param height pointer to the pixel height [IN/OUT]
+ * \param pitches table of scanline pitches in bytes for each pixel plane
+ *(the table is allocated by LibVLC) [OUT]
+ * \param lines table of scanlines count for each plane [OUT]
+ * \return the number of picture buffers allocated, 0 indicates failure
+ *
+ * \note
+ * For each pixels plane, the scanline pitch must be bigger than or equal to
+ * the number of bytes per pixel multiplied by the pixel width.
+ * Similarly, the number of scanlines must be bigger than of equal to
+ * the pixel height.
+ * Furthermore, we recommend that pitches and lines be multiple of 32
+ * to not break assumption that might be made by various optimizations
+ * in the video decoders, video filters and/or video converters.
+ */
+typedef unsigned (*libvlc_video_format_cb)(void **opaque, char *chroma,
+   unsigned *width, unsigned *height,
+   unsigned *pitches,
+   unsigned *lines);
+
+/**
+ * Callback prototype to configure picture buffers format.
+ *
+ * \param opaque private pointer as passed to libvlc_video_set_callbacks()
+ *   (and possibly modified by @ref libvlc_video_format_cb) [IN]
+ */
+typedef void (*libvlc_video_cleanup_cb)(void *opaque);
+
+
+/**
  * Set callbacks and private data to render decoded video to a custom area
- * in memory. Use libvlc_video_set_format() to configure the decoded format.
+ * in memory.
+ * Use libvlc_video_set_format() or libvlc_video_set_format_callbacks()
+ * to configure the decoded format.
  *
  * \param mp the media player
  * \param lock callback to lock video memory (must not be NULL)
@@ -278,16 +320,20 @@ void libvlc_video_set_callbacks( libvlc_media_player_t 
*mp,
  void *opaque );
 
 /**
- * Set decoded video chroma and dimensions. This only works in combination with
- * libvlc_video_set_callbacks().
+ * Set decoded video chroma and dimensions.
+ * This only works in combination with libvlc_video_set_callbacks(),
+ * and is mutually exclusive with libvlc_video_set_format_callbacks().
  *
  * \param mp the media player
  * \param chroma a four-characters string identifying the chroma
- *   (e.g. RV32 or I420)
+ *   (e.g. RV32 or YUYV)
  * \param width pixel width
  * \param height pixel height
  * \param pitch line pitch (in bytes)
  * \version LibVLC 1.1.1 or later
+ * \bug All pixel planes are expected to have the same pitch.
+ * To use the YCbCr color space with chrominance subsampling,
+ * consider using libvlc_video_set_format_callback() instead.
  */
 VLC_PUBLIC_API
 void libvlc_video_set_format( libvlc_media_player_t *mp, const char *chroma,
@@ -295,6 +341,20 @@ void libvlc_video_set_format( libvlc_media_player_t *mp, 
const char *chroma,
   unsigned pitch );
 
 /**
+ * Set decoded video chroma and dimensions. This only works in combination with
+ * libvlc_video_set_callbacks().
+ *
+ * \param mp the media player
+ * \param setup callback to select the video format (cannot be 

[vlc-commits] commit: Eliminate dead code (Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
18:06:58 2010 +0200| [ebb7f49b030c1734de79047da741c8ee28b929d9] | committer: 
Rémi Denis-Courmont 

Eliminate dead code

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=ebb7f49b030c1734de79047da741c8ee28b929d9
---

 modules/gui/qt4/util/qvlcapp.hpp |9 -
 1 files changed, 0 insertions(+), 9 deletions(-)

diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index bfd8a90..ac2aae4 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -53,17 +53,8 @@ public:
  emit app-quitSignal();
 }
 
-#if defined (Q_WS_X11)
- QVLCApp( Display *dp, int  argc, char ** argv )
- : QApplication( dp, argc, argv )
- {
-connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
- }
-#endif
-
 signals:
 void quitSignal();
 
 };
-
 #endif

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Qt4: cosmetic fixes (Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
18:00:38 2010 +0200| [9a0e0822d0c8739e4a984ea5df6b6eb6338d65b6] | committer: 
Rémi Denis-Courmont 

Qt4: cosmetic fixes

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=9a0e0822d0c8739e4a984ea5df6b6eb6338d65b6
---

 modules/gui/qt4/util/qvlcapp.hpp |6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index ac2aae4..c9de99a 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -48,9 +48,9 @@ public:
 
 static void triggerQuit()
 {
- QVLCApp *app = qobject_castQVLCApp*( instance() );
- if ( app )
- emit app-quitSignal();
+QVLCApp *app = qobject_castQVLCApp*( instance() );
+if( app )
+emit app-quitSignal();
 }
 
 signals:

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe (Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
18:08:06 2010 +0200| [1c9669ac53e83beadcd112f909b239a9645b031c] | committer: 
Rémi Denis-Courmont 

Qt4: fix crash regression in 1.1.5 closeAllWindows() not thread-safe

All UI related operations in Qt4 must be done on the UI thread, as
QtGui is not thread-safe internally.

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1c9669ac53e83beadcd112f909b239a9645b031c
---

 modules/gui/qt4/qt4.cpp  |8 ++--
 modules/gui/qt4/util/qvlcapp.hpp |9 -
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/modules/gui/qt4/qt4.cpp b/modules/gui/qt4/qt4.cpp
index 136995c..3f3beec 100644
--- a/modules/gui/qt4/qt4.cpp
+++ b/modules/gui/qt4/qt4.cpp
@@ -392,14 +392,10 @@ static void Close( vlc_object_t *p_this )
 }
 
 /* And quit */
-msg_Dbg( p_intf, Please die, die, die... );
-QApplication::closeAllWindows();
-
-//QApplication::quit();
-
+msg_Dbg( p_this, requesting exit... );
 QVLCApp::triggerQuit();
 
-msg_Dbg( p_intf, Please die, die, die 2... );
+msg_Dbg( p_this, waiting for UI thread... );
 #ifndef Q_WS_MAC
 vlc_join (p_sys-thread, NULL);
 #endif
diff --git a/modules/gui/qt4/util/qvlcapp.hpp b/modules/gui/qt4/util/qvlcapp.hpp
index c9de99a..66fa024 100644
--- a/modules/gui/qt4/util/qvlcapp.hpp
+++ b/modules/gui/qt4/util/qvlcapp.hpp
@@ -40,10 +40,17 @@ class QVLCApp : public QApplication
 {
 Q_OBJECT
 
+private slots:
+void doQuit()
+{
+closeAllWindows();
+quit();
+}
+
 public:
 QVLCApp( int  argc, char ** argv ) : QApplication( argc, argv, true )
 {
-connect( this, SIGNAL(quitSignal()), this, SLOT(quit()) );
+connect( this, SIGNAL(quitSignal()), this, SLOT(doQuit()) );
 }
 
 static void triggerQuit()

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Disable screensaver preemption before destroying the module ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc/vlc-1.1 | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 
21 19:12:32 2010 +0200| [577e2a2b2df314ad60957773ef3a36530d0de30e] | committer: 
Rémi Denis-Courmont 

Disable screensaver preemption before destroying the module
(cherry picked from commit 79bb2f751a8a4a90d56d728828a82a462298bce7)

 http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=577e2a2b2df314ad60957773ef3a36530d0de30e
---

 src/video_output/window.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/video_output/window.c b/src/video_output/window.c
index a8ef797..0350caf 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -99,7 +99,10 @@ void vout_window_Delete(vout_window_t *window)
 
 window_t *w = (window_t *)window;
 if (w-inhibit)
+{
+vlc_inhibit_Set (w-inhibit, false);
 vlc_inhibit_Destroy (w-inhibit);
+}
 
 module_unneed(window, w-module);
 

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Contribs: Win32 targets reordering, based on types ( Jean-Baptiste Kempf )

2010-11-21 Thread git
vlc | branch: master | Jean-Baptiste Kempf j...@videolan.org | Sun Nov 21 
17:01:42 2010 +0100| [8178340c39a53d7737f25f14ad9f965010142ead] | committer: 
Jean-Baptiste Kempf 

Contribs: Win32 targets reordering, based on types

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=8178340c39a53d7737f25f14ad9f965010142ead
---

 extras/contrib/src/Distributions/win32.mak |   16 
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/extras/contrib/src/Distributions/win32.mak 
b/extras/contrib/src/Distributions/win32.mak
index cea543d..08ab5c8 100644
--- a/extras/contrib/src/Distributions/win32.mak
+++ b/extras/contrib/src/Distributions/win32.mak
@@ -1,12 +1,12 @@
 # WIN32 rules
 all: .iconv .intl .freetype .fribidi .zlib \
+.gpg-error .gcrypt .gnutls .pthreads .xml .fontconfig \
 .a52 .mpeg2 .mad .ogg .vorbis .shout .vorbisenc .theora \
-.flac .speex .faad .lame .ebml  .matroska .ffmpeg .dvdcss \
-.live .pthreads .goom2k4 .caca .mod .x264  .xml .twolame \
-.png .gpg-error .gcrypt .gnutls .mpcdec .dirac .schroedinger \
-.dvdnav .dvbpsi .qt4_win32 .schroedinger .SDL_image \
-.libbluray .libupnp \
-.dx_headers .dshow_headers .gecko .dca \
-.lua .tag .fontconfig .portaudio .kate .libass .zvbi \
-.fluid .peflags .cddb .sqlite3 .libprojectM
+.flac .speex .faad .lame .ebml .matroska .ffmpeg \
+.live .goom2k4 .caca .mod .x264 .twolame \
+.png .mpcdec .dirac .schroedinger .dvbpsi \
+.dca .kate .libass .zvbi .fluid .SDL_image  \
+.libbluray .dvdcss .libupnp .dvdnav .qt4_win32 \
+.dx_headers .dshow_headers .portaudio .gecko \
+.lua .tag .peflags .cddb .sqlite3 .libprojectM
 #   .daap .cdio .vcdimager

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: Disable screensaver preemption before destroying the module ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
19:12:32 2010 +0200| [79bb2f751a8a4a90d56d728828a82a462298bce7] | committer: 
Rémi Denis-Courmont 

Disable screensaver preemption before destroying the module

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=79bb2f751a8a4a90d56d728828a82a462298bce7
---

 src/video_output/window.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/src/video_output/window.c b/src/video_output/window.c
index e5f4c25..51f2ce5 100644
--- a/src/video_output/window.c
+++ b/src/video_output/window.c
@@ -106,7 +106,10 @@ void vout_window_Delete(vout_window_t *window)
 
 window_t *w = (window_t *)window;
 if (w-inhibit)
+{
+vlc_inhibit_Set (w-inhibit, false);
 vlc_inhibit_Destroy (w-inhibit);
+}
 
 module_unneed(window, w-module);
 

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: XDG: wait for end of screensaver preemption before cancelling ( Rémi Denis-Courmont )

2010-11-21 Thread git
vlc | branch: master | Rémi Denis-Courmont r...@remlab.net | Sun Nov 21 
19:12:09 2010 +0200| [66456370991dfd488260c1ee497e66304b17ee2d] | committer: 
Rémi Denis-Courmont 

XDG: wait for end of screensaver preemption before cancelling

 http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=66456370991dfd488260c1ee497e66304b17ee2d
---

 modules/misc/inhibit/xdg.c |   48 ++-
 1 files changed, 33 insertions(+), 15 deletions(-)

diff --git a/modules/misc/inhibit/xdg.c b/modules/misc/inhibit/xdg.c
index 01decac..20a24ff 100644
--- a/modules/misc/inhibit/xdg.c
+++ b/modules/misc/inhibit/xdg.c
@@ -25,6 +25,7 @@
 #include vlc_common.h
 #include vlc_plugin.h
 #include vlc_inhibit.h
+#include assert.h
 #include spawn.h
 #include sys/wait.h
 
@@ -43,9 +44,9 @@ vlc_module_end ()
 struct vlc_inhibit_sys
 {
 vlc_thread_t thread;
-vlc_cond_t wait;
+vlc_cond_t update, inactive;
 vlc_mutex_t lock;
-bool suspend;
+bool suspend, suspended;
 };
 
 static void Inhibit (vlc_inhibit_t *ih, bool suspend);
@@ -62,12 +63,15 @@ static int Open (vlc_object_t *obj)
 ih-inhibit = Inhibit;
 
 vlc_mutex_init (p_sys-lock);
-vlc_cond_init (p_sys-wait);
+vlc_cond_init (p_sys-update);
+vlc_cond_init (p_sys-inactive);
 p_sys-suspend = false;
+p_sys-suspended = false;
 
 if (vlc_clone (p_sys-thread, Thread, ih, VLC_THREAD_PRIORITY_LOW))
 {
-vlc_cond_destroy (p_sys-wait);
+vlc_cond_destroy (p_sys-inactive);
+vlc_cond_destroy (p_sys-update);
 vlc_mutex_destroy (p_sys-lock);
 free (p_sys);
 return VLC_ENOMEM;
@@ -80,9 +84,16 @@ static void Close (vlc_object_t *obj)
 vlc_inhibit_t *ih = (vlc_inhibit_t *)obj;
 vlc_inhibit_sys_t *p_sys = ih-p_sys;
 
+/* Make sure xdg-screensaver is gone for good */
+vlc_mutex_lock (p_sys-lock);
+while (p_sys-suspended)
+vlc_cond_wait (p_sys-inactive, p_sys-lock);
+vlc_mutex_unlock (p_sys-lock);
+
 vlc_cancel (p_sys-thread);
 vlc_join (p_sys-thread, NULL);
-vlc_cond_destroy (p_sys-wait);
+vlc_cond_destroy (p_sys-inactive);
+vlc_cond_destroy (p_sys-update);
 vlc_mutex_destroy (p_sys-lock);
 free (p_sys);
 }
@@ -95,7 +106,7 @@ static void Inhibit (vlc_inhibit_t *ih, bool suspend)
  * So we avoid _waiting_ for it unless we really need to (clean up). */
 vlc_mutex_lock (p_sys-lock);
 p_sys-suspend = suspend;
-vlc_cond_signal (p_sys-wait);
+vlc_cond_signal (p_sys-update);
 vlc_mutex_unlock (p_sys-lock);
 }
 
@@ -109,23 +120,23 @@ static void *Thread (void *data)
 
 snprintf (id, sizeof (id), 0x%08PRIx32, ih-window_id);
 
-for (bool suspended = false;;)
+vlc_mutex_lock (p_sys-lock);
+mutex_cleanup_push (p_sys-lock);
+for (;;)
 {   /* TODO: detach the thread, so we don't need one at all time */
-vlc_mutex_lock (p_sys-lock);
-mutex_cleanup_push (p_sys-lock);
-while (suspended == p_sys-suspend)
-vlc_cond_wait (p_sys-wait, p_sys-lock);
-vlc_cleanup_run ();
+while (p_sys-suspended == p_sys-suspend)
+vlc_cond_wait (p_sys-update, p_sys-lock);
 
+int canc = vlc_savecancel ();
 char *argv[4] = {
 (char *)xdg-screensaver,
-(char *)(suspended ? resume : suspend),
+(char *)(p_sys-suspend ? suspend : resume),
 id,
 NULL,
 };
 pid_t pid;
-int canc = vlc_savecancel ();
 
+vlc_mutex_unlock (p_sys-lock);
 if (!posix_spawnp (pid, xdg-screensaver, NULL, NULL, argv, environ))
 {
 int status;
@@ -136,7 +147,14 @@ static void *Thread (void *data)
 }
 else/* We don't handle the error, but busy looping would be worse :( */
 msg_Warn (ih, could not start xdg-screensaver);
-suspended = !suspended;
+
+vlc_mutex_lock (p_sys-lock);
+p_sys-suspended = p_sys-suspend;
+if (!p_sys-suspended)
+vlc_cond_signal (p_sys-inactive);
 vlc_restorecancel (canc);
 }
+
+vlc_cleanup_pop ();
+assert (0);
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits


[vlc-commits] commit: skins2(Win32): remove an unneeded WS_EX_TOOLWINDOW option ( Erwan Tulou )

2010-11-21 Thread git
vlc/vlc-1.1 | branch: master | Erwan Tulou erwa...@videolan.org | Fri Nov 19 
00:47:26 2010 +0100| [6c437cbfd652d76e1335365e6ee447c51a659af8] | committer: 
Erwan Tulou 

skins2(Win32): remove an unneeded WS_EX_TOOLWINDOW option

This option prevents windows from being displayed in the alt-tab list.
This should fix trac #4343 for Vista and Win7  (to be tested)
(cherry picked from commit 6c74b935f99b9d46bb92b3ba01bfbaf4c7d52276)

 http://git.videolan.org/gitweb.cgi/vlc/vlc-1.1.git/?a=commit;h=6c437cbfd652d76e1335365e6ee447c51a659af8
---

 modules/gui/skins2/win32/win32_window.cpp |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/modules/gui/skins2/win32/win32_window.cpp 
b/modules/gui/skins2/win32/win32_window.cpp
index d71c74c..b3d707c 100644
--- a/modules/gui/skins2/win32/win32_window.cpp
+++ b/modules/gui/skins2/win32/win32_window.cpp
@@ -75,7 +75,7 @@ Win32Window::Win32Window( intf_thread_t *pIntf, GenericWindow 
rWindow,
 {
 // top-level window (owned by the root window)
 HWND hWnd_owner = pFactory-getParentWindow();
-m_hWnd = CreateWindowEx( WS_EX_TOOLWINDOW, SkinWindowClass,
+m_hWnd = CreateWindowEx( 0, SkinWindowClass,
 default name, WS_POPUP | WS_CLIPCHILDREN,
 0, 0, 0, 0, hWnd_owner, 0, hInst, NULL );
 }

___
vlc-commits mailing list
vlc-commits@videolan.org
http://mailman.videolan.org/listinfo/vlc-commits