summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMichael Roitzsch <mroi@users.sourceforge.net>2002-09-08 16:20:09 +0000
committerMichael Roitzsch <mroi@users.sourceforge.net>2002-09-08 16:20:09 +0000
commitdf42925e0db31a9970d40c76b891900595731b13 (patch)
tree4c1703f2904f13ed129945cb7e2e1f5a04782580 /src
parentd9a3110ce31b59dfd35849dbd7b84e954c397eea (diff)
downloadxine-lib-df42925e0db31a9970d40c76b891900595731b13.tar.gz
xine-lib-df42925e0db31a9970d40c76b891900595731b13.tar.bz2
- reorder XINE_VO_ASPECT_* constants so they match the order in the old
api (benefit: no remapping is required between dvd's and xine's aspect codes) - implement new scaling semantics as intended by Matthias Hopf CVS patchset: 2627 CVS date: 2002/09/08 16:20:09
Diffstat (limited to 'src')
-rw-r--r--src/video_out/video_out_xv.c4
-rw-r--r--src/xine-engine/vo_scale.c61
-rw-r--r--src/xine-engine/vo_scale.h16
3 files changed, 26 insertions, 55 deletions
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 410bbbdb6..62c564735 100644
--- a/src/video_out/video_out_xv.c
+++ b/src/video_out/video_out_xv.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: video_out_xv.c,v 1.130 2002/09/05 20:44:42 mroi Exp $
+ * $Id: video_out_xv.c,v 1.131 2002/09/08 16:20:11 mroi Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -1140,7 +1140,7 @@ static void *init_video_out_plugin (xine_t *xine, void *visual_gen) {
this->overlay = NULL;
this->screen = visual->screen;
- vo_scale_init (&this->sc, 1.0 /* FIXME */, 1, 0 );
+ vo_scale_init (&this->sc, 1, 0 );
this->sc.frame_output_cb = visual->frame_output_cb;
this->sc.user_data = visual->user_data;
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c
index 3d11ac946..1cc10572a 100644
--- a/src/xine-engine/vo_scale.c
+++ b/src/xine-engine/vo_scale.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: vo_scale.c,v 1.6 2002/09/05 05:51:15 jcdutton Exp $
+ * $Id: vo_scale.c,v 1.7 2002/09/08 16:20:13 mroi Exp $
*
* Contains common code to calculate video scaling parameters.
* In short, it will map frame dimensions to screen/window size.
@@ -43,12 +43,11 @@
void vo_scale_compute_ideal_size (vo_scale_t *this) {
- double image_ratio, desired_ratio, corr_factor;
+ double image_ratio, desired_ratio;
if (this->scaling_disabled) {
- this->ideal_width = this->delivered_width;
- this->ideal_height = this->delivered_height;
+ this->video_pixel_aspect = this->gui_pixel_aspect;
} else {
@@ -58,6 +57,7 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) {
image_ratio = (double) this->delivered_width / (double) this->delivered_height;
+ printf("vo_scale: DEBUG: user ratio %d, delivered ratio %d\n", this->user_ratio, this->delivered_ratio_code);
switch (this->user_ratio) {
case ASPECT_AUTO:
switch (this->delivered_ratio_code) {
@@ -65,11 +65,9 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) {
case XINE_VO_ASPECT_PAN_SCAN: /* we display pan&scan as widescreen */
desired_ratio = 16.0 /9.0;
break;
-#if 0 /* FIXME */
- case XINE_VO_ASPECT_211_1: /* 2.11:1 */
+ case XINE_VO_ASPECT_DVB: /* 2.11:1 */
desired_ratio = 2.11/1.0;
break;
-#endif
case XINE_VO_ASPECT_SQUARE: /* square pels */
case XINE_VO_ASPECT_DONT_TOUCH: /* probably non-mpeg stream => don't touch aspect ratio */
desired_ratio = image_ratio;
@@ -98,25 +96,6 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) {
desired_ratio = 4.0 / 3.0;
}
- corr_factor = this->display_ratio * desired_ratio / image_ratio ;
-
- if (fabs(corr_factor - 1.0) < 0.005) {
- this->ideal_width = this->delivered_width;
- this->ideal_height = this->delivered_height;
-
- } else {
-
- if (corr_factor >= 1.0) {
- this->ideal_width = this->delivered_width * corr_factor + 0.5;
- this->ideal_height = this->delivered_height;
- } else {
- this->ideal_width = this->delivered_width;
- this->ideal_height = this->delivered_height / corr_factor + 0.5;
- }
- }
-
-
-#if 0
this->video_pixel_aspect = desired_ratio / image_ratio;
assert (this->gui_pixel_aspect != 0.0);
@@ -124,7 +103,6 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) {
< 0.005) {
this->video_pixel_aspect = this->gui_pixel_aspect;
}
-#endif
#if 0
@@ -146,10 +124,11 @@ void vo_scale_compute_ideal_size (vo_scale_t *this) {
void vo_scale_compute_output_size (vo_scale_t *this) {
- double x_factor, y_factor;
+ double x_factor, y_factor, aspect;
- x_factor = (double) this->gui_width / (double) this->ideal_width;
- y_factor = (double) this->gui_height / (double) this->ideal_height;
+ aspect = this->video_pixel_aspect / this->gui_pixel_aspect;
+ x_factor = (double) this->gui_width / (double) (this->delivered_width * aspect);
+ y_factor = (double) (this->gui_height * aspect) / (double) this->delivered_height;
if (this->scaling_disabled) {
@@ -172,7 +151,7 @@ void vo_scale_compute_output_size (vo_scale_t *this) {
this->output_width = this->gui_width;
this->displayed_width = this->delivered_width / this->zoom_factor_x;
- this->output_height = this->ideal_height * x_factor;
+ this->output_height = this->delivered_height * x_factor;
if( this->output_height * this->zoom_factor_y <= this->gui_height ) {
this->displayed_height = this->delivered_height;
this->output_height = this->output_height * this->zoom_factor_y;
@@ -185,7 +164,7 @@ void vo_scale_compute_output_size (vo_scale_t *this) {
this->output_height = this->gui_height;
this->displayed_height = this->delivered_height / this->zoom_factor_y;
- this->output_width = this->ideal_width * y_factor;
+ this->output_width = this->delivered_width * y_factor;
if( this->output_width * this->zoom_factor_x <= this->gui_width ) {
this->displayed_width = this->delivered_width;
this->output_width = this->output_width * this->zoom_factor_x;
@@ -199,9 +178,9 @@ void vo_scale_compute_output_size (vo_scale_t *this) {
} else {
if(x_factor < y_factor) {
this->output_width = (double) this->gui_width;
- this->output_height = (double) this->ideal_height * x_factor;
+ this->output_height = (double) this->delivered_height * x_factor;
} else {
- this->output_width = (double) this->ideal_width * y_factor;
+ this->output_width = (double) this->delivered_width * y_factor;
this->output_height = (double) this->gui_height;
}
this->displayed_width = this->delivered_width;
@@ -265,21 +244,22 @@ void vo_scale_compute_output_size (vo_scale_t *this) {
int vo_scale_redraw_needed (vo_scale_t *this) {
int gui_x, gui_y, gui_width, gui_height, gui_win_x, gui_win_y;
- double gui_aspect;
+ double gui_pixel_aspect;
int ret = 0;
if( this->frame_output_cb ) {
this->frame_output_cb (this->user_data,
- this->ideal_width, this->ideal_height,
+ this->delivered_width, this->delivered_height,
this->video_pixel_aspect,
&gui_x, &gui_y, &gui_width, &gui_height,
- &gui_aspect, &gui_win_x, &gui_win_y );
+ &gui_pixel_aspect, &gui_win_x, &gui_win_y );
} else {
printf ("vo_scale: error! frame_output_cb must be set!\n");
}
if ( (gui_x != this->gui_x) || (gui_y != this->gui_y)
|| (gui_width != this->gui_width) || (gui_height != this->gui_height)
+ || (gui_pixel_aspect != this->gui_pixel_aspect)
|| (gui_win_x != this->gui_win_x) || (gui_win_y != this->gui_win_y) ) {
this->gui_x = gui_x;
@@ -288,6 +268,7 @@ int vo_scale_redraw_needed (vo_scale_t *this) {
this->gui_height = gui_height;
this->gui_win_x = gui_win_x;
this->gui_win_y = gui_win_y;
+ this->gui_pixel_aspect = gui_pixel_aspect;
ret = 1;
}
@@ -358,17 +339,15 @@ char *vo_scale_aspect_ratio_name(int a) {
* initialize rescaling struct
*/
-void vo_scale_init(vo_scale_t *this, double display_ratio,
- int support_zoom, int scaling_disabled ) {
+void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled ) {
memset( this, 0, sizeof(vo_scale_t) );
- this->display_ratio = display_ratio;
- this->gui_pixel_aspect = display_ratio;
this->support_zoom = support_zoom;
this->scaling_disabled = scaling_disabled;
this->force_redraw = 1;
this->zoom_factor_x = 1.0;
this->zoom_factor_y = 1.0;
+ this->gui_pixel_aspect = 1.0;
this->user_ratio = ASPECT_AUTO;
}
diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h
index cbd04c4cb..317cc4082 100644
--- a/src/xine-engine/vo_scale.h
+++ b/src/xine-engine/vo_scale.h
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: vo_scale.h,v 1.2 2002/09/04 23:31:13 guenter Exp $
+ * $Id: vo_scale.h,v 1.3 2002/09/08 16:20:13 mroi Exp $
*
* vo_scale.h
*
@@ -42,10 +42,6 @@ typedef struct {
struct vo_scale_s {
- /* display anatomy */
- double display_ratio; /* given by visual parameter
- from init function */
-
/* true if driver supports frame zooming */
int support_zoom;
@@ -75,12 +71,9 @@ struct vo_scale_s {
int displayed_height;
double zoom_factor_x, zoom_factor_y;
- /*
- * "ideal" size :
- * delivered width/height corrected by aspect ratio and display_ratio
- * units: screen pixels
+ /*
+ * user's aspect selection
*/
- int ideal_width, ideal_height;
int user_ratio;
/*
@@ -179,8 +172,7 @@ char *vo_scale_aspect_ratio_name(int a);
* initialize rescaling struct
*/
-void vo_scale_init(vo_scale_t *this, double display_ratio,
- int support_zoom, int scaling_disabled );
+void vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled );
#ifdef __cplusplus
}