[vlc-devel] commit: XCB/X11: handle scaling, crop and A/R ( Rémi Denis-Courmont )

git version control git at videolan.org
Thu May 7 22:59:22 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Thu May  7 23:22:33 2009 +0300| [305b0ad354d4696a236dd1f2c82567b3e80f605b] | committer: Rémi Denis-Courmont 

XCB/X11: handle scaling, crop and A/R

(Crop is currently dysfunctional, picture offset are missing)

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

 modules/video_output/xcb/common.c  |   43 ++++++++++++++++++++++++++++++++++++
 modules/video_output/xcb/x11.c     |    2 +
 modules/video_output/xcb/xcb_vlc.h |    1 +
 3 files changed, 46 insertions(+), 0 deletions(-)

diff --git a/modules/video_output/xcb/common.c b/modules/video_output/xcb/common.c
index 6bfac3f..7e5f4c3 100644
--- a/modules/video_output/xcb/common.c
+++ b/modules/video_output/xcb/common.c
@@ -226,3 +226,46 @@ void PictureFree (picture_t *pic, xcb_connection_t *conn)
     }
     shmdt (pic->p->p_pixels);
 }
+
+/**
+ * Video output thread management stuff.
+ * FIXME: Much of this should move to core
+ */
+void CommonManage (vout_thread_t *vout)
+{
+    if (vout->i_changes & VOUT_SCALE_CHANGE)
+    {
+        vout->b_autoscale = var_GetBool (vout, "autoscale");
+        vout->i_zoom = ZOOM_FP_FACTOR;
+        vout->i_changes &= ~VOUT_SCALE_CHANGE;
+        vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
+
+    if (vout->i_changes & VOUT_ZOOM_CHANGE)
+    {
+        vout->b_autoscale = false;
+        vout->i_zoom = var_GetFloat (vout, "scale") * ZOOM_FP_FACTOR;
+        vout->i_changes &= ~VOUT_ZOOM_CHANGE;
+        vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
+
+    if (vout->i_changes & VOUT_CROP_CHANGE)
+    {
+        vout->fmt_out.i_x_offset = vout->fmt_in.i_x_offset;
+        vout->fmt_out.i_y_offset = vout->fmt_in.i_y_offset;
+        vout->fmt_out.i_visible_width = vout->fmt_in.i_visible_width;
+        vout->fmt_out.i_visible_height = vout->fmt_in.i_visible_height;
+        vout->i_changes &= ~VOUT_CROP_CHANGE;
+        vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
+
+    if (vout->i_changes & VOUT_ASPECT_CHANGE)
+    {
+        vout->fmt_out.i_aspect = vout->fmt_in.i_aspect;
+        vout->fmt_out.i_sar_num = vout->fmt_in.i_sar_num;
+        vout->fmt_out.i_sar_den = vout->fmt_in.i_sar_den;
+        vout->output.i_aspect = vout->fmt_in.i_aspect;
+        vout->i_changes &= ~VOUT_ASPECT_CHANGE;
+        vout->i_changes |= VOUT_SIZE_CHANGE;
+    }
+}
diff --git a/modules/video_output/xcb/x11.c b/modules/video_output/xcb/x11.c
index 6d1bea4..8e09880 100644
--- a/modules/video_output/xcb/x11.c
+++ b/modules/video_output/xcb/x11.c
@@ -408,6 +408,8 @@ static int Manage (vout_thread_t *vout)
         msg_Err (vout, "X server failure");
         return VLC_EGENERIC;
     }
+
+    CommonManage (vout); /* FIXME: <-- move that to core */
     return VLC_SUCCESS;
 }
 
diff --git a/modules/video_output/xcb/xcb_vlc.h b/modules/video_output/xcb/xcb_vlc.h
index eed941d..aad0358 100644
--- a/modules/video_output/xcb/xcb_vlc.h
+++ b/modules/video_output/xcb/xcb_vlc.h
@@ -51,3 +51,4 @@ int GetWindowSize (struct vout_window_t *wnd, xcb_connection_t *conn,
                    unsigned *restrict width, unsigned *restrict height);
 int PictureAlloc (vout_thread_t *, picture_t *, size_t, xcb_connection_t *);
 void PictureFree (picture_t *pic, xcb_connection_t *conn);
+void CommonManage (vout_thread_t *);




More information about the vlc-devel mailing list