Index: libvo/vo_direct3d.c =================================================================== --- libvo/vo_direct3d.c (revision 28111) +++ libvo/vo_direct3d.c (working copy) @@ -127,40 +127,65 @@ priv->fs_panscan_rect.right = priv->src_width; priv->fs_panscan_rect.top = 0; priv->fs_panscan_rect.bottom = priv->src_height; - if (!vo_fs) return; + if (!vo_fs && WinID < 0) return; // adjust for fullscreen aspect and panscan - aspect(&scaled_width, &scaled_height, A_ZOOM); - panscan_calc(); - scaled_width += vo_panscan_x; - scaled_height += vo_panscan_y; + if (vo_fs) + { + aspect(&scaled_width, &scaled_height, A_ZOOM); + panscan_calc(); - // note: border is rounded to a multiple of two since at least - // ATI drivers can not handle odd values with YV12 input - if (scaled_width > vo_dwidth) { - int border = priv->src_width * (scaled_width - vo_dwidth) / scaled_width; - border = (border / 2 + 1) & ~1; - priv->fs_panscan_rect.left = border; - priv->fs_panscan_rect.right = priv->src_width - border; - } else { - priv->fs_movie_rect.left = (vo_dwidth - scaled_width) / 2; - priv->fs_movie_rect.right = priv->fs_movie_rect.left + scaled_width; + scaled_width += vo_panscan_x; + scaled_height += vo_panscan_y; + + // note: border is rounded to a multiple of two since at least + // ATI drivers can not handle odd values with YV12 input + if (scaled_width > vo_dwidth) { + int border = priv->src_width * (scaled_width - vo_dwidth) / scaled_width; + border = (border / 2 + 1) & ~1; + priv->fs_panscan_rect.left = border; + priv->fs_panscan_rect.right = priv->src_width - border; + } else { + priv->fs_movie_rect.left = (vo_dwidth - scaled_width) / 2; + priv->fs_movie_rect.right = priv->fs_movie_rect.left + scaled_width; + } + if (scaled_height > vo_dheight) { + int border = priv->src_height * (scaled_height - vo_dheight) / scaled_height; + border = (border / 2 + 1) & ~1; + priv->fs_panscan_rect.top = border; + priv->fs_panscan_rect.bottom = priv->src_height - border; + } else { + priv->fs_movie_rect.top = (vo_dheight - scaled_height) / 2; + priv->fs_movie_rect.bottom = priv->fs_movie_rect.top + scaled_height; + } + + mp_msg(MSGT_VO, MSGL_ERR, + "Fullscreen Movie Rect: t: %ld, l: %ld, r: %ld, b:%ld\r\n", + priv->fs_movie_rect.top, priv->fs_movie_rect.left, + priv->fs_movie_rect.right, priv->fs_movie_rect.bottom); } - if (scaled_height > vo_dheight) { - int border = priv->src_height * (scaled_height - vo_dheight) / scaled_height; - border = (border / 2 + 1) & ~1; - priv->fs_panscan_rect.top = border; - priv->fs_panscan_rect.bottom = priv->src_height - border; - } else { - priv->fs_movie_rect.top = (vo_dheight - scaled_height) / 2; - priv->fs_movie_rect.bottom = priv->fs_movie_rect.top + scaled_height; + + /* Center the movie if we're not fullscreen, but we're in slave mode. */ + if (!vo_fs && WinID >= 0) + { + int fit_width, fit_height; + float m_asp = (float) priv->src_width / (float) priv->src_height; + float w_asp = (float) vo_dwidth / (float) vo_dheight; + + /* Determine where the black bars are required (left/right or up/down) */ + if (w_asp > m_asp) + { + fit_width = (float) vo_dheight * (float) m_asp; + priv->fs_movie_rect.left += (vo_dwidth - fit_width ) / 2; + priv->fs_movie_rect.right -= (vo_dwidth - fit_width ) / 2; + } else if (w_asp < m_asp) + { + fit_height = (float) vo_dwidth / (float) m_asp; + priv->fs_movie_rect.top += (vo_dheight - fit_height ) / 2; + priv->fs_movie_rect.bottom -= (vo_dheight - fit_height ) / 2; + } } - mp_msg(MSGT_VO, MSGL_V, - "Fullscreen Movie Rect: t: %ld, l: %ld, r: %ld, b:%ld\r\n", - priv->fs_movie_rect.top, priv->fs_movie_rect.left, - priv->fs_movie_rect.right, priv->fs_movie_rect.bottom); - /* The backbuffer should be cleared before next StretchRect. This is * necessary because our new draw area could be smaller than the * previous one used by StretchRect and without it, leftovers from the