Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/tracklist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,9 @@ void BestTrackList::OpenFile(const std::filesystem::path &SourceFile, const std:

TrackList.push_back(TI);
}

File.ContainerStartTime = FormatContext->start_time;
File.ContainerStartTimeBase = AV_TIME_BASE;
}

BestTrackList::BestTrackList(const std::filesystem::path &SourceFile, const std::map<std::string, std::string> *LAVFOpts) {
Expand Down Expand Up @@ -120,3 +123,7 @@ std::map<std::string, std::string> BestTrackList::GetTrackMetadata(int Track) co

return Result;
}

const BestTrackList::FileInfo &BestTrackList::GetFileInfo() const {
return File;
}
7 changes: 7 additions & 0 deletions src/tracklist.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,16 @@ struct BestTrackList {
int Disposition;
std::string DispositionString;
};
struct FileInfo {
// Warning, ContainerStartTime may be equal to AV_NOPTS_VALUE.
int64_t ContainerStartTime;
int ContainerStartTimeBase;
};
private:
AVFormatContext *FormatContext = nullptr;

std::vector<TrackInfo> TrackList;
FileInfo File;

void OpenFile(const std::filesystem::path &SourceFile, const std::map<std::string, std::string> &LAVFOpts);
void Free();
Expand All @@ -52,6 +58,7 @@ struct BestTrackList {
[[nodiscard]] const TrackInfo &GetTrackInfo(int Track) const;
[[nodiscard]] std::map<std::string, std::string> GetFileMetadata() const;
[[nodiscard]] std::map<std::string, std::string> GetTrackMetadata(int Track) const;
[[nodiscard]] const FileInfo &GetFileInfo() const;
};

#endif
Loading