]> git.sesse.net Git - vlc/blobdiff - src/video_output/vout_wrapper.c
interlacing: fix overlapping memory copy
[vlc] / src / video_output / vout_wrapper.c
index 27b4e735412c11177e061ce14131017ce6012306..d172bcca0bfdacc9ebc5c7979a1f10850e7092c9 100644 (file)
@@ -1,24 +1,24 @@
 /*****************************************************************************
- * vout_display.c: "vout display" -> "video output" wrapper
+ * vout_wrapper.c: "vout display" -> "video output" wrapper
  *****************************************************************************
  * Copyright (C) 2009 Laurent Aimar
  * $Id$
  *
  * Authors: Laurent Aimar <fenrir _AT_ videolan _DOT_ org>
  *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or
  * (at your option) any later version.
  *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
  *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
@@ -39,7 +39,7 @@
 /*****************************************************************************
  * Local prototypes
  *****************************************************************************/
-#ifdef WIN32
+#ifdef _WIN32
 static int  Forward(vlc_object_t *, char const *,
                     vlc_value_t, vlc_value_t, void *);
 #endif
@@ -54,7 +54,7 @@ int vout_OpenWrapper(vout_thread_t *vout,
     msg_Dbg(vout, "Opening vout display wrapper");
 
     /* */
-    sys->display.title = var_CreateGetNonEmptyString(vout, "video-title");
+    sys->display.title = var_InheritString(vout, "video-title");
 
     /* */
     const mtime_t double_click_timeout = 300000;
@@ -73,9 +73,7 @@ int vout_OpenWrapper(vout_thread_t *vout,
     }
 
     /* */
-#ifdef WIN32
-    var_Create(vout, "direct3d-desktop", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
-    var_AddCallback(vout, "direct3d-desktop", Forward, NULL);
+#ifdef _WIN32
     var_Create(vout, "video-wallpaper", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
     var_AddCallback(vout, "video-wallpaper", Forward, NULL);
 #endif
@@ -93,8 +91,7 @@ void vout_CloseWrapper(vout_thread_t *vout, vout_display_state_t *state)
 {
     vout_thread_sys_t *sys = vout->p;
 
-#ifdef WIN32
-    var_DelCallback(vout, "direct3d-desktop", Forward, NULL);
+#ifdef _WIN32
     var_DelCallback(vout, "video-wallpaper", Forward, NULL);
 #endif
     sys->decoder_pool = NULL; /* FIXME remove */
@@ -116,16 +113,9 @@ static void NoDrInit(vout_thread_t *vout)
     if (sys->display.use_dr)
         sys->display_pool = vout_display_Pool(sys->display.vd, 3);
     else
-        //sys->display_pool = picture_pool_Reserve(sys->decoder_pool, DISPLAY_PICTURE_COUNT);
-        sys->display_pool = picture_pool_NewFromFormat(&sys->display.vd->source, DISPLAY_PICTURE_COUNT);
+        sys->display_pool = NULL;
 }
-static void NoDrClean(vout_thread_t *vout)
-{
-    vout_thread_sys_t *sys = vout->p;
 
-    if (!sys->display.use_dr)
-        picture_pool_Delete(sys->display_pool);
-}
 int vout_InitWrapper(vout_thread_t *vout)
 {
     vout_thread_sys_t *sys = vout->p;
@@ -153,6 +143,8 @@ int vout_InitWrapper(vout_thread_t *vout)
             picture_pool_NewFromFormat(&source,
                                        __MAX(VOUT_MAX_PICTURES,
                                              reserved_picture + decoder_picture - DISPLAY_PICTURE_COUNT));
+        if (!sys->decoder_pool)
+            return VLC_EGENERIC;
         if (allow_dr) {
             msg_Warn(vout, "Not enough direct buffers, using system memory");
             sys->dpb_size = 0;
@@ -175,12 +167,10 @@ void vout_EndWrapper(vout_thread_t *vout)
 
     assert(!sys->display.filtered);
     if (sys->private_pool)
-        picture_pool_Delete(sys->private_pool);
+        picture_pool_Release(sys->private_pool);
 
-    if (sys->decoder_pool != sys->display_pool) {
-        NoDrClean(vout);
-        picture_pool_Delete(sys->decoder_pool);
-    }
+    if (sys->decoder_pool != sys->display_pool)
+        picture_pool_Release(sys->decoder_pool);
 }
 
 /*****************************************************************************
@@ -191,18 +181,16 @@ void vout_ManageWrapper(vout_thread_t *vout)
     vout_thread_sys_t *sys = vout->p;
     vout_display_t *vd = sys->display.vd;
 
-    bool reset_display_pool = sys->display.use_dr && vout_AreDisplayPicturesInvalid(vd);
-    vout_ManageDisplay(vd, !sys->display.use_dr || reset_display_pool);
+    bool reset_display_pool = vout_AreDisplayPicturesInvalid(vd);
+    reset_display_pool |= vout_ManageDisplay(vd, !sys->display.use_dr || reset_display_pool);
 
     if (reset_display_pool) {
-        NoDrClean(vout);
-
         sys->display.use_dr = !vout_IsDisplayFiltered(vd);
         NoDrInit(vout);
     }
 }
 
-#ifdef WIN32
+#ifdef _WIN32
 static int Forward(vlc_object_t *object, char const *var,
                    vlc_value_t oldval, vlc_value_t newval, void *data)
 {