aboutsummaryrefslogtreecommitdiffhomepage
path: root/libvo
diff options
context:
space:
mode:
authorGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-17 11:59:49 +0000
committerGravatar reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2>2009-02-17 11:59:49 +0000
commit01ef7e45790e1f0dd2277f73c583c9a503b2b6bd (patch)
treee513cf8669a9f80b1a9e77fe4e41b449d6f5a1ac /libvo
parenta845504a5ee6fd7e545f028cf84e1e503da574c1 (diff)
Extend calc_src_dst_rects to also calculate the border values needed for
correctly placed dvdnav highlights, and fix direct3d and vdpau accordingly. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28633 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r--libvo/video_out.c12
-rw-r--r--libvo/video_out.h3
-rw-r--r--libvo/vo_direct3d.c10
-rw-r--r--libvo/vo_vdpau.c9
-rw-r--r--libvo/vo_xv.c2
-rw-r--r--libvo/vo_xvmc.c2
6 files changed, 30 insertions, 8 deletions
diff --git a/libvo/video_out.c b/libvo/video_out.c
index a444e680e4..945759f0a8 100644
--- a/libvo/video_out.c
+++ b/libvo/video_out.c
@@ -387,8 +387,11 @@ static void src_dst_split_scaling(int src_size, int dst_size, int scaled_src_siz
* Can be extended to take future cropping support into account.
*
* \param crop specifies the cropping border size in the left, right, top and bottom members, may be NULL
+ * \param borders the border values as e.g. EOSD (ASS) and properly placed DVD highlight support requires,
+ * may be NULL and only left and top are currently valid.
*/
-void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop) {
+void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
+ struct vo_rect *borders, const struct vo_rect *crop) {
static const struct vo_rect no_crop = {0, 0, 0, 0, 0, 0};
int scaled_width = 0;
int scaled_height = 0;
@@ -401,11 +404,18 @@ void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, stru
dst->top = 0; dst->bottom = vo_dheight;
src->left = 0; src->right = src_width;
src->top = 0; src->bottom = src_height;
+ if (borders) {
+ borders->left = 0; borders->top = 0;
+ }
if (vo_fs) {
aspect(&scaled_width, &scaled_height, A_ZOOM);
panscan_calc();
scaled_width += vo_panscan_x;
scaled_height += vo_panscan_y;
+ if (borders) {
+ borders->left = (vo_dwidth - scaled_width ) / 2;
+ borders->top = (vo_dheight - scaled_height) / 2;
+ }
src_dst_split_scaling(src_width, vo_dwidth, scaled_width,
&src->left, &src->right, &dst->left, &dst->right);
src_dst_split_scaling(src_height, vo_dheight, scaled_height,
diff --git a/libvo/video_out.h b/libvo/video_out.h
index 61588f9efb..7c56231d41 100644
--- a/libvo/video_out.h
+++ b/libvo/video_out.h
@@ -272,6 +272,7 @@ int lookup_keymap_table(const struct keymap *map, int key);
struct vo_rect {
int left, right, top, bottom, width, height;
};
-void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst, const struct vo_rect *crop);
+void calc_src_dst_rects(int src_width, int src_height, struct vo_rect *src, struct vo_rect *dst,
+ struct vo_rect *borders, const struct vo_rect *crop);
#endif /* MPLAYER_VIDEO_OUT_H */
diff --git a/libvo/vo_direct3d.c b/libvo/vo_direct3d.c
index c2955f2d44..bfeb82e562 100644
--- a/libvo/vo_direct3d.c
+++ b/libvo/vo_direct3d.c
@@ -63,6 +63,8 @@ static struct global_priv {
fullscreen */
int src_width; /**< Source (movie) width */
int src_height; /**< Source (movie) heigth */
+ int border_x; /**< horizontal border value for OSD */
+ int border_y; /**< vertical border value for OSD */
D3DFORMAT movie_src_fmt; /**< Movie colorspace format (depends on
the movie's codec) */
@@ -149,7 +151,8 @@ static void calc_fs_rect(void)
{
struct vo_rect src_rect;
struct vo_rect dst_rect;
- calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, NULL);
+ struct vo_rect borders;
+ calc_src_dst_rects(priv->src_width, priv->src_height, &src_rect, &dst_rect, &borders, NULL);
priv->fs_movie_rect.left = dst_rect.left;
priv->fs_movie_rect.right = dst_rect.right;
@@ -159,6 +162,8 @@ static void calc_fs_rect(void)
priv->fs_panscan_rect.right = src_rect.right;
priv->fs_panscan_rect.top = src_rect.top;
priv->fs_panscan_rect.bottom = src_rect.bottom;
+ priv->border_x = borders.left;
+ priv->border_y = borders.top;
mp_msg(MSGT_VO, MSGL_V,
"<vo_direct3d>Fullscreen movie rectangle: t: %ld, l: %ld, r: %ld, b:%ld\n",
@@ -1027,7 +1032,8 @@ static void draw_osd(void)
/* required for if subs are in the boarder region */
priv->is_clear_needed = 1;
- vo_draw_text(priv->osd_width, priv->osd_height, draw_alpha);
+ vo_draw_text_ext(priv->osd_width, priv->osd_height, priv->border_x, priv->border_y,
+ priv->border_x, priv->border_y, priv->src_width, priv->src_height, draw_alpha);
if (!priv->device_texture_sys)
{
diff --git a/libvo/vo_vdpau.c b/libvo/vo_vdpau.c
index 46e897615c..368f889c6b 100644
--- a/libvo/vo_vdpau.c
+++ b/libvo/vo_vdpau.c
@@ -138,6 +138,7 @@ static int decoder_max_refs;
static VdpRect src_rect_vid;
static VdpRect out_rect_vid;
+static int border_x, border_y;
static struct vdpau_render_state surface_render[MAX_VIDEO_SURFACES];
static int surface_num;
@@ -184,7 +185,8 @@ static void resize(void)
int i;
struct vo_rect src_rect;
struct vo_rect dst_rect;
- calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, NULL);
+ struct vo_rect borders;
+ calc_src_dst_rects(vid_width, vid_height, &src_rect, &dst_rect, &borders, NULL);
out_rect_vid.x0 = dst_rect.left;
out_rect_vid.x1 = dst_rect.right;
out_rect_vid.y0 = dst_rect.top;
@@ -193,6 +195,8 @@ static void resize(void)
src_rect_vid.x1 = src_rect.right;
src_rect_vid.y0 = src_rect.top;
src_rect_vid.y1 = src_rect.bottom;
+ border_x = borders.left;
+ border_y = borders.top;
#ifdef CONFIG_FREETYPE
// adjust font size to display size
force_load_font = 1;
@@ -522,7 +526,8 @@ static void draw_osd(void)
{
mp_msg(MSGT_VO, MSGL_DBG2, "DRAW_OSD\n");
- vo_draw_text(vo_dwidth, vo_dheight, draw_osd_I8A8);
+ vo_draw_text_ext(vo_dwidth, vo_dheight, border_x, border_y, border_x, border_y,
+ vid_width, vid_height, draw_osd_I8A8);
}
static void flip_page(void)
diff --git a/libvo/vo_xv.c b/libvo/vo_xv.c
index ddde21a402..47174d41a0 100644
--- a/libvo/vo_xv.c
+++ b/libvo/vo_xv.c
@@ -161,7 +161,7 @@ static void deallocate_xvimage(int foo);
static void resize(void)
{
- calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
+ calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
vo_x11_clearwindow_part(mDisplay, vo_window, dst_rect.width, dst_rect.height, 1);
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);
}
diff --git a/libvo/vo_xvmc.c b/libvo/vo_xvmc.c
index ac06f668ad..9e84f4e751 100644
--- a/libvo/vo_xvmc.c
+++ b/libvo/vo_xvmc.c
@@ -943,7 +943,7 @@ int i;
if(p_render_surface == NULL)
return;
- calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL);
+ calc_src_dst_rects(image_width, image_height, &src_rect, &dst_rect, NULL, NULL);
if(draw_ck)
vo_xv_draw_colorkey(dst_rect.left, dst_rect.top, dst_rect.width, dst_rect.height);