--- xine-lib-1.1.2-r2-xbox/src/post/planar/expand.c.orig 2006-07-31 15:25:27.000000000 +0300 +++ xine-lib-1.1.2-r2-xbox/src/post/planar/expand.c 2006-08-20 15:55:29.000000000 +0300 @@ -311,9 +311,67 @@ frame->base[0] += frame->pitches[0] * top_bar_height; } } else { - frame = port->original_port->get_frame(port->original_port, - width, height, ratio, format, flags); - /* no need to intercept this one, we are not going to do anything with it */ + + uint32_t new_width, side_bar_width; int y; + + /* Calculate width of expanded frame */ + new_width = (double)width * this->aspect / ratio; + new_width = (new_width + 1) & ~1; + side_bar_width = (new_width - width) / 2; + side_bar_width = (side_bar_width + 1) & ~1; + + //this->side_bar_width = side_bar_width; + + if (new_width > width && + (format == XINE_IMGFMT_YV12 || format == XINE_IMGFMT_YUY2)) { +#if 0 +new_width=width+100; +side_bar_width=50; +#endif +/*printf("expand: %dx%d --> %dx%d\n", width, height, new_width, height);fflush(stdout);*/ + frame = port->original_port->get_frame(port->original_port, + new_width, height, + this->aspect, format, flags); + + _x_post_inc_usage(port); + frame = _x_post_intercept_video_frame(frame, port); + + + /* paint black bars in the top and bottom of the frame and hide these + * from the decoders by modifying the pointers to and + * the size of the drawing area */ + frame->width = width; + frame->ratio = this->aspect; + + switch (format) { + case XINE_IMGFMT_YV12: + for(y=0; ybase[0] + (2*y )*frame->pitches[0], 0, side_bar_width ); + memset(frame->base[0] + (2*y+1)*frame->pitches[0], 0, side_bar_width ); + memset(frame->base[1] + y *frame->pitches[1], 128, side_bar_width / 2); + memset(frame->base[2] + y *frame->pitches[2], 128, side_bar_width / 2); + /* paint right bar */ + memset(frame->base[0] + (2*y )*frame->pitches[0] + (width+side_bar_width), 0, side_bar_width ); + memset(frame->base[0] + (2*y+1)*frame->pitches[0] + (width+side_bar_width), 0, side_bar_width ); + memset(frame->base[1] + y *frame->pitches[1] + (width+side_bar_width)/2, 128, side_bar_width / 2); + memset(frame->base[2] + y *frame->pitches[2] + (width+side_bar_width)/2, 128, side_bar_width / 2); + } + /* modify drawing area */ + frame->base[0] += /*frame->pitches[0] **/ side_bar_width; + frame->base[1] += /*frame->pitches[1] **/ side_bar_width / 2; + frame->base[2] += /*frame->pitches[2] **/ side_bar_width / 2; + break; +#if 0 + case XINE_IMGFMT_YUY2: +#endif + } + + } else { + frame = port->original_port->get_frame(port->original_port, + width, height, ratio, format, flags); + /* no need to intercept this one, we are not going to do anything with it */ + } } return frame;