cgv
video_writer.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 
8 namespace cgv {
9  namespace media {
10  namespace video {
11 
12 class CGV_API video_writer;
13 
15 class CGV_API abst_video_writer : public cgv::base::base
16 {
17 public:
18  friend class video_writer;
20  virtual abst_video_writer* clone() const = 0;
22  virtual const char* get_supported_extensions() const = 0;
24  virtual const std::string& get_last_error() const = 0;
26  virtual bool scan_codecs(std::vector<std::string>& codec_names) const;
28  virtual bool set_codec(const std::string& codec_name);
30  virtual std::string get_codec() const;
32  virtual bool open(const std::string& file_name, const cgv::data::data_format& image_format, float fps, bool interactive) = 0;
34  virtual bool write_frame(const cgv::data::const_data_view& image_data) = 0;
36  virtual bool close() = 0;
37 };
38 
40 class CGV_API video_writer : public cgv::base::base
41 {
42 protected:
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);
51 public:
54  static const std::string& get_supported_extensions(char sep = ';');
56  static std::string construct_filter_string();
58  video_writer(const std::string& file_extension);
60  const std::string& get_last_error() const;
62  std::string get_type_name() const;
64  bool scan_codecs(std::vector<std::string>& codec_names) const;
66  bool set_codec(const std::string& codec_name);
68  std::string get_codec() const;
72  std::string get_property_declarations();
75  bool open(const std::string& file_name,
76  const cgv::data::data_format& image_format,
77  float fps = 25,
78  bool interactive = false);
81  bool write_frame(const cgv::data::const_data_view& image_data);
83  bool close();
84 };
85 
86  }
87  }
88 }
89 
90 #include <cgv/config/lib_end.h>
cgv::media::video::video_writer::last_error
std::string last_error
store the last error not resulting from video writer implementations
Definition: video_writer.h:46
cgv::media::video::video_writer
the image writer chooses a specific writer automatically based on the extension of the given file nam...
Definition: video_writer.h:41
cgv::media::video::abst_video_writer::write_frame
virtual bool write_frame(const cgv::data::const_data_view &image_data)=0
write the next frame
cgv::data::const_data_view
Definition: data_view.h:211
cgv::media::video::abst_video_writer::open
virtual bool open(const std::string &file_name, const cgv::data::data_format &image_format, float fps, bool interactive)=0
open file from given file name, format and fps
cgv::media::video::video_writer::wr
abst_video_writer * wr
store a pointer to the chosen reader
Definition: video_writer.h:44
cgv::data::data_format
Definition: data_format.h:18
cgv::media::video::abst_video_writer::close
virtual bool close()=0
close the video file
cgv::media::video::abst_video_writer
abstract interface for video writers
Definition: video_writer.h:16
cgv::base::base
Definition: base.h:57
cgv::type::info::get_type_name
const char * get_type_name(TypeId tid)
function that returns the name of a type specified through TypeId
Definition: type_id.cxx:117
cgv::media::video::abst_video_writer::clone
virtual abst_video_writer * clone() const =0
construct a copy of the video writer
cgv::media::video::abst_video_writer::get_supported_extensions
virtual const char * get_supported_extensions() const =0
return a string containing a colon separated list of extensions that can be read with this video writ...
cgv::media::video::abst_video_writer::get_last_error
virtual const std::string & get_last_error() const =0
return a reference to the last error message
cgv
the cgv namespace
Definition: vr_calib.cxx:9