mf
Media Framework
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
seekable_frame_importer.h
Go to the documentation of this file.
1 #ifndef MF_SEEKABLE_FRAME_IMPORTER_H_
2 #define MF_SEEKABLE_FRAME_IMPORTER_H_
3 
4 #include "frame_importer.h"
5 #include "../common.h"
6 #include "../ndarray/ndcoord.h"
7 #include "../ndarray/ndarray_view.h"
8 
9 namespace mf {
10 
11 
13 
15 template<std::size_t Dim, typename Elem>
16 class seekable_frame_importer : public frame_importer<Dim, Elem> {
18 
19 protected:
21  base(frame_shape) { }
22 
23 public:
24  using typename base::frame_view_type;
25  constexpr static bool is_seekable = true;
26 
27  virtual time_unit current_time() const = 0;
28  virtual time_unit total_duration() const = 0;
29 
30  virtual void seek(time_unit) = 0;
31 
33  this->seek(t);
34  this->read_frame(vw);
35  }
36 };
37 
38 
39 }
40 
41 #endif
42 
Mapping between coordinates, indices, and addresses of multi-dimensional data.
Definition: ndarray_view.h:16
virtual void read_frame(const frame_view_type &)=0
std::ptrdiff_t time_unit
Discrete time unit type.
Definition: common.h:52
seekable_frame_importer(const ndsize< Dim > &frame_shape)
Definition: seekable_frame_importer.h:20
Seekable frame importer, abstract base class.
Definition: seekable_frame_importer.h:16
void read_frame_at(const frame_view_type &vw, time_unit t)
Definition: seekable_frame_importer.h:32
const ndsize< Dim > & frame_shape()
Definition: frame_importer.h:30
static constexpr bool is_seekable
Definition: seekable_frame_importer.h:25
Vector of n-dimensional coordinates.
Definition: ndcoord.h:18
ndarray_view< Dim, Elem > frame_view_type
Definition: frame_importer.h:23
virtual void seek(time_unit)=0
virtual time_unit total_duration() const =0
virtual time_unit current_time() const =0
Frame importer, abstract base class.
Definition: frame_importer.h:14