static void resize(void) { aspect(&vo_dwidth, &vo_dheight, vo_fs ? A_ZOOM : A_NOZOOM); panscan_calc(); vo_dwidth += vo_panscan_x; vo_dheight += vo_panscan_y; mpgxSetSquare(vo_dwidth / 2.0, vo_dheight / 2.0); }
static int control(uint32_t request, void *data, ...) { switch (request) { case VOCTRL_QUERY_FORMAT: return query_format(*((uint32_t*)data)); case VOCTRL_GET_IMAGE: return get_image(data); case VOCTRL_DRAW_IMAGE: return draw_image(data); case VOCTRL_SET_EQUALIZER: { va_list ap; short value; uint32_t luma,prev; if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE; if (ioctl(f,MGA_VID_GET_LUMA,&prev)) { perror("Error in mga_vid_config ioctl()"); mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); return VO_FALSE; } // printf("GET: 0x%4X 0x%4X \n",(prev>>16),(prev&0xffff)); va_start(ap, data); value = va_arg(ap, int); va_end(ap); // printf("value: %d -> ",value); value=((value+100)*255)/200-128; // maps -100=>-128 and +100=>127 // printf("%d \n",value); if(!strcmp(data,"contrast")) luma = (prev&0xFFFF0000)|(value&0xFFFF); else luma = (prev&0xFFFF)|(value<<16); if (ioctl(f,MGA_VID_SET_LUMA,luma)) { perror("Error in mga_vid_config ioctl()"); mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotSetLumaValuesFromTheKernelModule); return VO_FALSE; } return VO_TRUE; } case VOCTRL_GET_EQUALIZER: { va_list ap; int * value; short val; uint32_t luma; if ( strcmp( data,"brightness" ) && strcmp( data,"contrast" ) ) return VO_FALSE; if (ioctl(f,MGA_VID_GET_LUMA,&luma)) { perror("Error in mga_vid_config ioctl()"); mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_CouldNotGetLumaValuesFromTheKernelModule); return VO_FALSE; } if ( !strcmp( data,"contrast" ) ) val=(luma & 0xFFFF); else val=(luma >> 16); va_start(ap, data); value = va_arg(ap, int*); va_end(ap); *value = (val*200)/255; return VO_TRUE; } #ifndef VO_XMGA case VOCTRL_FULLSCREEN: if (vo_screenwidth && vo_screenheight) mga_fullscreen(); else mp_msg(MSGT_VO,MSGL_WARN, MSGTR_LIBVO_MGA_ScreenWidthHeightUnknown); return VO_TRUE; case VOCTRL_GET_PANSCAN: if ( !vo_fs ) return VO_FALSE; return VO_TRUE; #endif #if defined(VO_XMGA) && defined(CONFIG_GUI) case VOCTRL_GUISUPPORT: return VO_TRUE; #endif #ifdef VO_XMGA case VOCTRL_ONTOP: vo_x11_ontop(); return VO_TRUE; case VOCTRL_GET_PANSCAN: if ( !initialized || !vo_fs ) return VO_FALSE; return VO_TRUE; case VOCTRL_FULLSCREEN: vo_x11_fullscreen(); vo_panscan_amount=0; /* indended, fallthrough to update panscan on fullscreen/windowed switch */ #endif case VOCTRL_SET_PANSCAN: if ( vo_fs && ( vo_panscan != vo_panscan_amount ) ) // || ( !vo_fs && vo_panscan_amount ) ) { // int old_y = vo_panscan_y; panscan_calc(); // if ( old_y != vo_panscan_y ) set_window(); } return VO_TRUE; } return VO_NOTIMPL; }