mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 18:59:59 +01:00
Save & Load Device Source.
This commit is contained in:
@@ -221,10 +221,11 @@ void DeviceSource::setDevice(const std::string &devicename)
|
||||
|
||||
// test the device and get config
|
||||
DeviceConfigSet confs = Device::manager().config(index);
|
||||
// for( DeviceInfoSet::iterator it = confs.begin(); it != confs.end(); it++ ){
|
||||
// Log::Info("config possible : %s %dx%d @ %d fps", (*it).format.c_str(), (*it).width, (*it).height, (*it).fps_numerator);
|
||||
// }
|
||||
// for( DeviceConfigSet::iterator it = confs.begin(); it != confs.end(); it++ ){
|
||||
// Log::Info("config possible : %s %dx%d @ %d fps", (*it).format.c_str(), (*it).width, (*it).height, (*it).fps_numerator);
|
||||
// }
|
||||
DeviceConfigSet::reverse_iterator best = confs.rbegin();
|
||||
Log::Info("Auto select optimal config for '%s': %s %dx%d @ %d fps", device_.c_str(), (*best).format.c_str(), (*best).width, (*best).height, (*best).fps_numerator);
|
||||
|
||||
pipeline << " ! " << (*best).format;
|
||||
pipeline << ",framerate=" << (*best).fps_numerator << "/" << (*best).fps_denominator;
|
||||
|
||||
@@ -118,6 +118,11 @@ void SessionCreator::loadSession(XMLElement *sessionNode)
|
||||
new_pattern_source->accept(*this);
|
||||
session_->addSource(new_pattern_source);
|
||||
}
|
||||
else if ( std::string(pType) == "DeviceSource") {
|
||||
DeviceSource *new_pattern_source = new DeviceSource;
|
||||
new_pattern_source->accept(*this);
|
||||
session_->addSource(new_pattern_source);
|
||||
}
|
||||
// TODO : create other types of source
|
||||
|
||||
}
|
||||
@@ -348,5 +353,11 @@ void SessionCreator::visit (PatternSource& s)
|
||||
s.setPattern(p, resolution);
|
||||
}
|
||||
|
||||
void SessionCreator::visit (DeviceSource& s)
|
||||
{
|
||||
const char *devname = xmlCurrent_->Attribute("device");
|
||||
s.setDevice(devname);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ public:
|
||||
void visit (MediaSource& s) override;
|
||||
void visit (SessionSource& s) override;
|
||||
void visit (PatternSource& s) override;
|
||||
void visit (DeviceSource& s) override;
|
||||
|
||||
static std::string info(const std::string& filename);
|
||||
static void XMLToNode(tinyxml2::XMLElement *xml, Node &n);
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
#include "MediaSource.h"
|
||||
#include "SessionSource.h"
|
||||
#include "PatternSource.h"
|
||||
#include "DeviceSource.h"
|
||||
#include "ImageShader.h"
|
||||
#include "ImageProcessingShader.h"
|
||||
#include "MediaPlayer.h"
|
||||
@@ -390,3 +391,9 @@ void SessionVisitor::visit (PatternSource& s)
|
||||
resolution->InsertEndChild( XMLElementFromGLM(xmlDoc_, s.pattern()->resolution() ) );
|
||||
xmlCurrent_->InsertEndChild(resolution);
|
||||
}
|
||||
|
||||
void SessionVisitor::visit (DeviceSource& s)
|
||||
{
|
||||
xmlCurrent_->SetAttribute("type", "DeviceSource");
|
||||
xmlCurrent_->SetAttribute("device", s.device().c_str() );
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public:
|
||||
void visit (RenderSource& s) override;
|
||||
void visit (CloneSource& s) override;
|
||||
void visit (PatternSource& s) override;
|
||||
void visit (DeviceSource& s) override;
|
||||
|
||||
static tinyxml2::XMLElement *NodeToXML(Node &n, tinyxml2::XMLDocument *doc);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user