]> git.sesse.net Git - vlc/blobdiff - modules/video_output/wrapper.c
Move x11-display config to core
[vlc] / modules / video_output / wrapper.c
index caffae2102b3b2c2aad2b7708b18ebca5e710440..baf4526f3fd0296062646b29a480811a3fc3d51d 100644 (file)
@@ -53,16 +53,25 @@ DECLARE_OPEN(xcb_xv);
 DECLARE_OPEN(dummy);
 DECLARE_OPEN(fb);
 DECLARE_OPEN(directfb);
+DECLARE_OPEN(yuv);
+DECLARE_OPEN(snapshot);
+DECLARE_OPEN(vmem);
+DECLARE_OPEN(direct3d_xp);
+DECLARE_OPEN(direct3d_vista);
+DECLARE_OPEN(glwin32);
 
 #undef DECLARE_OPEN
 
-#define DECLARE_MODULE(name, priority)                  \
-    set_description( "Video display "#name" wrapper" )  \
-    set_shortname( "Video display "#name" wrapper" )    \
+#define DECLARE_MODULE_EXT(name, module, priority)      \
+    set_description( "Video display "#module" wrapper" )  \
+    set_shortname( "Video display "#module" wrapper" )    \
     set_capability( "video output", priority )          \
-    set_callbacks( Open##name, Close )                  \
+    set_callbacks( Open##module, Close )                \
     add_shortcut( #name )
 
+#define DECLARE_MODULE(name, priority)                  \
+    DECLARE_MODULE_EXT(name, name, priority)
+
 vlc_module_begin()
     set_category( CAT_VIDEO )
     set_subcategory( SUBCAT_VIDEO_VOUT )
@@ -90,6 +99,24 @@ vlc_module_begin()
     add_submodule()
     DECLARE_MODULE(directfb, 60)
 
+    add_submodule()
+    DECLARE_MODULE(yuv, 0)
+
+    add_submodule()
+    DECLARE_MODULE(snapshot, 0)
+
+    add_submodule()
+    DECLARE_MODULE(vmem, 0)
+
+    add_submodule()
+    DECLARE_MODULE_EXT(direct3d, direct3d_vista, 150)
+
+    add_submodule()
+    DECLARE_MODULE_EXT(direct3d, direct3d_xp, 70)
+
+    add_submodule()
+    DECLARE_MODULE(glwin32, 20)
+
 vlc_module_end()
 
 #undef DECLARE_MODULE
@@ -98,6 +125,7 @@ vlc_module_end()
  *
  *****************************************************************************/
 struct vout_sys_t {
+    const char     *name;
     char           *title;
     vout_display_t *vd;
     bool           use_dr;
@@ -119,6 +147,10 @@ static void Display(vout_thread_t *, picture_t *);
 static void VoutGetDisplayCfg(vout_thread_t *,
                               vout_display_cfg_t *, const char *title);
 
+static int  Forward(vlc_object_t *, char const *,
+                    vlc_value_t, vlc_value_t, void *);
+
+
 /*****************************************************************************
  *
  *****************************************************************************/
@@ -134,6 +166,7 @@ static int Open(vlc_object_t *object, const char *module)
     if (!sys)
         return VLC_ENOMEM;
 
+    sys->name = module;
     sys->title = var_CreateGetNonEmptyString(vout, "video-title");
 
     /* */
@@ -160,6 +193,12 @@ static int Open(vlc_object_t *object, const char *module)
         return VLC_EGENERIC;
     }
 
+    /* */
+    if (!strcmp(sys->name, "direct3d_xp") || !strcmp(sys->name, "direct3d_vista")) {
+        var_Create(vout, "direct3d-desktop", VLC_VAR_BOOL|VLC_VAR_DOINHERIT);
+        var_AddCallback(vout, "direct3d-desktop", Forward, NULL);
+    }
+
     /* */
     vout->pf_init    = Init;
     vout->pf_end     = End;
@@ -180,8 +219,12 @@ static void Close(vlc_object_t *object)
     vout_thread_t *vout = (vout_thread_t *)object;
     vout_sys_t *sys = vout->p_sys;
 
-    if (sys->vd)
-        vout_DeleteDisplay(sys->vd, NULL);
+    /* */
+    if (!strcmp(sys->name, "direct3d_xp") || !strcmp(sys->name, "direct3d_vista")) {
+        var_DelCallback(vout, "direct3d-desktop", Forward, NULL);
+    }
+
+    vout_DeleteDisplay(sys->vd, NULL);
     free(sys->title);
     free(sys );
 }
@@ -299,7 +342,11 @@ static void End(vout_thread_t *vout)
         if (!sys->use_dr)
             free(picture->p_data_orig);
         free(picture->p_sys);
+
+        picture->i_status = FREE_PICTURE;
     }
+    if (sys->use_dr && vout_AreDisplayPicturesInvalid(sys->vd))
+        vout_ManageDisplay(sys->vd, true);
 }
 
 /*****************************************************************************
@@ -390,8 +437,7 @@ static int Manage(vout_thread_t *vout)
     if (sys->use_dr && vout_AreDisplayPicturesInvalid(vd)) {
         vout->i_changes |= VOUT_PICTURE_BUFFERS_CHANGE;
     }
-
-    vout_ManageDisplay(vd);
+    vout_ManageDisplay(vd, !sys->use_dr);
     return VLC_SUCCESS;
 }
 
@@ -404,21 +450,15 @@ static void Render(vout_thread_t *vout, picture_t *picture)
     vout_display_t *vd = sys->vd;
 
     assert(sys->use_dr || !picture->p_sys->direct);
+    assert(vout_IsDisplayFiltered(vd) == !sys->use_dr);
 
     if (sys->use_dr) {
-        assert(!vout_IsDisplayFiltered(vd));
         assert(picture->p_sys->direct);
-
         vout_display_Prepare(vd, picture->p_sys->direct);
     } else {
-        picture_t *filtered = vout_FilterDisplay(vd, picture);
-        if (filtered) {
-            picture_t *direct = picture->p_sys->direct = vout_display_Get(vd);
-            if (direct) {
-                picture_Copy(direct, filtered);
-                vout_display_Prepare(vd, direct);
-            }
-            picture_Release(filtered);
+        picture_t *direct = picture->p_sys->direct = vout_FilterDisplay(vd, picture);
+        if (direct) {
+            vout_display_Prepare(vd, direct);
         }
     }
 }
@@ -475,3 +515,13 @@ static void VoutGetDisplayCfg(vout_thread_t *vout, vout_display_cfg_t *cfg, cons
         cfg->align.horizontal = VOUT_DISPLAY_ALIGN_BOTTOM;
 }
 
+static int Forward(vlc_object_t *object, char const *var,
+                   vlc_value_t oldval, vlc_value_t newval, void *data)
+{
+    vout_thread_t *vout = (vout_thread_t*)object;
+
+    VLC_UNUSED(oldval);
+    VLC_UNUSED(data);
+    return var_Set(vout->p_sys->vd, var, newval);
+}
+