# HG changeset patch # User mswitch # Date 1007159080 0 # Node ID d037e1201721f26eb22c9f5118fa98fdc57468c9 # Parent 4bc4354ec88e5b6fc460a652392176a9b703815e Added support for codecs that supports BGR24 (some opensource codecs and vivo) Added the over-requested underrated black-border around scaled movies that everyone's been nagging me about lately =). Fixed the following Bugs: YV12 video getting cropped at the bottom Lockups on exit (if these problems surface again, contact me please) Invalid stride in YUY2 playback diff -r 4bc4354ec88e -r d037e1201721 libvo/vo_dxr3.c --- a/libvo/vo_dxr3.c Fri Nov 30 22:18:51 2001 +0000 +++ b/libvo/vo_dxr3.c Fri Nov 30 22:24:40 2001 +0000 @@ -1,4 +1,3 @@ -#define PES_MAX_SIZE 2048 /* * vo_dxr3.c - DXR3/H+ video out * @@ -46,7 +45,6 @@ static unsigned char *picture_data[3]; static unsigned int picture_linesize[3]; -static unsigned char *spubuf=NULL; static int v_width,v_height; static int s_width,s_height; static int c_width,c_height; @@ -54,7 +52,25 @@ static int d_pos_x,d_pos_y; static int osd_w,osd_h; static int img_format = 0; -static int palette[] = { 0x000000, 0x494949, 0xb5b5b5, 0xffffff }; +static uint32_t palette[] = + { + 0x00505050, + 0x00000000, + 0x00808080, + 0xffffffff, + 0x00005555, + 0x0000ff00, + 0x00cc2255, + 0x00cc0055, + 0x00404040, + 0x00202020, + 0x00b0b0b0, + 0x00d0d0d0, + 0x60606000, + 0x70707000, + 0x80808000, + 0x60606000, + }; static int fd_control = -1; static int fd_video = -1; static int fd_spu = -1; @@ -72,7 +88,7 @@ void write_dxr3( rte_context* context, void* data, size_t size, void* user_data ) { if( ioctl( fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts ) < 0 ) - printf( "VO: [dxr3] Unable to set PTS\n" ); + printf( "VO: [dxr3] Unable to set video PTS\n" ); write( fd_video, data, size ); } #endif @@ -125,9 +141,8 @@ v_height = height; s_width = scr_width; s_height = scr_height; - spubuf = malloc(53220); /* 53220 bytes is the standardized max size of a subpic */ - if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 ) + if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 || format == IMGFMT_BGR24 ) { #ifdef USE_MP1E int size; @@ -162,6 +177,8 @@ mp1e_context = rte_context_new( c_width, c_height, "mp1e", (void*)0xdeadbeef ); rte_set_verbosity( mp1e_context, 0 ); + printf( "VO: [dxr3] %dx%d => %dx%d\n", v_width, v_height, c_width, c_height ); + if( !mp1e_context ) { printf( "VO: [dxr3] Unable to create context!\n" ); @@ -281,7 +298,7 @@ vo_mpegpes_t *p=(vo_mpegpes_t *)src[0]; if( ioctl( fd_video, EM8300_IOCTL_VIDEO_SETPTS, &vo_pts ) < 0 ) - printf( "VO: [dxr3] Unable to set PTS\n" ); + printf( "VO: [dxr3] Unable to set video PTS\n" ); data_left = p->size; while( data_left ) @@ -289,6 +306,7 @@ return 0; } +#ifdef USE_MP1E else if( img_format == IMGFMT_YUY2 ) { int w=v_width,h=v_height; @@ -310,8 +328,57 @@ rte_push_video_buffer( mp1e_context, &mp1e_buffer ); return 0; } - - printf( "VO: [dxr3] Error in draw_frame(...)\n" ); + else if( img_format == IMGFMT_BGR24 ) + { + int x,y,w=v_width,h=v_height; + unsigned char *s,*dY,*dU,*dV; + + if(d_pos_x+w>picture_linesize[0]) w=picture_linesize[0]-d_pos_x; + if(d_pos_y+h>c_height) h=c_height-d_pos_y; + + s = src[0]+s_pos_y*(w*3); + + dY = picture_data[0]+d_pos_y*picture_linesize[0]; + dU = picture_data[1]+(d_pos_y/2)*picture_linesize[1]; + dV = picture_data[2]+(d_pos_y/2)*picture_linesize[2]; + + for(y=0;ypicture_linesize[0]) w=picture_linesize[0]-x0; if(y0+h>c_height) h=c_height-y0; s=srcimg[0]+s_pos_x+s_pos_y*stride[0]; d=picture_data[0]+x0+y0*picture_linesize[0]; - memcpy(d,s,(w*h)); + for(y=0;y