Open3D (C++ API)
MKVReader.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - Open3D: www.open3d.org -
3 // ----------------------------------------------------------------------------
4 // The MIT License (MIT)
5 //
6 // Copyright (c) 2018 www.open3d.org
7 //
8 // Permission is hereby granted, free of charge, to any person obtaining a copy
9 // of this software and associated documentation files (the "Software"), to deal
10 // in the Software without restriction, including without limitation the rights
11 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12 // copies of the Software, and to permit persons to whom the Software is
13 // furnished to do so, subject to the following conditions:
14 //
15 // The above copyright notice and this permission notice shall be included in
16 // all copies or substantial portions of the Software.
17 //
18 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
23 // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
24 // IN THE SOFTWARE.
25 // ----------------------------------------------------------------------------
26 
27 #pragma once
28 
32 
33 struct _k4a_playback_t; // typedef _k4a_playback_t* k4a_playback_t;
34 struct _k4a_capture_t; // typedef _k4a_capture_t* k4a_capture_t;
35 struct _k4a_transformation_t; // typedef _k4a_transformation_t*
36  // k4a_transformation_t;
37 
38 namespace open3d {
39 namespace io {
40 
44 class MKVReader {
45 public:
47  MKVReader();
48  virtual ~MKVReader() {}
49 
51  bool IsOpened();
53  bool IsEOF() { return is_eof_; }
54 
58  bool Open(const std::string &filename);
60  void Close();
61 
63  MKVMetadata &GetMetadata() { return metadata_; }
65  bool SeekTimestamp(size_t timestamp);
67  std::shared_ptr<geometry::RGBDImage> NextFrame();
68 
69 private:
70  _k4a_playback_t *handle_;
71  _k4a_transformation_t *transformation_;
72  MKVMetadata metadata_;
73  bool is_eof_ = false;
74 
75  Json::Value GetMetadataJson();
76  std::string GetTagInMetadata(const std::string &tag_name);
77 };
78 } // namespace io
79 } // namespace open3d
Definition: MKVMetadata.h:45
Definition: MKVReader.h:44
MKVReader()
Default Constructor.
Definition: MKVReader.cpp:42
std::shared_ptr< geometry::RGBDImage > NextFrame()
Get next frame from the mkv playback and returns the RGBD object.
Definition: MKVReader.cpp:157
bool IsOpened()
Check If the mkv file is opened.
Definition: MKVReader.cpp:44
bool SeekTimestamp(size_t timestamp)
Seek to the timestamp (in us).
Definition: MKVReader.cpp:136
virtual ~MKVReader()
Definition: MKVReader.h:48
void Close()
Close the opened mkv playback.
Definition: MKVReader.cpp:78
bool IsEOF()
Check if the mkv file is all read.
Definition: MKVReader.h:53
Definition: Open3DViewer.h:29
bool Open(const std::string &filename)
Definition: MKVReader.cpp:61
MKVMetadata & GetMetadata()
Get metadata of the mkv playback.
Definition: MKVReader.h:63