cgv
|
the video reader chooses a specific reader automatically based on the extension of the given file name More...
#include <video_reader.h>
Public Member Functions | |
video_reader (cgv::data::data_format &image_format) | |
construct a video reader from a reference to the image format, which will be set after opening a file. | |
~video_reader () | |
destruct reader and implementation | |
std::string | get_type_name () const |
overload to return the type name of this object | |
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 | |
const std::string & | get_last_error () const |
return a reference to the last error message | |
bool | open (const std::string &file_name) |
open the file and read the video header in order to determine the image format | |
const cgv::data::data_format & | get_image_format () const |
return the image format of the video file | |
float | get_fps () const |
return the frame rate | |
bool | read_frame (cgv::data::data_view &dv) |
read the next frame to the given data view, if this is empty recreate it with a newly allocated data pointer, which is owned by the view afterwards. | |
bool | read_frame (const cgv::data::data_view &dv) |
same as other read_frame version, but the data_view must point to allocated data of the correct format. | |
bool | close () |
close the video file | |
![]() | |
virtual std::string | get_default_options () const |
overload to provide default options for registration | |
std::string | get_name_or_type_name () const |
determine name of instance by checking cgv::base::named interface and in failure fallback to get_type_name() | |
virtual void | on_register () |
overload to handle register events that is sent after the instance has been registered | |
virtual void | unregister () |
overload to handle unregistration of instances | |
virtual bool | on_exit_request () |
overload to handle the appication exit request, return true if exiting is allowed and false otherwise | |
virtual void | stream_stats (std::ostream &) |
overload to show the content of this object | |
virtual data::ref_ptr< named, true > | get_named () |
perform downcast to named | |
virtual data::ref_ptr< node, true > | get_node () |
perform downcast to node | |
virtual data::ref_ptr< group, true > | get_group () |
perform downcast to group | |
virtual data::ref_ptr< const named, true > | get_named_const () const |
perform downcast to const named | |
virtual data::ref_ptr< const node, true > | get_node_const () const |
perform downcast to const node | |
virtual data::ref_ptr< const group, true > | get_group_const () const |
perform downcast to const 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 > | |
data::ref_ptr< const T, true > | cast_const () |
const 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 | |
virtual bool | self_reflect (cgv::reflect::reflection_handler &) |
used for simple self reflection | |
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 | |
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. | |
template<typename T > | |
T | get (const std::string &property) |
query a property of the element and perform standard conversions if necessary. | |
void | multi_set (const std::string &property_assignments, bool report_error=true) |
set several properties | |
bool | is_property (const std::string &property_name, std::string *type_name=0) |
check if the given name specifies a property. | |
void * | find_member_ptr (const std::string &property_name, std::string *type_name=0) |
find a member pointer by name. | |
![]() | |
int | get_ref_count () const |
read access to current count | |
Static Public Member Functions | |
static const std::string & | get_supported_extensions (char sep=';') |
return a string with a list of supported extensions, where the list entries are separated with the passed character that defaults to a semicolon | |
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, by default it simply returns false | |
bool | get_void (const std::string &property, const std::string &type, void *value) |
abstract interface for the getter, by default it simply returns false | |
![]() | |
virtual | ~base () |
make destructor virtual and not accessible from outside | |
![]() | |
ref_counted () | |
constructor initializes the count to 0 | |
void | set_ref_count (int c) const |
write access is also const to allow ref counted pointers to const instances | |
Protected Attributes | |
cgv::data::data_format * | image_format_ptr |
store the image format | |
abst_video_reader * | rd |
store a pointer to the chosen reader | |
float | fps |
store the fps of the opened video file | |
std::string | last_error |
store the last error not resulting from video writer implementations | |
Additional Inherited Members | |
![]() | |
template<class T > | |
static data::ref_ptr< T, true > | cast_dynamic (base *b) |
use dynamic cast for upcast to given class | |
the video reader chooses a specific reader automatically based on the extension of the given file name
Definition at line 36 of file video_reader.h.
cgv::media::video::video_reader::video_reader | ( | cgv::data::data_format & | image_format | ) |
construct a video reader from a reference to the image format, which will be set after opening a file.
construct an image reader from a file name
Definition at line 46 of file video_reader.cxx.
References fps.
cgv::media::video::video_reader::~video_reader | ( | ) |
destruct reader and implementation
Definition at line 53 of file video_reader.cxx.
References close().
bool cgv::media::video::video_reader::close | ( | ) |
close the video file
Definition at line 156 of file video_reader.cxx.
References cgv::media::video::abst_video_reader::close(), last_error, and rd.
Referenced by open(), and ~video_reader().
|
static |
use this to generate a file_open_dialog or file_save_dialog
Definition at line 75 of file video_reader.cxx.
References get_supported_extensions(), and cgv::utils::replace().
float cgv::media::video::video_reader::get_fps | ( | ) | const |
const cgv::data::data_format & cgv::media::video::video_reader::get_image_format | ( | ) | const |
return the image format of the video file
Definition at line 118 of file video_reader.cxx.
References image_format_ptr.
const std::string & cgv::media::video::video_reader::get_last_error | ( | ) | const |
return a reference to the last error message
Definition at line 87 of file video_reader.cxx.
References cgv::media::video::abst_video_reader::get_last_error(), and rd.
|
virtual |
return a semicolon separated list of property declarations of the form "name:type", by default an empty list is returned
Reimplemented from cgv::base::base.
Definition at line 176 of file video_reader.cxx.
References cgv::base::base::get_property_declarations(), and rd.
|
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
Definition at line 60 of file video_reader.cxx.
References cgv::utils::replace().
Referenced by construct_filter_string(), and open().
|
virtual |
overload to return the type name of this object
Reimplemented from cgv::base::base.
Definition at line 169 of file video_reader.cxx.
References cgv::base::base::get_type_name(), and rd.
|
protectedvirtual |
abstract interface for the getter, by default it simply returns false
Reimplemented from cgv::base::base.
Definition at line 191 of file video_reader.cxx.
References cgv::base::base::get_void(), and rd.
open the file and read the video header in order to determine the image format
Definition at line 96 of file video_reader.cxx.
References close(), fps, get_supported_extensions(), image_format_ptr, cgv::utils::is_element(), last_error, cgv::media::video::abst_video_reader::open(), rd, and cgv::utils::to_lower().
bool cgv::media::video::video_reader::read_frame | ( | cgv::data::data_view & | dv | ) |
read the next frame to the given data view, if this is empty recreate it with a newly allocated data pointer, which is owned by the view afterwards.
This method returns false if an error occurs or if there are no more frames in the file.
Definition at line 133 of file video_reader.cxx.
References cgv::data::data_view_impl< D, P >::empty(), image_format_ptr, last_error, rd, and cgv::media::video::abst_video_reader::read_frame().
bool cgv::media::video::video_reader::read_frame | ( | const cgv::data::data_view & | dv | ) |
same as other read_frame version, but the data_view must point to allocated data of the correct format.
Definition at line 148 of file video_reader.cxx.
References last_error, rd, and cgv::media::video::abst_video_reader::read_frame().
|
protectedvirtual |
abstract interface for the setter, by default it simply returns false
Reimplemented from cgv::base::base.
Definition at line 184 of file video_reader.cxx.
References rd, and cgv::base::base::set_void().
|
protected |
store the fps of the opened video file
Definition at line 44 of file video_reader.h.
Referenced by get_fps(), open(), and video_reader().
|
protected |
store the image format
Definition at line 40 of file video_reader.h.
Referenced by get_image_format(), open(), and read_frame().
|
protected |
store the last error not resulting from video writer implementations
Definition at line 46 of file video_reader.h.
Referenced by close(), open(), read_frame(), and read_frame().
|
protected |
store a pointer to the chosen reader
Definition at line 42 of file video_reader.h.
Referenced by close(), get_last_error(), get_property_declarations(), get_type_name(), get_void(), open(), read_frame(), read_frame(), and set_void().