Skip to content

Access externalMedia etc from Clip #1616

Answered by darbyjohnston
alatdneg asked this question in Q&A
Discussion options

You must be logged in to vote

Yes, you can dynamically cast the media references something like this:

std::string mediaURL;
if (auto externalRef = dynamic_cast<const otio::ExternalReference*>(clip->media_reference()))
{
    mediaURL = externalRef->target_url();
}
else if (auto imageSequenceRef = dynamic_cast<const otio::ImageSequenceReference*>(clip->media_reference()))
{
    std::stringstream ss;
    ss << imageSequenceRef->target_url_base() <<
        imageSequenceRef->name_prefix() <<
        std::setfill('0') << std::setw(imageSequenceRef->frame_zero_padding()) <<
        imageSequenceRef->start_frame() <<
        imageSequenceRef->name_suffix();
    mediaURL = ss.str();
}

Here I am using clip->media_reference()

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@alatdneg
Comment options

Answer selected by alatdneg
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants