Fix and de wxify video_manager.cpp.

Originally committed to SVN as r5329.
This commit is contained in:
Amar Takhar 2011-02-09 04:41:40 +00:00
parent 7d2594b134
commit ce912335f1
2 changed files with 27 additions and 20 deletions

View file

@ -24,8 +24,9 @@ endif
SRC = \ SRC = \
common/video_frame.cpp \
common/audio_manager.cpp \ common/audio_manager.cpp \
common/video_frame.cpp \
common/video_manager.cpp \
audio/downmix.cpp \ audio/downmix.cpp \
audio/convert.cpp \ audio/convert.cpp \
audio/dummy_audio.cpp \ audio/dummy_audio.cpp \

View file

@ -36,30 +36,34 @@
#include "config.h" #include "config.h"
#ifndef MAGI_PRE
#include <string>
#endif
#include <libaegisub/log.h> #include <libaegisub/log.h>
#include "compat.h" #include "libmedia/video.h"
#include "main.h"
#ifdef WITH_AVISYNTH #ifdef WITH_AVISYNTH
#include "video_provider_avs.h" #include "../video/avs_video.h"
#endif #endif
#include "video_provider_cache.h" #include "../cache/video_cache.h"
#include "video_provider_dummy.h" //XXX: needs fixing. #include "../video/dummy_video.h"
#ifdef WITH_FFMPEGSOURCE #ifdef WITH_FFMPEGSOURCE
#include "video_provider_ffmpegsource.h" #include "../video/ffms_video.h"
#endif #endif
#include "video_provider_manager.h" //XXX: needs fixing. #include "../video/yuv4mpeg.h"
#include "video_provider_yuv4mpeg.h"
namespace media {
/// @brief Get provider /// @brief Get provider
/// @param video /// @param video
/// @return /// @return
/// ///
VideoProvider *VideoProviderFactory::GetProvider(wxString video) { VideoProvider *VideoProviderFactory::GetProvider(std::string video) {
std::vector<std::string> list = GetClasses(OPT_GET("Video/Provider")->GetString()); //XXX std::vector<std::string> list = GetClasses(OPT_GET("Video/Provider")->GetString());
if (video.StartsWith("?dummy")) list.insert(list.begin(), "Dummy"); std::vector<std::string> list = GetClasses("ffmpegsource");
if (video.find("?dummy") == 0) list.insert(list.begin(), "Dummy");
list.insert(list.begin(), "YUV4MPEG"); list.insert(list.begin(), "YUV4MPEG");
bool fileFound = false; bool fileFound = false;
@ -70,7 +74,7 @@ VideoProvider *VideoProviderFactory::GetProvider(wxString video) {
std::string err; std::string err;
try { try {
VideoProvider *provider = Create(list[i], video); VideoProvider *provider = Create(list[i], video);
LOG_I("manager/video/provider") << list[i] << ": opened " << STD_STR(video); LOG_I("manager/video/provider") << list[i] << ": opened " << video;
if (provider->WantsCaching()) { if (provider->WantsCaching()) {
return new VideoProviderCache(provider); return new VideoProviderCache(provider);
} }
@ -99,10 +103,10 @@ VideoProvider *VideoProviderFactory::GetProvider(wxString video) {
} }
// No provider could open the file // No provider could open the file
LOG_E("manager/video/provider") << "Could not open " << STD_STR(video); LOG_E("manager/video/provider") << "Could not open " << video;
std::string msg = "Could not open " + STD_STR(video) + ":\n" + errors; std::string msg = "Could not open " + video + ":\n" + errors;
if (!fileFound) throw agi::FileNotFoundError(STD_STR(video)); if (!fileFound) throw agi::FileNotFoundError(video);
if (!fileSupported) throw VideoNotSupported(msg); if (!fileSupported) throw VideoNotSupported(msg);
throw VideoOpenError(msg); throw VideoOpenError(msg);
} }
@ -114,10 +118,12 @@ void VideoProviderFactory::RegisterProviders() {
Register<AvisynthVideoProvider>("Avisynth"); Register<AvisynthVideoProvider>("Avisynth");
#endif #endif
#ifdef WITH_FFMPEGSOURCE #ifdef WITH_FFMPEGSOURCE
Register<FFmpegSourceVideoProvider>("FFmpegSource"); Register<ffms::FFmpegSourceVideoProvider>("FFmpegSource");
#endif #endif
Register<DummyVideoProvider>("Dummy", true); //XXX Register<DummyVideoProvider>("Dummy", true);
Register<YUV4MPEGVideoProvider>("YUV4MPEG", true); //XXX Register<YUV4MPEGVideoProvider>("YUV4MPEG", true);
} }
template<> VideoProviderFactory::map *FactoryBase<VideoProvider *(*)(wxString)>::classes = NULL; template<> VideoProviderFactory::map *FactoryBase<VideoProvider *(*)(std::string)>::classes = NULL;
} // namespace media