mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-14 05:55:13 +01:00
movie: fix some checks
Fixes invalid movie error
This commit is contained in:
parent
b163502744
commit
dcd6e7f99f
@ -453,7 +453,7 @@ static boost::optional<CTMHeader> ReadHeader(const std::string& movie_file) {
|
|||||||
|
|
||||||
void Movie::PrepareForPlayback(const std::string& movie_file) {
|
void Movie::PrepareForPlayback(const std::string& movie_file) {
|
||||||
auto header = ReadHeader(movie_file);
|
auto header = ReadHeader(movie_file);
|
||||||
if (header != boost::none)
|
if (header == boost::none)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
init_time = header.value().clock_init_time;
|
init_time = header.value().clock_init_time;
|
||||||
@ -468,7 +468,7 @@ void Movie::PrepareForRecording() {
|
|||||||
Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file, u64 program_id) const {
|
Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file, u64 program_id) const {
|
||||||
LOG_INFO(Movie, "Validating Movie file '{}'", movie_file);
|
LOG_INFO(Movie, "Validating Movie file '{}'", movie_file);
|
||||||
auto header = ReadHeader(movie_file);
|
auto header = ReadHeader(movie_file);
|
||||||
if (header != boost::none)
|
if (header == boost::none)
|
||||||
return ValidationResult::Invalid;
|
return ValidationResult::Invalid;
|
||||||
|
|
||||||
return ValidateHeader(header.value(), program_id);
|
return ValidateHeader(header.value(), program_id);
|
||||||
@ -476,7 +476,7 @@ Movie::ValidationResult Movie::ValidateMovie(const std::string& movie_file, u64
|
|||||||
|
|
||||||
u64 Movie::GetMovieProgramID(const std::string& movie_file) const {
|
u64 Movie::GetMovieProgramID(const std::string& movie_file) const {
|
||||||
auto header = ReadHeader(movie_file);
|
auto header = ReadHeader(movie_file);
|
||||||
if (header != boost::none)
|
if (header == boost::none)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
return static_cast<u64>(header.value().program_id);
|
return static_cast<u64>(header.value().program_id);
|
||||||
|
Loading…
Reference in New Issue
Block a user