forked from mia/Aegisub
Allow opening video with no working subtitle providers enabled
Originally committed to SVN as r6126.
This commit is contained in:
parent
3cdc27c894
commit
4133806fe7
3 changed files with 17 additions and 5 deletions
|
@ -53,7 +53,7 @@
|
|||
///
|
||||
SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
||||
std::vector<std::string> list = GetClasses(OPT_GET("Subtitle/Provider")->GetString());
|
||||
if (list.empty()) throw "No subtitle providers are available.";
|
||||
if (list.empty()) throw wxString("No subtitle providers are available.");
|
||||
|
||||
// Get provider
|
||||
wxString error;
|
||||
|
|
|
@ -76,7 +76,7 @@ std::tr1::shared_ptr<AegiVideoFrame> ThreadedFrameSource::ProcFrame(int frameNum
|
|||
|
||||
// This deliberately results in a call to LoadSubtitles while a render
|
||||
// is pending making the queued render use the new file
|
||||
if (!raw) {
|
||||
if (!raw && provider) {
|
||||
try {
|
||||
wxMutexLocker locker(fileMutex);
|
||||
if (subs.get() && singleFrame != frameNum) {
|
||||
|
@ -167,9 +167,19 @@ void *ThreadedFrameSource::Entry() {
|
|||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
||||
static SubtitlesProvider *get_subs_provider(wxEvtHandler *parent) {
|
||||
try {
|
||||
return SubtitlesProviderFactory::GetProvider();
|
||||
}
|
||||
catch (wxString const& err) {
|
||||
parent->AddPendingEvent(SubtitlesProviderErrorEvent(err));
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *parent)
|
||||
: wxThread(wxTHREAD_JOINABLE)
|
||||
, provider(SubtitlesProviderFactory::GetProvider())
|
||||
, provider(get_subs_provider(parent))
|
||||
, videoProvider(VideoProviderFactory::GetProvider(videoFileName))
|
||||
, parent(parent)
|
||||
, nextTime(-1.)
|
||||
|
|
|
@ -42,6 +42,8 @@
|
|||
#endif
|
||||
|
||||
#include <libaegisub/exception.h>
|
||||
#include <libaegisub/scoped_ptr.h>
|
||||
|
||||
#include "video_frame.h"
|
||||
|
||||
class AssFile;
|
||||
|
@ -53,9 +55,9 @@ class VideoProviderError;
|
|||
/// @brief An asynchronous video decoding and subtitle rendering wrapper
|
||||
class ThreadedFrameSource : public wxThread {
|
||||
/// Subtitles provider
|
||||
std::auto_ptr<SubtitlesProvider> provider;
|
||||
agi::scoped_ptr<SubtitlesProvider> provider;
|
||||
/// Video provider
|
||||
std::auto_ptr<VideoProvider> videoProvider;
|
||||
agi::scoped_ptr<VideoProvider> videoProvider;
|
||||
/// Event handler to send FrameReady events to
|
||||
wxEvtHandler *parent;
|
||||
|
||||
|
|
Loading…
Reference in a new issue