summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMiguel Freitas <miguelfreitas@users.sourceforge.net>2005-09-11 13:37:31 +0000
committerMiguel Freitas <miguelfreitas@users.sourceforge.net>2005-09-11 13:37:31 +0000
commit44b9e700ca169719aee8f3282f62dd531d86bde5 (patch)
treecc005132677a07ffe29b4f85384ea6e6247a71ac /src
parentc5505b0d78be9e0930a18c2522eac1f227607650 (diff)
downloadxine-lib-44b9e700ca169719aee8f3282f62dd531d86bde5.tar.gz
xine-lib-44b9e700ca169719aee8f3282f62dd531d86bde5.tar.bz2
fix destination aspect ratio and add support for non 4/3 displays
patch by Jason Tackaberry CVS patchset: 7724 CVS date: 2005/09/11 13:37:31
Diffstat (limited to 'src')
-rw-r--r--src/post/planar/expand.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/post/planar/expand.c b/src/post/planar/expand.c
index 9e9a51515..5326e055c 100644
--- a/src/post/planar/expand.c
+++ b/src/post/planar/expand.c
@@ -62,6 +62,7 @@ void *expand_init_plugin(xine_t *xine, void *);
typedef struct expand_parameters_s {
int enable_automatic_shift;
int overlay_y_offset;
+ double aspect;
} expand_parameters_t;
START_PARAM_DESCR(expand_parameters_t)
@@ -69,6 +70,8 @@ PARAM_ITEM(POST_PARAM_TYPE_BOOL, enable_automatic_shift, NULL, 0, 1, 0,
"enable automatic overlay shifting")
PARAM_ITEM(POST_PARAM_TYPE_INT, overlay_y_offset, NULL, -500, 500, 0,
"manually shift the overlay vertically")
+PARAM_ITEM(POST_PARAM_TYPE_DOUBLE, aspect, NULL, 1.0, 3.5, 0,
+ "target aspect ratio")
END_PARAM_DESCR(expand_param_descr)
typedef struct post_expand_s {
@@ -78,6 +81,7 @@ typedef struct post_expand_s {
int enable_automatic_shift;
int overlay_y_offset;
+ double aspect;
int top_bar_height;
} post_expand_t;
@@ -147,6 +151,7 @@ static post_plugin_t *expand_open_plugin(post_class_t *class_gen, int inputs,
this->enable_automatic_shift = 0;
this->overlay_y_offset = 0;
+ this->aspect = 4.0 / 3.0;
port = _x_post_intercept_video_port(&this->post, video_target[0], &input, &output);
port->new_port.get_frame = expand_get_frame;
@@ -203,9 +208,10 @@ static int expand_set_parameters(xine_post_t *this_gen, void *param_gen)
{
post_expand_t *this = (post_expand_t *)this_gen;
expand_parameters_t *param = (expand_parameters_t *)param_gen;
-
+
this->enable_automatic_shift = param->enable_automatic_shift;
this->overlay_y_offset = param->overlay_y_offset;
+ this->aspect = param->aspect;
return 1;
}
@@ -216,18 +222,20 @@ static int expand_get_parameters(xine_post_t *this_gen, void *param_gen)
param->enable_automatic_shift = this->enable_automatic_shift;
param->overlay_y_offset = this->overlay_y_offset;
+ param->aspect = this->aspect;
return 1;
}
static char *expand_get_help(void) {
return _("The expand plugin is meant to take frames of arbitrary aspect ratio and "
- "converts them to 4:3 aspect by adding black bars on the top and bottom "
- "of the frame. This allows us to shift overlays down into the black area "
- "so they don't cover the image.\n"
+ "converts them to a different aspect (4:3 by default) by adding black bars "
+ "on the top and bottom of the frame. This allows us to shift overlays "
+ "down into the black area so they don't cover the image.\n"
"\n"
"Parameters (FIXME: better help)\n"
" Enable_automatic_shift: Enable automatic overlay shifting\n"
" Overlay_y_offset: Manually shift the overlay vertically\n"
+ " aspect: The target aspect ratio (default 4:3)\n"
"\n"
);
}
@@ -248,7 +256,7 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width,
if (ratio <= 0.0) ratio = (double)width / (double)height;
/* Calculate height of expanded frame */
- new_height = (double)height * ratio * 3.0 / 4.0;
+ new_height = (double)height * ratio / this->aspect;
new_height = (new_height + 1) & ~1;
top_bar_height = (new_height - height) / 2;
top_bar_height = (top_bar_height + 1) & ~1;
@@ -258,7 +266,7 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width,
if (new_height > height &&
(format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) {
frame = port->original_port->get_frame(port->original_port,
- width, new_height, 4.0 / 3.0, format, flags);
+ width, new_height, this->aspect, format, flags);
_x_post_inc_usage(port);
frame = _x_post_intercept_video_frame(frame, port);
@@ -267,7 +275,7 @@ static vo_frame_t *expand_get_frame(xine_video_port_t *port_gen, uint32_t width,
* from the decoders by modifying the pointers to and
* the size of the drawing area */
frame->height = height;
- frame->ratio = ratio;
+ frame->ratio = this->aspect;
switch (format) {
case XINE_IMGFMT_YV12:
/* paint top bar */