[gephex-devel] gephex--main--0.4--patch-1815
gephex at sonnenland.kexbox.org
gephex at sonnenland.kexbox.org
Wed Nov 10 10:04:37 CET 2004
Archive: gephex at gephex.org--2004
New revision: gephex--main--0.4--patch-1815
--
Revision: gephex--main--0.4--patch-1815
Archive: gephex at gephex.org--2004
Creator: GePhex <gephex at gephex.org>
Date: Wed Nov 10 10:04:01 CET 2004
Standard-date: 2004-11-10 09:04:01 GMT
Modified-files: engine/src/dllloader/dllloader.cpp
engine/src/dllloader/frei0r.h
engine/src/dllloader/frei0rwrapper.cpp
modules/src/capturemodule/capturemodule.cpp
New-patches: georg at gephex.org--2004-home/gephex--georg--0.4--patch-352
georg at gephex.org--2004-home/gephex--georg--0.4--patch-353
georg at gephex.org--2004-home/gephex--georg--0.4--patch-354
georg at gephex.org--2004-home/gephex--georg--0.4--patch-355
gephex at gephex.org--2004/gephex--main--0.4--patch-1815
Summary: update frei0r loader
Keywords:
Patches applied:
* georg at gephex.org--2004-home/gephex--georg--0.4--patch-352
Remove some more frei0r related debug messages
* georg at gephex.org--2004-home/gephex--georg--0.4--patch-353
Merge in cahnges made during piksel04
* georg at gephex.org--2004-home/gephex--georg--0.4--patch-354
capturemodule now first uses v4l2 and on failure v4l driver
* georg at gephex.org--2004-home/gephex--georg--0.4--patch-355
update frei0r.h (F0R_PARAM_BOOL)
* added files
{arch}/gephex/gephex--georg/gephex--georg--0.4/georg at gephex.org--2004-home/patch-log/patch-352
{arch}/gephex/gephex--georg/gephex--georg--0.4/georg at gephex.org--2004-home/patch-log/patch-353
{arch}/gephex/gephex--georg/gephex--georg--0.4/georg at gephex.org--2004-home/patch-log/patch-354
{arch}/gephex/gephex--georg/gephex--georg--0.4/georg at gephex.org--2004-home/patch-log/patch-355
{arch}/gephex/gephex--main/gephex--main--0.4/gephex at gephex.org--2004/patch-log/patch-1815
* modified files
--- orig/engine/src/dllloader/dllloader.cpp
+++ mod/engine/src/dllloader/dllloader.cpp
@@ -600,7 +600,6 @@
std::string inSpec;
if (frei0r)
{
- std::cout << "i = " << i << "
";
if (i == 0)
{
inSpec = frei0r_create_in_spec();
@@ -614,8 +613,10 @@
f0r_param_info_t pinfo;
frei0r->get_param_info(&pinfo, i-1);
inSpec = frei0r_create_in_param_spec(pinfo);
+#if (ENGINE_VERBOSITY > 1)
std::cout << "param # " << i-1 << " name '"
<< pinfo.name << "'
";
+#endif
f0r_param_names.push_back(pinfo.name);
}
}
@@ -897,7 +898,9 @@
f0r.get_plugin_info(&inf0r);
std::string name = std::string("mod_") + inf0r.name;
+#if (ENGINE_VERBOSITY > 1)
std::cout << "Nam0r = " << name << "
";
+#endif
f0r.deinit();
--- orig/engine/src/dllloader/frei0r.h
+++ mod/engine/src/dllloader/frei0r.h
@@ -94,22 +94,33 @@
//---------------------------------------------------------------------------
/**
+ * Parameter type for boolean values
+ */
+#define F0R_PARAM_BOOL 0
+
+/**
* Parameter type for doubles
*/
-#define F0R_PARAM_DOUBLE 0
+#define F0R_PARAM_DOUBLE 1
+
/**
* Parameter type for color
*/
-#define F0R_PARAM_COLOR 1
+#define F0R_PARAM_COLOR 2
/**
* Parameter type for position
*/
-#define F0R_PARAM_POSITION 2
+#define F0R_PARAM_POSITION 3
+
+
+/**
+ * The boolean type. The allowed range of values is [0, 1].
+ * [0, 0.5[ is mapped to false and [0.5, 1] is mapped to true.
+ */
+typedef double f0r_param_bool;
/**
* The double type. The allowed range of values is [0, 1].
- * For boolean values, [0, 0.5] is mapped to false and
- * ]0.5, 1] is mapped to false.
*/
typedef double f0r_param_double;
@@ -138,8 +149,6 @@
/**
* Similar to f0r_plugin_info_t, this structure
* is filled by the plugin for every parameter.
- * If the type is F0R_PARAM_DOUBLE and the name ends with a '?',
- * the plugin interprets this parameter as a boolean flag.
*/
typedef struct f0r_param_info
{
@@ -163,7 +172,7 @@
/**
* Constructor for effect instances. The plugin returns a pointer to
- * its internal instance structure. Input resolution has to be
+ * its internal instance structure. The resolution has to be
* a multiple of 8 in both dimension.
* \param width The x-resolution of the processed video frames
* \param height The y-resolution of the processed video frames
@@ -222,4 +231,3 @@
//---------------------------------------------------------------------------
#endif
-
--- orig/engine/src/dllloader/frei0rwrapper.cpp
+++ mod/engine/src/dllloader/frei0rwrapper.cpp
@@ -192,12 +192,16 @@
switch (f0r_pinfo.type)
{
+ case F0R_PARAM_BOOL:
+ os << "typ_NumberType"; break;
case F0R_PARAM_DOUBLE:
os << "typ_NumberType"; break;
case F0R_PARAM_COLOR:
os << "typ_RGBType"; break;
case F0R_PARAM_POSITION:
os << "typ_PositionType"; break;
+ default:
+ throw std::runtime_error("Invalid frei0r parameter type");
}
os << " id=[" << f0r_pinfo.name << "] const=true strong_dependency=true } ";
--- orig/modules/src/capturemodule/capturemodule.cpp
+++ mod/modules/src/capturemodule/capturemodule.cpp
@@ -51,7 +51,9 @@
struct device_descriptor
{
- device_descriptor() : drv(0), ref_count(0) {}
+ device_descriptor()
+ : drv(0), dev_num(-1), ref_count(0)
+ {}
~device_descriptor() { delete drv; }
void decrease_refcount()
@@ -78,15 +80,39 @@
if (ref_count == 0)
{
- drv = create_driver();
+ try
+ {
+#if defined(OS_POSIX)
+ drv = new V4L2CaptureDriver();
+ try
+ {
+ drv->open(dev_num);
+ }
+ catch (std::exception& e)
+ {
+ delete drv;
+ drv = new V4LCaptureDriver();
+ }
+#elif defined(OS_WIN32)
+ drv = new DSHOWCaptureDriver();
+#endif
+ if (!drv->is_open())
+ drv->open(dev_num);
+ }
+ catch (...)
+ {
+ delete drv;
+ drv = 0;
+ throw;
+ }
}
-
assert(drv);
++ref_count;
}
CaptureDriver* drv;
+ int dev_num;
int ref_count;
};
@@ -124,13 +150,11 @@
static CaptureDriver* open_device(int device_num)
{
+ s_devices[device_num].dev_num = device_num;
s_devices[device_num].increase_refcount();
CaptureDriver* drv = s_devices[device_num].drv;
- if (!drv->is_open())
- drv->open(device_num);
-
return drv;
}
More information about the gephex-devel
mailing list