cgv
|
the image writer chooses a specific writer automatically based on the extension of the given file name More...
#include <video_writer.h>
Public Member Functions | |
video_writer (const std::string &file_extension) | |
construct a video writer from a file extension and choose an implementation based on the extension | |
const std::string & | get_last_error () const |
return a reference to the last error message | |
std::string | get_type_name () const |
returns the type name of the chosen video writer implementation | |
bool | scan_codecs (std::vector< std::string > &codec_names) const |
return a list of supported codecs in text format | |
bool | set_codec (const std::string &codec_name) |
select a specific codec. This will chance the properties available with the property interface. | |
std::string | get_codec () const |
return the currently selected codec | |
std::string | get_property_declarations () |
return a semicolon separated list of property declarations of the form "name:type", by default an empty list is returned More... | |
bool | open (const std::string &file_name, const cgv::data::data_format &image_format, float fps=25, bool interactive=false) |
bool | write_frame (const cgv::data::const_data_view &image_data) |
bool | close () |
close the video file | |
virtual std::string | get_default_options () const |
overload to provide default options for registration | |
virtual void | on_register () |
overload to handle register events that is sent after the instance has been registered More... | |
virtual void | unregister () |
overload to handle unregistration of instances | |
virtual void | stream_stats (std::ostream &) |
overload to show the content of this object | |
virtual data::ref_ptr< named, true > | get_named () |
cast upward to named | |
virtual data::ref_ptr< node, true > | get_node () |
cast upward to node | |
virtual data::ref_ptr< group, true > | get_group () |
cast upward to group | |
template<class T > | |
data::ref_ptr< T, true > | cast () |
cast to arbitrary class, but use the casts to named, node and group from the interface | |
template<class T > | |
T * | get_interface () |
use dynamic type cast to check for the given interface | |
template<class T > | |
const T * | get_const_interface () const |
use dynamic type cast to check for the given interface | |
virtual void | update () |
this virtual update allows for example to ask a view to update the viewed value. The default implementation is empty. | |
virtual void * | get_user_data () const |
this virtual method allows to pass application specific data for internal purposes More... | |
int | get_ref_count () const |
read access to current count | |
Static Public Member Functions | |
static const std::string & | get_supported_extensions (char sep=';') |
static std::string | construct_filter_string () |
use this to generate a file_open_dialog or file_save_dialog | |
Protected Member Functions | |
bool | set_void (const std::string &property, const std::string &type, const void *value) |
abstract interface for the setter, uses the interface of the selected writer implementation More... | |
bool | get_void (const std::string &property, const std::string &type, void *value) |
abstract interface for the getter, uses the interface of the selected writer implementation More... | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Static Protected Member Functions | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
Protected Attributes | |
abst_video_writer * | wr |
store a pointer to the chosen reader | |
std::string | last_error |
store the last error not resulting from video writer implementations | |
property interface | |
virtual bool | self_reflect (cgv::reflect::reflection_handler &) |
used for simple self reflection More... | |
virtual void | on_set (void *member_ptr) |
this callback is called when the set_void method has changed a member and can be overloaded in derived class | |
virtual bool | call_void (const std::string &method, const std::vector< std::string > ¶m_value_types, const std::vector< const void * > ¶m_value_ptrs, const std::string &result_type="", void *result_value_ptr=0) |
abstract interface to call an action More... | |
void | set (const std::string &property, const char *value) |
specialization of set method to support const char* as strings | |
template<typename T > | |
void | set (const std::string &property, const T &value) |
set a property of the element to the given value and perform standard conversions if necessary. More... | |
template<typename T > | |
T | get (const std::string &property) |
query a property of the element and perform standard conversions if necessary. More... | |
void | multi_set (const std::string &property_assignments, bool report_error=true) |
set several properties More... | |
bool | is_property (const std::string &property_name, std::string *type_name=0) |
check if the given name specifies a property. More... | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. More... | |
the image writer chooses a specific writer automatically based on the extension of the given file name
|
virtualinherited |
abstract interface to call an action
overload to implement the execution of a method based on the method name and the given parameters
, i.e. a class method based on the action name and the given parameters. The default implementation uses the self_reflect() method to dispatch this call. If not found, the get_void method returns false.
|
inherited |
find a member pointer by name.
If not found the null pointer is returned. If the type name string pointer is provided, the type of the property is copied to the referenced string.
|
inlineinherited |
query a property of the element and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
virtual |
return a semicolon separated list of property declarations of the form "name:type", by default an empty list is returned
return a semicolon separated list of property declarations supported by the selected codec. Each property declaration is of the form "name:type", where type is in correcpondence with the cgv::type::info::type_name.
Reimplemented from cgv::base::base.
|
static |
return a string with a list of supported extensions, where the list entries are separated with the passed character that defaults to a semicolon
|
virtualinherited |
this virtual method allows to pass application specific data for internal purposes
this virtual method allows derived classes to pass application specific data
|
protectedvirtual |
abstract interface for the getter, uses the interface of the selected writer implementation
abstract interface for the getter, by default it simply returns false
Reimplemented from cgv::base::base.
|
inherited |
check if the given name specifies a property.
If the type name string pointer is provided, the type of the property is copied to the referenced string.
|
inherited |
set several properties
set several properties, which are defined as colon separated assignments, where the types are derived automatically
, which are defined as colon separated assignments, where the types are derived automatically to bool, int, double or std::string.
|
virtualinherited |
overload to handle register events that is sent after the instance has been registered
overload to return a type info structure. By default an empty pointer is returned.
bool cgv::media::video::video_writer::open | ( | const std::string & | file_name, |
const cgv::data::data_format & | image_format, | ||
float | fps = 25 , |
||
bool | interactive = false |
||
) |
open a video file for writing images in the given format with the given fps. Use the currently selected codec and codec properties as set with the property interface.
|
virtualinherited |
used for simple self reflection
is used by default implementation of set_void, get_void and get_property_declarations
The overloaded implementation is used by the default implementations of set_void, get_void and get_property_declarations with corresponding reflection handlers. The default implementation of self_reflect is empty.
Reimplemented in cgv::render::render_config, and cgv::render::shader_config.
|
inlineinherited |
set a property of the element to the given value and perform standard conversions if necessary.
This templated version simply extracts the type of the value from the reference and calls the set_void() method. Note that this only works if the template cgv::type::info::type_name<T> is overloaded for the value type.
|
protectedvirtual |
abstract interface for the setter, uses the interface of the selected writer implementation
abstract interface for the setter, by default it simply returns false
Reimplemented from cgv::base::base.
bool cgv::media::video::video_writer::write_frame | ( | const cgv::data::const_data_view & | image_data | ) |
write the image data stored in the data view as next video frame to the previously opened video file. Return whether this was successful.