static gboolean gst_sdlvideosink_supported (GstImplementsInterface * interface, GType iface_type) { GstSDLVideoSink *sdlvideosink = GST_SDLVIDEOSINK (interface); gboolean result = FALSE; /* check SDL for whether it was compiled against X, FB, etc. */ if (iface_type == GST_TYPE_X_OVERLAY) { gchar tmp[4]; if (!sdlvideosink->init) { g_mutex_lock (sdlvideosink->lock); SDL_Init (SDL_INIT_VIDEO); /* True if the video driver is X11 */ result = (strcmp ("x11", SDL_VideoDriverName (tmp, 4)) == 0); SDL_QuitSubSystem (SDL_INIT_VIDEO); g_mutex_unlock (sdlvideosink->lock); } else result = sdlvideosink->is_xwindows; } else if (iface_type == GST_TYPE_NAVIGATION) result = TRUE; return result; }
void SDL::printSystemInfo() { // Getting Video Driver information char namebuf[255]; SDL_VideoDriverName(namebuf, 254); Log::log("Video Driver: " + std::string(namebuf)); // Getting Joystick information int num = SDL_NumJoysticks(); Log::log("There are " + SDL::intToString(num) + " Joystick(s) currently available."); for (int i = 0; i < num; i++) Log::log("Joystick no " + SDL::intToString(i + 1) + ": " + std::string(SDL_JoystickName(i))); // Getting CD-ROM information num = SDL_CDNumDrives(); Log::log("There are " + SDL::intToString(num) + " CD-ROM Drive(s) currently available."); for (int i = 0; i < num; i++) Log::log("CD-ROM Drive no " + SDL::intToString(i + 1) + ": " + std::string(SDL_CDName(i))); }
int TFB_GL_InitGraphics (int driver, int flags, int width, int height) { char VideoName[256]; log_add (log_Info, "Initializing SDL with OpenGL support."); SDL_VideoDriverName (VideoName, sizeof (VideoName)); log_add (log_Info, "SDL driver used: %s", VideoName); log_add (log_Info, "SDL initialized."); log_add (log_Info, "Initializing Screen."); ScreenWidth = 320; ScreenHeight = 240; if (TFB_GL_ConfigureVideo (driver, flags, width, height, 0)) { log_add (log_Fatal, "Could not initialize video: " "no fallback at start of program!"); exit (EXIT_FAILURE); } // Initialize scalers (let them precompute whatever) Scale_Init (); return 0; }
static mrb_value mrb_sdl_video_driver_name (mrb_state *mrb, mrb_value self) { char* name_buf; mrb_int max_len; mrb_get_args(mrb, "s", &name_buf); mrb_get_args(mrb, "|i", &max_len); return mrb_str_new_cstr(mrb, SDL_VideoDriverName(name_buf, max_len)); }
bool Graphics::setVideoMode(int w, int h, int bpp, bool fs, bool hwaccel) { logger->log("Setting video mode %dx%d %s", w, h, fs ? "fullscreen" : "windowed"); logger->log("Bits per pixel: %d", bpp); int displayFlags = SDL_ANYFORMAT; mFullscreen = fs; mHWAccel = hwaccel; if (fs) displayFlags |= SDL_FULLSCREEN; if (hwaccel) displayFlags |= SDL_HWSURFACE | SDL_DOUBLEBUF; else displayFlags |= SDL_SWSURFACE; mScreen = SDL_SetVideoMode(w, h, bpp, displayFlags); if (!mScreen) return false; char videoDriverName[64]; if (SDL_VideoDriverName(videoDriverName, 64)) logger->log("Using video driver: %s", videoDriverName); else logger->log("Using video driver: unknown"); const SDL_VideoInfo *vi = SDL_GetVideoInfo(); logger->log("Possible to create hardware surfaces: %s", ((vi->hw_available) ? "yes" : "no")); logger->log("Window manager available: %s", ((vi->wm_available) ? "yes" : "no")); logger->log("Accelerated hardware to hardware blits: %s", ((vi->blit_hw) ? "yes" : "no")); logger->log("Accelerated hardware to hardware colorkey blits: %s", ((vi->blit_hw_CC) ? "yes" : "no")); logger->log("Accelerated hardware to hardware alpha blits: %s", ((vi->blit_hw_A) ? "yes" : "no")); logger->log("Accelerated software to hardware blits: %s", ((vi->blit_sw) ? "yes" : "no")); logger->log("Accelerated software to hardware colorkey blits: %s", ((vi->blit_sw_CC) ? "yes" : "no")); logger->log("Accelerated software to hardware alpha blits: %s", ((vi->blit_sw_A) ? "yes" : "no")); logger->log("Accelerated color fills: %s", ((vi->blit_fill) ? "yes" : "no")); logger->log("Available video memory: %d", vi->video_mem); setTarget(mScreen); return true; }
bool Graphics::videoInfo() { logger->log("SDL video info"); #ifdef USE_SDL2 logger->log("Using video driver: %s", SDL_GetCurrentVideoDriver()); if (mRenderer) { SDL_RendererInfo info; SDL_GetRendererInfo(mRenderer, &info); dumpRendererInfo("Current SDL renderer name: %s", info); const int num = SDL_GetNumRenderDrivers(); logger->log("Known renderers"); for (int f = 0; f < num; f ++) { if (!SDL_GetRenderDriverInfo(f, &info)) dumpRendererInfo("renderer name: %s", info); } } #else char videoDriverName[65]; if (SDL_VideoDriverName(videoDriverName, 64)) logger->log("Using video driver: %s", videoDriverName); else logger->log1("Using video driver: unknown"); mDoubleBuffer = ((mWindow->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF); logger->log("Double buffer mode: %s", mDoubleBuffer ? "yes" : "no"); ImageHelper::dumpSurfaceFormat(mWindow); const SDL_VideoInfo *const vi = SDL_GetVideoInfo(); if (!vi) return false; logger->log("Possible to create hardware surfaces: %s", ((vi->hw_available) ? "yes" : "no")); logger->log("Window manager available: %s", ((vi->wm_available) ? "yes" : "no")); logger->log("Accelerated hardware to hardware blits: %s", ((vi->blit_hw) ? "yes" : "no")); logger->log("Accelerated hardware to hardware colorkey blits: %s", ((vi->blit_hw_CC) ? "yes" : "no")); logger->log("Accelerated hardware to hardware alpha blits: %s", ((vi->blit_hw_A) ? "yes" : "no")); logger->log("Accelerated software to hardware blits: %s", ((vi->blit_sw) ? "yes" : "no")); logger->log("Accelerated software to hardware colorkey blits: %s", ((vi->blit_sw_CC) ? "yes" : "no")); logger->log("Accelerated software to hardware alpha blits: %s", ((vi->blit_sw_A) ? "yes" : "no")); logger->log("Accelerated color fills: %s", ((vi->blit_fill) ? "yes" : "no")); #endif return true; }
bool SdlDisplay::Open( int w, int h, int bpp, bool full ) { logInfo( "Opening display: w=%i h=%i bpp=%i full=%i", w, h, bpp, full ); ASSERT( ! m_surface ); if( m_surface ) { logError( "Cannot open a display that is already opened!" ); return false; } if( ! SDL_WasInit( SDL_INIT_VIDEO ) ) { if( SDL_InitSubSystem( SDL_INIT_VIDEO ) < 0 ) { logError( "Failed to initialize video subsystem, cannot open display: %s", SDL_GetError() ); return false; } logDebug( "Video subsystem initialized" ); } const SDL_VideoInfo* info = SDL_GetVideoInfo(); if( ! info ) { logError( "Failed to query video info: %s", SDL_GetError() ); SDL_QuitSubSystem( SDL_INIT_VIDEO ); return false; } SDL_GL_SetAttribute( SDL_GL_RED_SIZE, bpp/3 ); SDL_GL_SetAttribute( SDL_GL_GREEN_SIZE, bpp/3 ); SDL_GL_SetAttribute( SDL_GL_BLUE_SIZE, bpp/3 ); SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE, 16 ); // depth buffer size int flags = SDL_OPENGL; if( full ) flags |= SDL_FULLSCREEN; m_surface = SDL_SetVideoMode( w, h, bpp, flags ); if( ! m_surface ) { logError( "Failed to set video mode: w=%i h=%i bpp=%i flags=%i error=%s", w, h, bpp, flags, SDL_GetError() ); SDL_QuitSubSystem( SDL_INIT_VIDEO ); return false; } char temp[ 128 ]={0}; logInfo( "Video initialized. SDL reports driver as: %s", SDL_VideoDriverName(temp, sizeof(temp) ) ); logInfo( "OpenGL information:" ); logInfo( " GL_VENDOR : %s", glGetString( GL_VENDOR ) ); logInfo( " GL_RENDERER : %s", glGetString( GL_RENDERER ) ); logInfo( " GL_VERSION : %s", glGetString( GL_VERSION ) ); logInfo( " GL_EXTENSIONS : %s", glGetString( GL_EXTENSIONS ) ); return true; }
/* * CSDLVideo class is the interface to SDL. We probably want to * move this to another file, to leave the ring buffer code (what is * CSDLVideoSync) alone * Having this seperate allows us to keep the video window present between * changing sessions. */ CSDLVideo::CSDLVideo(int initial_x, int initial_y, uint32_t mask) { char buf[32]; const SDL_VideoInfo *video_info; m_mutex = SDL_CreateMutex(); m_image = NULL; m_screen = NULL; m_pos_x = initial_x; m_pos_y = initial_y; m_mask = mask; m_name = NULL; m_pixel_width = -1; m_pixel_height = -1; m_max_width = -1; m_max_height = -1; // One time initialization stuff if (SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) < 0 || !SDL_VideoDriverName(buf, 1)) { video_message(LOG_CRIT, "Could not init SDL video: %s", SDL_GetError()); } video_info = SDL_GetVideoInfo(); switch (video_info->vfmt->BitsPerPixel) { case 16: case 32: m_video_bpp = video_info->vfmt->BitsPerPixel; break; default: m_video_bpp = 16; break; } m_old_win_w = m_old_win_h = 0; m_old_w = m_old_h = 0; SDL_ShowCursor(SDL_DISABLE); //Query the current Window system resolution SDL_SysWMinfo info; SDL_VERSION(&info.version); if (SDL_GetWMInfo(&info)) { #if defined(WM_X11) if ( info.subsystem == SDL_SYSWM_X11 ) { info.info.x11.lock_func(); m_max_width = DisplayWidth(info.info.x11.display, DefaultScreen(info.info.x11.display)); m_max_height = DisplayHeight(info.info.x11.display, DefaultScreen(info.info.x11.display)); info.info.x11.unlock_func(); video_message(LOG_INFO, "Max Window resolution %dx%d", m_max_width, m_max_height); } else { video_message(LOG_ERR, "Failed to get Max resolution foe window system"); } #elif defined (WM_WIN) m_max_width=GetSystemMetrics(SM_CXSCREEN); m_max_height=GetSystemMetrics(SM_CYSCREEN); video_message(LOG_INFO, "Max Window resolution %dx%d", m_max_width, m_max_height); #endif } }
// // initsystem() -- init SDL systems // int32_t initsystem(void) { #if defined NOSDLPARACHUTE const int sdlinitflags = SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE; #else const int sdlinitflags = SDL_INIT_VIDEO; #endif mutex_init(&m_initprintf); #ifdef _WIN32 win_init(); #endif if (sdlayer_checkversion()) return -1; if (SDL_Init(sdlinitflags)) { initprintf("Initialization failed! (%s)\nNon-interactive mode enabled\n", SDL_GetError()); novideo = 1; #ifdef USE_OPENGL nogl = 1; #endif } atexit(uninitsystem); frameplace = 0; lockcount = 0; if (!novideo) { char drvname[32]; #ifdef USE_OPENGL if (loadgldriver(getenv("BUILD_GLDRV"))) { initprintf("Failed loading OpenGL driver. GL modes will be unavailable.\n"); nogl = 1; } #endif if (SDL_VideoDriverName(drvname, 32)) initprintf("Using \"%s\" video driver\n", drvname); wm_setapptitle(apptitle); } #if defined GEKKO SDL_ShowCursor(SDL_DISABLE); #endif return 0; }
// Инициализация библиотеки эмулятора void InitEGraph() { char pcCaption[80]; if (strlen(szVideoDriver)!=0) { strcpy(pcCaption, "SDL_VIDEODRIVER="); strcat(pcCaption,szVideoDriver); putenv(pcCaption); } if (strlen(szAudioDriver)!=0) { strcpy(pcCaption, "SDL_AUDIODRIVER="); strcat(pcCaption,szAudioDriver); putenv(pcCaption); } //putenv("SDL_VIDEODRIVER=windib"); //putenv("SDL_AUDIODRIVER=waveout"); SDL_Init(SDL_INIT_VIDEO | SDL_INIT_TIMER); if (!bMute) bMute=SDL_InitSubSystem(SDL_INIT_AUDIO); char pcDrvName[20]; strcpy(pcCaption, "Emu80/SDL v. 3.14 development (video: "); SDL_VideoDriverName(pcDrvName, 20); strcat(pcCaption,pcDrvName); if (!bMute) { strcat(pcCaption,", audio: "); SDL_AudioDriverName(pcDrvName, 20); strcat(pcCaption,pcDrvName); } strcat(pcCaption,"), F10 - menu"); //SDL_WM_SetCaption("Emu80 / SDL", 0); SDL_WM_SetCaption(pcCaption, 0); atexit(SDL_Quit); //semDraw=SDL_CreateSemaphore(1); /*sfScreen = SDL_SetVideoMode(640, 480, 8, SDL_HWSURFACE | SDL_HWPALETTE);*/ pcScreenBuf=new char[160*64]; ClearScreen(); LoadFonts(); SetVideoMode(vmText30); //ChangeResolution(); //SDL_ShowCursor(SDL_DISABLE); ClearScreen(); InitAudio(); }
//-------------------------------------------------------------------------------------------- SDL_bool SDLX_Get_Screen_Info( SDLX_screen_info_t * psi, SDL_bool make_report ) { Uint32 init_flags = 0; SDL_Surface * ps; const SDL_VideoInfo * pvi; memset( psi, 0, sizeof( *psi ) ); init_flags = SDL_WasInit( SDL_INIT_EVERYTHING ); if ( 0 == init_flags ) { if ( make_report ) fprintf( LOCAL_STDOUT, "ERROR: SDLX_Get_Screen_Info() called before initializing SDL\n" ); return SDL_FALSE; } else if ( HAS_NO_BITS( init_flags, SDL_INIT_VIDEO ) ) { if ( make_report ) fprintf( LOCAL_STDOUT, "ERROR: SDLX_Get_Screen_Info() called before initializing SDL video driver\n" ); return SDL_FALSE; } ps = SDL_GetVideoSurface(); pvi = SDL_GetVideoInfo(); // store the screen info for everyone to use psi->pscreen = ps; psi->d = ps->format->BitsPerPixel; psi->x = ps->w; psi->y = ps->h; // Grab all the available video modes psi->video_mode_list = SDL_ListModes( ps->format, ps->flags | SDL_FULLSCREEN ); // log the video driver info SDL_VideoDriverName( psi->szDriver, sizeof( psi->szDriver ) ); // grab all SDL_GL_* attributes SDLX_read_sdl_gl_attrib( &( psi->gl_att ) ); // translate the surface flags into the bitfield SDLX_download_sdl_video_flags( ps->flags, &( psi->flags ) ); psi->hw_available = pvi->hw_available; psi->wm_available = pvi->wm_available; psi->blit_hw = pvi->blit_hw; psi->blit_hw_CC = pvi->blit_hw_CC; psi->blit_hw_A = pvi->blit_hw_A; psi->blit_sw = pvi->blit_sw; psi->blit_sw_CC = pvi->blit_sw_CC; psi->blit_sw_A = pvi->blit_sw_A; if ( make_report ) SDLX_Report_Screen_Info( psi ); return SDL_TRUE; }
void SDLVid_SetCaption() { char szName[100]; if (SDL_VideoDriverName(szName, 100)) { char szCap[1024]; sprintf(szCap, "SDL Video Output (%s)", szName); SDL_WM_SetCaption(szCap, NULL); } else { SDL_WM_SetCaption("SDL Video Output", NULL); } }
void I_EnableLoadingDisk(void) { patch_t *disk; byte *tmpbuf; char *disk_name; int y; char buf[20]; SDL_VideoDriverName(buf, 15); if (!strcmp(buf, "Quartz")) { // MacOS Quartz gives us pageflipped graphics that screw up the // display when we use the loading disk. Disable it. // This is a gross hack. return; } if (M_CheckParm("-cdrom") > 0) disk_name = DEH_String("STCDROM"); else disk_name = DEH_String("STDISK"); disk = W_CacheLumpName(disk_name, PU_STATIC); // Draw the patch into a temporary buffer tmpbuf = Z_Malloc(SCREENWIDTH * (disk->height + 1), PU_STATIC, NULL); V_UseBuffer(tmpbuf); // Draw the disk to the screen: V_DrawPatch(0, 0, disk); disk_image = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); for (y=0; y<LOADING_DISK_H; ++y) { memcpy(disk_image + LOADING_DISK_W * y, tmpbuf + SCREENWIDTH * y, LOADING_DISK_W); } // All done - free the screen buffer and restore the normal // video buffer. W_ReleaseLumpName(disk_name); V_RestoreBuffer(); Z_Free(tmpbuf); }
qboolean GLimp_StartDriverAndSetMode(int mode, qboolean fullscreen, qboolean noborder) { rserr_t err; if (!SDL_WasInit(SDL_INIT_VIDEO)) { char driverName[64]; if (SDL_Init(SDL_INIT_VIDEO) == -1) { ri.Printf(PRINT_ALL, "SDL_Init( SDL_INIT_VIDEO ) FAILED (%s)\n", SDL_GetError()); return qfalse; } SDL_VideoDriverName(driverName, sizeof(driverName) - 1); ri.Printf(PRINT_ALL, "SDL using driver \"%s\"\n", driverName); Cvar_Set("r_sdlDriver", driverName); } if (fullscreen && Cvar_VariableIntegerValue("in_nograb")) { ri.Printf(PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n"); ri.Cvar_Set("r_fullscreen", "0"); r_fullscreen->modified = qfalse; fullscreen = qfalse; } err = GLimp_SetMode(mode, fullscreen, noborder); switch (err) { case RSERR_INVALID_FULLSCREEN: ri.Printf(PRINT_ALL, "Fullscreen unavailable in mode: (%d)\n",mode); return qfalse; case RSERR_INVALID_MODE: ri.Printf(PRINT_ALL, "WARNING: could not set mode: (%d)\n", mode); return qfalse; default: ri.Printf(PRINT_ALL, "Set video mode: (%d)\n", mode); break; } if ( !qglGetString(GL_VENDOR) ) return qfalse; return qtrue; }
void CScreen::Debug() { char VideoDriverName[SMALL_BUF]; const SDL_VideoInfo *SV_Info = SDL_GetVideoInfo(); std::cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << std::endl << " MDD - Debug do Video " << std::endl << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=" << std::endl << std::endl; if (SDL_VideoDriverName(VideoDriverName, SMALL_BUF)) std::cout << "Nome do driver de vídeo: " << VideoDriverName << std::endl; else std::cout << "Nome do driver de vídeo: desconhecido" << std::endl; std::cout << "Resolução atual: " << uiWidth << "x" << uiHeight << "x" << uiBPP << std::endl << std::endl; std::cout << "Configuração Atual: " << std::endl << std::endl << "Tela Cheia: " << (((SS_p_Screen->flags & SDL_FULLSCREEN) == SDL_FULLSCREEN) ? "sim" : "não") << std::endl << "Buffer Duplo: " << (((SS_p_Screen->flags & SDL_DOUBLEBUF) == SDL_DOUBLEBUF) ? "sim" : "não") << std::endl << "Surperfície no Hardware: " << (((SS_p_Screen->flags & SDL_HWSURFACE)== SDL_HWSURFACE) ? "sim" : "não") << std::endl << "Aceleração por Hardware: " << (((SS_p_Screen->flags & SDL_HWACCEL)== SDL_HWACCEL) ? "sim" : "não") << std::endl << std::endl; std::cout << "\'Manipulador de Janelas\' presente: " << ((SV_Info->wm_available) ? "sim" : "não") << std::endl; std::cout << "\'Hardware Surfaces\' Possíveis de criar: " << ((SV_Info->hw_available) ? "sim" : "não") << std::endl; std::cout << "\'Blits\' Hardware para Hardware Acelerado: " << ((SV_Info->blit_hw) ? "sim" : "não") << std::endl; std::cout << "\'ColorKey Blits\' Hardware para Hardware Acelerado: " << ((SV_Info->blit_hw_CC) ? "sim" : "não") << std::endl; std::cout << "\'Alpha Blit\' Hardware para Hardware Acelerado: " << ((SV_Info->blit_hw_A) ? "sim" : "não") << std::endl; std::cout << "\'Blits\' Software para Hardware Acelerado: " << ((SV_Info->blit_sw) ? "sim" : "não") << std::endl; std::cout << "\'ColorKey Blits\' Software para Hardware Acelerado: " << ((SV_Info->blit_sw_CC) ? "sim" : "não") << std::endl; std::cout << "\'Alpha Blits\' Software para Hardware Acelerado: " << ((SV_Info->blit_sw_A) ? "sim" : "não") << std::endl; std::cout << "\'Color Fills\' Acelerado: " << ((SV_Info->blit_fill) ? "sim" : "não") << std::endl; std::cout << std::endl << "Total de Memória de Vídeo livre presente: " << SV_Info->video_mem << "KB" << std::endl << std::endl; std::cout << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << std::endl << " MDD - Fim do debug do Video " << std::endl << "-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-" << std::endl; }
// // ISDL12Window::getVideoDriverName // // Returns the name of the video driver that SDL is currently // configured to use. // std::string ISDL12Window::getVideoDriverName() const { char driver[128]; if ((SDL_VideoDriverName(driver, 128)) == NULL) { const char* pdrv = getenv("SDL_VIDEODRIVER"); if (pdrv == NULL) return ""; return std::string(pdrv); } return std::string(driver); }
std::string SDLVideo::GetVideoDriverName() { char driver[128]; if((SDL_VideoDriverName(driver, 128)) == NULL) { char *pdrv; // Don't modify or free this if((pdrv = getenv("SDL_VIDEODRIVER")) == NULL) return ""; // Can't determine driver return std::string(pdrv); // Return the environment variable } return std::string(driver); // Return the name as provided by SDL }
/* =============== GLimp_StartDriverAndSetMode =============== */ static qboolean GLimp_StartDriverAndSetMode( int mode, int fullscreen, int noborder ) { rserr_t err; if ( !SDL_WasInit( SDL_INIT_VIDEO ) ) { char driverName[ 64 ]; ri.Printf( PRINT_ALL, "SDL_Init( SDL_INIT_VIDEO )... " ); if ( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE ) == -1 ) { ri.Printf( PRINT_ALL, "SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE) FAILED (%s)\n", SDL_GetError() ); return qfalse; } SDL_VideoDriverName( driverName, sizeof( driverName ) - 1 ); ri.Printf( PRINT_ALL, "SDL using driver \"%s\"\n", driverName ); ri.Cvar_Set( "r_sdlDriver", driverName ); } if ( fullscreen && ri.Cvar_VariableIntegerValue( "in_nograb" ) ) { ri.Printf( PRINT_ALL, "Fullscreen not allowed with in_nograb 1\n" ); ri.Cvar_Set( "r_fullscreen", "0" ); r_fullscreen->modified = qfalse; fullscreen = qfalse; } err = GLimp_SetMode( mode, fullscreen, noborder ); switch ( err ) { case RSERR_INVALID_FULLSCREEN: ri.Printf( PRINT_ALL, "...WARNING: fullscreen unavailable in this mode\n" ); return qfalse; case RSERR_INVALID_MODE: ri.Printf( PRINT_ALL, "...WARNING: could not set the given mode (%d)\n", mode ); return qfalse; default: break; } return qtrue; }
/**\brief Initializes the Video display. */ bool Video::Initialize( void ) { char buf[32] = {0}; // initialize SDL if( SDL_Init( SDL_INIT_VIDEO ) != 0 ) { LogMsg(ERR, "Could not initialize SDL: %s", SDL_GetError() ); return( false ); } else { LogMsg(INFO, "SDL video initialized using %s driver.", SDL_VideoDriverName( buf, 31 ) ); } atexit( SDL_Quit ); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); return( true ); }
static void LoadDiskImage(void) { patch_t *disk; char *disk_name; int y; int xoffset = SCREENWIDTH - LOADING_DISK_W; int yoffset = SCREENHEIGHT - LOADING_DISK_H; char buf[20]; SDL_VideoDriverName(buf, 15); if (!strcmp(buf, "Quartz")) { // MacOS Quartz gives us pageflipped graphics that screw up the // display when we use the loading disk. Disable it. // This is a gross hack. return; } if (M_CheckParm("-cdrom") > 0) disk_name = DEH_String("STCDROM"); else disk_name = DEH_String("STDISK"); disk = W_CacheLumpName(disk_name, PU_STATIC); // Draw the disk to the screen: V_DrawPatch(SCREENWIDTH - LOADING_DISK_W, SCREENHEIGHT - LOADING_DISK_H, 0, disk); disk_image = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); saved_background = Z_Malloc(LOADING_DISK_W * LOADING_DISK_H, PU_STATIC, NULL); for (y=0; y<LOADING_DISK_H; ++y) { memcpy(disk_image + LOADING_DISK_W * y, screens[0] + SCREENWIDTH * (y + yoffset) + xoffset, LOADING_DISK_W); } W_ReleaseLumpName(disk_name); }
int video_init() { SDL_Color palette[4]; char drivername[32]; if(SDL_Init(SDL_INIT_VIDEO) != 0) { maggie_error("ERRRO: SDL_Init: %s\n",SDL_GetError()); return FALSE; } SDL_WM_SetCaption("Maggie",NULL); screen = SDL_SetVideoMode(160,144,8,SDL_SWSURFACE); /*palette[0].r = palette[0].g = palette[0].b = 240; palette[1].r = palette[1].g = palette[1].b = 160; palette[2].r = palette[2].g = palette[2].b = 80; palette[3].r = palette[3].g = palette[3].b = 0;*/ palette[0].r = 240; palette[0].g = 140; palette[0].b = 0; palette[1].r = 200; palette[1].g = 100; palette[1].b = 0; palette[2].r = 160; palette[2].g = 60; palette[2].b = 0; palette[3].r = 0; palette[3].g = 0; palette[3].b = 0; SDL_SetColors(screen,palette,0,4); SDL_VideoDriverName(drivername,32); if(strcmp(drivername,"x11") != 0) SDL_ShowCursor(FALSE); return TRUE; }
bool VideoFrame::init() { log::info << "Starting the SDL subsystem..." << log::endl; int result = SDL_Init(SDL_INIT_VIDEO); if (result < 0) { log::error << "Could not start SDL (error: " << result << ")" << log::endl; return false; } char driverName[128]; SDL_VideoDriverName(driverName, sizeof (driverName)); log::info << "Using Video Driver : " << driverName << log::endl; screen = SDL_SetVideoMode(width, height, 0, video_format); overlay = SDL_CreateYUVOverlay(width, height, SDL_YV12_OVERLAY, screen); SDL_WM_SetCaption(window_name.c_str(), NULL); return true; }
/* * Initialzes the SDL OpenGL context */ int GLimp_Init(void) { if (!SDL_WasInit(SDL_INIT_VIDEO)) { char driverName[64]; if (SDL_Init(SDL_INIT_VIDEO) == -1) { VID_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n", SDL_GetError()); return false; } SDL_VideoDriverName(driverName, sizeof(driverName) - 1); VID_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName); } return true; }
int main(int argc, char *args[]){ vecBlocksInPlay.push_back(Block2); vecBlocksInPlay.push_back(Block3); vecBlocksInPlay.push_back(Floor); char VideoDriver[50]; bool quit = false; //bool to see if user wants to exit the game. SDL_VideoDriverName(VideoDriver, 50); printf("Video Driver: %s\n", VideoDriver); Video1->ApplySurface(10,50,ScreenFont1.DrawFontString("Welcome to the game it will start soon!!!")); Video1->Flip(); keyBoardTest(Video1); exit(0); return 0; }
const char *VideoDriver_SDL::Start(const char * const *parm) { char buf[30]; _use_hwpalette = GetDriverParamInt(parm, "hw_palette", 2); const char *s = SdlOpen(SDL_INIT_VIDEO); if (s != NULL) return s; GetVideoModes(); if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) { return SDL_CALL SDL_GetError(); } SDL_CALL SDL_VideoDriverName(buf, sizeof buf); DEBUG(driver, 1, "SDL: using driver '%s'", buf); MarkWholeScreenDirty(); SetupKeyboard(); _draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL; return NULL; }
/* * Initialzes the SDL OpenGL context */ int GLimp_Init(void) { if (!SDL_WasInit(SDL_INIT_VIDEO)) { if (SDL_Init(SDL_INIT_VIDEO) == -1) { VID_Printf(PRINT_ALL, "Couldn't init SDL video: %s.\n", SDL_GetError()); return false; } #if SDL_VERSION_ATLEAST(2, 0, 0) const char* driverName = SDL_GetCurrentVideoDriver(); #else char driverName[64]; SDL_VideoDriverName(driverName, sizeof(driverName)); #endif VID_Printf(PRINT_ALL, "SDL video driver is \"%s\".\n", driverName); } return true; }
const char *VideoDriver_SDL::Start(const char * const *parm) { char buf[30]; const char *s = SdlOpen(SDL_INIT_VIDEO); if (s != NULL) return s; GetVideoModes(); if (!CreateMainSurface(_cur_resolution.width, _cur_resolution.height)) { return SDL_CALL SDL_GetError(); } SDL_CALL SDL_VideoDriverName(buf, sizeof buf); DEBUG(driver, 1, "SDL: using driver '%s'", buf); MarkWholeScreenDirty(); SDL_CALL SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); SDL_CALL SDL_EnableUNICODE(1); _draw_threaded = GetDriverParam(parm, "no_threads") == NULL && GetDriverParam(parm, "no_thread") == NULL; return NULL; }
static SDL_Overlay * video_init( void *data, SDL_Surface **pscreen ) { struct ALL_DATA *all_data = (struct ALL_DATA *) data; struct GLOBAL *global = all_data->global; int width = global->width; int height = global->height; if (*pscreen == NULL) //init SDL { char driver[128]; /*----------------------------- Test SDL capabilities ---------------------*/ if (SDL_Init(SDL_INIT_VIDEO|SDL_INIT_TIMER) < 0) { g_printerr("Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } /* For this version, we will use hardware acceleration as default*/ if(global->hwaccel) // set global environmental variables if hw accel available { if ( ! getenv("SDL_VIDEO_YUV_HWACCEL") ) putenv("SDL_VIDEO_YUV_HWACCEL=1"); if ( ! getenv("SDL_VIDEO_YUV_DIRECT") ) putenv("SDL_VIDEO_YUV_DIRECT=1"); } else { if ( ! getenv("SDL_VIDEO_YUV_HWACCEL") ) putenv("SDL_VIDEO_YUV_HWACCEL=0"); if ( ! getenv("SDL_VIDEO_YUV_DIRECT") ) putenv("SDL_VIDEO_YUV_DIRECT=0"); } // print the name of the video driver if debugging if (SDL_VideoDriverName(driver, sizeof(driver)) && global->debug) { g_print("Video driver: %s\n", driver); } info = SDL_GetVideoInfo(); // get camera info if (info->wm_available && global->debug) g_print("A window manager is available\n"); if (info->hw_available) { if (global->debug) g_print("Hardware surfaces are available (%dK video memory)\n", info->video_mem); SDL_VIDEO_Flags |= SDL_HWSURFACE; SDL_VIDEO_Flags |= SDL_DOUBLEBUF; } else { SDL_VIDEO_Flags |= SDL_SWSURFACE; } if (info->blit_hw) { if (global->debug) g_print("Copy blits between hardware surfaces are accelerated\n"); SDL_VIDEO_Flags |= SDL_ASYNCBLIT; } if(!global->desktop_w) global->desktop_w = info->current_w; //get desktop width if(!global->desktop_h) global->desktop_h = info->current_h; //get desktop height if (global->debug) { if (info->blit_hw_CC) g_print ("Colorkey blits between hardware surfaces are accelerated\n"); if (info->blit_hw_A) g_print("Alpha blits between hardware surfaces are accelerated\n"); if (info->blit_sw) g_print ("Copy blits from software surfaces to hardware surfaces are accelerated\n"); if (info->blit_sw_CC) g_print ("Colorkey blits from software surfaces to hardware surfaces are accelerated\n"); if (info->blit_sw_A) g_print("Alpha blits from software surfaces to hardware surfaces are accelerated\n"); if (info->blit_fill) g_print("Color fills on hardware surfaces are accelerated\n"); } SDL_WM_SetCaption(global->WVcaption, NULL); /* enable key repeat */ SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY,SDL_DEFAULT_REPEAT_INTERVAL); } /*------------------------------ SDL init video ---------------------*/ if(global->debug) g_print("(Desktop resolution = %ix%i)\n", global->desktop_w, global->desktop_h); g_print("Checking video mode %ix%i@32bpp : ", width, height); int bpp = SDL_VideoModeOK( width, height, 32, SDL_VIDEO_Flags); if(!bpp) { g_print("Not available \n"); /*resize video mode*/ if ((width > global->desktop_w) || (height > global->desktop_h)) { width = global->desktop_w; /*use desktop video resolution*/ height = global->desktop_h; } else { width = 800; height = 600; } g_print("Resizing to %ix%i\n", width, height); } else // success: { g_print("OK \n"); if ((bpp != 32) && global->debug) g_print("recomended color depth = %i\n", bpp); global->bpp = bpp; } *pscreen = SDL_SetVideoMode( width, height, global->bpp, SDL_VIDEO_Flags); if(*pscreen == NULL) { return (NULL); } //use requested resolution for overlay even if not available as video mode SDL_Overlay* overlay=NULL; overlay = SDL_CreateYUVOverlay(global->width, global->height, SDL_YUY2_OVERLAY, *pscreen); SDL_ShowCursor(SDL_DISABLE); return (overlay); }
int plat_sdl_init(void) { static const char *vout_list[] = { NULL, NULL, NULL, NULL }; const SDL_VideoInfo *info; SDL_SysWMinfo wminfo; int overlay_works = 0; int gl_works = 0; int i, ret, h; ret = SDL_Init(SDL_INIT_VIDEO | SDL_INIT_NOPARACHUTE); if (ret != 0) { fprintf(stderr, "SDL_Init failed: %s\n", SDL_GetError()); return -1; } info = SDL_GetVideoInfo(); if (info != NULL) { fs_w = info->current_w; fs_h = info->current_h; printf("plat_sdl: using %dx%d as fullscreen resolution\n", fs_w, fs_h); } g_menuscreen_w = 640; if (fs_w != 0 && g_menuscreen_w > fs_w) g_menuscreen_w = fs_w; g_menuscreen_h = 480; if (fs_h != 0) { h = fs_h; if (info && info->wm_available && h > WM_DECORATION_H) h -= WM_DECORATION_H; if (g_menuscreen_h > h) g_menuscreen_h = h; } ret = plat_sdl_change_video_mode(g_menuscreen_w, g_menuscreen_h, 1); if (ret != 0) { plat_sdl_screen = SDL_SetVideoMode(0, 0, 16, SDL_SWSURFACE); if (plat_sdl_screen == NULL) { fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); goto fail; } if (plat_sdl_screen->w < 320 || plat_sdl_screen->h < 240) { fprintf(stderr, "resolution %dx%d is too small, sorry.\n", plat_sdl_screen->w, plat_sdl_screen->h); goto fail; } } g_menuscreen_w = window_w = plat_sdl_screen->w; g_menuscreen_h = window_h = plat_sdl_screen->h; // overlay/gl require native bpp in some cases.. plat_sdl_screen = SDL_SetVideoMode(g_menuscreen_w, g_menuscreen_h, 0, SDL_SWSURFACE); if (plat_sdl_screen == NULL) { fprintf(stderr, "SDL_SetVideoMode failed: %s\n", SDL_GetError()); goto fail; } plat_sdl_overlay = SDL_CreateYUVOverlay(plat_sdl_screen->w, plat_sdl_screen->h, SDL_UYVY_OVERLAY, plat_sdl_screen); if (plat_sdl_overlay != NULL) { printf("plat_sdl: overlay: fmt %x, planes: %d, pitch: %d, hw: %d\n", plat_sdl_overlay->format, plat_sdl_overlay->planes, *plat_sdl_overlay->pitches, plat_sdl_overlay->hw_overlay); if (plat_sdl_overlay->hw_overlay) overlay_works = 1; else fprintf(stderr, "warning: video overlay is not hardware accelerated, " "not going to use it.\n"); SDL_FreeYUVOverlay(plat_sdl_overlay); plat_sdl_overlay = NULL; } else fprintf(stderr, "overlay is not available.\n"); // get x11 display/window for GL SDL_VideoDriverName(vid_drv_name, sizeof(vid_drv_name)); #ifdef SDL_VIDEO_DRIVER_X11 if (strcmp(vid_drv_name, "x11") == 0) { SDL_VERSION(&wminfo.version); ret = SDL_GetWMInfo(&wminfo); if (ret > 0) { display = wminfo.info.x11.display; window = (void *)wminfo.info.x11.window; } } #endif ret = gl_init(display, window, &gl_quirks); if (ret == 0) { gl_works = 1; gl_finish(); } i = 0; vout_list[i++] = "SDL Window"; if (overlay_works) { plat_target.vout_method = vout_mode_overlay = i; vout_list[i++] = "Video Overlay"; } if (gl_works) { plat_target.vout_method = vout_mode_gl = i; vout_list[i++] = "OpenGL"; } plat_target.vout_methods = vout_list; return 0; fail: SDL_Quit(); return -1; }
int main(int argc, char *argv[]) { #ifndef EMBEDED_X210 //PC platform const SDL_VideoInfo *info; char driver[128]; SDL_Surface *pscreen; SDL_Overlay *overlay; SDL_Rect drect; SDL_Event sdlevent; SDL_Thread *mythread; SDL_mutex *affmutex; Uint32 currtime; Uint32 lasttime; #endif int status; unsigned char *p = NULL; int hwaccel = 0; const char *videodevice = NULL; const char *mode = NULL; int format = V4L2_PIX_FMT_MJPEG; int i; int grabmethod = 1; int width = 320; int height = 240; int fps = 15; unsigned char frmrate = 0; char *avifilename = NULL; int queryformats = 0; int querycontrols = 0; int readconfigfile = 0; char *separateur; char *sizestring = NULL; char *fpsstring = NULL; int enableRawStreamCapture = 0; int enableRawFrameCapture = 0; char * pRGBData=NULL; printf("luvcview version %s \n", version); for (i = 1; i < argc; i++) { /* skip bad arguments */ if (argv[i] == NULL || *argv[i] == 0 || *argv[i] != '-') { continue; } if (strcmp(argv[i], "-d") == 0) { if (i + 1 >= argc) { printf("No parameter specified with -d, aborting.\n"); exit(1); } videodevice = strdup(argv[i + 1]); } if (strcmp(argv[i], "-g") == 0) { /* Ask for read instead default mmap */ grabmethod = 0; } if (strcmp(argv[i], "-w") == 0) { /* disable hw acceleration */ hwaccel = 1; } if (strcmp(argv[i], "-f") == 0) { if (i + 1 >= argc) { printf("No parameter specified with -f, aborting.\n"); exit(1); } mode = strdup(argv[i + 1]); if (strncmp(mode, "yuv", 3) == 0) { format = V4L2_PIX_FMT_YUYV; } else if (strncmp(mode, "jpg", 3) == 0) { format = V4L2_PIX_FMT_MJPEG; } else { format = V4L2_PIX_FMT_MJPEG; } } if (strcmp(argv[i], "-s") == 0) { if (i + 1 >= argc) { printf("No parameter specified with -s, aborting.\n"); exit(1); } sizestring = strdup(argv[i + 1]); width = strtoul(sizestring, &separateur, 10); if (*separateur != 'x') { printf("Error in size use -s widthxheight \n"); exit(1); } else { ++separateur; height = strtoul(separateur, &separateur, 10); if (*separateur != 0) printf("hmm.. dont like that!! trying this height \n"); printf(" size width: %d height: %d \n", width, height); } } if (strcmp(argv[i], "-i") == 0){ if (i + 1 >= argc) { printf("No parameter specified with -i, aborting. \n"); exit(1); } fpsstring = strdup(argv[i + 1]); fps = strtoul(fpsstring, &separateur, 10); printf(" interval: %d fps \n", fps); } if (strcmp(argv[i], "-S") == 0) { /* Enable raw stream capture from the start */ enableRawStreamCapture = 1; } if (strcmp(argv[i], "-c") == 0) { /* Enable raw frame capture for the first frame */ enableRawFrameCapture = 1; } if (strcmp(argv[i], "-C") == 0) { /* Enable raw frame stream capture from the start*/ enableRawFrameCapture = 2; } if (strcmp(argv[i], "-o") == 0) { /* set the avi filename */ if (i + 1 >= argc) { printf("No parameter specified with -o, aborting.\n"); exit(1); } avifilename = strdup(argv[i + 1]); } if (strcmp(argv[i], "-L") == 0) { /* query list of valid video formats */ queryformats = 1; } if (strcmp(argv[i], "-l") == 0) { /* query list of valid video formats */ querycontrols = 1; } if (strcmp(argv[i], "-r") == 0) { /* query list of valid video formats */ readconfigfile = 1; } if (strcmp(argv[i], "-h") == 0) { printf("usage: uvcview [-h -d -g -f -s -i -c -o -C -S -L -l -r] \n"); printf("-h print this message \n"); printf("-d /dev/videoX use videoX device\n"); printf("-g use read method for grab instead mmap \n"); printf("-w disable SDL hardware accel. \n"); printf("-f video format default jpg others options are yuv jpg \n"); printf("-i fps use specified frame interval \n"); printf("-s widthxheight use specified input size \n"); printf("-c enable raw frame capturing for the first frame\n"); printf("-C enable raw frame stream capturing from the start\n"); printf("-S enable raw stream capturing from the start\n"); printf("-o avifile create avifile, default video.avi\n"); printf("-L query valid video formats\n"); printf("-l query valid controls and settings\n"); printf("-r read and set control settings from luvcview.cfg\n"); exit(0); } } #ifndef EMBEDED_X210 //PC platform /************* Test SDL capabilities ************/ if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); exit(1); } /* For this version, we'll be save and disable hardware acceleration */ if(hwaccel) { if ( ! getenv("SDL_VIDEO_YUV_HWACCEL") ) { putenv("SDL_VIDEO_YUV_HWACCEL=0"); } } if (SDL_VideoDriverName(driver, sizeof(driver))) { printf("Video driver: %s\n", driver); } info = SDL_GetVideoInfo(); if (info->wm_available) { printf("A window manager is available\n"); } if (info->hw_available) { printf("Hardware surfaces are available (%dK video memory)\n", info->video_mem); SDL_VIDEO_Flags |= SDL_HWSURFACE; } if (info->blit_hw) { printf("Copy blits between hardware surfaces are accelerated\n"); SDL_VIDEO_Flags |= SDL_ASYNCBLIT; } if (info->blit_hw_CC) { printf ("Colorkey blits between hardware surfaces are accelerated\n"); } if (info->blit_hw_A) { printf("Alpha blits between hardware surfaces are accelerated\n"); } if (info->blit_sw) { printf ("Copy blits from software surfaces to hardware surfaces are accelerated\n"); } if (info->blit_sw_CC) { printf ("Colorkey blits from software surfaces to hardware surfaces are accelerated\n"); } if (info->blit_sw_A) { printf ("Alpha blits from software surfaces to hardware surfaces are accelerated\n"); } if (info->blit_fill) { printf("Color fills on hardware surfaces are accelerated\n"); } if (!(SDL_VIDEO_Flags & SDL_HWSURFACE)) SDL_VIDEO_Flags |= SDL_SWSURFACE; #endif if (videodevice == NULL || *videodevice == 0) { videodevice = "/dev/video0"; } if (avifilename == NULL || *avifilename == 0) { avifilename = "video.avi"; } videoIn = (struct vdIn *) calloc(1, sizeof(struct vdIn)); if ( queryformats ) { /* if we're supposed to list the video formats, do that now and go out */ check_videoIn(videoIn,(char *) videodevice); free(videoIn); #ifndef EMBEDED_X210 SDL_Quit(); #endif exit(1); } if (init_videoIn(videoIn, (char *) videodevice, width, height, fps, format, grabmethod, avifilename) < 0) exit(1); /* if we're supposed to list the controls, do that now */ if ( querycontrols ) enum_controls(videoIn->fd); /* if we're supposed to read the control settings from a configfile, do that now */ if ( readconfigfile ) load_controls(videoIn->fd); #ifdef EMBEDED_X210 #ifdef SOFT_COLOR_CONVERT init_framebuffer(); #else x6410_init_Draw(videoIn->width,videoIn->height); #endif #else pscreen = SDL_SetVideoMode(videoIn->width, videoIn->height+30 , 0,SDL_VIDEO_Flags); overlay =SDL_CreateYUVOverlay(videoIn->width, videoIn->height+30 , SDL_YUY2_OVERLAY, pscreen); p = (unsigned char *) overlay->pixels[0]; drect.x = 0; drect.y = 0; drect.w =pscreen->w; drect.h = pscreen->h; #endif if (enableRawStreamCapture) { videoIn->captureFile = fopen("stream.raw", "wb"); if(videoIn->captureFile == NULL) { perror("Unable to open file for raw stream capturing"); } else { printf("Starting raw stream capturing to stream.raw ...\n"); } } if (enableRawFrameCapture) videoIn->rawFrameCapture = enableRawFrameCapture; initLut(); #ifndef EMBEDED_X210 SDL_WM_SetCaption(title_act[A_VIDEO].title, NULL); lasttime = SDL_GetTicks(); creatButt(videoIn->width, 32); SDL_LockYUVOverlay(overlay); memcpy(p + (videoIn->width * (videoIn->height) * 2), YUYVbutt, videoIn->width * 64); SDL_UnlockYUVOverlay(overlay); /* initialize thread data */ ptdata.ptscreen = &pscreen; ptdata.ptvideoIn = videoIn; ptdata.ptsdlevent = &sdlevent; ptdata.drect = &drect; affmutex = SDL_CreateMutex(); ptdata.affmutex = affmutex; mythread = SDL_CreateThread(eventThread, (void *) &ptdata); #endif pRGBData = (unsigned char *)malloc(videoIn->width*videoIn->width*4*sizeof(char)); if(pRGBData==NULL) { return ; } /* main big loop */ while (videoIn->signalquit) { #ifndef EMBEDED_X210 currtime = SDL_GetTicks(); if (currtime - lasttime > 0) { frmrate = 1000/(currtime - lasttime); } lasttime = currtime; #endif if (uvcGrab(videoIn) < 0) { printf("Error grabbing \n"); break; } /* if we're grabbing video, show the frame rate */ if (videoIn->toggleAvi) printf("\rframe rate: %d ",frmrate); #ifndef EMBEDED_X210 SDL_LockYUVOverlay(overlay); memcpy(p, videoIn->framebuffer, videoIn->width * (videoIn->height) * 2); SDL_UnlockYUVOverlay(overlay); SDL_DisplayYUVOverlay(overlay, &drect); #endif #ifdef EMBEDED_X210 #ifdef SOFT_COLOR_CONVERT // yuv to rgb565 ,and to frambuffer process_image(videoIn->framebuffer,fbp,videoIn->width,videoIn->height,vinfo,finfo); // convertYUYVtoRGB565(videoIn->framebuffer,pRGBData,videoIn->width,videoIn->height); // Pyuv422torgb24(videoIn->framebuffer, pRGBData, videoIn->width, videoIn->height); // memcpy(fbp,pRGBData,videoIn->width*videoIn->height*2); #else //X6410 post processor convert yuv to rgb,X210 not suport now. /* memcpy(pInbuffer, videoIn->framebuffer, videoIn->width * (videoIn->height) * 2); ioctl(dev_fb0, GET_FB_INFO, &fb_info); pp_param.SrcFrmSt = ioctl(dev_pp, S3C_PP_GET_RESERVED_MEM_ADDR_PHY); //must be physical adress pp_param.DstFrmSt = fb_info.map_dma_f1; //must be physical adress ioctl(dev_pp, S3C_PP_SET_PARAMS, &pp_param); ioctl(dev_pp, S3C_PP_SET_DST_BUF_ADDR_PHY, &pp_param); ioctl(dev_pp, S3C_PP_SET_SRC_BUF_ADDR_PHY, &pp_param); ioctl(dev_pp, S3C_PP_START); */ #endif #endif if (videoIn->getPict) { switch(videoIn->formatIn){ case V4L2_PIX_FMT_MJPEG: get_picture(videoIn->tmpbuffer,videoIn->buf.bytesused); break; case V4L2_PIX_FMT_YUYV: get_pictureYV2(videoIn->framebuffer,videoIn->width,videoIn->height); break; default: break; } videoIn->getPict = 0; printf("get picture !\n"); } #ifndef EMBEDED_X210 SDL_LockMutex(affmutex); ptdata.frmrate = frmrate; SDL_WM_SetCaption(videoIn->status, NULL); SDL_UnlockMutex(affmutex); #endif #ifdef EMBEDED_X210 usleep(10); #else SDL_Delay(10); #endif } #ifndef EMBEDED_X210 SDL_WaitThread(mythread, &status); SDL_DestroyMutex(affmutex); #endif /* if avifile is defined, we made a video: compute the exact fps and set it in the video */ if (videoIn->avifile != NULL) { float fps=(videoIn->framecount/(videoIn->recordtime/1000)); fprintf(stderr,"setting fps to %f\n",fps); AVI_set_video(videoIn->avifile, videoIn->width, videoIn->height, fps, "MJPG"); AVI_close(videoIn->avifile); } close_v4l2(videoIn); #ifdef EMBEDED_X210 #ifdef SOFT_COLOR_CONVERT close_frambuffer(); #else x6410_DeInit_Draw(); #endif #endif free(pRGBData); free(videoIn); destroyButt(); freeLut(); printf(" Clean Up done Quit \n"); #ifndef EMBEDED_X210 SDL_Quit(); #endif }