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() {
|
SubtitlesProvider* SubtitlesProviderFactory::GetProvider() {
|
||||||
std::vector<std::string> list = GetClasses(OPT_GET("Subtitle/Provider")->GetString());
|
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
|
// Get provider
|
||||||
wxString error;
|
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
|
// This deliberately results in a call to LoadSubtitles while a render
|
||||||
// is pending making the queued render use the new file
|
// is pending making the queued render use the new file
|
||||||
if (!raw) {
|
if (!raw && provider) {
|
||||||
try {
|
try {
|
||||||
wxMutexLocker locker(fileMutex);
|
wxMutexLocker locker(fileMutex);
|
||||||
if (subs.get() && singleFrame != frameNum) {
|
if (subs.get() && singleFrame != frameNum) {
|
||||||
|
@ -167,9 +167,19 @@ void *ThreadedFrameSource::Entry() {
|
||||||
return EXIT_SUCCESS;
|
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)
|
ThreadedFrameSource::ThreadedFrameSource(wxString videoFileName, wxEvtHandler *parent)
|
||||||
: wxThread(wxTHREAD_JOINABLE)
|
: wxThread(wxTHREAD_JOINABLE)
|
||||||
, provider(SubtitlesProviderFactory::GetProvider())
|
, provider(get_subs_provider(parent))
|
||||||
, videoProvider(VideoProviderFactory::GetProvider(videoFileName))
|
, videoProvider(VideoProviderFactory::GetProvider(videoFileName))
|
||||||
, parent(parent)
|
, parent(parent)
|
||||||
, nextTime(-1.)
|
, nextTime(-1.)
|
||||||
|
|
|
@ -42,6 +42,8 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <libaegisub/exception.h>
|
#include <libaegisub/exception.h>
|
||||||
|
#include <libaegisub/scoped_ptr.h>
|
||||||
|
|
||||||
#include "video_frame.h"
|
#include "video_frame.h"
|
||||||
|
|
||||||
class AssFile;
|
class AssFile;
|
||||||
|
@ -53,9 +55,9 @@ class VideoProviderError;
|
||||||
/// @brief An asynchronous video decoding and subtitle rendering wrapper
|
/// @brief An asynchronous video decoding and subtitle rendering wrapper
|
||||||
class ThreadedFrameSource : public wxThread {
|
class ThreadedFrameSource : public wxThread {
|
||||||
/// Subtitles provider
|
/// Subtitles provider
|
||||||
std::auto_ptr<SubtitlesProvider> provider;
|
agi::scoped_ptr<SubtitlesProvider> provider;
|
||||||
/// Video provider
|
/// Video provider
|
||||||
std::auto_ptr<VideoProvider> videoProvider;
|
agi::scoped_ptr<VideoProvider> videoProvider;
|
||||||
/// Event handler to send FrameReady events to
|
/// Event handler to send FrameReady events to
|
||||||
wxEvtHandler *parent;
|
wxEvtHandler *parent;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue