MCPcopy Create free account
hub / github.com/TypesettingTools/Aegisub / DoIndexing

Method DoIndexing

src/ffmpegsource_common.cpp:63–100  ·  view source on GitHub ↗

@brief Does indexing of a source file @param Indexer A pointer to the indexer object representing the file to be indexed @param CacheName The filename of the output index file @param Trackmask A binary mask of the track numbers to index

Source from the content-addressed store, hash-verified

61/// @param CacheName The filename of the output index file
62/// @param Trackmask A binary mask of the track numbers to index
63FFMS_Index *FFmpegSourceProvider::DoIndexing(FFMS_Indexer *Indexer,
64 agi::fs::path const& CacheName,
65 TrackSelection Track,
66 FFMS_IndexErrorHandling IndexEH) {
67 char FFMSErrMsg[1024];
68 FFMS_ErrorInfo ErrInfo;
69 ErrInfo.Buffer = FFMSErrMsg;
70 ErrInfo.BufferSize = sizeof(FFMSErrMsg);
71 ErrInfo.ErrorType = FFMS_ERROR_SUCCESS;
72 ErrInfo.SubType = FFMS_ERROR_SUCCESS;
73
74 // index all audio tracks
75 FFMS_Index *Index;
76 br->Run([&](agi::ProgressSink *ps) {
77 ps->SetTitle(from_wx(_("Indexing")));
78 ps->SetMessage(from_wx(_("Reading timecodes and frame/sample data")));
79 TIndexCallback callback = [](int64_t Current, int64_t Total, void *Private) -> int {
80 auto ps = static_cast<agi::ProgressSink *>(Private);
81 ps->SetProgress(Current, Total);
82 return ps->IsCancelled();
83 };
84 if (Track == TrackSelection::All)
85 FFMS_TrackTypeIndexSettings(Indexer, FFMS_TYPE_AUDIO, 1, 0);
86 else if (Track != TrackSelection::None)
87 FFMS_TrackIndexSettings(Indexer, static_cast<int>(Track), 1, 0);
88 FFMS_TrackTypeIndexSettings(Indexer, FFMS_TYPE_VIDEO, 1, 0);
89 FFMS_SetProgressCallback(Indexer, callback, ps);
90 Index = FFMS_DoIndexing2(Indexer, IndexEH, &ErrInfo);
91 });
92
93 if (Index == nullptr)
94 throw agi::EnvironmentError(std::string("Failed to index: ") + ErrInfo.Buffer);
95
96 // write index to disk for later use
97 FFMS_WriteIndex(CacheName.string().c_str(), Index, &ErrInfo);
98
99 return Index;
100}
101
102/// @brief Finds all tracks of the given type and return their track numbers and respective codec names
103/// @param Indexer The indexer object representing the source file

Callers

nothing calls this directly

Calls 7

from_wxFunction · 0.85
stringMethod · 0.80
RunMethod · 0.45
SetTitleMethod · 0.45
SetMessageMethod · 0.45
SetProgressMethod · 0.45
IsCancelledMethod · 0.45

Tested by

no test coverage detected