add option for ffmpegsource thread count and seek mode

Originally committed to SVN as r2314.
This commit is contained in:
Karl Blomster 2008-09-03 21:22:33 +00:00
parent 3e13ef206f
commit b2153dd6cf

View file

@ -41,7 +41,7 @@
#include <ffms.h> #include <ffms.h>
#include "vfr.h" #include "vfr.h"
#include "video_context.h" #include "video_context.h"
// #include "options.h" // for later use #include "options.h" // for later use
/////////////// ///////////////
@ -97,13 +97,18 @@ void FFmpegSourceVideoProvider::LoadVideo(Aegisub::String filename, double fps)
} }
} }
// TODO: make this user-configurable // set thread count
int Threads = 1; int Threads = Options.AsInt(_T("FFmpegSource decoding threads"));
if (Threads < 1) if (Threads < 1)
throw _T("FFmpegSource video provider: invalid decoding thread count"); throw _T("FFmpegSource video provider: invalid decoding thread count");
// TODO: tie this to the option "ffmpeg allow unsafe seeking" // set seekmode
int SeekMode = 1; // TODO: give this its own option?
int SeekMode;
if (Options.AsBool(_T("FFmpeg allow unsafe seeking")))
SeekMode = 2;
else
SeekMode = 1;
// finally create the actual video source // finally create the actual video source
VideoSource = FFMS_CreateVideoSource(FileNameWX.char_str(), -1, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize); VideoSource = FFMS_CreateVideoSource(FileNameWX.char_str(), -1, Index, "", Threads, SeekMode, FFMSErrorMessage, MessageSize);