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

Method exportAsFile

exporter/src/export/PAGExport.cpp:260–338  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

258}
259
260std::shared_ptr<pag::File> PAGExport::exportAsFile() {
261 auto id = GetItemID(itemHandle);
262
263 PAGExportSessionManager::GetInstance()->setCurrentSession(session);
264 ScopedAssign<pag::ID> arCI(session->compID, id);
265 session->progressModel.addTotalSteps(1);
266
267 ExportComposition(session, itemHandle);
268 AdjustTrackMatteLayer(session);
269 if (session->stopExport) {
270 return nullptr;
271 }
272
273 pag::Codec::InstallReferences(session->compositions);
274 addRootComposition();
275 if (session->stopExport) {
276 return nullptr;
277 }
278
279 auto compositions = session->compositions;
280 if (session->exportAudio && session->configParam.isTagCodeSupport(pag::TagCode::AudioBytes)) {
281 GetAudioSequence(itemHandle, session->outputPath, compositions[compositions.size() - 1]);
282 CombineAudioMarkers(compositions);
283 }
284 if (session->stopExport) {
285 return nullptr;
286 }
287
288 std::vector<pag::ImageBytes*> images = getRefImages(compositions);
289 CheckBeforeExport(session, compositions, images);
290
291 if (session->stopExport ||
292 (session->showAlertInfo && !AlertInfoManager::GetInstance().showAlertInfo())) {
293 canceled = true;
294 return nullptr;
295 }
296
297 exportResources(compositions);
298 if (session->stopExport) {
299 return nullptr;
300 }
301
302 AdjustCompositionSize(compositions);
303 CheckAfterExport(session, compositions);
304 if (session->stopExport) {
305 return nullptr;
306 }
307
308 if (!session->configParam.exportLayerName ||
309 !session->configParam.isTagCodeSupport(pag::TagCode::LayerAttributesV2)) {
310 ClearLayerName(compositions.back());
311 }
312
313 if (!session->exportActually) {
314 return nullptr;
315 }
316
317 auto pagFile = pag::Codec::VerifyAndMake(compositions, images);

Callers

nothing calls this directly

Calls 15

GetItemIDFunction · 0.85
ExportCompositionFunction · 0.85
AdjustTrackMatteLayerFunction · 0.85
GetAudioSequenceFunction · 0.85
CombineAudioMarkersFunction · 0.85
CheckBeforeExportFunction · 0.85
AdjustCompositionSizeFunction · 0.85
CheckAfterExportFunction · 0.85
ClearLayerNameFunction · 0.85
CheckGraphicsMemoryFunction · 0.85
ExportTimeStretchFunction · 0.85
ExportLayerEditableFunction · 0.85

Tested by

no test coverage detected