Frame data does need to be uploaded to the video card on every change as the subtitles and video frame are not seperate.

Originally committed to SVN as r4633.
This commit is contained in:
Thomas Goyne 2010-06-28 07:39:42 +00:00
parent a3ff2cc746
commit b0afd8659c
3 changed files with 43 additions and 34 deletions

View file

@ -289,7 +289,7 @@ void VideoContext::SetVideo(const wxString &filename) {
hasSubtitles = MatroskaWrapper::HasSubtitles(filename); hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
} }
UpdateDisplays(true, true); UpdateDisplays(true);
} }
catch (wxString &e) { catch (wxString &e) {

View file

@ -162,6 +162,8 @@ void VideoDisplay::SetFrame(int frameNumber) {
VideoContext *context = VideoContext::Get(); VideoContext *context = VideoContext::Get();
ControlSlider->SetValue(frameNumber); ControlSlider->SetValue(frameNumber);
currentFrame = frameNumber;
// Get time for frame // Get time for frame
{ {
int time = VFR_Output.GetTimeAtFrame(frameNumber, true, true); int time = VFR_Output.GetTimeAtFrame(frameNumber, true, true);
@ -203,9 +205,15 @@ void VideoDisplay::SetFrame(int frameNumber) {
// Render the new frame // Render the new frame
if (context->IsLoaded()) { if (context->IsLoaded()) {
context->GetScriptSize(scriptW, scriptH); context->GetScriptSize(scriptW, scriptH);
if (!tool.get()) tool.reset(new VisualToolCross(this, video, toolBar));
tool->SetFrame(frameNumber); tool->SetFrame(frameNumber);
UploadFrameData();
}
Render();
}
void VideoDisplay::UploadFrameData() {
VideoContext *context = VideoContext::Get();
AegiVideoFrame frame; AegiVideoFrame frame;
try { try {
frame = context->GetFrame(currentFrame); frame = context->GetFrame(currentFrame);
@ -238,12 +246,10 @@ void VideoDisplay::SetFrame(int frameNumber) {
err.GetMessage().c_str()); err.GetMessage().c_str());
} }
} }
Render();
currentFrame = frameNumber;
}
void VideoDisplay::Refresh() { void VideoDisplay::Refresh() {
UploadFrameData();
if (!tool.get()) tool.reset(new VisualToolCross(this, video, toolBar));
tool->Refresh(); tool->Refresh();
Render(); Render();
} }

View file

@ -96,6 +96,9 @@ class VideoDisplay: public wxGLCanvas {
/// @param alpha The alpha of the mask /// @param alpha The alpha of the mask
void DrawOverscanMask(int sizeH, int sizeV, wxColor color, double alpha) const; void DrawOverscanMask(int sizeH, int sizeV, wxColor color, double alpha) const;
/// Upload the image for the current frame to the video card
void UploadFrameData();
/// @brief Paint event /// @brief Paint event
void OnPaint(wxPaintEvent& event); void OnPaint(wxPaintEvent& event);
/// @brief Key event handler /// @brief Key event handler