summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--src/dxr3/video_out_dxr3.c6
-rw-r--r--src/libffmpeg/video_decoder.c23
-rw-r--r--src/libmpeg2/decode.c18
-rw-r--r--src/libmpeg2/header.c7
-rw-r--r--src/libmpeg2/mpeg2_internal.h3
-rw-r--r--src/video_out/video_out_aa.c4
-rw-r--r--src/video_out/video_out_caca.c4
-rw-r--r--src/video_out/video_out_directfb.c4
-rwxr-xr-xsrc/video_out/video_out_directx.c4
-rw-r--r--src/video_out/video_out_fb.c14
-rw-r--r--src/video_out/video_out_none.c4
-rw-r--r--src/video_out/video_out_opengl.c4
-rw-r--r--src/video_out/video_out_pgx32.c4
-rw-r--r--src/video_out/video_out_pgx64.c4
-rw-r--r--src/video_out/video_out_sdl.c4
-rw-r--r--src/video_out/video_out_stk.c4
-rw-r--r--src/video_out/video_out_syncfb.c11
-rw-r--r--src/video_out/video_out_vidix.c13
-rw-r--r--src/video_out/video_out_xshm.c15
-rw-r--r--src/video_out/video_out_xv.c11
-rw-r--r--src/video_out/video_out_xvmc.c11
-rw-r--r--src/xine-engine/video_out.c100
-rw-r--r--src/xine-engine/video_out.h8
-rw-r--r--src/xine-engine/vo_scale.c63
-rw-r--r--src/xine-engine/vo_scale.h11
26 files changed, 266 insertions, 89 deletions
diff --git a/ChangeLog b/ChangeLog
index 9edd25845..61a4bbafd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,6 +1,7 @@
* build system improvements: replacement functions, better work with headers
* Set the codec name for Real Media even if we can't play the files
* Fix win32 playback on recent versions of Linux
+ * Added cropping capability to some video_out drivers
xine-lib (1-rc6)
* Moved win32 frontend into separate module.
diff --git a/src/dxr3/video_out_dxr3.c b/src/dxr3/video_out_dxr3.c
index 654f1547f..cec83ceab 100644
--- a/src/dxr3/video_out_dxr3.c
+++ b/src/dxr3/video_out_dxr3.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_dxr3.c,v 1.103 2004/07/20 16:37:44 mroi Exp $
+ * $Id: video_out_dxr3.c,v 1.104 2004/09/22 20:29:13 miguelfreitas Exp $
*/
/* mpeg1 encoding video out plugin for the dxr3.
@@ -95,9 +95,9 @@ static vo_info_t vo_info_dxr3_aa = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
#ifdef HAVE_X11
- { PLUGIN_VIDEO_OUT, 19, "dxr3", XINE_VERSION_CODE, &vo_info_dxr3_x11, &dxr3_x11_init_plugin },
+ { PLUGIN_VIDEO_OUT, 20, "dxr3", XINE_VERSION_CODE, &vo_info_dxr3_x11, &dxr3_x11_init_plugin },
#endif
- { PLUGIN_VIDEO_OUT, 19, "aadxr3", XINE_VERSION_CODE, &vo_info_dxr3_aa, &dxr3_aa_init_plugin },
+ { PLUGIN_VIDEO_OUT, 20, "aadxr3", XINE_VERSION_CODE, &vo_info_dxr3_aa, &dxr3_aa_init_plugin },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/libffmpeg/video_decoder.c b/src/libffmpeg/video_decoder.c
index e4e279bd4..a74886fab 100644
--- a/src/libffmpeg/video_decoder.c
+++ b/src/libffmpeg/video_decoder.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_decoder.c,v 1.33 2004/09/20 22:52:04 tmattern Exp $
+ * $Id: video_decoder.c,v 1.34 2004/09/22 20:29:14 miguelfreitas Exp $
*
* xine video decoder plugin using ffmpeg
*
@@ -104,6 +104,7 @@ struct ff_video_decoder_s {
double aspect_ratio;
int frame_flags;
+ int crop_right, crop_bottom;
int output_format;
yuv_planes_t yuv;
@@ -134,8 +135,7 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){
avcodec_align_dimensions(context, &width, &height);
- if( (this->context->pix_fmt != PIX_FMT_YUV420P) ||
- (width != this->bih.biWidth) || (height != this->bih.biHeight) ) {
+ if( this->context->pix_fmt != PIX_FMT_YUV420P ) {
xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
_("ffmpeg_video_dec: unsupported frame format, DR1 disabled.\n"));
@@ -143,6 +143,20 @@ static int get_buffer(AVCodecContext *context, AVFrame *av_frame){
this->context->release_buffer = avcodec_default_release_buffer;
return avcodec_default_get_buffer(context, av_frame);
}
+
+ if((width != context->width) || (height != context->height)) {
+ if(this->stream->video_out->get_capabilities(this->stream->video_out) & VO_CAP_CROP) {
+ this->crop_right = width - context->width;
+ this->crop_bottom = height - context->height;
+ } else {
+ xprintf(this->stream->xine, XINE_VERBOSITY_LOG,
+ _("ffmpeg_video_dec: unsupported frame dimensions, DR1 disabled.\n"));
+
+ this->context->get_buffer = avcodec_default_get_buffer;
+ this->context->release_buffer = avcodec_default_release_buffer;
+ return avcodec_default_get_buffer(context, av_frame);
+ }
+ }
img = this->stream->video_out->get_frame (this->stream->video_out,
width,
@@ -1085,6 +1099,9 @@ static void ff_decode_data (video_decoder_t *this_gen, buf_element_t *buf) {
else
img->duration = this->video_step * 3 / 2;
+ img->crop_right = this->crop_right;
+ img->crop_bottom = this->crop_bottom;
+
this->skipframes = img->draw(img, this->stream);
if( this->skipframes < 0 )
this->skipframes = 0;
diff --git a/src/libmpeg2/decode.c b/src/libmpeg2/decode.c
index 40f182599..bb5076489 100644
--- a/src/libmpeg2/decode.c
+++ b/src/libmpeg2/decode.c
@@ -203,8 +203,8 @@ static void remember_metainfo (mpeg2dec_t *mpeg2dec) {
picture_t * picture = mpeg2dec->picture;
- _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH, picture->frame_width);
- _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, picture->frame_height);
+ _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH, picture->display_width);
+ _x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT, picture->display_height);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_RATIO,
((double)10000 * get_aspect_ratio(mpeg2dec)));
@@ -421,9 +421,9 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream,XINE_STREAM_INFO_VIDEO_WIDTH,
- picture->coded_picture_width);
+ picture->display_width);
_x_stream_info_set(mpeg2dec->stream,XINE_STREAM_INFO_VIDEO_HEIGHT,
- picture->coded_picture_height);
+ picture->display_height);
if (picture->forward_reference_frame &&
picture->forward_reference_frame != picture->current_frame &&
@@ -521,6 +521,8 @@ static inline int parse_chunk (mpeg2dec_t * mpeg2dec, int code,
picture->current_frame->top_field_first = picture->top_field_first;
picture->current_frame->repeat_first_field = picture->repeat_first_field;
picture->current_frame->progressive_frame = picture->progressive_frame;
+ picture->current_frame->crop_right = picture->coded_picture_width - picture->display_width;
+ picture->current_frame->crop_bottom = picture->coded_picture_height - picture->display_height;
switch( picture->picture_coding_type ) {
case I_TYPE:
@@ -841,9 +843,9 @@ void mpeg2_find_sequence_header (mpeg2dec_t * mpeg2dec,
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- picture->coded_picture_width);
+ picture->display_width);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- picture->coded_picture_height);
+ picture->display_height);
}
} else if (code == 0xb5) { /* extension_start_code */
if (mpeg2_header_extension (picture, mpeg2dec->chunk_buffer)) {
@@ -890,9 +892,9 @@ static void process_userdata(mpeg2dec_t *mpeg2dec, uint8_t *buffer)
xine_event_send(mpeg2dec->stream, &event);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_WIDTH,
- mpeg2dec->picture->coded_picture_width);
+ mpeg2dec->picture->display_width);
_x_stream_info_set(mpeg2dec->stream, XINE_STREAM_INFO_VIDEO_HEIGHT,
- mpeg2dec->picture->coded_picture_height);
+ mpeg2dec->picture->display_height);
}
if (mpeg2dec->cc_dec) {
diff --git a/src/libmpeg2/header.c b/src/libmpeg2/header.c
index c68ee5165..0f10588b0 100644
--- a/src/libmpeg2/header.c
+++ b/src/libmpeg2/header.c
@@ -116,8 +116,11 @@ int mpeg2_header_sequence (picture_t * picture, uint8_t * buffer)
height = (buffer[0] << 16) | (buffer[1] << 8) | buffer[2];
- width = ((height >> 12) + 15) & ~15;
- height = ((height & 0xfff) + 15) & ~15;
+ picture->display_width = width = (height >> 12);
+ picture->display_height = height = (height & 0xfff);
+
+ width = (width + 15) & ~15;
+ height = (height + 15) & ~15;
if ((width > 1920) || (height > 1152))
return 1; /* size restrictions for MP@HL */
diff --git a/src/libmpeg2/mpeg2_internal.h b/src/libmpeg2/mpeg2_internal.h
index 28bd60645..6ec414789 100644
--- a/src/libmpeg2/mpeg2_internal.h
+++ b/src/libmpeg2/mpeg2_internal.h
@@ -112,6 +112,9 @@ typedef struct picture_s {
/* The width and height of the picture snapped to macroblock units */
int coded_picture_width;
int coded_picture_height;
+
+ /* The width and height as it appears on header sequence */
+ unsigned int display_width, display_height;
/* picture header stuff */
diff --git a/src/video_out/video_out_aa.c b/src/video_out/video_out_aa.c
index 1110c46ad..f3e02de1a 100644
--- a/src/video_out/video_out_aa.c
+++ b/src/video_out/video_out_aa.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_aa.c,v 1.43 2004/03/03 20:09:15 mroi Exp $
+ * $Id: video_out_aa.c,v 1.44 2004/09/22 20:29:15 miguelfreitas Exp $
*
* video_out_aa.c, ascii-art output plugin for xine
*
@@ -337,6 +337,6 @@ static vo_info_t vo_info_aa = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "aa", XINE_VERSION_CODE, &vo_info_aa, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_caca.c b/src/video_out/video_out_caca.c
index dc11fdda1..225177fc6 100644
--- a/src/video_out/video_out_caca.c
+++ b/src/video_out/video_out_caca.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_caca.c,v 1.2 2004/03/03 20:09:15 mroi Exp $
+ * $Id: video_out_caca.c,v 1.3 2004/09/22 20:29:15 miguelfreitas Exp $
*
* video_out_caca.c, Color AsCii Art output plugin for xine
*
@@ -338,6 +338,6 @@ static vo_info_t vo_info_caca = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "caca", XINE_VERSION_CODE, &vo_info_caca, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "caca", XINE_VERSION_CODE, &vo_info_caca, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_directfb.c b/src/video_out/video_out_directfb.c
index c55ec1185..2560d4dfb 100644
--- a/src/video_out/video_out_directfb.c
+++ b/src/video_out/video_out_directfb.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_directfb.c,v 1.26 2003/12/14 22:13:25 siggi Exp $
+ * $Id: video_out_directfb.c,v 1.27 2004/09/22 20:29:15 miguelfreitas Exp $
*
* DirectFB based output plugin.
* Rich Wareham <richwareham@users.sourceforge.net>
@@ -596,7 +596,7 @@ static vo_info_t vo_info_directfb = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "DirectFB", XINE_VERSION_CODE, &vo_info_directfb, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "DirectFB", XINE_VERSION_CODE, &vo_info_directfb, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_directx.c b/src/video_out/video_out_directx.c
index ae2f2e543..8e113f7a8 100755
--- a/src/video_out/video_out_directx.c
+++ b/src/video_out/video_out_directx.c
@@ -20,7 +20,7 @@
* video_out_directx.c, direct draw video output plugin for xine
* by Matthew Grooms <elon@altavista.com>
*
- * $Id: video_out_directx.c,v 1.18 2004/09/02 19:56:42 valtri Exp $
+ * $Id: video_out_directx.c,v 1.19 2004/09/22 20:29:15 miguelfreitas Exp $
*/
typedef unsigned char boolean;
@@ -1253,6 +1253,6 @@ static vo_info_t vo_info_win32 = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "vo_directx", XINE_VERSION_CODE, &vo_info_win32, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "vo_directx", XINE_VERSION_CODE, &vo_info_win32, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_fb.c b/src/video_out/video_out_fb.c
index 6aae47597..d3841fd87 100644
--- a/src/video_out/video_out_fb.c
+++ b/src/video_out/video_out_fb.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_fb.c,v 1.36 2004/04/26 17:50:09 mroi Exp $
+ * $Id: video_out_fb.c,v 1.37 2004/09/22 20:29:15 miguelfreitas Exp $
*
* video_out_fb.c, frame buffer xine driver by Miguel Freitas
*
@@ -163,6 +163,16 @@ static void fb_frame_proc_slice(vo_frame_t *vo_img, uint8_t **src)
fb_frame_t *frame = (fb_frame_t *)vo_img ;
vo_img->proc_called = 1;
+
+ if( frame->vo_frame.crop_left || frame->vo_frame.crop_top ||
+ frame->vo_frame.crop_right || frame->vo_frame.crop_bottom )
+ {
+ /* we don't support crop, so don't even waste cpu cycles.
+ * cropping will be performed by video_out.c
+ */
+ return;
+ }
+
if(frame->format == XINE_IMGFMT_YV12)
frame->yuv2rgb->yuv2rgb_fun(frame->yuv2rgb, frame->rgb_dst,
src[0], src[1], src[2]);
@@ -1068,6 +1078,6 @@ static vo_info_t vo_info_fb =
/* exported plugin catalog entry */
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class },
+ { PLUGIN_VIDEO_OUT, 20, "fb", XINE_VERSION_CODE, &vo_info_fb, fb_init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_none.c b/src/video_out/video_out_none.c
index 31d45cce0..aae86fc01 100644
--- a/src/video_out/video_out_none.c
+++ b/src/video_out/video_out_none.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_none.c,v 1.21 2004/06/05 16:06:13 jcdutton Exp $
+ * $Id: video_out_none.c,v 1.22 2004/09/22 20:29:15 miguelfreitas Exp $
*
* Was originally part of toxine frontend.
* ...but has now been adapted to xine coding style standards ;)
@@ -306,6 +306,6 @@ static vo_info_t vo_info_none = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "none", XINE_VERSION_CODE, &vo_info_none, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "none", XINE_VERSION_CODE, &vo_info_none, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_opengl.c b/src/video_out/video_out_opengl.c
index 52496b24f..9a96698c0 100644
--- a/src/video_out/video_out_opengl.c
+++ b/src/video_out/video_out_opengl.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_opengl.c,v 1.39 2004/08/26 17:57:53 valtri Exp $
+ * $Id: video_out_opengl.c,v 1.40 2004/09/22 20:29:15 miguelfreitas Exp $
*
* video_out_glut.c, glut based OpenGL rendering interface for xine
* Matthias Hopf <mat@mshopf.de>
@@ -1016,7 +1016,7 @@ static vo_info_t vo_info_opengl = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "opengl", XINE_VERSION_CODE,
+ { PLUGIN_VIDEO_OUT, 20, "opengl", XINE_VERSION_CODE,
&vo_info_opengl, opengl_init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_pgx32.c b/src/video_out/video_out_pgx32.c
index 58202e325..1c370f221 100644
--- a/src/video_out/video_out_pgx32.c
+++ b/src/video_out/video_out_pgx32.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_pgx32.c,v 1.10 2004/07/24 17:26:02 komadori Exp $
+ * $Id: video_out_pgx32.c,v 1.11 2004/09/22 20:29:15 miguelfreitas Exp $
*
* video_out_pgx32.c, Sun PGX32 output plugin for xine
*
@@ -885,6 +885,6 @@ static void *pgx32_init_class(xine_t *xine, void *visual_gen)
}
plugin_info_t xine_plugin_info[] = {
- {PLUGIN_VIDEO_OUT, 19, "pgx32", XINE_VERSION_CODE, &vo_info_pgx32, pgx32_init_class},
+ {PLUGIN_VIDEO_OUT, 20, "pgx32", XINE_VERSION_CODE, &vo_info_pgx32, pgx32_init_class},
{PLUGIN_NONE, 0, "", 0, NULL, NULL}
};
diff --git a/src/video_out/video_out_pgx64.c b/src/video_out/video_out_pgx64.c
index 11cee6430..ce637ebdc 100644
--- a/src/video_out/video_out_pgx64.c
+++ b/src/video_out/video_out_pgx64.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_pgx64.c,v 1.69 2004/06/24 13:06:57 komadori Exp $
+ * $Id: video_out_pgx64.c,v 1.70 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_pgx64.c, Sun XVR100/PGX64/PGX24 output plugin for xine
*
@@ -1518,6 +1518,6 @@ static void *pgx64_init_class(xine_t *xine, void *visual_gen)
}
plugin_info_t xine_plugin_info[] = {
- {PLUGIN_VIDEO_OUT, 19, "pgx64", XINE_VERSION_CODE, &vo_info_pgx64, pgx64_init_class},
+ {PLUGIN_VIDEO_OUT, 20, "pgx64", XINE_VERSION_CODE, &vo_info_pgx64, pgx64_init_class},
{PLUGIN_NONE, 0, "", 0, NULL, NULL}
};
diff --git a/src/video_out/video_out_sdl.c b/src/video_out/video_out_sdl.c
index a395896c4..04aa7cd49 100644
--- a/src/video_out/video_out_sdl.c
+++ b/src/video_out/video_out_sdl.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_sdl.c,v 1.39 2004/06/08 20:34:13 mroi Exp $
+ * $Id: video_out_sdl.c,v 1.40 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_sdl.c, Simple DirectMedia Layer
*
@@ -601,6 +601,6 @@ static vo_info_t vo_info_sdl = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "sdl", XINE_VERSION_CODE, &vo_info_sdl, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "sdl", XINE_VERSION_CODE, &vo_info_sdl, init_class },
{ PLUGIN_NONE, 0, "" , 0 , NULL, NULL}
};
diff --git a/src/video_out/video_out_stk.c b/src/video_out/video_out_stk.c
index 7ef381d2e..528b18bea 100644
--- a/src/video_out/video_out_stk.c
+++ b/src/video_out/video_out_stk.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_stk.c,v 1.12 2003/12/14 22:13:25 siggi Exp $
+ * $Id: video_out_stk.c,v 1.13 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_stk.c, Libstk Surface Video Driver
* more info on Libstk at http://www.libstk.org
@@ -476,7 +476,7 @@ static vo_info_t vo_info_stk = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "stk", XINE_VERSION_CODE, &vo_info_stk, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "stk", XINE_VERSION_CODE, &vo_info_stk, init_class },
{ PLUGIN_NONE, 0, "" , 0 , NULL, NULL}
};
diff --git a/src/video_out/video_out_syncfb.c b/src/video_out/video_out_syncfb.c
index 2fd87adfa..3e9637637 100644
--- a/src/video_out/video_out_syncfb.c
+++ b/src/video_out/video_out_syncfb.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_syncfb.c,v 1.97 2004/04/26 17:50:10 mroi Exp $
+ * $Id: video_out_syncfb.c,v 1.98 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_syncfb.c, SyncFB (for Matrox G200/G400 cards) interface for xine
*
@@ -597,6 +597,11 @@ static void syncfb_display_frame(vo_driver_t* this_gen, vo_frame_t* frame_gen)
this->sc.delivered_width = frame->width;
this->sc.delivered_height = frame->height;
this->sc.delivered_ratio = frame->ratio;
+
+ this->sc.crop_left = frame->vo_frame.crop_left;
+ this->sc.crop_right = frame->vo_frame.crop_right;
+ this->sc.crop_top = frame->vo_frame.crop_top;
+ this->sc.crop_bottom = frame->vo_frame.crop_bottom;
syncfb_compute_ideal_size(this);
@@ -912,7 +917,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
this->props[VO_PROP_ZOOM_Y].value = 100;
/* check for formats we need... */
- this->supported_capabilities = 0;
+ this->supported_capabilities = VO_CAP_CROP;
this->yuv_format = 0;
/*
@@ -1105,7 +1110,7 @@ static vo_info_t vo_info_syncfb = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "SyncFB", XINE_VERSION_CODE, &vo_info_syncfb, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "SyncFB", XINE_VERSION_CODE, &vo_info_syncfb, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_vidix.c b/src/video_out/video_out_vidix.c
index fc9520529..740bd2eb7 100644
--- a/src/video_out/video_out_vidix.c
+++ b/src/video_out/video_out_vidix.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_vidix.c,v 1.64 2004/09/12 19:23:37 mroi Exp $
+ * $Id: video_out_vidix.c,v 1.65 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_vidix.c
*
@@ -630,6 +630,11 @@ static void vidix_display_frame (vo_driver_t *this_gen, vo_frame_t *frame_gen) {
this->sc.delivered_ratio = frame->ratio;
this->delivered_format = frame->format;
+ this->sc.crop_left = frame->vo_frame.crop_left;
+ this->sc.crop_right = frame->vo_frame.crop_right;
+ this->sc.crop_top = frame->vo_frame.crop_top;
+ this->sc.crop_bottom = frame->vo_frame.crop_bottom;
+
vidix_compute_ideal_size( this );
this->sc.force_redraw = 1;
}
@@ -915,7 +920,7 @@ static vidix_driver_t *open_plugin (video_driver_class_t *class_gen) {
this->config = config;
this->got_frame_data = 0;
- this->capabilities = 0;
+ this->capabilities = VO_CAP_CROP;
/* Find what equalizer flags are supported */
if(this->vidix_cap.flags & FLAG_EQUALIZER) {
@@ -1273,10 +1278,10 @@ static vo_info_t vo_info_vidixfb = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
#ifdef HAVE_X11
- { PLUGIN_VIDEO_OUT, 19, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class },
+ { PLUGIN_VIDEO_OUT, 20, "vidix", XINE_VERSION_CODE, &vo_info_vidix, vidix_init_class },
#endif
#ifdef HAVE_FB
- { PLUGIN_VIDEO_OUT, 19, "vidixfb", XINE_VERSION_CODE, &vo_info_vidixfb, vidixfb_init_class },
+ { PLUGIN_VIDEO_OUT, 20, "vidixfb", XINE_VERSION_CODE, &vo_info_vidixfb, vidixfb_init_class },
#endif
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_xshm.c b/src/video_out/video_out_xshm.c
index 83bf7125d..c3d91efd6 100644
--- a/src/video_out/video_out_xshm.c
+++ b/src/video_out/video_out_xshm.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_xshm.c,v 1.134 2004/09/22 20:16:11 miguelfreitas Exp $
+ * $Id: video_out_xshm.c,v 1.135 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_xshm.c, X11 shared memory extension interface for xine
*
@@ -315,9 +315,18 @@ static uint32_t xshm_get_capabilities (vo_driver_t *this_gen) {
static void xshm_frame_proc_slice (vo_frame_t *vo_img, uint8_t **src) {
xshm_frame_t *frame = (xshm_frame_t *) vo_img ;
/*xshm_driver_t *this = (xshm_driver_t *) vo_img->driver; */
-
+
vo_img->proc_called = 1;
+ if( frame->vo_frame.crop_left || frame->vo_frame.crop_top ||
+ frame->vo_frame.crop_right || frame->vo_frame.crop_bottom )
+ {
+ /* we don't support crop, so don't even waste cpu cycles.
+ * cropping will be performed by video_out.c
+ */
+ return;
+ }
+
lprintf ("copy... (format %d)\n", frame->format);
if (frame->format == XINE_IMGFMT_YV12)
@@ -1295,6 +1304,6 @@ static vo_info_t vo_info_xshm = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class },
+ { PLUGIN_VIDEO_OUT, 20, "xshm", XINE_VERSION_CODE, &vo_info_xshm, xshm_init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_xv.c b/src/video_out/video_out_xv.c
index 109e6f7b1..c3787c983 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.204 2004/07/19 22:07:41 miguelfreitas Exp $
+ * $Id: video_out_xv.c,v 1.205 2004/09/22 20:29:16 miguelfreitas Exp $
*
* video_out_xv.c, X11 video extension interface for xine
*
@@ -712,6 +712,11 @@ static int xv_redraw_needed (vo_driver_t *this_gen) {
this->sc.delivered_height = this->cur_frame->height;
this->sc.delivered_width = this->cur_frame->width;
this->sc.delivered_ratio = this->cur_frame->ratio;
+
+ this->sc.crop_left = this->cur_frame->vo_frame.crop_left;
+ this->sc.crop_right = this->cur_frame->vo_frame.crop_right;
+ this->sc.crop_top = this->cur_frame->vo_frame.crop_top;
+ this->sc.crop_bottom = this->cur_frame->vo_frame.crop_bottom;
xv_compute_ideal_size(this);
@@ -1311,7 +1316,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
XLockDisplay (this->display);
this->gc = XCreateGC (this->display, this->drawable, 0, NULL);
XUnlockDisplay (this->display);
- this->capabilities = 0;
+ this->capabilities = VO_CAP_CROP;
this->use_shm = 1;
this->deinterlace_method = 0;
this->deinterlace_frame.image = NULL;
@@ -1595,7 +1600,7 @@ static vo_info_t vo_info_xv = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "xv", XINE_VERSION_CODE, &vo_info_xv, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/video_out/video_out_xvmc.c b/src/video_out/video_out_xvmc.c
index 1cfd377c2..6046910b4 100644
--- a/src/video_out/video_out_xvmc.c
+++ b/src/video_out/video_out_xvmc.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_xvmc.c,v 1.16 2004/06/26 13:52:20 mroi Exp $
+ * $Id: video_out_xvmc.c,v 1.17 2004/09/22 20:29:17 miguelfreitas Exp $
*
* video_out_xvmc.c, X11 video motion compensation extension interface for xine
*
@@ -923,6 +923,11 @@ static int xvmc_redraw_needed (vo_driver_t *this_gen) {
this->sc.delivered_width = this->cur_frame->width;
this->sc.delivered_ratio = this->cur_frame->ratio;
+ this->sc.crop_left = this->cur_frame->vo_frame.crop_left;
+ this->sc.crop_right = this->cur_frame->vo_frame.crop_right;
+ this->sc.crop_top = this->cur_frame->vo_frame.crop_top;
+ this->sc.crop_bottom = this->cur_frame->vo_frame.crop_bottom;
+
xvmc_compute_ideal_size(this);
if(_x_vo_scale_redraw_needed(&this->sc)) {
@@ -1393,7 +1398,7 @@ static vo_driver_t *open_plugin (video_driver_class_t *class_gen, const void *vi
XLockDisplay(this->display);
this->gc = XCreateGC(this->display, this->drawable, 0, NULL);
XUnlockDisplay(this->display);
- this->capabilities = VO_CAP_XVMC_MOCOMP;
+ this->capabilities = VO_CAP_XVMC_MOCOMP | VO_CAP_CROP;
this->surface_type_id = class->surface_type_id;
this->max_surface_width = class->max_surface_width;
@@ -1839,7 +1844,7 @@ static vo_info_t vo_info_xvmc = {
plugin_info_t xine_plugin_info[] = {
/* type, API, "name", version, special_info, init_function */
- { PLUGIN_VIDEO_OUT, 19, "xvmc", XINE_VERSION_CODE, &vo_info_xvmc, init_class },
+ { PLUGIN_VIDEO_OUT, 20, "xvmc", XINE_VERSION_CODE, &vo_info_xvmc, init_class },
{ PLUGIN_NONE, 0, "", 0, NULL, NULL }
};
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index eacc59dd5..dfc6aa5b7 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.205 2004/07/19 22:45:48 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.206 2004/09/22 20:29:17 miguelfreitas Exp $
*
* frame allocation / queuing / scheduling / output functions
*/
@@ -59,6 +59,8 @@
#define FIRST_FRAME_POLL_DELAY 3000
#define FIRST_FRAME_MAX_POLL 10 /* poll n times at most */
+static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img );
+
typedef struct {
vo_frame_t *first;
vo_frame_t *last;
@@ -329,7 +331,11 @@ static vo_frame_t *vo_get_frame (xine_video_port_t *this_gen,
img->progressive_frame = 0;
img->repeat_first_field = 0;
img->top_field_first = 1;
- img->macroblocks = NULL;
+ img->crop_left = 0;
+ img->crop_right = 0;
+ img->crop_top = 0;
+ img->crop_bottom = 0;
+ img->macroblocks = NULL;
_x_extra_info_reset ( img->extra_info );
/* let driver ensure this image has the right format */
@@ -425,7 +431,18 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
if (!img->bad_frame) {
-
+
+ int dispose_img = 0;
+
+ /* perform cropping when vo driver does not support it */
+ if( (img->crop_left || img->crop_top ||
+ img->crop_right || img->crop_bottom) &&
+ (this->grab_only ||
+ !(this->driver->get_capabilities (this->driver) & VO_CAP_CROP)) ) {
+ img = crop_frame( img->port, img );
+ dispose_img = 1;
+ }
+
/* do not call proc_*() for frames that will be dropped */
if( !frames_to_skip && !img->proc_called )
vo_frame_driver_proc(img);
@@ -461,6 +478,9 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
vo_frame_inc_lock( img );
vo_append_to_img_buf_queue (this->display_img_buf_queue, img);
+
+ if( dispose_img )
+ vo_frame_dec_lock( img );
} else {
lprintf ("bad_frame\n");
@@ -560,7 +580,6 @@ static int vo_frame_draw (vo_frame_t *img, xine_stream_t *stream) {
static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
vo_frame_t *dupl;
- int image_size;
if( !this->free_img_buf_queue->first)
return NULL;
@@ -583,14 +602,19 @@ static vo_frame_t * duplicate_frame( vos_t *this, vo_frame_t *img ) {
dupl->ratio = img->ratio;
dupl->format = img->format;
dupl->flags = img->flags | VO_BOTH_FIELDS;
+ dupl->progressive_frame = img->progressive_frame;
+ dupl->repeat_first_field = img->repeat_first_field;
+ dupl->top_field_first = img->top_field_first;
+ dupl->crop_left = img->crop_left;
+ dupl->crop_right = img->crop_right;
+ dupl->crop_top = img->crop_top;
+ dupl->crop_bottom = img->crop_bottom;
this->driver->update_frame_format (this->driver, dupl, dupl->width, dupl->height,
dupl->ratio, dupl->format, dupl->flags);
pthread_mutex_unlock (&dupl->mutex);
- image_size = img->pitches[0] * img->height;
-
switch (img->format) {
case XINE_IMGFMT_YV12:
yv12_to_yv12(
@@ -1176,6 +1200,7 @@ int xine_get_next_video_frame (xine_video_port_t *this_gen,
frame->height = img->height;
frame->pos_stream = img->extra_info->input_normpos;
frame->pos_time = img->extra_info->input_time;
+ frame->frame_number = img->extra_info->frame_number;
frame->aspect_ratio = img->ratio;
frame->colorspace = img->format;
frame->data = img->base[0];
@@ -1508,6 +1533,69 @@ static void vo_flush (xine_video_port_t *this_gen) {
}
}
+/* crop_frame() will allocate a new frame to copy in the given image
+ * while cropping. maybe someday this will be an automatic post plugin.
+ */
+static vo_frame_t * crop_frame( xine_video_port_t *this_gen, vo_frame_t *img ) {
+
+ vo_frame_t *dupl;
+
+ dupl = vo_get_frame ( this_gen,
+ img->width - img->crop_left - img->crop_right,
+ img->height - img->crop_top - img->crop_bottom,
+ img->ratio, img->format, img->flags | VO_BOTH_FIELDS);
+
+ dupl->progressive_frame = img->progressive_frame;
+ dupl->repeat_first_field = img->repeat_first_field;
+ dupl->top_field_first = img->top_field_first;
+
+ switch (img->format) {
+ case XINE_IMGFMT_YV12:
+ yv12_to_yv12(
+ /* Y */
+ img->base[0] + img->crop_top * img->pitches[0] +
+ img->crop_left, img->pitches[0],
+ dupl->base[0], dupl->pitches[0],
+ /* U */
+ img->base[1] + img->crop_top/2 * img->pitches[1] +
+ img->crop_left/2, img->pitches[1],
+ dupl->base[1], dupl->pitches[1],
+ /* V */
+ img->base[2] + img->crop_top/2 * img->pitches[2] +
+ img->crop_left/2, img->pitches[2],
+ dupl->base[2], dupl->pitches[2],
+ /* width x height */
+ dupl->width, dupl->height);
+ break;
+ case XINE_IMGFMT_YUY2:
+ yuy2_to_yuy2(
+ /* src */
+ img->base[0] + img->crop_top * img->pitches[0] +
+ img->crop_left/2, img->pitches[0],
+ /* dst */
+ dupl->base[0], dupl->pitches[0],
+ /* width x height */
+ dupl->width, dupl->height);
+ break;
+ }
+
+ dupl->bad_frame = 0;
+ dupl->pts = img->pts;
+ dupl->vpts = img->vpts;
+ dupl->proc_called = 0;
+
+ dupl->duration = img->duration;
+ dupl->is_first = img->is_first;
+
+ dupl->stream = img->stream;
+ memcpy( dupl->extra_info, img->extra_info, sizeof(extra_info_t) );
+
+ /* delay frame processing for now, we might not even need it (eg. frame will be discarded) */
+ /* vo_frame_driver_proc(dupl); */
+
+ return dupl;
+}
+
xine_video_port_t *_x_vo_new_port (xine_t *xine, vo_driver_t *driver, int grabonly) {
vos_t *this;
diff --git a/src/xine-engine/video_out.h b/src/xine-engine/video_out.h
index fa4600c5d..0b70998e2 100644
--- a/src/xine-engine/video_out.h
+++ b/src/xine-engine/video_out.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: video_out.h,v 1.108 2004/07/06 22:53:23 miguelfreitas Exp $
+ * $Id: video_out.h,v 1.109 2004/09/22 20:29:17 miguelfreitas Exp $
*
*
* xine version of video_out.h
@@ -146,6 +146,9 @@ struct vo_frame_s {
*/
int progressive_frame;
int picture_coding_type;
+
+ /* cropping to be done */
+ int crop_left, crop_right, crop_top, crop_bottom;
/* extra info coming from input or demuxers */
extra_info_t *extra_info;
@@ -289,6 +292,7 @@ struct xine_video_port_s {
#define VO_CAP_XVMC_MOCOMP 0x00000004 /* driver can use XvMC motion compensation */
#define VO_CAP_XVMC_IDCT 0x00000008 /* driver can use XvMC idct acceleration */
#define VO_CAP_UNSCALED_OVERLAY 0x00000010 /* driver can blend overlay at output resolution */
+#define VO_CAP_CROP 0x00000020 /* driver can crop */
/* macroblock modes */
#define XINE_MACROBLOCK_INTRA 1
@@ -325,7 +329,7 @@ struct xine_video_port_s {
* from generic vo functions.
*/
-#define VIDEO_OUT_DRIVER_IFACE_VERSION 19
+#define VIDEO_OUT_DRIVER_IFACE_VERSION 20
struct vo_driver_s {
diff --git a/src/xine-engine/vo_scale.c b/src/xine-engine/vo_scale.c
index 5704a1c8c..021ca72c3 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.31 2004/05/11 02:21:16 miguelfreitas Exp $
+ * $Id: vo_scale.c,v 1.32 2004/09/22 20:29:17 miguelfreitas Exp $
*
* Contains common code to calculate video scaling parameters.
* In short, it will map frame dimensions to screen/window size.
@@ -56,7 +56,8 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) {
* aspect ratio
*/
- image_ratio = (double) this->delivered_width / (double) this->delivered_height;
+ image_ratio = (double) (this->delivered_width - (this->crop_left + this->crop_right)) /
+ (double) (this->delivered_height - (this->crop_top + this->crop_bottom));
switch (this->user_ratio) {
case XINE_VO_ASPECT_AUTO:
@@ -105,18 +106,22 @@ void _x_vo_scale_compute_ideal_size (vo_scale_t *this) {
void _x_vo_scale_compute_output_size (vo_scale_t *this) {
+ int cropped_width, cropped_height;
double x_factor, y_factor, aspect;
- 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;
+ cropped_width = this->delivered_width - (this->crop_left + this->crop_right);
+ cropped_height = this->delivered_height - (this->crop_top + this->crop_bottom);
+ aspect = this->video_pixel_aspect / this->gui_pixel_aspect;
+ x_factor = (double) this->gui_width / (double) (cropped_width * aspect);
+ y_factor = (double) (this->gui_height * aspect) / (double) cropped_height;
+
if (this->scaling_disabled) {
- this->output_width = this->delivered_width;
- this->output_height = this->delivered_height;
- this->displayed_width = this->delivered_width;
- this->displayed_height = this->delivered_height;
+ this->output_width = cropped_width;
+ this->output_height = cropped_height;
+ this->displayed_width = cropped_width;
+ this->displayed_height = cropped_height;
} else {
@@ -128,44 +133,44 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) {
* black borders to use.
* - exceding zoom shall be accounted by reducing displayed image.
*/
- if (((double)this->gui_width - (double)this->delivered_width * y_factor) < ((double)this->gui_height - (double)this->delivered_height * x_factor)) {
+ if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) {
this->output_width = this->gui_width;
- this->displayed_width = (double)this->delivered_width / this->zoom_factor_x + 0.5;
+ this->displayed_width = (double)cropped_width / this->zoom_factor_x + 0.5;
- this->output_height = (double)this->delivered_height * x_factor + 0.5;
+ this->output_height = (double)cropped_height * x_factor + 0.5;
if( this->output_height * this->zoom_factor_y <= this->gui_height ) {
- this->displayed_height = this->delivered_height;
+ this->displayed_height = cropped_height;
this->output_height = (double)this->output_height * this->zoom_factor_y + 0.5;
} else {
- this->displayed_height = (double) this->delivered_height *
+ this->displayed_height = (double)cropped_height *
this->gui_height / this->output_height / this->zoom_factor_y + 0.5;
this->output_height = this->gui_height;
}
} else {
this->output_height = this->gui_height;
- this->displayed_height = (double)this->delivered_height / this->zoom_factor_y + 0.5;
+ this->displayed_height = (double)cropped_height / this->zoom_factor_y + 0.5;
- this->output_width = (double)this->delivered_width * y_factor + 0.5;
+ this->output_width = (double)cropped_width * y_factor + 0.5;
if( this->output_width * this->zoom_factor_x <= this->gui_width ) {
- this->displayed_width = this->delivered_width;
+ this->displayed_width = cropped_width;
this->output_width = (double)this->output_width * this->zoom_factor_x + 0.5;
} else {
- this->displayed_width = (double) this->delivered_width *
+ this->displayed_width = (double)cropped_width *
this->gui_width / this->output_width / this->zoom_factor_x + 0.5;
this->output_width = this->gui_width;
}
}
} else {
- if (((double)this->gui_width - (double)this->delivered_width * y_factor) < ((double)this->gui_height - (double)this->delivered_height * x_factor)) {
+ if (((double)this->gui_width - (double)cropped_width * y_factor) < ((double)this->gui_height - (double)cropped_height * x_factor)) {
this->output_width = (double) this->gui_width;
- this->output_height = (double) this->delivered_height * x_factor + 0.5;
+ this->output_height = (double) cropped_height * x_factor + 0.5;
} else {
- this->output_width = (double) this->delivered_width * y_factor + 0.5;
+ this->output_width = (double) cropped_width * y_factor + 0.5;
this->output_height = (double) this->gui_height;
}
- this->displayed_width = this->delivered_width;
- this->displayed_height = this->delivered_height;
+ this->displayed_width = cropped_width;
+ this->displayed_height = cropped_height;
}
}
@@ -188,8 +193,8 @@ void _x_vo_scale_compute_output_size (vo_scale_t *this) {
this->output_yoffset =
(this->gui_height - this->output_height) * this->output_vertical_position + this->gui_y;
- this->displayed_xoffset = (this->delivered_width - this->displayed_width) / 2;
- this->displayed_yoffset = (this->delivered_height - this->displayed_height) / 2;
+ this->displayed_xoffset = ((cropped_width - this->displayed_width) / 2) + this->crop_left;
+ this->displayed_yoffset = ((cropped_height - this->displayed_height) / 2) + this->crop_top;
lprintf ("frame source %d x %d (%d x %d) => screen output %d x %d\n",
this->delivered_width, this->delivered_height,
@@ -244,7 +249,8 @@ int _x_vo_scale_redraw_needed (vo_scale_t *this) {
if( this->frame_output_cb ) {
this->frame_output_cb (this->user_data,
- this->delivered_width, this->delivered_height,
+ this->delivered_width - (this->crop_left + this->crop_right),
+ this->delivered_height - (this->crop_top + this->crop_bottom),
this->video_pixel_aspect,
&gui_x, &gui_y, &gui_width, &gui_height,
&gui_pixel_aspect, &gui_win_x, &gui_win_y );
@@ -365,6 +371,11 @@ void _x_vo_scale_init(vo_scale_t *this, int support_zoom, int scaling_disabled,
this->user_ratio = XINE_VO_ASPECT_AUTO;
this->delivered_ratio = 0.0;
+ this->crop_left = 0;
+ this->crop_right = 0;
+ this->crop_top = 0;
+ this->crop_bottom = 0;
+
this->output_horizontal_position =
config->register_range(config, "video.horizontal_position", 50, 0, 100,
_("horizontal image position in the output window"), NULL, 10,
diff --git a/src/xine-engine/vo_scale.h b/src/xine-engine/vo_scale.h
index 736e50fbd..a5fd8d9e4 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.12 2004/04/25 14:50:32 komadori Exp $
+ * $Id: vo_scale.h,v 1.13 2004/09/22 20:29:18 miguelfreitas Exp $
*
* vo_scale.h
*
@@ -65,6 +65,15 @@ struct vo_scale_s {
int delivered_width;
int delivered_height;
double delivered_ratio;
+
+ /*
+ * required cropping:
+ * units: frame pixels
+ */
+ int crop_left;
+ int crop_right;
+ int crop_top;
+ int crop_bottom;
/*
* displayed part of delivered images,