void Update() { std::vector<int> const& keyframes = vc->GetKeyFrames(); agi::vfr::Framerate const& timecodes = vc->FPS(); if (keyframes.empty() || !timecodes.IsLoaded()) { if (keyframe_samples.empty()) { return; } keyframe_samples.clear(); AnnounceMarkerMoved(); return; } keyframe_samples.clear(); keyframe_samples.reserve(keyframes.size()); for (size_t i = 0; i < keyframes.size(); ++i) { keyframe_samples.push_back(AudioMarkerKeyframe( controller->SamplesFromMilliseconds(timecodes.TimeAtFrame(keyframes[i])))); } AnnounceMarkerMoved(); }
void* VLCPlayer::lock(void *data, void **planes) { VideoContext* context = *(VideoContext**)data; context->Lock(); planes[0] = context->GetPlane(0); planes[1] = context->GetPlane(1); planes[2] = context->GetPlane(2); return NULL; // we are using a single buffer so return NULL }
bool Camera::setupCamera(VideoContext const& context) { float ratio; if ((ratio = static_cast<float>(context.getScreenWidth()) / static_cast<float>(context.getScreenHeight())) == 0.0f) return false; setRatio(ratio); return true; }
AudioMarkerProviderKeyframes(AudioController *controller) : vc(VideoContext::Get()) , keyframe_slot(vc->AddKeyframesListener(&AudioMarkerProviderKeyframes::Update, this)) , audio_open_slot(controller->AddAudioOpenListener(&AudioMarkerProviderKeyframes::Update, this)) , timecode_slot(vc->AddTimecodesListener(&AudioMarkerProviderKeyframes::Update, this)) , controller(controller) { Update(); }
void VisualToolDrag::OnSubTool(wxCommandEvent &) { // Toggle \move <-> \pos VideoContext *vc = c->videoController; for (auto line : selection) { Vector2D p1, p2; int t1, t2; bool has_move = GetLineMove(line, p1, p2, t1, t2); if (has_move) SetOverride(line, "\\pos", p1.PStr()); else { p1 = GetLinePosition(line); // Round the start and end times to exact frames int start = vc->TimeAtFrame(vc->FrameAtTime(line->Start, agi::vfr::START)) - line->Start; int end = vc->TimeAtFrame(vc->FrameAtTime(line->Start, agi::vfr::END)) - line->Start; SetOverride(line, "\\move", str(boost::format("(%s,%s,%d,%d)") % p1.Str() % p1.Str() % start % end)); } } Commit(); OnFileChanged(); UpdateToggleButtons(); }
void VLCPlayer::unlock(void *data, void *id, void *const * /*planes*/) { assert(id == NULL); // we are using a single buffer so id should always be NULL VideoContext* context = *(VideoContext**)data; context->Unlock(); }
agi::vfr::Framerate SubtitleFormat::AskForFPS(bool allow_vfr, bool show_smpte) { wxArrayString choices; // Video FPS VideoContext *context = VideoContext::Get(); bool vidLoaded = context->TimecodesLoaded(); if (vidLoaded) { if (!context->FPS().IsVFR()) choices.Add(wxString::Format(_("From video (%g)"), context->FPS().FPS())); else if (allow_vfr) choices.Add(_("From video (VFR)")); else vidLoaded = false; } // Standard FPS values choices.Add(_("15.000 FPS")); choices.Add(_("23.976 FPS (Decimated NTSC)")); choices.Add(_("24.000 FPS (FILM)")); choices.Add(_("25.000 FPS (PAL)")); choices.Add(_("29.970 FPS (NTSC)")); if (show_smpte) choices.Add(_("29.970 FPS (NTSC with SMPTE dropframe)")); choices.Add(_("30.000 FPS")); choices.Add(_("50.000 FPS (PAL x2)")); choices.Add(_("59.940 FPS (NTSC x2)")); choices.Add(_("60.000 FPS")); choices.Add(_("119.880 FPS (NTSC x4)")); choices.Add(_("120.000 FPS")); bool was_busy = wxIsBusy(); if (was_busy) wxEndBusyCursor(); int choice = wxGetSingleChoiceIndex(_("Please choose the appropriate FPS for the subtitles:"), _("FPS"), choices); if (was_busy) wxBeginBusyCursor(); using agi::vfr::Framerate; if (choice == -1) return Framerate(); // Get FPS from choice if (vidLoaded) --choice; if (!show_smpte && choice > 4) --choice; switch (choice) { case -1: return context->FPS(); break; // VIDEO case 0: return Framerate(15, 1); break; case 1: return Framerate(24000, 1001); break; case 2: return Framerate(24, 1); break; case 3: return Framerate(25, 1); break; case 4: return Framerate(30000, 1001); break; case 5: return Framerate(30000, 1001, true); break; case 6: return Framerate(30, 1); break; case 7: return Framerate(50, 1); break; case 8: return Framerate(60000, 1001); break; case 9: return Framerate(60, 1); break; case 10: return Framerate(120000, 1001); break; case 11: return Framerate(120, 1); break; } assert(false); return Framerate(); }