mirror of https://github.com/odrling/Aegisub
fix vfr handling for the ffmpegsource video provider, entire thing should be considered working now
Originally committed to SVN as r2313.
This commit is contained in:
parent
98341f62be
commit
3e13ef206f
|
@ -157,6 +157,9 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
|
|||
VFR_Input.SetVFR(TimecodesVector);
|
||||
VFR_Output.SetVFR(TimecodesVector);
|
||||
}
|
||||
} else { // no timecodes loaded, go ahead and apply
|
||||
VFR_Input.SetVFR(TimecodesVector);
|
||||
VFR_Output.SetVFR(TimecodesVector);
|
||||
}
|
||||
|
||||
// we don't need this anymore
|
||||
|
@ -188,16 +191,22 @@ void FFmpegSourceVideoProvider::Close() {
|
|||
|
||||
///////////////
|
||||
// Get frame
|
||||
const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int n, int FormatType) {
|
||||
const AegiVideoFrame FFmpegSourceVideoProvider::GetFrame(int _n, int FormatType) {
|
||||
// don't try to seek to insane places
|
||||
int n = _n;
|
||||
if (n < 0)
|
||||
n = 0;
|
||||
if (n >= GetFrameCount())
|
||||
n = GetFrameCount()-1;
|
||||
// set position
|
||||
FrameNumber = n;
|
||||
|
||||
const AVFrameLite *SrcFrame = FFMS_GetFrame(VideoSource, n, FFMSErrorMessage, MessageSize);
|
||||
if (SrcFrame == NULL) {
|
||||
ErrorMsg.Printf(_T("FFmpegSource video provider: %s"), FFMSErrorMessage);
|
||||
throw ErrorMsg;
|
||||
}
|
||||
|
||||
// set position
|
||||
FrameNumber = n;
|
||||
|
||||
AVPicture *SrcPicture = reinterpret_cast<AVPicture *>(const_cast<AVFrameLite *>(SrcFrame));
|
||||
|
||||
// prepare stuff for conversion to RGB32
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
bool AreKeyFramesLoaded() { return KeyFramesLoaded; };
|
||||
wxArrayInt GetKeyFrames() { return KeyFramesList; };
|
||||
bool IsVFR() { return true; };
|
||||
FrameRate GetTrueFrameRate() { return FrameRate(); };
|
||||
FrameRate GetTrueFrameRate() { return Timecodes; };
|
||||
Aegisub::String GetDecoderName() { return L"FFmpegSource"; }
|
||||
bool IsNativelyByFrames() { return true; }
|
||||
int GetDesiredCacheSize() { return 8; }
|
||||
|
|
Loading…
Reference in New Issue