summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xine-engine/video_out.c43
-rw-r--r--src/xine-engine/vo_scale.c6
-rw-r--r--src/xine-engine/xine_interface.c10
3 files changed, 56 insertions, 3 deletions
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index f5bcf312a..38c420da3 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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.c,v 1.212 2004/10/18 21:07:38 f1rmb Exp $
+ * $Id: video_out.c,v 1.213 2004/10/26 20:10:20 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -120,6 +120,7 @@ typedef struct {
int64_t current_duration;
int frame_drop_limit;
int frame_drop_cpt;
+ int crop_left, crop_right, crop_top, crop_bottom;
} vos_t;
@@ -438,6 +439,12 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
int img_already_locked = 0;
+ /* add cropping requested by frontend */
+ img->crop_left += this->crop_left;
+ img->crop_right += this->crop_right;
+ img->crop_top += this->crop_top;
+ img->crop_bottom += this->crop_bottom;
+
/* perform cropping when vo driver does not support it */
if( (img->crop_left || img->crop_top ||
img->crop_right || img->crop_bottom) &&
@@ -1305,6 +1312,19 @@ static int vo_get_property (xine_video_port_t *this_gen, int property) {
/*
* handle XINE_PARAM_xxx properties (convert from driver's range)
*/
+ case XINE_PARAM_VO_CROP_LEFT:
+ ret = this->crop_left;
+ break;
+ case XINE_PARAM_VO_CROP_RIGHT:
+ ret = this->crop_right;
+ break;
+ case XINE_PARAM_VO_CROP_TOP:
+ ret = this->crop_top;
+ break;
+ case XINE_PARAM_VO_CROP_BOTTOM:
+ ret = this->crop_bottom;
+ break;
+
case XINE_PARAM_VO_HUE:
case XINE_PARAM_VO_SATURATION:
case XINE_PARAM_VO_CONTRAST:
@@ -1373,6 +1393,27 @@ static int vo_set_property (xine_video_port_t *this_gen, int property, int value
/*
* handle XINE_PARAM_xxx properties (convert to driver's range)
*/
+ case XINE_PARAM_VO_CROP_LEFT:
+ if( value < 0 )
+ value = 0;
+ ret = this->crop_left = value;
+ break;
+ case XINE_PARAM_VO_CROP_RIGHT:
+ if( value < 0 )
+ value = 0;
+ ret = this->crop_right = value;
+ break;
+ case XINE_PARAM_VO_CROP_TOP:
+ if( value < 0 )
+ value = 0;
+ ret = this->crop_top = value;
+ break;
+ case XINE_PARAM_VO_CROP_BOTTOM:
+ if( value < 0 )
+ value = 0;
+ ret = this->crop_bottom = value;
+ break;
+
case XINE_PARAM_VO_HUE:
case XINE_PARAM_VO_SATURATION:
case XINE_PARAM_VO_CONTRAST:
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c
index 0f522ea1d..a93c0c08e 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.34 2004/10/09 06:44:52 mroi Exp $
+ * $Id: vo_scale.c,v 1.35 2004/10/26 20:10:25 miguelfreitas Exp $
*
* Contains common code to calculate video scaling parameters.
* In short, it will map frame dimensions to screen/window size.
@@ -56,8 +56,12 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) {
* aspect ratio
*/
+ /*
image_ratio = (double) (this->delivered_width - (this->crop_left + this->crop_right)) /
(double) (this->delivered_height - (this->crop_top + this->crop_bottom));
+ */
+ image_ratio = (double) (this->delivered_width) /
+ (double) (this->delivered_height);
switch (this->user_ratio) {
case XINE_VO_ASPECT_AUTO:
diff --git a/src/xine-engine/xine_interface.c b/src/xine-engine/xine_interface.c
index 3567d9d4d..5c11c065a 100644
--- a/src/xine-engine/xine_interface.c
+++ b/src/xine-engine/xine_interface.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: xine_interface.c,v 1.83 2004/08/02 12:51:21 miguelfreitas Exp $
+ * $Id: xine_interface.c,v 1.84 2004/10/26 20:10:24 miguelfreitas Exp $
*
* convenience/abstraction layer, functions to implement
* libxine's public interface
@@ -441,6 +441,10 @@ void xine_set_param (xine_stream_t *stream, int param, int value) {
case XINE_PARAM_VO_ZOOM_Y:
case XINE_PARAM_VO_PAN_SCAN:
case XINE_PARAM_VO_TVMODE:
+ case XINE_PARAM_VO_CROP_LEFT:
+ case XINE_PARAM_VO_CROP_RIGHT:
+ case XINE_PARAM_VO_CROP_TOP:
+ case XINE_PARAM_VO_CROP_BOTTOM:
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
stream->video_out->set_property(stream->video_out, param, value);
stream->xine->port_ticket->release(stream->xine->port_ticket, 0);
@@ -586,6 +590,10 @@ int xine_get_param (xine_stream_t *stream, int param) {
case XINE_PARAM_VO_ZOOM_Y:
case XINE_PARAM_VO_PAN_SCAN:
case XINE_PARAM_VO_TVMODE:
+ case XINE_PARAM_VO_CROP_LEFT:
+ case XINE_PARAM_VO_CROP_RIGHT:
+ case XINE_PARAM_VO_CROP_TOP:
+ case XINE_PARAM_VO_CROP_BOTTOM:
stream->xine->port_ticket->acquire(stream->xine->port_ticket, 0);
ret = stream->video_out->get_property(stream->video_out, param);
stream->xine->port_ticket->release(stream->xine->port_ticket, 0);