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:
parent
a3ff2cc746
commit
b0afd8659c
3 changed files with 43 additions and 34 deletions
|
@ -289,7 +289,7 @@ void VideoContext::SetVideo(const wxString &filename) {
|
|||
hasSubtitles = MatroskaWrapper::HasSubtitles(filename);
|
||||
}
|
||||
|
||||
UpdateDisplays(true, true);
|
||||
UpdateDisplays(true);
|
||||
}
|
||||
|
||||
catch (wxString &e) {
|
||||
|
|
|
@ -162,6 +162,8 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
|||
VideoContext *context = VideoContext::Get();
|
||||
ControlSlider->SetValue(frameNumber);
|
||||
|
||||
currentFrame = frameNumber;
|
||||
|
||||
// Get time for frame
|
||||
{
|
||||
int time = VFR_Output.GetTimeAtFrame(frameNumber, true, true);
|
||||
|
@ -203,47 +205,51 @@ void VideoDisplay::SetFrame(int frameNumber) {
|
|||
// Render the new frame
|
||||
if (context->IsLoaded()) {
|
||||
context->GetScriptSize(scriptW, scriptH);
|
||||
if (!tool.get()) tool.reset(new VisualToolCross(this, video, toolBar));
|
||||
tool->SetFrame(frameNumber);
|
||||
|
||||
AegiVideoFrame frame;
|
||||
try {
|
||||
frame = context->GetFrame(currentFrame);
|
||||
}
|
||||
catch (const wxChar *err) {
|
||||
wxLogError(
|
||||
L"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
||||
L"Error message reported: %s",
|
||||
err);
|
||||
}
|
||||
catch (...) {
|
||||
wxLogError(
|
||||
L"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
||||
L"No further error message given.");
|
||||
}
|
||||
try {
|
||||
videoOut->UploadFrameData(frame);
|
||||
}
|
||||
catch (const VideoOutInitException& err) {
|
||||
wxLogError(
|
||||
L"Failed to initialize video display. Closing other running programs and updating your video card drivers may fix this.\n"
|
||||
L"Error message reported: %s",
|
||||
err.GetMessage().c_str());
|
||||
context->Reset();
|
||||
}
|
||||
catch (const VideoOutRenderException& err) {
|
||||
wxLogError(
|
||||
L"Could not upload video frame to graphics card.\n"
|
||||
L"Error message reported: %s",
|
||||
err.GetMessage().c_str());
|
||||
}
|
||||
UploadFrameData();
|
||||
}
|
||||
Render();
|
||||
}
|
||||
|
||||
currentFrame = frameNumber;
|
||||
void VideoDisplay::UploadFrameData() {
|
||||
VideoContext *context = VideoContext::Get();
|
||||
AegiVideoFrame frame;
|
||||
try {
|
||||
frame = context->GetFrame(currentFrame);
|
||||
}
|
||||
catch (const wxChar *err) {
|
||||
wxLogError(
|
||||
L"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
||||
L"Error message reported: %s",
|
||||
err);
|
||||
}
|
||||
catch (...) {
|
||||
wxLogError(
|
||||
L"Failed seeking video. The video file may be corrupt or incomplete.\n"
|
||||
L"No further error message given.");
|
||||
}
|
||||
try {
|
||||
videoOut->UploadFrameData(frame);
|
||||
}
|
||||
catch (const VideoOutInitException& err) {
|
||||
wxLogError(
|
||||
L"Failed to initialize video display. Closing other running programs and updating your video card drivers may fix this.\n"
|
||||
L"Error message reported: %s",
|
||||
err.GetMessage().c_str());
|
||||
context->Reset();
|
||||
}
|
||||
catch (const VideoOutRenderException& err) {
|
||||
wxLogError(
|
||||
L"Could not upload video frame to graphics card.\n"
|
||||
L"Error message reported: %s",
|
||||
err.GetMessage().c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void VideoDisplay::Refresh() {
|
||||
UploadFrameData();
|
||||
if (!tool.get()) tool.reset(new VisualToolCross(this, video, toolBar));
|
||||
tool->Refresh();
|
||||
Render();
|
||||
}
|
||||
|
|
|
@ -96,6 +96,9 @@ class VideoDisplay: public wxGLCanvas {
|
|||
/// @param alpha The alpha of the mask
|
||||
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
|
||||
void OnPaint(wxPaintEvent& event);
|
||||
/// @brief Key event handler
|
||||
|
|
Loading…
Reference in a new issue