Added Util::packetSorter with async/sync modes, set DTSC outputs to use async mode
This commit is contained in:
parent
6042c1ea70
commit
dae32ede11
5 changed files with 278 additions and 135 deletions
33
lib/stream.h
33
lib/stream.h
|
|
@ -50,6 +50,39 @@ namespace Util{
|
|||
extern trackSortOrder defaultTrackSortOrder;
|
||||
void sortTracks(std::set<size_t> & validTracks, const DTSC::Meta & M, trackSortOrder sorting, std::list<size_t> & srtTrks);
|
||||
|
||||
/// This struct keeps packet information sorted in playback order
|
||||
struct sortedPageInfo{
|
||||
bool operator<(const sortedPageInfo &rhs) const{
|
||||
if (time < rhs.time){return true;}
|
||||
return (time == rhs.time && tid < rhs.tid);
|
||||
}
|
||||
size_t tid;
|
||||
uint64_t time;
|
||||
uint64_t offset;
|
||||
size_t partIndex;
|
||||
};
|
||||
|
||||
/// Packet sorter used to determine which packet should be output next
|
||||
class packetSorter{
|
||||
public:
|
||||
packetSorter();
|
||||
size_t size() const;
|
||||
void clear();
|
||||
const sortedPageInfo * begin() const;
|
||||
void insert(const sortedPageInfo &pInfo);
|
||||
void dropTrack(size_t tid);
|
||||
void replaceFirst(const sortedPageInfo &pInfo);
|
||||
void moveFirstToEnd();
|
||||
bool hasEntry(size_t tid) const;
|
||||
void getTrackList(std::set<size_t> &toFill) const;
|
||||
void setSyncMode(bool synced);
|
||||
bool getSyncMode() const;
|
||||
private:
|
||||
bool dequeMode;
|
||||
std::deque<sortedPageInfo> dequeBuffer;
|
||||
std::set<sortedPageInfo> setBuffer;
|
||||
};
|
||||
|
||||
|
||||
class DTSCShmReader{
|
||||
public:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue