Merge branch 'otio_improvments' of https://github.com/ThomasWilshaw/olive into ThomasWilshaw-otio_improvments

This commit is contained in:
itsmattkc
2021-04-10 11:07:51 +10:00
8 changed files with 72 additions and 34 deletions
+1
View File
@@ -38,6 +38,7 @@ set(OLIVE_SOURCES
common/functiontimer.h
common/lerp.h
common/memorypool.cpp
common/otioutils.h
common/memorypool.h
common/ocioutils.cpp
common/ocioutils.h
+29
View File
@@ -0,0 +1,29 @@
/***
Olive - Non-Linear Video Editor
Copyright (C) 2019 Olive Team
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
***/
#ifndef OTIOUTILS_H
#define OTIOUTILS_H
#ifdef USE_OTIO
#include <opentimelineio/version.h>
namespace OTIO = opentimelineio::OPENTIMELINEIO_VERSION;
#endif
#endif // OTIOUTILS
+4 -2
View File
@@ -103,10 +103,12 @@ AVRational rational::toAVRational() const
}
#ifdef USE_OTIO
opentime::RationalTime rational::toRationalTime() const
opentime::RationalTime rational::toRationalTime(double framerate) const
{
// Is this the best way of doing this?
return opentime::RationalTime::from_seconds(toDouble());
// Olive can store rationals as 0/0 which causes errors in OTIO
opentime::RationalTime time = opentime::RationalTime(numer_, denom_ == 0 ? 1 : denom_);
return time.rescaled_to(framerate);
}
#endif
+2 -1
View File
@@ -101,7 +101,8 @@ public:
AVRational toAVRational() const;
#ifdef USE_OTIO
opentime::RationalTime toRationalTime() const;
// Convert Olive ratioanls to opentime rationals with the given framerate (defaults to 24)
opentime::RationalTime toRationalTime(double framerate = 24) const;
#endif
// Produce "flipped" version