Skip to content

Commit

Permalink
Added and refactored _getAbsolutePath().
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Jan 17, 2023
1 parent 82be189 commit 02c60dc
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions mrViewer/lib/mrvFl/mrvTimelineCreate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ namespace tl
{
namespace
{

std::string _getAbsolutePath( const file::Path& path )
{
std::string file = path.get();
if ( !path.isAbsolute() )
{
file = fs::current_path().generic_string() + '/' + file;
}
return file;
}

file::Path _getAudioPath(
const file::Path& path,
const FileSequenceAudio& fileSequenceAudio,
Expand Down Expand Up @@ -191,13 +202,7 @@ namespace tl
}
else
{
// videoClip->set_media_reference(new otio::ExternalReference(path.get(-1, false)));
std::string file = path.get();
if ( !path.isAbsolute() )
{
file = fs::current_path().generic_string() + '/' +
file;
}
const std::string& file =_getAbsolutePath(path);
videoClip->set_media_reference(new otio::ExternalReference(file));
}
if (!videoTrack)
Expand Down Expand Up @@ -232,12 +237,7 @@ namespace tl

auto audioClip = new otio::Clip;
audioClip->set_source_range(audioInfo.audioTime);
// audioClip->set_media_reference(new otio::ExternalReference(audioPath.get(-1, false)));
std::string file = audioPath.get();
if (!audioPath.isAbsolute() && !audioPath.isEmpty())
{
file = fs::current_path().generic_string() + '/' + file;
}
const std::string& file = _getAbsolutePath(audioPath);
audioClip->set_media_reference(new otio::ExternalReference(file));

if (!audioTrack)
Expand All @@ -256,11 +256,7 @@ namespace tl
{
auto audioClip = new otio::Clip;
audioClip->set_source_range(info.audioTime);
std::string file = path.get();
if (!path.isAbsolute() && !path.isEmpty())
{
file = fs::current_path().generic_string() + '/' + file;
}
const std::string& file = _getAbsolutePath(path);
audioClip->set_media_reference(new otio::ExternalReference(file));

if (!audioTrack)
Expand Down

0 comments on commit 02c60dc

Please sign in to comment.