void HwRunRisc(PBT878_VIDEOCHIP pChip) { SetVideo(pChip); ULONG dma=ReadReg(pChip, REG_GPIO_DMA_CTL); char dma_bits[16+100]; Dec2Bin(16, dma_bits, dma); // set start address WriteReg(pChip, REG_RISC_STRT_ADD, pChip->Scr.pCodePhy); // risc enable, fifo enable SetBin(dma_bits, 1, "1"); // risc enable SetBin(dma_bits, 0, "1"); // fifo enable WriteReg(pChip, REG_GPIO_DMA_CTL, Bin2Dec(dma_bits)); // capture control WriteReg(pChip, REG_CAP_CTL, SetBin( 1, "1") |// capture odd SetBin( 0, "1") // capture even ); // interrupt mask WriteReg(pChip,REG_INT_MASK, BIT_RISCI | // RISCI BIT_VSYNC ); }
void VideoContext::Reload() { if (IsLoaded()) { int frame = frame_n; SetVideo(videoFile.Clone()); JumpToFrame(frame); } }
VideoPlayerPanel::VideoPlayerPanel( vgui::Panel *parent, const char *panelName, int nXpos, int nYpos, int nWidth, int nHeight, const char *pVideoFile ) : BaseClass( parent, panelName ), m_VideoMaterial( NULL ), m_VideoFileName( NULL ), m_VideoLoaded( false ), m_VideoPlaying( false ) { Assert( g_pVideo != NULL ); // init all the video realted member vars ClearVideo(); SetVisible( false ); SetKeyBoardInputEnabled( false ); SetMouseInputEnabled( false ); SetProportional( false ); SetPaintBackgroundEnabled( false ); SetPaintBorderEnabled( false ); // Set us up SetTall( nHeight ); SetWide( nWidth ); SetPos( nXpos, nYpos ); // use defaults for scheme and control settings for now // SetScheme( vgui::scheme()->LoadSchemeFromFile( "resource/VideoPlayerPanelScheme.res", "VideoPlayerPanelScheme")); //LoadControlSettings("resource/UI/VideoPlayerPanel.res"); // Assign video file if supplied SetVideo( pVideoFile ); SetVisible( true ); }
int main( int argc, char* argv[] ) { SDL_Event event; Uint32 u; Uint32 v; int i; int w = W; int h = H; int multis = MULTIS; int threads = THREADS; int photons = PHOTONS; unsigned seed = (unsigned)-1; bool preview = true; NICEME; // Process cmd line args for(i=1; i<argc; i++) { if( argv[i][0]=='-' ) switch( argv[i][1] ) { case 'w': w = atoi(argv[i]+2); break; case 'h': h = atoi(argv[i]+2); break; case 'm': multis = atoi(argv[i]+2); break; case 't': threads = atoi(argv[i]+2); break; case 'p': photons = atoi(argv[i]+2); break; case '-': printf( "Usage: [OPTION]... [SEED]\nRender ray-traced 3D images generated randomly with seed number SEED.\n\n option default description\n -wNUM %7d Set image output width to NUM\n -hNUM %7d Set image output height to NUM\n -mNUM %7d Set multisampling level to NUM (level 2 recommended)\n -tNUM %7d Parallelize with NUM threads\n -pNUM %7d Simulate lighting with NUM million photons!\n",W,H,MULTIS,THREADS,PHOTONS ), exit(0); default: fprintf( stderr, "Halt! -%c isn't one of my options!\nUse --help for help.\n", argv[i][1] ), exit(-1); } else if( seed==(unsigned)-1 ) { seed = atoi(argv[i]); if( !seed ) fprintf( stderr, "Halt! SEED ought to be a positive number, not %s\n", argv[i] ), exit(-1); } else fprintf( stderr, "Halt! I'm confused by cmd line argument #%d: %s\n", i, argv[i] ), exit(-1); } if( w<1 ) w=W; if( h<1 ) h=H; if( multis<1 ) multis=MULTIS; if( threads<1 ) threads=THREADS; if( photons<1 ) photons=PHOTONS; // Use time as seed if not otherwise specified if( seed==(unsigned)-1 ) seed = (unsigned)time(NULL); // Init SDL if( SDL_Init( SDL_INIT_TIMER|SDL_INIT_AUDIO|SDL_INIT_VIDEO ) < 0 || !SDL_GetVideoInfo() ) return 0; // Create Window SetVideo( w, h ); SDL_WM_SetCaption("PixelMachine", NULL); pinfo = SDL_GetVideoInfo(); // font init SJF_Init(pinfo); //ui setup ui.init(); h_menu = ui.new_control(0,0,0,0); h_render = ui.new_control(h_menu,80,15,SJUIF_EXTENDSV); ui.set_caption(h_menu,"Click to render..."); ui.set_caption(h_render,"Loading"); //pm preview render setup pixelmachine = new PIXELMACHINE; pixelmachine->init(seed,100,75,1,threads,(photons?1:0)); thread = SDL_CreateThread(run_pixel_machine,NULL); // MAIN LOOP while( 1 ) { while( SDL_PollEvent(&event) ) switch(event.type) { case SDL_VIDEOEXPOSE: ; break; case SDL_VIDEORESIZE: SetVideo( event.resize.w, event.resize.h ); break; case SDL_MOUSEBUTTONDOWN: if( preview ) { //pm full render go! preview = false; pixelmachine->cancel = true; SDL_WaitThread(thread,NULL); //BUG: thread may not be valid? delete pixelmachine; pixelmachine = new PIXELMACHINE; pixelmachine->init(seed,w,h,multis,threads,photons); thread = SDL_CreateThread(run_pixel_machine,NULL); } break; case SDL_KEYDOWN: ; break; case SDL_QUIT: pixelmachine->cancel = true; SDL_WaitThread(thread,NULL); //BUG: thread may not be valid? delete pixelmachine; Cleanup(); break; } gutimenow = SDL_GetTicks(); if( (Uint32)(gutimenow-gutime)>50 ) { Render(); gutime = gutimenow; } // chill out for a bit SDL_Delay(10); } return 0; }
void FrameMain::OnSubtitlesOpen() { UpdateTitle(); auto vc = context->videoController; /// @todo figure out how to move this to the relevant controllers without /// prompting for each file loaded/unloaded // Load stuff from the new script auto video = config::path->MakeAbsolute(context->ass->GetScriptInfo("Video File"), "?script"); auto vfr = config::path->MakeAbsolute(context->ass->GetScriptInfo("VFR File"), "?script"); auto keyframes = config::path->MakeAbsolute(context->ass->GetScriptInfo("Keyframes File"), "?script"); auto audio = config::path->MakeAbsolute(context->ass->GetScriptInfo("Audio URI"), "?script"); bool videoChanged = !blockVideoLoad && video != vc->GetVideoName(); bool timecodesChanged = vfr != vc->GetTimecodesName(); bool keyframesChanged = keyframes != vc->GetKeyFramesName(); bool audioChanged = !blockAudioLoad && audio != context->audioController->GetAudioURL(); // Check if there is anything to change int autoLoadMode = OPT_GET("App/Auto/Load Linked Files")->GetInt(); if (autoLoadMode == 0 || (!videoChanged && !timecodesChanged && !keyframesChanged && !audioChanged)) { SetDisplayMode(1, 1); return; } if (autoLoadMode == 2) { if (wxMessageBox(_("Do you want to load/unload the associated files?"), _("(Un)Load files?"), wxYES_NO | wxCENTRE, this) != wxYES) { SetDisplayMode(1, 1); if (vc->IsLoaded() && vc->GetProvider()->GetColorSpace() != context->ass->GetScriptInfo("YCbCr Matrix")) vc->Reload(); return; } } if (audioChanged) blockAudioLoad = true; // Video if (videoChanged) { vc->SetVideo(video); if (vc->IsLoaded()) { vc->JumpToFrame(context->ass->GetUIStateAsInt("Video Position")); std::string arString = context->ass->GetUIState("Video Aspect Ratio"); if (boost::starts_with(arString, "c")) { double ar = 0.; agi::util::try_parse(arString.substr(1), &ar); vc->SetAspectRatio(ar); } else { int ar = 0; if (agi::util::try_parse(arString, &ar) && ar >= 0 && ar < 4) vc->SetAspectRatio((AspectRatio)ar); } double videoZoom = 0.; if (agi::util::try_parse(context->ass->GetUIState("Video Zoom Percent"), &videoZoom)) context->videoDisplay->SetZoom(videoZoom); } } else if (vc->IsLoaded() && vc->GetProvider()->GetColorSpace() != context->ass->GetScriptInfo("YCbCr Matrix")) vc->Reload(); vc->LoadTimecodes(vfr); vc->LoadKeyframes(keyframes); // Audio if (audioChanged) { blockAudioLoad = false; try { if (audio.empty()) context->audioController->CloseAudio(); else context->audioController->OpenAudio(audio); } catch (agi::UserCancelException const&) { } catch (agi::fs::FileSystemError const& err) { wxMessageBox(to_wx(err.GetMessage()), "Error opening audio", wxOK | wxICON_ERROR | wxCENTER, this); } } SetDisplayMode(1, 1); }
int InitMachine(void) { int J; /* Initialize variables */ UseZoom = UseZoom<1? 1:UseZoom>5? 5:UseZoom; InMenu = 0; FastForward = 0; OutImage.Data = 0; KeyReady = 0; /* Initialize system resources */ if (!InitQNX(Title,UseZoom*WIDTH,UseZoom*HEIGHT)) return 0; /* Set visual effects */ BPSSetEffects(UseEffects); /* Create main image buffer */ if(!NewImage(&OutImage,WIDTH,HEIGHT)) { TrashQNX(); return(0); } ClearImage(&OutImage,PIXEL(0,0,0)); CropImage(&ScrImage,&OutImage,XOFFSET,YOFFSET,(TI83_FAMILY?5:4)*TIWIDTH,4*TIHEIGHT); /* Initialize video to main image */ SetVideo(&OutImage,0,0,WIDTH,HEIGHT); /* Set colors */ XPal[0] = White = PIXEL(255,255,255); XPal[1] = Black = PIXEL(0,0,0); /* Attach keyboard handler */ SetKeyHandler(HandleKeys); /* Attach mouse handler */ SetMouseHandler(HandleMouse); /* Initialize sound */ InitSound(UseSound,150); SndSwitch=(1<<4)-1; SndVolume=255/4; SetChannels(SndVolume,SndSwitch); /* Initialize sync timer if needed */ if((SyncFreq>0)&&!SetSyncTimer(SyncFreq*UPeriod/100)) SyncFreq=0; deviceinfo_details_t* data; deviceinfo_get_details(&data); const char* os = deviceinfo_details_get_device_os(data); if (strcmp(os, "BlackBerry 10") == 0) { int i = 0; while (TouchMap[i].KeyCode) { TouchMap[i].X = TouchMap[i].X * 1.28; TouchMap[i].W = TouchMap[i].W * 1.28; TouchMap[i].Y = TouchMap[i].Y * 1.25; TouchMap[i].H = TouchMap[i].H * 1.25; i++; } } deviceinfo_free_details(&data); /* Done */ return(1); }