Skip to content

Commit

Permalink
Improve logging of the cause when a movie can't be opened
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Dumusc committed Sep 13, 2018
1 parent 575f651 commit a10f402
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions tide/core/data/FFMPEGVideoStream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,8 @@ void FFMPEGVideoStream::_generateSeekingParameters()
const auto den = int64_t(timeBase.num) * AV_TIME_BASE;
duration = av_rescale(_avFormatContext.duration, num, den);
}
if (duration <= 0)
throw std::runtime_error("cannot determine movie duration");

// Estimate number of frames if unavailable
_numFrames = _videoStream->nb_frames;
Expand Down
5 changes: 4 additions & 1 deletion tide/core/scene/MovieContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@

#include "data/FFMPEGMovie.h"

#include "utils/log.h"

BOOST_CLASS_EXPORT_IMPLEMENT(MovieContent)

IMPLEMENT_SERIALIZE_FOR_XML(MovieContent)
Expand All @@ -67,8 +69,9 @@ bool MovieContent::readMetadata()
_frameDuration = movie.getFrameDuration();
return true;
}
catch (const std::runtime_error&)
catch (const std::runtime_error& e)
{
put_log(LOG_DEBUG, LOG_AV, e.what());
return false;
}
}
Expand Down

0 comments on commit a10f402

Please sign in to comment.