cgv
Loading...
Searching...
No Matches
video_reader.h
1#pragma once
2
3#include <cgv/base/base.h>
4#include <cgv/data/data_view.h>
5
6#include "lib_begin.h"
7
8namespace cgv {
9 namespace media {
11 namespace video {
12
13class CGV_API video_reader;
14
16class CGV_API abst_video_reader : public cgv::base::base
17{
18public:
19 friend class video_reader;
21 virtual abst_video_reader* clone() const = 0;
23 virtual const std::string& get_last_error() const = 0;
25 virtual const char* get_supported_extensions() const = 0;
27 virtual bool open(const std::string& file_name, cgv::data::data_format& df, float& fps) = 0;
29 virtual bool read_frame(const cgv::data::data_view& dv) = 0;
31 virtual bool close() = 0;
32
33};
34
36class CGV_API video_reader : public cgv::base::base
37{
38protected:
44 float fps;
46 std::string last_error;
48 bool set_void(const std::string& property, const std::string& type, const void* value);
50 bool get_void(const std::string& property, const std::string& type, void* value);
51public:
58 std::string get_type_name() const;
60 static const std::string& get_supported_extensions(char sep = ';');
62 static std::string construct_filter_string();
64 std::string get_property_declarations();
66 const std::string& get_last_error() const;
68 bool open(const std::string& file_name);
70 const cgv::data::data_format& get_image_format() const;
72 float get_fps() const;
77 bool read_frame(cgv::data::data_view& dv);
80 bool read_frame(const cgv::data::data_view& dv);
82 bool close();
83};
84
85 }
86 }
87}
88
89#include <cgv/config/lib_end.h>
base class for all classes that can be registered with support for dynamic properties (see also secti...
Definition base.h:75
A data_format describes a multidimensional data block of data entries.
Definition data_format.h:17
the data view gives access to a data array of one, two, three or four dimensions.
Definition data_view.h:153
abstract interface for a video reader
virtual abst_video_reader * clone() const =0
construct a copy of the video reader
virtual bool open(const std::string &file_name, cgv::data::data_format &df, float &fps)=0
open the file and read the header in order to determine the image format and the fps
virtual const char * get_supported_extensions() const =0
return a string containing a colon separated list of extensions that can be read with this reader
virtual bool close()=0
close the video file
virtual bool read_frame(const cgv::data::data_view &dv)=0
read a frame and return whether this was successful
virtual const std::string & get_last_error() const =0
return a reference to the last error message
the video reader chooses a specific reader automatically based on the extension of the given file nam...
float fps
store the fps of the opened video file
cgv::data::data_format * image_format_ptr
store the image format
std::string last_error
store the last error not resulting from video writer implementations
abst_video_reader * rd
store a pointer to the chosen reader
the cgv namespace
Definition print.h:11