mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-14 03:39:57 +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
|
// test the device and get config
|
||||||
DeviceConfigSet confs = Device::manager().config(index);
|
DeviceConfigSet confs = Device::manager().config(index);
|
||||||
// for( DeviceInfoSet::iterator it = confs.begin(); it != confs.end(); it++ ){
|
// 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);
|
// 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();
|
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 << " ! " << (*best).format;
|
||||||
pipeline << ",framerate=" << (*best).fps_numerator << "/" << (*best).fps_denominator;
|
pipeline << ",framerate=" << (*best).fps_numerator << "/" << (*best).fps_denominator;
|
||||||
|
|||||||
@@ -118,6 +118,11 @@ void SessionCreator::loadSession(XMLElement *sessionNode)
|
|||||||
new_pattern_source->accept(*this);
|
new_pattern_source->accept(*this);
|
||||||
session_->addSource(new_pattern_source);
|
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
|
// TODO : create other types of source
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -348,5 +353,11 @@ void SessionCreator::visit (PatternSource& s)
|
|||||||
s.setPattern(p, resolution);
|
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 (MediaSource& s) override;
|
||||||
void visit (SessionSource& s) override;
|
void visit (SessionSource& s) override;
|
||||||
void visit (PatternSource& s) override;
|
void visit (PatternSource& s) override;
|
||||||
|
void visit (DeviceSource& s) override;
|
||||||
|
|
||||||
static std::string info(const std::string& filename);
|
static std::string info(const std::string& filename);
|
||||||
static void XMLToNode(tinyxml2::XMLElement *xml, Node &n);
|
static void XMLToNode(tinyxml2::XMLElement *xml, Node &n);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@
|
|||||||
#include "MediaSource.h"
|
#include "MediaSource.h"
|
||||||
#include "SessionSource.h"
|
#include "SessionSource.h"
|
||||||
#include "PatternSource.h"
|
#include "PatternSource.h"
|
||||||
|
#include "DeviceSource.h"
|
||||||
#include "ImageShader.h"
|
#include "ImageShader.h"
|
||||||
#include "ImageProcessingShader.h"
|
#include "ImageProcessingShader.h"
|
||||||
#include "MediaPlayer.h"
|
#include "MediaPlayer.h"
|
||||||
@@ -390,3 +391,9 @@ void SessionVisitor::visit (PatternSource& s)
|
|||||||
resolution->InsertEndChild( XMLElementFromGLM(xmlDoc_, s.pattern()->resolution() ) );
|
resolution->InsertEndChild( XMLElementFromGLM(xmlDoc_, s.pattern()->resolution() ) );
|
||||||
xmlCurrent_->InsertEndChild(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 (RenderSource& s) override;
|
||||||
void visit (CloneSource& s) override;
|
void visit (CloneSource& s) override;
|
||||||
void visit (PatternSource& s) override;
|
void visit (PatternSource& s) override;
|
||||||
|
void visit (DeviceSource& s) override;
|
||||||
|
|
||||||
static tinyxml2::XMLElement *NodeToXML(Node &n, tinyxml2::XMLDocument *doc);
|
static tinyxml2::XMLElement *NodeToXML(Node &n, tinyxml2::XMLDocument *doc);
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user