41 void open(
const std::vector<adtf_file::Stream>& streams,
42 bool sample_timestamps,
43 std::chrono::seconds sorting_window,
44 bool trigger_for_each_sample);
53 void seekTo(uint64_t item_index) override;
66 virtual uint64_t getUnsortedItemIndexForTimeStamp(std::chrono::nanoseconds time_stamp);
67 virtual std::shared_ptr<const
adtf_file::StreamType> getUnsortedStreamTypeBefore(uint64_t item_index,
69 virtual
void unsortedSeekTo(uint64_t item_index);
72 void internalSeek(std::chrono::nanoseconds time_stamp);
73 void fillQueue(std::chrono::nanoseconds sorting_window_duration);
75 struct FileItemCompare
82 using Queue = std::multimap<adtf_file::FileItem, std::shared_ptr<const adtf_file::StreamType>, FileItemCompare>;
84 bool _end_of_file =
false;
86 std::optional<std::chrono::nanoseconds> _internal_seek_queue_position;
89 std::optional<std::chrono::nanoseconds> _seek_queue_position;
90 std::chrono::seconds _sorting_window = std::chrono::seconds(10);
91 std::unordered_map<uint16_t, std::chrono::nanoseconds> _highest_sample_item_timestamps;
92 bool _sample_timestamps =
true;
93 bool _trigger_for_each_sample =
false;
94 std::vector<uint16_t> _stream_ids;
95 std::unordered_map<uint16_t, std::shared_ptr<const adtf_file::StreamType>> _current_types;
96 std::unordered_map<uint16_t, std::shared_ptr<const adtf_file::StreamType>> _last_published_types;
111 void open(
const std::string& file_name,
112 std::shared_ptr<adtf_file::SampleFactory> sample_factory,
113 std::shared_ptr<adtf_file::StreamTypeFactory> stream_type_factory)
override;
123 uint64_t getUnsortedItemIndexForTimeStamp(std::chrono::nanoseconds time_stamp)
override;
124 std::shared_ptr<const adtf_file::StreamType> getUnsortedStreamTypeBefore(uint64_t item_index,
125 uint16_t stream_id)
override;
126 void unsortedSeekTo(uint64_t item_index)
override;
129 std::shared_ptr<Reader> _reader;
130 std::vector<adtf_file::Stream> _streams;
class to create or read a file item. This file item is either a sample, streamtype or trigger.
Definition reader.h:172
std::chrono::nanoseconds time_stamp
time stamp of the file item
Definition reader.h:177
Default Reader factory implementation for readers using a standard default CTOR.
Definition reader.h:367
virtual void open(const std::string &filename, std::shared_ptr< SampleFactory > sample_factory, std::shared_ptr< StreamTypeFactory > stream_type_factory)=0
opens a file by the given filename. The given factories must be used to create samples and streamtype...
Interface for seekable Reader, where the file position can be adapted.
Definition reader.h:288
uint32_t getFileVersion() const override
std::optional< double > getProgress() const override
Get the Progress, a relative file position between 0.0 and 1.0.
std::vector< adtf_file::Extension > getExtensions() const override
Get the Extensions if any.
SortingProxyReader()
CTOR.
std::string getDescription() const override
std::vector< adtf_file::Stream > getStreams() const override
Get the Streams.
void open(const std::string &file_name, std::shared_ptr< adtf_file::SampleFactory > sample_factory, std::shared_ptr< adtf_file::StreamTypeFactory > stream_type_factory) override
opens a file by the given filename. The given factories must be used to create samples and streamtype...
std::optional< uint64_t > getItemCount() const override
Get the Item Count. This gets the overall count of all items (samples, stream types and triggers) of ...
std::string getReaderIdentifier() const override
Get the Reader Identifier of the Reader.
adtf_file::FileItem getNextUnsortedItem() override
Proxy reader that reorders items within a sliding window to restore timestamp order....
Definition sorting_reader.h:30
std::shared_ptr< const adtf_file::StreamType > getStreamTypeBefore(uint64_t item_index, uint16_t stream_id) override
uint64_t getItemIndexForTimeStamp(std::chrono::nanoseconds time_stamp) override
void open(const std::vector< adtf_file::Stream > &streams, bool sample_timestamps, std::chrono::seconds sorting_window, bool trigger_for_each_sample)
prepare the sorting algorithm.
void seekTo(uint64_t item_index) override
uint64_t getItemIndexForStreamItemIndex(uint16_t stream_id, uint64_t stream_item_index) override
adtf_file::FileItem getNextItem() final override
virtual adtf_file::FileItem getNextUnsortedItem()=0
namespace for ADTF File library
Definition adtf2_adtf_core_media_sample_deserializer.h:25
namespace for ADTF DAT Processing library.
Definition ddl_helpers.h:38
adtf_file::ReaderFactoryImplementation< SortingProxyReader > SortingReaderFactory
Default reader factory implementation for the SortingProxyReader.
Definition sorting_reader.h:136