int ph_EnterFullScreen(_THIS, SDL_Surface* screen, int fmode) { PgDisplaySettings_t settings; int mode; char* refreshrate; int refreshratenum; if (!currently_fullscreen) { /* Get the video mode and set it */ if (screen->flags & SDL_ANYFORMAT) { if ((mode = get_mode_any_format(screen->w, screen->h, screen->format->BitsPerPixel)) == 0) { SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n"); return 0; } } else { if ((mode = ph_GetVideoMode(screen->w, screen->h, screen->format->BitsPerPixel)) == 0) { SDL_SetError("ph_EnterFullScreen(): can't find appropriate video mode !\n"); return 0; } if (PgGetVideoModeInfo(mode, &mode_info) < 0) { SDL_SetError("ph_EnterFullScreen(): can't get video mode capabilities !\n"); return 0; } if (mode_info.height != screen->h) { if ((mode_info.height==480) && (screen->h==400)) { videomode_emulatemode=1; } } else { videomode_emulatemode=0; } } /* save old video mode caps */ PgGetVideoMode(&settings); old_video_mode=settings.mode; old_refresh_rate=settings.refresh; /* setup new video mode */ settings.mode = mode; settings.refresh = 0; settings.flags = 0; refreshrate=SDL_getenv("SDL_PHOTON_FULLSCREEN_REFRESH"); if (refreshrate!=NULL) { if (SDL_sscanf(refreshrate, "%d", &refreshratenum)==1) { settings.refresh = refreshratenum; } } if (PgSetVideoMode(&settings) < 0) { SDL_SetError("ph_EnterFullScreen(): PgSetVideoMode() call failed !\n"); return 0; } if (this->screen) { if ((this->screen->flags & SDL_OPENGL)==SDL_OPENGL) { #if !SDL_VIDEO_OPENGL || (_NTO_VERSION < 630) return 0; /* 6.3.0 */ #endif } } if (fmode==0) { if (OCImage.direct_context==NULL) { OCImage.direct_context=(PdDirectContext_t*)PdCreateDirectContext(); if (!OCImage.direct_context) { SDL_SetError("ph_EnterFullScreen(): Can't create direct context !\n"); ph_LeaveFullScreen(this); return 0; } } OCImage.oldDC=PdDirectStart(OCImage.direct_context); } currently_fullscreen = 1; } PgFlush(); return 1; }
/***************************************************************************** * QNXInitDisplay: check screen resolution, depth, amount of video ram, etc *****************************************************************************/ static int QNXInitDisplay( vout_thread_t * p_vout ) { PgHWCaps_t hwcaps; PgDisplaySettings_t cfg; PgVideoModeInfo_t minfo; /* get graphics card hw capabilities */ if( PgGetGraphicsHWCaps( &hwcaps ) != 0 ) { msg_Err( p_vout, "unable to get gfx card capabilities" ); return( 1 ); } /* get current video mode */ if( PgGetVideoMode( &cfg ) != 0 ) { msg_Err( p_vout, "unable to get current video mode" ); return( 1 ); } /* get video mode info */ if( PgGetVideoModeInfo( cfg.mode, &minfo ) != 0 ) { msg_Err( p_vout, "unable to get info for video mode" ); return( 1 ); } if( p_vout->p_sys->i_mode == MODE_VIDEO_OVERLAY ) { int i = 0; PgScalerCaps_t vcaps; if( ( p_vout->p_sys->p_channel = PgCreateVideoChannel( Pg_VIDEO_CHANNEL_SCALER, 0 ) ) == NULL ) { msg_Err( p_vout, "unable to create video channel" ); printf("errno = %d\n", errno); p_vout->p_sys->i_mode = MODE_NORMAL_MEM; } else { vcaps.size = sizeof( vcaps ); while( PgGetScalerCapabilities( p_vout->p_sys->p_channel, i++, &vcaps ) == 0 ) { printf("vcaps.format = 0x%x\n", vcaps.format); if( vcaps.format == Pg_VIDEO_FORMAT_YV12 || vcaps.format == Pg_VIDEO_FORMAT_YUV420 || vcaps.format == Pg_VIDEO_FORMAT_YUY2 || vcaps.format == Pg_VIDEO_FORMAT_UYVY || vcaps.format == Pg_VIDEO_FORMAT_RGB555 || vcaps.format == Pg_VIDEO_FORMAT_RGB565 || vcaps.format == Pg_VIDEO_FORMAT_RGB8888 ) { p_vout->p_sys->i_vc_flags = vcaps.flags; p_vout->p_sys->i_vc_format = vcaps.format; } vcaps.size = sizeof( vcaps ); } if( p_vout->p_sys->i_vc_format == 0 ) { msg_Warn( p_vout, "need YV12, YUY2 or RGB8888 overlay" ); p_vout->p_sys->i_mode = MODE_NORMAL_MEM; } } } /* use video ram if we have enough available */ if( p_vout->p_sys->i_mode == MODE_NORMAL_MEM && (minfo.bits_per_pixel != 8) && hwcaps.currently_available_video_ram >= ( ( minfo.width * minfo.height * minfo.bits_per_pixel * MAX_DIRECTBUFFERS) / 8 ) ) { p_vout->p_sys->i_mode = MODE_VIDEO_MEM; printf("Using video memory...\n"); } p_vout->p_sys->i_img_type = minfo.type; p_vout->p_sys->screen_dim.w = minfo.width; p_vout->p_sys->screen_dim.h = minfo.height; p_vout->p_sys->i_screen_depth = minfo.bits_per_pixel; switch( p_vout->p_sys->i_screen_depth ) { case 8: p_vout->output.i_chroma = VLC_CODEC_RGB8; p_vout->p_sys->i_bytes_per_pixel = 1; p_vout->output.pf_setpalette = SetPalette; break; case 15: p_vout->output.i_chroma = VLC_CODEC_RGB15; p_vout->p_sys->i_bytes_per_pixel = 2; p_vout->output.i_rmask = 0x7c00; p_vout->output.i_gmask = 0x03e0; p_vout->output.i_bmask = 0x001f; break; case 16: p_vout->output.i_chroma = VLC_CODEC_RGB16; p_vout->p_sys->i_bytes_per_pixel = 2; p_vout->output.i_rmask = 0xf800; p_vout->output.i_gmask = 0x07e0; p_vout->output.i_bmask = 0x001f; break; case 24: p_vout->output.i_chroma = VLC_CODEC_RGB24; p_vout->p_sys->i_bytes_per_pixel = 3; p_vout->output.i_rmask = 0xff0000; p_vout->output.i_gmask = 0x00ff00; p_vout->output.i_bmask = 0x0000ff; break; case 32: default: p_vout->output.i_chroma = VLC_CODEC_RGB32; p_vout->p_sys->i_bytes_per_pixel = 4; p_vout->output.i_rmask = 0xff0000; p_vout->output.i_gmask = 0x00ff00; p_vout->output.i_bmask = 0x0000ff; break; } return( 0 ); }