decoder: fixed regression in image handling in OIIO decoder

Fixes #1277
This commit is contained in:
itsmattkc
2020-10-27 12:36:55 +11:00
parent 5f5d6e82ab
commit 1e6208517f
2 changed files with 21 additions and 5 deletions
+20 -4
View File
@@ -99,7 +99,20 @@ bool OIIODecoder::Open()
{
Q_ASSERT(stream());
if (stream()->type() != Stream::kVideo && !OpenImageHandler(stream()->footage()->filename())) {
if (stream()->type() != Stream::kVideo) {
// Guard against non-video types
return false;
}
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream());
if (video_stream->video_type() == VideoStream::kVideoTypeVideo) {
// This decoder only handles kVideoTypeImageSequence and kVideoTypeStill
return false;
}
if (video_stream->video_type() == VideoStream::kVideoTypeStill
&& !OpenImageHandler(stream()->footage()->filename())) {
return false;
}
@@ -111,11 +124,14 @@ bool OIIODecoder::Open()
FramePtr OIIODecoder::RetrieveVideo(const rational &timecode, const int& divider)
{
if (!open_) {
qWarning() << "Tried to retrieve video on a decoder that's still closed";
return nullptr;
}
if (stream()->type() == Stream::kVideo) {
int64_t ts = std::static_pointer_cast<VideoStream>(stream())->get_time_in_timebase_units(timecode);
VideoStreamPtr video_stream = std::static_pointer_cast<VideoStream>(stream());
if (video_stream->video_type() == VideoStream::kVideoTypeImageSequence) {
int64_t ts = video_stream->get_time_in_timebase_units(timecode);
if (!OpenImageHandler(TransformImageSequenceFileName(stream()->footage()->filename(), ts))) {
return nullptr;
@@ -149,7 +165,7 @@ FramePtr OIIODecoder::RetrieveVideo(const rational &timecode, const int& divider
}
if (stream()->type() == Stream::kVideo) {
if (video_stream->video_type() == VideoStream::kVideoTypeImageSequence) {
CloseImageHandle();
}
+1 -1
View File
@@ -281,7 +281,7 @@ int64_t ProjectImportTask::GetImageSequenceLimit(const QString& start_fn, int64_
start = test_index;
}
return test_index;
return start;
}
OLIVE_NAMESPACE_EXIT