aboutsummaryrefslogtreecommitdiff
path: root/Gem/develop/include/Gem/plugins
diff options
context:
space:
mode:
authorTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2017-12-06 23:47:39 +0000
committerTravis CI <zmoelnig@travis-ci.umlaeute.mur.at>2017-12-06 23:47:39 +0000
commitc886922cc0b8c32ead0459b581f51ff60fdebbd4 (patch)
tree98c9b3036116ebfefde32c8c278639b767e2d305 /Gem/develop/include/Gem/plugins
parentff954ec3b2de3f0bce8aee70680469468896df7d (diff)
Gem 427a3d0e61d61e64e76facfa905c120356383bab osx/x86_64
built 'master:427a3d0e61d61e64e76facfa905c120356383bab' for osx/x86_64
Diffstat (limited to 'Gem/develop/include/Gem/plugins')
-rw-r--r--Gem/develop/include/Gem/plugins/PluginFactory.h172
-rw-r--r--Gem/develop/include/Gem/plugins/PluginFactoryTimple.h84
-rw-r--r--Gem/develop/include/Gem/plugins/film.h26
-rw-r--r--Gem/develop/include/Gem/plugins/imageloader.h66
-rw-r--r--Gem/develop/include/Gem/plugins/imagesaver.h166
-rw-r--r--Gem/develop/include/Gem/plugins/record.h14
-rw-r--r--Gem/develop/include/Gem/plugins/video.h349
7 files changed, 458 insertions, 419 deletions
diff --git a/Gem/develop/include/Gem/plugins/PluginFactory.h b/Gem/develop/include/Gem/plugins/PluginFactory.h
index 73057e7..90c5a0f 100644
--- a/Gem/develop/include/Gem/plugins/PluginFactory.h
+++ b/Gem/develop/include/Gem/plugins/PluginFactory.h
@@ -11,90 +11,94 @@
#include <typeinfo>
#include <iostream>
-namespace gem {
-
- class GEM_EXTERN BasePluginFactory {
- protected:
- int doLoadPlugins(const std::string&basename, const std::string&path);
- BasePluginFactory(void);
- virtual ~BasePluginFactory(void);
-
- std::vector<std::string>get(void);
- void*get(std::string);
- void set(std::string, void*);
-
- private:
- class Pimpl;
- Pimpl*m_pimpl;
- };
-
- template<class Class>
- class GEM_EXPORT PluginFactory : public BasePluginFactory {
- public:
-
- /**
- * constructor function type (without arguments)
- */
- typedef Class*(ctor_t)(void);
-
- /**
- * register a a constructor associated with a given ID
- */
- static void registerClass(std::string id, ctor_t*c);
- /**
- * get an instance of class constructed by the constructor associated with the given ID
- */
- static Class*getInstance(std::string id);
-
- /**
- * get a list of all IDs currently registered with this factory
- */
- static std::vector<std::string>getIDs(void);
-
- /**
- * load more plugins
- */
- static int loadPlugins(std::string basename, std::string path=std::string(""));
-
- private:
- static PluginFactory<Class>*s_factory;
- public:
- static PluginFactory<Class>*getPluginFactory(void);
-
- private:
- void doRegisterClass(std::string id, ctor_t*c);
- Class*doGetInstance(std::string id);
- std::vector<std::string>doGetIDs(void);
- };
-
-
- namespace PluginFactoryRegistrar {
- /**
- * creates a new ChildClass and returns it as a (pointer to) an instance of BaseClass
- */
- template<class ChildClass, class BaseClass>
- static BaseClass* allocator(void);
-
- /**
- * registers a ChildClass with a certain ID in the BaseClass factory
- *
- * example:
- * static gem::PluginFactoryRegistrar<Child, Base, std::string > basefac_childreg("childID"); // register Child as 'childID'
- * Base*instance=gem::PluginFactory<Base>::getInstance("childID"); // returns an instance of Child
- */
- template<class ChildClass, class BaseClass>
- struct registrar {
- registrar(std::string ID);
- };
-
- /**
- * registers a dummy constructor with a default ID
- */
- template<class BaseClass>
- struct dummy {
- dummy(void);
- };
- };
+namespace gem
+{
+
+class GEM_EXTERN BasePluginFactory
+{
+protected:
+ int doLoadPlugins(const std::string&basename, const std::string&path);
+ BasePluginFactory(void);
+ virtual ~BasePluginFactory(void);
+
+ std::vector<std::string>get(void);
+ void*get(std::string);
+ void set(std::string, void*);
+
+private:
+ class Pimpl;
+ Pimpl*m_pimpl;
+};
+
+template<class Class>
+class GEM_EXPORT PluginFactory : public BasePluginFactory
+{
+public:
+
+ /**
+ * constructor function type (without arguments)
+ */
+ typedef Class*(ctor_t)(void);
+
+ /**
+ * register a a constructor associated with a given ID
+ */
+ static void registerClass(std::string id, ctor_t*c);
+ /**
+ * get an instance of class constructed by the constructor associated with the given ID
+ */
+ static Class*getInstance(std::string id);
+
+ /**
+ * get a list of all IDs currently registered with this factory
+ */
+ static std::vector<std::string>getIDs(void);
+
+ /**
+ * load more plugins
+ */
+ static int loadPlugins(std::string basename, std::string path=std::string(""));
+
+private:
+ static PluginFactory<Class>*s_factory;
+public:
+ static PluginFactory<Class>*getPluginFactory(void);
+
+private:
+ void doRegisterClass(std::string id, ctor_t*c);
+ Class*doGetInstance(std::string id);
+ std::vector<std::string>doGetIDs(void);
+};
+
+
+namespace PluginFactoryRegistrar
+{
+/**
+ * creates a new ChildClass and returns it as a (pointer to) an instance of BaseClass
+ */
+template<class ChildClass, class BaseClass>
+static BaseClass* allocator(void);
+
+/**
+ * registers a ChildClass with a certain ID in the BaseClass factory
+ *
+ * example:
+ * static gem::PluginFactoryRegistrar<Child, Base, std::string > basefac_childreg("childID"); // register Child as 'childID'
+ * Base*instance=gem::PluginFactory<Base>::getInstance("childID"); // returns an instance of Child
+ */
+template<class ChildClass, class BaseClass>
+struct registrar {
+ registrar(std::string ID);
+};
+
+/**
+ * registers a dummy constructor with a default ID
+ */
+template<class BaseClass>
+struct dummy {
+ dummy(void);
+};
+};
/* include the actual implementation */
#include "PluginFactoryTimple.h"
diff --git a/Gem/develop/include/Gem/plugins/PluginFactoryTimple.h b/Gem/develop/include/Gem/plugins/PluginFactoryTimple.h
index 700d0a2..a07af99 100644
--- a/Gem/develop/include/Gem/plugins/PluginFactoryTimple.h
+++ b/Gem/develop/include/Gem/plugins/PluginFactoryTimple.h
@@ -3,7 +3,7 @@
LOG
GEM - Graphics Environment for Multimedia
- - template implementation for PluginFactory
+ - template implementation for PluginFactory
Copyright (c) 2010-2011 IOhannes m zmölnig. forum::für::umläute. IEM. zmoelnig@iem.at
For information on usage and redistribution, and for a DISCLAIMER OF ALL
@@ -45,35 +45,40 @@ LOG
/* Implementation of PluginFactory<Class> */
template<class Class>
- PluginFactory<Class>* PluginFactory<Class>::s_factory=NULL;
+PluginFactory<Class>* PluginFactory<Class>::s_factory=NULL;
template<class Class>
- PluginFactory<Class>* PluginFactory<Class>::getPluginFactory(void) {
+PluginFactory<Class>* PluginFactory<Class>::getPluginFactory(void)
+{
if(NULL==s_factory) {
s_factory=new PluginFactory<Class>;
}
#if GEM_PLUGFAC_DEBUG
- std::cerr << "factory @ " << (void*)s_factory << " --> " << typeid(s_factory).name() << std::endl;
+ std::cerr << "factory @ " << (void*)s_factory << " --> " << typeid(s_factory).name() << std::endl;
#endif /* GEM_PLUGFAC_DEBUG */
return s_factory;
}
template<class Class>
- void PluginFactory<Class>::doRegisterClass(std::string id, ctor_t*c) {
+void PluginFactory<Class>::doRegisterClass(std::string id, ctor_t*c)
+{
set(id, (void*)c);
}
template<class Class>
- Class*PluginFactory<Class>::doGetInstance(std::string id) {
+Class*PluginFactory<Class>::doGetInstance(std::string id)
+{
ctor_t*ctor=(ctor_t*)get(id);
- if(ctor)
+ if(ctor) {
return ctor();
- else
+ } else {
return NULL;
+ }
}
template<class Class>
-void PluginFactory<Class>::registerClass(std::string id, ctor_t*c) {
+void PluginFactory<Class>::registerClass(std::string id, ctor_t*c)
+{
PluginFactory<Class>*fac=getPluginFactory();
if(NULL==fac) {
std::cerr << "unable to get a factory!" << std::endl;
@@ -85,7 +90,8 @@ void PluginFactory<Class>::registerClass(std::string id, ctor_t*c) {
}
template<class Class>
-Class*PluginFactory<Class>::getInstance(std::string id) {
+Class*PluginFactory<Class>::getInstance(std::string id)
+{
PluginFactory<Class>*fac=getPluginFactory();
#if GEM_PLUGFAC_DEBUG
std::cerr << "getting " << typeid(Class).name() << " instance '" << id << "' from factory: " << (void*)fac << std::endl;
@@ -97,7 +103,8 @@ Class*PluginFactory<Class>::getInstance(std::string id) {
}
template<class Class>
- int PluginFactory<Class>::loadPlugins(std::string basename, std::string path) {
+int PluginFactory<Class>::loadPlugins(std::string basename, std::string path)
+{
PluginFactory<Class>*fac=getPluginFactory();
#if GEM_PLUGFAC_DEBUG
std::cerr << "loading " << typeid(Class).name() << " plugins from factory: " << (void*)fac << std::endl;
@@ -109,12 +116,14 @@ template<class Class>
}
template<class Class>
- std::vector<std::string>PluginFactory<Class>::doGetIDs() {
+std::vector<std::string>PluginFactory<Class>::doGetIDs()
+{
return get();
}
template<class Class>
- std::vector<std::string>PluginFactory<Class>::getIDs() {
+std::vector<std::string>PluginFactory<Class>::getIDs()
+{
std::vector<std::string>result;
PluginFactory<Class>*fac=getPluginFactory();
if(fac) {
@@ -128,30 +137,33 @@ template<class Class>
/* ********************************************************************* */
/* Implementation of PluginFactoryRegistrar<ChildClass, BaseClass> */
-namespace PluginFactoryRegistrar {
- template<class ChildClass, class BaseClass>
- BaseClass* allocator() {
- ChildClass* res0 = new ChildClass();
- BaseClass* res1 = dynamic_cast<BaseClass*>(res0);
- if(NULL==res1) {
- /* if ChildClass is derived from BaseClass and we successfully allocated an object,
- * this code cannot never be reached;
- * the compiler can check this during template expansion, be we don't */
- /* coverity[dead_error_line] FIXXME stackoverflow:23489764 */
- delete res0;
- }
- return res1;
+namespace PluginFactoryRegistrar
+{
+template<class ChildClass, class BaseClass>
+BaseClass* allocator()
+{
+ ChildClass* res0 = new ChildClass();
+ BaseClass* res1 = dynamic_cast<BaseClass*>(res0);
+ if(NULL==res1) {
+ /* if ChildClass is derived from BaseClass and we successfully allocated an object,
+ * this code cannot never be reached;
+ * the compiler can check this during template expansion, be we don't */
+ /* coverity[dead_error_line] FIXXME stackoverflow:23489764 */
+ delete res0;
}
+ return res1;
+}
- template<class ChildClass, class BaseClass>
- registrar<ChildClass, BaseClass> :: registrar(std::string id) {
- PluginFactory<BaseClass>::registerClass(id, allocator<ChildClass, BaseClass>);
- }
- template<class BaseClass>
- dummy<BaseClass> :: dummy() {
- std::string id; // default ID
- PluginFactory<BaseClass>::registerClass(id, NULL);
- }
+template<class ChildClass, class BaseClass>
+registrar<ChildClass, BaseClass> :: registrar(std::string id)
+{
+ PluginFactory<BaseClass>::registerClass(id, allocator<ChildClass, BaseClass>);
+}
+template<class BaseClass>
+dummy<BaseClass> :: dummy()
+{
+ std::string id; // default ID
+ PluginFactory<BaseClass>::registerClass(id, NULL);
+}
};
-
diff --git a/Gem/develop/include/Gem/plugins/film.h b/Gem/develop/include/Gem/plugins/film.h
index 14f39ec..9e89726 100644
--- a/Gem/develop/include/Gem/plugins/film.h
+++ b/Gem/develop/include/Gem/plugins/film.h
@@ -35,13 +35,17 @@ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
struct pixBlock;
-namespace gem {
- class Properties;
+namespace gem
+{
+class Properties;
}
-namespace gem { namespace plugins {
+namespace gem
+{
+namespace plugins
+{
class GEM_EXTERN film
{
- public:
+public:
//////////
// returns an instance wrapping all plugins or NULL
@@ -81,12 +85,13 @@ class GEM_EXTERN film
*/
/* returns TRUE if loading was successful, FALSE otherwise */
virtual bool open(const std::string&,
- const gem::Properties&requestprops) = 0;
+ const gem::Properties&requestprops) = 0;
/* some error codes */
enum errCode { SUCCESS = 0,
- FAILURE = 1,
- DONTKNOW= 2 };
+ FAILURE = 1,
+ DONTKNOW= 2
+ };
//////////
// Change which image to display
@@ -132,7 +137,7 @@ class GEM_EXTERN film
*/
virtual bool enumProperties(gem::Properties&readable,
- gem::Properties&writeable) = 0;
+ gem::Properties&writeable) = 0;
/**
* set a number of properties (as defined by "props")
@@ -158,7 +163,8 @@ class GEM_EXTERN film
virtual void getProperties(gem::Properties&props) = 0;
};
-};}; // namespace gem::plugins
+};
+}; // namespace gem::plugins
/**
@@ -170,4 +176,4 @@ class GEM_EXTERN film
*/
#define REGISTER_FILMFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::film> fac_film_ ## TYP (id)
-#endif // for header file
+#endif // for header file
diff --git a/Gem/develop/include/Gem/plugins/imageloader.h b/Gem/develop/include/Gem/plugins/imageloader.h
index 9fe904d..22bc5a7 100644
--- a/Gem/develop/include/Gem/plugins/imageloader.h
+++ b/Gem/develop/include/Gem/plugins/imageloader.h
@@ -31,36 +31,40 @@ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
DESCRIPTION
-----------------------------------------------------------------*/
-namespace gem { namespace plugins {
- class GEM_EXTERN imageloader
- {
- public:
-
- //////////
- // returns an instance wrapping all plugins or NULL
- // if NULL is returned, you might still try your luck with manually accessing the
- // PluginFactory
- static imageloader*getInstance(void);
-
- ////////
- // dtor must be virtual
- virtual ~imageloader(void);
-
- /* read a image
- *
- * props can be filled by the loader with additional information on the image
- * e.g. EXIF tags,...
- */
- /* returns TRUE if loading was successful, FALSE otherwise */
- virtual bool load(std::string filename,
- imageStruct&result,
- gem::Properties&props) = 0;
-
- /* returns TRUE if this object can be used from within a thread */
- virtual bool isThreadable(void) = 0;
- };
-
- };}; // namespace gem
+namespace gem
+{
+namespace plugins
+{
+class GEM_EXTERN imageloader
+{
+public:
+
+ //////////
+ // returns an instance wrapping all plugins or NULL
+ // if NULL is returned, you might still try your luck with manually accessing the
+ // PluginFactory
+ static imageloader*getInstance(void);
+
+ ////////
+ // dtor must be virtual
+ virtual ~imageloader(void);
+
+ /* read a image
+ *
+ * props can be filled by the loader with additional information on the image
+ * e.g. EXIF tags,...
+ */
+ /* returns TRUE if loading was successful, FALSE otherwise */
+ virtual bool load(std::string filename,
+ imageStruct&result,
+ gem::Properties&props) = 0;
+
+ /* returns TRUE if this object can be used from within a thread */
+ virtual bool isThreadable(void) = 0;
+};
+
+};
+}; // namespace gem
/**
@@ -72,4 +76,4 @@ namespace gem { namespace plugins {
*/
#define REGISTER_IMAGELOADERFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::imageloader> fac_imageloader_ ## TYP (id)
-#endif // for header file
+#endif // for header file
diff --git a/Gem/develop/include/Gem/plugins/imagesaver.h b/Gem/develop/include/Gem/plugins/imagesaver.h
index e883669..3b36911 100644
--- a/Gem/develop/include/Gem/plugins/imagesaver.h
+++ b/Gem/develop/include/Gem/plugins/imagesaver.h
@@ -32,86 +32,90 @@ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
DESCRIPTION
-----------------------------------------------------------------*/
-namespace gem { namespace plugins {
- class GEM_EXTERN imagesaver
- {
- public:
-
- //////////
- // returns an instance wrapping all plugins or NULL
- // if NULL is returned, you might still try your luck with manually accessing the
- // PluginFactory
- static imagesaver*getInstance(void);
-
- ////////
- // dtor must be virtual
- virtual ~imagesaver(void);
-
- /* save the image 'img' under the filename 'filename', respecting as many 'props' as possible
- *
- * returns TRUE if saving was successful, FALSE otherwise */
- virtual bool save(const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) = 0;
-
- /* estimate how 'well' we could save the 'img'
- * this is used to rate the different backends for a given image
- *
- * e.g. if the user requests saving of an image as <filename>, virtually all backends will have a way to to as requested
- * however, if filename was "bla.jpg", a TIFF-backend might save as a TIFF-image with a .jpg extension,
- * which is probably not what the user expected (esp. if there _is_ a JPEG-backend, which for whatever reasons
- * would only have been called after the TIFF-backend)
- *
- * the solution is quite simple: each backend is first asked, how well it could save a given image according to properties
- * the backend that returns the highest value, will be chosen first; if it fails to save the image
- * (returning FALSE in the save() function), the backend with the next higher rating will be chosen and so on
- *
- *
- * mimetype and properties are the main factors for rating;
- * 'mimetype' (string): mimetype of the image; e.g. 'image/jpeg' means 'write the image as JPEG'
- * if not empty, the mimetype will override all other ways to set the output format (like filename)
- * even though we only expect mimetypes of type 'image/*', the prefix ('image/') is mandatory
- * a predefined properties (for legacy reasons) is:
- * 'quality' (float) : for lossy formats, this is the quality (in percent)
- *
- * expected return values:
- * <=0: 'USE ME IF YOU MUST (but rather not)'
- * 0 is returned, if the backend expects to be able to save the given image under the given
- * filename to disk, but it will ignore all properties (including the mimetype!) and will
- * ignore all file extensions
- * it is hoped that '0' is never the winner (for any feasible format)
- * example: saves a TIFF-image as /tmp/foo.doc
- * 100: 'YES'
- * 100 is returned, if the plugin knows how to handle the given 'mimetype' property
- * if 'mimetype' is empty and the plugin has performed an heuristic based on the filename
- * to determine that the user wants a format that is provided by this very plugin, it can return 100 as well.
- * however, if 'mimetype' and file extension contradict each other, 'mimetype' wins!
- * 100+: 'YES, ABSOLUTELY'
- * every additional property that can be applied, gains an extra point
- * example: both the JPG and the JPEG2K backend provide saving of jpegs, but only JPG can set the quality
- * the user requests: filename=img.jpg,mimetype='image/jpeg',quality=20
- * JPG returns 101, whereas JPEG2K returns 100, so JPG wins and writes
- * 0..50: the backend knows how to handle some of the properties (but it has no clue about the output format requested
- * example: filename=img.tif,mimetype='image/tiff',quality=20
- * JPG knows how to handle the 'quality' property, but not the 'mimetype', so it scores 1 point
- * TIFF knows how to handle the 'mimetype' but not the 'quality', so it scores 100 points
- */
- virtual float estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) = 0;
-
- /**
- * get writing capabilities of this backend (informative)
- *
- * list all (known) mimetypes and properties this backend supports for writing
- * both can be empty, if they are not known when requested
- * if only some properties/mimetypes are explicitly known (but it is likely that more are supported),
- * it is generally better, to list the few rather than nothing
- */
- virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) = 0;
-
- /* returns TRUE, if it is save to use this backend from multiple threads
- */
- virtual bool isThreadable(void) = 0;
- };
-
- }; }; // namespace gem
+namespace gem
+{
+namespace plugins
+{
+class GEM_EXTERN imagesaver
+{
+public:
+
+ //////////
+ // returns an instance wrapping all plugins or NULL
+ // if NULL is returned, you might still try your luck with manually accessing the
+ // PluginFactory
+ static imagesaver*getInstance(void);
+
+ ////////
+ // dtor must be virtual
+ virtual ~imagesaver(void);
+
+ /* save the image 'img' under the filename 'filename', respecting as many 'props' as possible
+ *
+ * returns TRUE if saving was successful, FALSE otherwise */
+ virtual bool save(const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) = 0;
+
+ /* estimate how 'well' we could save the 'img'
+ * this is used to rate the different backends for a given image
+ *
+ * e.g. if the user requests saving of an image as <filename>, virtually all backends will have a way to to as requested
+ * however, if filename was "bla.jpg", a TIFF-backend might save as a TIFF-image with a .jpg extension,
+ * which is probably not what the user expected (esp. if there _is_ a JPEG-backend, which for whatever reasons
+ * would only have been called after the TIFF-backend)
+ *
+ * the solution is quite simple: each backend is first asked, how well it could save a given image according to properties
+ * the backend that returns the highest value, will be chosen first; if it fails to save the image
+ * (returning FALSE in the save() function), the backend with the next higher rating will be chosen and so on
+ *
+ *
+ * mimetype and properties are the main factors for rating;
+ * 'mimetype' (string): mimetype of the image; e.g. 'image/jpeg' means 'write the image as JPEG'
+ * if not empty, the mimetype will override all other ways to set the output format (like filename)
+ * even though we only expect mimetypes of type 'image/*', the prefix ('image/') is mandatory
+ * a predefined properties (for legacy reasons) is:
+ * 'quality' (float) : for lossy formats, this is the quality (in percent)
+ *
+ * expected return values:
+ * <=0: 'USE ME IF YOU MUST (but rather not)'
+ * 0 is returned, if the backend expects to be able to save the given image under the given
+ * filename to disk, but it will ignore all properties (including the mimetype!) and will
+ * ignore all file extensions
+ * it is hoped that '0' is never the winner (for any feasible format)
+ * example: saves a TIFF-image as /tmp/foo.doc
+ * 100: 'YES'
+ * 100 is returned, if the plugin knows how to handle the given 'mimetype' property
+ * if 'mimetype' is empty and the plugin has performed an heuristic based on the filename
+ * to determine that the user wants a format that is provided by this very plugin, it can return 100 as well.
+ * however, if 'mimetype' and file extension contradict each other, 'mimetype' wins!
+ * 100+: 'YES, ABSOLUTELY'
+ * every additional property that can be applied, gains an extra point
+ * example: both the JPG and the JPEG2K backend provide saving of jpegs, but only JPG can set the quality
+ * the user requests: filename=img.jpg,mimetype='image/jpeg',quality=20
+ * JPG returns 101, whereas JPEG2K returns 100, so JPG wins and writes
+ * 0..50: the backend knows how to handle some of the properties (but it has no clue about the output format requested
+ * example: filename=img.tif,mimetype='image/tiff',quality=20
+ * JPG knows how to handle the 'quality' property, but not the 'mimetype', so it scores 1 point
+ * TIFF knows how to handle the 'mimetype' but not the 'quality', so it scores 100 points
+ */
+ virtual float estimateSave( const imageStruct&img, const std::string&filename, const std::string&mimetype, const gem::Properties&props) = 0;
+
+ /**
+ * get writing capabilities of this backend (informative)
+ *
+ * list all (known) mimetypes and properties this backend supports for writing
+ * both can be empty, if they are not known when requested
+ * if only some properties/mimetypes are explicitly known (but it is likely that more are supported),
+ * it is generally better, to list the few rather than nothing
+ */
+ virtual void getWriteCapabilities(std::vector<std::string>&mimetypes, gem::Properties&props) = 0;
+
+ /* returns TRUE, if it is save to use this backend from multiple threads
+ */
+ virtual bool isThreadable(void) = 0;
+};
+
+};
+}; // namespace gem
/**
@@ -123,4 +127,4 @@ namespace gem { namespace plugins {
*/
#define REGISTER_IMAGESAVERFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::imagesaver> fac_imagesaver_ ## TYP (id)
-#endif // for header file
+#endif // for header file
diff --git a/Gem/develop/include/Gem/plugins/record.h b/Gem/develop/include/Gem/plugins/record.h
index ed0113c..99a1c2c 100644
--- a/Gem/develop/include/Gem/plugins/record.h
+++ b/Gem/develop/include/Gem/plugins/record.h
@@ -32,8 +32,11 @@ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
DESCRIPTION
-----------------------------------------------------------------*/
-namespace gem { namespace plugins {
- class GEM_EXTERN record
+namespace gem
+{
+namespace plugins
+{
+class GEM_EXTERN record
{
public:
@@ -86,8 +89,9 @@ public:
// stop recording
virtual void stop (void) = 0;
- };
-}; };
+};
+};
+};
@@ -105,4 +109,4 @@ public:
*/
#define REGISTER_RECORDFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::record> fac_record_ ## TYP (id)
-#endif // for header file
+#endif // for header file
diff --git a/Gem/develop/include/Gem/plugins/video.h b/Gem/develop/include/Gem/plugins/video.h
index a949c86..0b18925 100644
--- a/Gem/develop/include/Gem/plugins/video.h
+++ b/Gem/develop/include/Gem/plugins/video.h
@@ -29,177 +29,182 @@ WARRANTIES, see the file, "GEM.LICENSE.TERMS" in this distribution.
-----------------------------------------------------------------*/
struct pixBlock;
-namespace gem { namespace plugins {
- class GEM_EXTERN video {
- public:
-
- //////////
- // returns an instance wrapping all plugins or NULL
- // if NULL is returned, you might still try your luck with manually accessing the
- // PluginFactory
- static video*getInstance(void);
-
- ////////
- // dtor must be virtual
- virtual ~video(void);
-
- //////////////////////
- // device settings
-
- /**
- * enumerate known devices
- * \return a list of device names (if they can be enumerated)
- */
- virtual std::vector<std::string>enumerate(void) = 0;
-
- /**
- * set the device to be opened next time
- * the ID provided should match an index in the list returned by enumerate()
- * after the device has been set, the caller(!) has to restart
- * (close() the current handle, try open() with the new settings)
- * the default implementation (which you normally shouldn't need to override)
- * will simply set m_devicenum and clear m_devicename
- */
- virtual bool setDevice(int ID) = 0;
-
- /**
- * set the device to be opened next time
- * the list returned by enumerate() provides a set of valid names to use here
- * depending on the backend, other names might be possible as well (e.g. IP-cameras)
- * after the device has been set, the caller(!) has to restart
- * (close() the current handle, try open() with the new settings)
- * the default implementation (which you normally shouldn't need to override)
- * will simply set m_devicename and clear m_devicenum
- */
- virtual bool setDevice(const std::string&) = 0;
-
-
- //! open the device (calls openDevice())
- virtual bool open(gem::Properties&props) = 0;
- //! start the transmission (calls startTransfer())
- virtual bool start(void) = 0;
-
- /**
- * get the next frame (called when rendering)
- * grab the next frame from the device
- * if no new frame is available, this should set the "newimage" flag to false
- * \return the new frame or NULL on error
- */
- virtual pixBlock *getFrame(void) = 0;
-
- /**
- * release a frame (after use)
- * this gets called once for each frame retrieved via getFrame()
- * if you are using DMA or the like, now is the time to release the resource
- */
- virtual void releaseFrame(void) = 0;
-
-
- //! stop the transmission (calls stopTransfer())
- virtual bool stop(void) = 0;
- //! close the device (calls closeDevice())
- virtual void close(void) = 0;
-
- /**
- * reset the backend, possibly re-enumerating devices
- * returns TRUE if reset was successful
- */
- virtual bool reset(void) = 0;
-
-
- /**
- * list all properties the currently opened device supports
- * after calling, "readable" will hold a list of all properties that can be read
- * and "writeable" will hold a list of all properties that can be set
- * if the enumeration fails, this returns <code>false</code>
- *
- * the backend has to provide the names for the properties
- * these are defined by default, and need not be enumerated!
- * "width" "dimen" message (float)
- * "height" "dimen" message (float)
- * "leftmargin" ("dimen" message) (float)
- * "rightmargin" ("dimen" message) (float)
- * "toptmargin" ("dimen" message) (float)
- * "bottommargin" ("dimen" message) (float)
- * "channel" "channel" message (float)
- * "frequency" "channel" message (float)
- * "norm" "norm" message (string)
- * "quality" "quality" message (float)
- */
- virtual bool enumProperties(gem::Properties&readable,
- gem::Properties&writeable) = 0;
-
- /**
- * set a number of properties (as defined by "props")
- * the "props" may hold properties not supported by the currently opened device,
- * which is legal; in this case the superfluous properties are simply ignored
- * this function MAY modify the props;
- * namely one-shot properties (e.g. "do-white-balance-now")
- * should be removed from the props
- */
- virtual void setProperties(gem::Properties&props) = 0;
-
- /**
- * get the current value of the given properties from the device
- * if props holds properties that can not be read from the device, they are set to UNSET
- */
- virtual void getProperties(gem::Properties&props) = 0;
-
-
- /**
- * call a system-specific configuration dialog
- * if your system provides a GUI for configuring the device, here is the time to open it
- * of several dialogs are available (for different properties), the user can specify which one
- * they want with the string list
- * if the list is empty, provide sane defaults (e.g. ALL dialogs)
- * if the system does not support dialogs, return FALSE
- * if the system does support dialogs and the user has specified which one they want,
- * return TRUE if at least one dialog could be handled
- */
- virtual bool dialog(std::vector<std::string>names=std::vector<std::string>()) = 0;
- /**
- * enumerate list of possible dialogs (if any)
- */
- virtual std::vector<std::string>dialogs(void) = 0;
-
-
-
- /**
- * returns TRUE if the object can be used in a thread or FALSE otherwise
- * if a backend implements threading itself, it should return FALSE
- * in order to prevent double threading
- */
- virtual bool isThreadable(void) = 0;
-
-
- /** turn on/off "asynchronous"-grabbing
- * default is "true"
- * "asynchronous" means, that the device is constantly grabbing, and grabFrame() returns the current frame
- * non-"asynchronous" means, that the device will only issue a new grab when a frame has read
- * (thus potentially reducing the CPU-load to what is needed, at the cost of slightly outdated images
- * returns: the old state
- */
- virtual bool grabAsynchronous(bool) = 0;
-
- /**
- * Set the preferred colorspace (of the frames returned by getFrame()
- * \return FALSE if the colorspace cannot be set (e.g. while grabbing is active)
- */
- virtual bool setColor(int) = 0;
-
-
- // meta information about the plugin
-
- // for pix_video: query whether this backend provides access to this class of devices
- // (e.g. "dv")
- virtual bool provides(const std::string&) = 0;
- // get a list of all provided devices
- virtual std::vector<std::string>provides(void) = 0;
-
- // get's the name of the backend (e.g. "v4l")
- virtual const std::string getName(void) = 0;
- };
- };}; // namespace
+namespace gem
+{
+namespace plugins
+{
+class GEM_EXTERN video
+{
+public:
+
+ //////////
+ // returns an instance wrapping all plugins or NULL
+ // if NULL is returned, you might still try your luck with manually accessing the
+ // PluginFactory
+ static video*getInstance(void);
+
+ ////////
+ // dtor must be virtual
+ virtual ~video(void);
+
+ //////////////////////
+ // device settings
+
+ /**
+ * enumerate known devices
+ * \return a list of device names (if they can be enumerated)
+ */
+ virtual std::vector<std::string>enumerate(void) = 0;
+
+ /**
+ * set the device to be opened next time
+ * the ID provided should match an index in the list returned by enumerate()
+ * after the device has been set, the caller(!) has to restart
+ * (close() the current handle, try open() with the new settings)
+ * the default implementation (which you normally shouldn't need to override)
+ * will simply set m_devicenum and clear m_devicename
+ */
+ virtual bool setDevice(int ID) = 0;
+
+ /**
+ * set the device to be opened next time
+ * the list returned by enumerate() provides a set of valid names to use here
+ * depending on the backend, other names might be possible as well (e.g. IP-cameras)
+ * after the device has been set, the caller(!) has to restart
+ * (close() the current handle, try open() with the new settings)
+ * the default implementation (which you normally shouldn't need to override)
+ * will simply set m_devicename and clear m_devicenum
+ */
+ virtual bool setDevice(const std::string&) = 0;
+
+
+ //! open the device (calls openDevice())
+ virtual bool open(gem::Properties&props) = 0;
+ //! start the transmission (calls startTransfer())
+ virtual bool start(void) = 0;
+
+ /**
+ * get the next frame (called when rendering)
+ * grab the next frame from the device
+ * if no new frame is available, this should set the "newimage" flag to false
+ * \return the new frame or NULL on error
+ */
+ virtual pixBlock *getFrame(void) = 0;
+
+ /**
+ * release a frame (after use)
+ * this gets called once for each frame retrieved via getFrame()
+ * if you are using DMA or the like, now is the time to release the resource
+ */
+ virtual void releaseFrame(void) = 0;
+
+
+ //! stop the transmission (calls stopTransfer())
+ virtual bool stop(void) = 0;
+ //! close the device (calls closeDevice())
+ virtual void close(void) = 0;
+
+ /**
+ * reset the backend, possibly re-enumerating devices
+ * returns TRUE if reset was successful
+ */
+ virtual bool reset(void) = 0;
+
+
+ /**
+ * list all properties the currently opened device supports
+ * after calling, "readable" will hold a list of all properties that can be read
+ * and "writeable" will hold a list of all properties that can be set
+ * if the enumeration fails, this returns <code>false</code>
+ *
+ * the backend has to provide the names for the properties
+ * these are defined by default, and need not be enumerated!
+ * "width" "dimen" message (float)
+ * "height" "dimen" message (float)
+ * "leftmargin" ("dimen" message) (float)
+ * "rightmargin" ("dimen" message) (float)
+ * "toptmargin" ("dimen" message) (float)
+ * "bottommargin" ("dimen" message) (float)
+ * "channel" "channel" message (float)
+ * "frequency" "channel" message (float)
+ * "norm" "norm" message (string)
+ * "quality" "quality" message (float)
+ */
+ virtual bool enumProperties(gem::Properties&readable,
+ gem::Properties&writeable) = 0;
+
+ /**
+ * set a number of properties (as defined by "props")
+ * the "props" may hold properties not supported by the currently opened device,
+ * which is legal; in this case the superfluous properties are simply ignored
+ * this function MAY modify the props;
+ * namely one-shot properties (e.g. "do-white-balance-now")
+ * should be removed from the props
+ */
+ virtual void setProperties(gem::Properties&props) = 0;
+
+ /**
+ * get the current value of the given properties from the device
+ * if props holds properties that can not be read from the device, they are set to UNSET
+ */
+ virtual void getProperties(gem::Properties&props) = 0;
+
+
+ /**
+ * call a system-specific configuration dialog
+ * if your system provides a GUI for configuring the device, here is the time to open it
+ * of several dialogs are available (for different properties), the user can specify which one
+ * they want with the string list
+ * if the list is empty, provide sane defaults (e.g. ALL dialogs)
+ * if the system does not support dialogs, return FALSE
+ * if the system does support dialogs and the user has specified which one they want,
+ * return TRUE if at least one dialog could be handled
+ */
+ virtual bool dialog(std::vector<std::string>names=std::vector<std::string>()) = 0;
+ /**
+ * enumerate list of possible dialogs (if any)
+ */
+ virtual std::vector<std::string>dialogs(void) = 0;
+
+
+
+ /**
+ * returns TRUE if the object can be used in a thread or FALSE otherwise
+ * if a backend implements threading itself, it should return FALSE
+ * in order to prevent double threading
+ */
+ virtual bool isThreadable(void) = 0;
+
+
+ /** turn on/off "asynchronous"-grabbing
+ * default is "true"
+ * "asynchronous" means, that the device is constantly grabbing, and grabFrame() returns the current frame
+ * non-"asynchronous" means, that the device will only issue a new grab when a frame has read
+ * (thus potentially reducing the CPU-load to what is needed, at the cost of slightly outdated images
+ * returns: the old state
+ */
+ virtual bool grabAsynchronous(bool) = 0;
+
+ /**
+ * Set the preferred colorspace (of the frames returned by getFrame()
+ * \return FALSE if the colorspace cannot be set (e.g. while grabbing is active)
+ */
+ virtual bool setColor(int) = 0;
+
+
+ // meta information about the plugin
+
+ // for pix_video: query whether this backend provides access to this class of devices
+ // (e.g. "dv")
+ virtual bool provides(const std::string&) = 0;
+ // get a list of all provided devices
+ virtual std::vector<std::string>provides(void) = 0;
+
+ // get's the name of the backend (e.g. "v4l")
+ virtual const std::string getName(void) = 0;
+};
+};
+}; // namespace
/*
* factory code:
@@ -216,4 +221,4 @@ namespace gem { namespace plugins {
*/
#define REGISTER_VIDEOFACTORY(id, TYP) static gem::PluginFactoryRegistrar::registrar<TYP, gem::plugins::video> fac_video_ ## TYP (id)
-#endif // for header file
+#endif // for header file