ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
MKVReader.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <IJsonConvertible.h>
11 #include <RGBDImage.h>
12 
14 
15 struct _k4a_playback_t; // typedef _k4a_playback_t* k4a_playback_t;
16 struct _k4a_capture_t; // typedef _k4a_capture_t* k4a_capture_t;
17 struct _k4a_transformation_t; // typedef _k4a_transformation_t*
18  // k4a_transformation_t;
19 
20 namespace cloudViewer {
21 namespace io {
22 
26 class MKVReader {
27 public:
29  MKVReader();
30  virtual ~MKVReader() {}
31 
33  bool IsOpened();
35  bool IsEOF() { return is_eof_; }
36 
40  bool Open(const std::string &filename);
42  void Close();
43 
45  MKVMetadata &GetMetadata() { return metadata_; }
47  bool SeekTimestamp(size_t timestamp);
49  std::shared_ptr<geometry::RGBDImage> NextFrame();
50 
51 private:
52  _k4a_playback_t *handle_;
53  _k4a_transformation_t *transformation_;
54  MKVMetadata metadata_;
55  bool is_eof_ = false;
56 
57  Json::Value GetMetadataJson();
58  std::string GetTagInMetadata(const std::string &tag_name);
59 };
60 } // namespace io
61 } // namespace cloudViewer
std::string filename
std::shared_ptr< geometry::RGBDImage > NextFrame()
Get next frame from the mkv playback and returns the RGBD object.
Definition: MKVReader.cpp:141
MKVMetadata & GetMetadata()
Get metadata of the mkv playback.
Definition: MKVReader.h:45
bool IsEOF()
Check if the mkv file is all read.
Definition: MKVReader.h:35
bool IsOpened()
Check If the mkv file is opened.
Definition: MKVReader.cpp:28
bool Open(const std::string &filename)
Definition: MKVReader.cpp:45
bool SeekTimestamp(size_t timestamp)
Seek to the timestamp (in us).
Definition: MKVReader.cpp:120
void Close()
Close the opened mkv playback.
Definition: MKVReader.cpp:62
MKVReader()
Default Constructor.
Definition: MKVReader.cpp:26
Generic file read and write utility for python interface.