MCPcopy Create free account
hub / github.com/Tencent/libpag / ExportTimeStretch

Function ExportTimeStretch

exporter/src/export/Marker.cpp:609–643  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

607}
608
609void ExportTimeStretch(std::shared_ptr<pag::File> file, std::shared_ptr<PAGExportSession> session,
610 const AEGP_ItemH& itemHandle) {
611 if (file == nullptr || itemHandle == nullptr) {
612 return;
613 }
614
615 const auto& suites = GetSuites();
616
617 A_Time durationTime = {};
618 AEGP_CompH compHandle = GetItemCompH(itemHandle);
619 suites->CompSuite6()->AEGP_GetCompWorkAreaDuration(compHandle, &durationTime);
620 auto compositionDuration = AEDurationToFrame(durationTime, session->frameRate);
621
622 auto optInfo = GetTimeStretchInfo(itemHandle);
623 if (optInfo.has_value()) {
624 const auto& info = *optInfo;
625 pag::Frame timeStretchStart =
626 std::min(std::max(info.start, (pag::Frame)0), compositionDuration);
627 pag::Frame timeStretchDuration =
628 std::min(std::max(info.duration, (pag::Frame)0), compositionDuration - timeStretchStart);
629
630 if (timeStretchDuration == 0) {
631 file->scaledTimeRange.start = 0;
632 file->scaledTimeRange.end = compositionDuration;
633 } else {
634 file->scaledTimeRange.start = timeStretchStart;
635 file->scaledTimeRange.end = timeStretchStart + timeStretchDuration;
636 }
637 file->timeStretchMode = info.mode;
638 } else {
639 file->timeStretchMode = pag::PAGTimeStretchMode::Repeat;
640 file->scaledTimeRange.start = 0;
641 file->scaledTimeRange.end = compositionDuration;
642 }
643}
644
645void ExportImageLayerEditable(std::shared_ptr<pag::File> file,
646 std::shared_ptr<PAGExportSession> session,

Callers 1

exportAsFileMethod · 0.85

Calls 4

GetSuitesFunction · 0.85
GetItemCompHFunction · 0.85
AEDurationToFrameFunction · 0.85
GetTimeStretchInfoFunction · 0.85

Tested by

no test coverage detected