mirror of
https://github.com/vcmi/vcmi.git
synced 2025-11-27 22:49:25 +02:00
Prefer high-quality bik's to smk's
This commit is contained in:
@@ -61,14 +61,27 @@ static si64 lodSeek(void * opaque, si64 pos, int whence)
|
|||||||
throw std::runtime_error(errorMessage.data());
|
throw std::runtime_error(errorMessage.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void CVideoInstance::open(const VideoPath & videoToOpen)
|
static std::unique_ptr<CInputStream> findVideoData(const VideoPath & videoToOpen)
|
||||||
{
|
{
|
||||||
if(CResourceHandler::get()->existsResource(videoToOpen))
|
if(CResourceHandler::get()->existsResource(videoToOpen))
|
||||||
state.actualPath = videoToOpen;
|
return CResourceHandler::get()->load(videoToOpen);
|
||||||
else
|
|
||||||
state.actualPath = videoToOpen.addPrefix("VIDEO/");
|
|
||||||
|
|
||||||
state.videoData = CResourceHandler::get()->load(state.actualPath);
|
auto highQualityVideoToOpenWithDir = videoToOpen.addPrefix("VIDEO/");
|
||||||
|
auto lowQualityVideo = videoToOpen.toType<EResType::VIDEO_LOW_QUALITY>();
|
||||||
|
auto lowQualityVideoWithDir = highQualityVideoToOpenWithDir.toType<EResType::VIDEO_LOW_QUALITY>();
|
||||||
|
|
||||||
|
if(CResourceHandler::get()->existsResource(highQualityVideoToOpenWithDir))
|
||||||
|
return CResourceHandler::get()->load(highQualityVideoToOpenWithDir);
|
||||||
|
|
||||||
|
if(CResourceHandler::get()->existsResource(lowQualityVideo))
|
||||||
|
return CResourceHandler::get()->load(lowQualityVideo);
|
||||||
|
|
||||||
|
return CResourceHandler::get()->load(lowQualityVideoWithDir);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CVideoInstance::open(const VideoPath & videoToOpen)
|
||||||
|
{
|
||||||
|
state.videoData = findVideoData(videoToOpen);
|
||||||
|
|
||||||
static const int BUFFER_SIZE = 4096;
|
static const int BUFFER_SIZE = 4096;
|
||||||
|
|
||||||
|
|||||||
@@ -113,11 +113,8 @@ EResType EResTypeHelper::getTypeFromExtension(std::string extension)
|
|||||||
{".MP3", EResType::SOUND},
|
{".MP3", EResType::SOUND},
|
||||||
{".OGG", EResType::SOUND},
|
{".OGG", EResType::SOUND},
|
||||||
{".FLAC", EResType::SOUND},
|
{".FLAC", EResType::SOUND},
|
||||||
{".SMK", EResType::VIDEO},
|
{".SMK", EResType::VIDEO_LOW_QUALITY},
|
||||||
{".BIK", EResType::VIDEO},
|
{".BIK", EResType::VIDEO},
|
||||||
{".MJPG", EResType::VIDEO},
|
|
||||||
{".MPG", EResType::VIDEO},
|
|
||||||
{".AVI", EResType::VIDEO},
|
|
||||||
{".WEBM", EResType::VIDEO},
|
{".WEBM", EResType::VIDEO},
|
||||||
{".ZIP", EResType::ARCHIVE_ZIP},
|
{".ZIP", EResType::ARCHIVE_ZIP},
|
||||||
{".LOD", EResType::ARCHIVE_LOD},
|
{".LOD", EResType::ARCHIVE_LOD},
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ enum class EResType
|
|||||||
TTF_FONT,
|
TTF_FONT,
|
||||||
IMAGE,
|
IMAGE,
|
||||||
VIDEO,
|
VIDEO,
|
||||||
|
VIDEO_LOW_QUALITY,
|
||||||
SOUND,
|
SOUND,
|
||||||
ARCHIVE_VID,
|
ARCHIVE_VID,
|
||||||
ARCHIVE_ZIP,
|
ARCHIVE_ZIP,
|
||||||
|
|||||||
@@ -493,6 +493,7 @@ static std::string imageFile(const JsonNode & node)
|
|||||||
static std::string videoFile(const JsonNode & node)
|
static std::string videoFile(const JsonNode & node)
|
||||||
{
|
{
|
||||||
TEST_FILE(node.getModScope(), "Video/", node.String(), EResType::VIDEO);
|
TEST_FILE(node.getModScope(), "Video/", node.String(), EResType::VIDEO);
|
||||||
|
TEST_FILE(node.getModScope(), "Video/", node.String(), EResType::VIDEO_LOW_QUALITY);
|
||||||
return "Video file \"" + node.String() + "\" was not found";
|
return "Video file \"" + node.String() + "\" was not found";
|
||||||
}
|
}
|
||||||
#undef TEST_FILE
|
#undef TEST_FILE
|
||||||
|
|||||||
Reference in New Issue
Block a user