13 #include <condition_variable>
16 #include <unordered_map>
64 virtual bool IsOpened()
const override {
return is_opened_; }
67 virtual bool IsEOF()
const override;
75 virtual void Close()
override;
97 virtual std::string
GetFilename()
const override {
return filename_; };
103 std::string filename_;
106 std::atomic<bool> is_eof_{
false};
107 std::atomic<bool> is_opened_{
false};
117 std::vector<t::geometry::RGBDImage> frame_buffer_;
118 std::vector<uint64_t>
120 static const size_t BUFFER_REFILL_FACTOR =
122 std::atomic<uint64_t> head_fid_{
124 std::atomic<uint64_t> tail_fid_{0};
125 std::atomic<uint64_t> seek_to_{UINT64_MAX};
126 std::condition_variable need_frames_;
132 void fill_frame_buffer();
133 std::thread frame_reader_thread_;
135 std::unique_ptr<rs2::pipeline> pipe_;
137 Json::Value GetMetadataJson();
138 std::string GetTagInMetadata(
const std::string &tag_name);
RGBDImage A pair of color and depth images.
virtual void SaveFrames(const std::string &frame_path, uint64_t start_time_us=0, uint64_t end_time_us=UINT64_MAX)
virtual std::string ToString() const
Text description.
virtual bool SeekTimestamp(uint64_t timestamp) override
static const size_t DEFAULT_BUFFER_SIZE
RSBagReader(size_t buffer_size=DEFAULT_BUFFER_SIZE)
virtual RGBDVideoMetadata & GetMetadata() override
Get reference to the metadata of the RGBD video playback.
virtual std::string GetFilename() const override
Return filename being read.
RSBagReader(const RSBagReader &)=delete
virtual bool IsEOF() const override
Check if the RSBag file is all read.
virtual bool IsOpened() const override
Check If the RSBag file is opened.
virtual uint64_t GetTimestamp() const override
Get current timestamp (in us).
RSBagReader & operator=(const RSBagReader &)=delete
virtual bool Open(const std::string &filename) override
virtual t::geometry::RGBDImage NextFrame() override
Copy next frame from the bag file and return the RGBDImage object.
virtual const RGBDVideoMetadata & GetMetadata() const override
Get (read-only) metadata of the playback.
virtual void Close() override
Close the opened RSBag playback.
Generic file read and write utility for python interface.