cgv
Loading...
Searching...
No Matches
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
8namespace cgv {
9 namespace media {
10 namespace video {
11
12class CGV_API video_writer;
13
15class CGV_API abst_video_writer : public cgv::base::base
16{
17public:
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
40class CGV_API video_writer : public cgv::base::base
41{
42protected:
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:
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>
base class for all classes that can be registered with support for dynamic properties (see also secti...
Definition base.h:75
The const_data_view has the functionality of the data_view but uses a const pointer and therefore doe...
Definition data_view.h:221
A data_format describes a multidimensional data block of data entries.
Definition data_format.h:17
abstract interface for video writers
virtual bool close()=0
close the video file
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...
virtual bool write_frame(const cgv::data::const_data_view &image_data)=0
write the next frame
virtual abst_video_writer * clone() const =0
construct a copy of the video writer
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
virtual const std::string & get_last_error() const =0
return a reference to the last error message
the image writer chooses a specific writer automatically based on the extension of the given file nam...
std::string last_error
store the last error not resulting from video writer implementations
abst_video_writer * wr
store a pointer to the chosen reader
the cgv namespace
Definition print.h:11