# HG changeset patch # User mswitch # Date 1008881435 0 # Node ID 64ee21b3bd093033ff443c3982c7f0c7b67a0fe8 # Parent c27ab6f11c51ae5119b79ebf6fa3939793c879ee Modified the sync code once again, commented out hardware pts sync (I'll likely burn in hell before understanding how to get this bastard to sync well) Added automagic setup of aspect ratio, will remove the "aspect-bug" (I hope). As well as please you rich 16:9 doods ;) diff -r c27ab6f11c51 -r 64ee21b3bd09 libvo/vo_dxr3.c --- a/libvo/vo_dxr3.c Thu Dec 20 19:52:51 2001 +0000 +++ b/libvo/vo_dxr3.c Thu Dec 20 20:50:35 2001 +0000 @@ -30,6 +30,8 @@ #include "mmx.h" #endif +#include "aspect.h" + LIBVO_EXTERN (dxr3) #ifdef USE_MP1E @@ -72,14 +74,15 @@ #ifdef USE_MP1E 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" ); +/* if(ioctl(fd_video,EM8300_IOCTL_VIDEO_SETPTS,&vo_pts) < 0) + printf( "VO: [dxr3] Unable to set pts\n" );*/ write( fd_video, data, size ); } #endif static uint32_t init(uint32_t scr_width, uint32_t scr_height, uint32_t width, uint32_t height, uint32_t fullscreen, char *title, uint32_t format) { + int tmp1,tmp2; fd_control = open( "/dev/em8300", O_WRONLY ); if( fd_control < 1 ) { @@ -113,14 +116,34 @@ if( ioctl( fd_control, EM8300_IOCTL_SET_PLAYMODE, &ioval ) < 0 ) printf( "VO: [dxr3] Unable to set playmode!\n" ); - close( fd_control ); - img_format = format; v_width = width; v_height = height; - s_width = scr_width; - s_height = scr_height; + /* Calculate screen res */ + aspect_save_orig(v_width,v_height); + aspect_save_prescale(scr_width,scr_height); + aspect_save_screenres(720,576); /* Reference values from DVD spec */ + aspect(&s_width,&s_height,A_NOZOOM); + s_width = (scr_width+15)/16; s_width*=16; + s_height = (scr_height+15)/16; s_height*=16; + + /* Try to figure out whether to use ws output or not */ + tmp1 = abs(height - ((s_width/4)*3)); + tmp2 = abs(height - ((s_width/16)*9)); + if(tmp1 < tmp2) + { + tmp1 = EM8300_ASPECTRATIO_4_3; + printf( "VO: [dxr3] Setting aspect ratio to 4:3\n" ); + } + else + { + tmp1 = EM8300_ASPECTRATIO_16_9; + printf( "VO: [dxr3] Setting aspect ratio to 16:9\n" ); + } + ioctl(fd_control,EM8300_IOCTL_SET_ASPECTRATIO,&tmp1); + close(fd_control); + if( format == IMGFMT_YV12 || format == IMGFMT_YUY2 || format == IMGFMT_BGR24 ) { #ifdef USE_MP1E @@ -134,9 +157,6 @@ return -1; } - s_width = (scr_width+15)/16; s_width*=16; - s_height = (scr_height+15)/16; s_height*=16; - mp1e_context = rte_context_new( s_width, s_height, NULL ); rte_set_verbosity( mp1e_context, 0 ); @@ -219,9 +239,9 @@ // Set the border colorwou RGBTOYUV(0,0,0) - memset( picture_data[0], YUV_s.Y, picture_linesize[0]*s_height ); - memset( picture_data[1], YUV_s.U, picture_linesize[1]*(s_height/2) ); - memset( picture_data[2], YUV_s.V, picture_linesize[2]*(s_height/2) ); + memset( picture_data[0], YUV_s.Y, size ); + memset( picture_data[1], YUV_s.U, size/4 ); + memset( picture_data[2], YUV_s.V, size/4 ); if( !rte_start_encoding( mp1e_context ) ) { @@ -230,6 +250,7 @@ return -1; } + if(format == IMGFMT_BGR24) yuv2rgb_init(24, MODE_BGR); return 0; #endif return -1; @@ -264,8 +285,8 @@ int data_left; vo_mpegpes_t *p=(vo_mpegpes_t *)src[0]; - if(ioctl(fd_video,EM8300_IOCTL_VIDEO_SETPTS,&p->timestamp) < 0) - printf( "VO: [dxr3] Unable to set pts\n" ); +/* if(ioctl(fd_video,EM8300_IOCTL_VIDEO_SETPTS,&p->timestamp) < 0) + printf( "VO: [dxr3] Unable to set pts\n" );*/ data_left = p->size; while( data_left ) data_left -= write( fd_video, &((unsigned char*)p->data)[p->size-data_left], data_left ); @@ -295,33 +316,7 @@ 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;y