mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-11 18:34:58 +01:00
BugFix: PatternSource pattern type is unsigned and undefined when
created
This commit is contained in:
@@ -489,7 +489,7 @@ void ImGuiVisitor::visit (PatternSource& s)
|
|||||||
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
ImGui::SetNextItemWidth(IMGUI_RIGHT_ALIGN);
|
||||||
if (ImGui::BeginCombo("##Patterns", Pattern::pattern_types[s.pattern()->type()].c_str()) )
|
if (ImGui::BeginCombo("##Patterns", Pattern::pattern_types[s.pattern()->type()].c_str()) )
|
||||||
{
|
{
|
||||||
for (int p = 0; p < Pattern::pattern_types.size(); ++p){
|
for (uint p = 0; p < Pattern::pattern_types.size(); ++p){
|
||||||
if (ImGui::Selectable( Pattern::pattern_types[p].c_str() )) {
|
if (ImGui::Selectable( Pattern::pattern_types[p].c_str() )) {
|
||||||
s.setPattern(p, s.pattern()->resolution());
|
s.setPattern(p, s.pattern()->resolution());
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
|
|||||||
@@ -278,7 +278,7 @@ Source * Mixer::createSourceStream(const std::string &gstreamerpipeline)
|
|||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
Source * Mixer::createSourcePattern(int pattern, glm::ivec2 res)
|
Source * Mixer::createSourcePattern(uint pattern, glm::ivec2 res)
|
||||||
{
|
{
|
||||||
// ready to create a source
|
// ready to create a source
|
||||||
PatternSource *s = new PatternSource;
|
PatternSource *s = new PatternSource;
|
||||||
|
|||||||
2
Mixer.h
2
Mixer.h
@@ -40,7 +40,7 @@ public:
|
|||||||
Source * createSourceClone (const std::string &namesource = "");
|
Source * createSourceClone (const std::string &namesource = "");
|
||||||
Source * createSourceRender ();
|
Source * createSourceRender ();
|
||||||
Source * createSourceStream (const std::string &gstreamerpipeline);
|
Source * createSourceStream (const std::string &gstreamerpipeline);
|
||||||
Source * createSourcePattern(int pattern, glm::ivec2 res);
|
Source * createSourcePattern(uint pattern, glm::ivec2 res);
|
||||||
Source * createSourceDevice (const std::string &namedevice);
|
Source * createSourceDevice (const std::string &namedevice);
|
||||||
|
|
||||||
// operations on sources
|
// operations on sources
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#include "Visitor.h"
|
#include "Visitor.h"
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
|
||||||
|
#define MAX_PATTERN 23
|
||||||
|
|
||||||
// smpte (0) – SMPTE 100%% color bars
|
// smpte (0) – SMPTE 100%% color bars
|
||||||
// snow (1) – Random (television snow)
|
// snow (1) – Random (television snow)
|
||||||
// black (2) – 100%% Black
|
// black (2) – 100%% Black
|
||||||
@@ -88,7 +90,7 @@ std::vector<std::string> Pattern::pattern_types = { "Black",
|
|||||||
"Clock"
|
"Clock"
|
||||||
};
|
};
|
||||||
|
|
||||||
Pattern::Pattern() : Stream()
|
Pattern::Pattern() : Stream(), type_(MAX_PATTERN+1) // invalid pattern
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,13 +103,13 @@ glm::ivec2 Pattern::resolution()
|
|||||||
|
|
||||||
void Pattern::open( uint pattern, glm::ivec2 res )
|
void Pattern::open( uint pattern, glm::ivec2 res )
|
||||||
{
|
{
|
||||||
type_ = CLAMP(pattern, 0, 23);
|
type_ = MIN(pattern, MAX_PATTERN);
|
||||||
std::string gstreamer_pattern = pattern_internal_[type_];
|
std::string gstreamer_pattern = pattern_internal_[type_];
|
||||||
|
|
||||||
// there is always a special case...
|
// there is always a special case...
|
||||||
switch(type_)
|
switch(type_)
|
||||||
{
|
{
|
||||||
case 18:
|
case 18: // zone plates
|
||||||
case 17:
|
case 17:
|
||||||
{
|
{
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
@@ -119,7 +121,7 @@ void Pattern::open( uint pattern, glm::ivec2 res )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// all patterns before index are single frames (not animated)
|
// all patterns before 'SMPTE test pattern' are single frames (not animated)
|
||||||
single_frame_ = type_ < 14;
|
single_frame_ = type_ < 14;
|
||||||
|
|
||||||
// (private) open stream
|
// (private) open stream
|
||||||
@@ -136,7 +138,7 @@ PatternSource::PatternSource() : StreamSource()
|
|||||||
overlays_[View::LAYER]->attach( new Symbol(Symbol::PATTERN, glm::vec3(0.8f, 0.8f, 0.01f)) );
|
overlays_[View::LAYER]->attach( new Symbol(Symbol::PATTERN, glm::vec3(0.8f, 0.8f, 0.01f)) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void PatternSource::setPattern(int type, glm::ivec2 resolution)
|
void PatternSource::setPattern(uint type, glm::ivec2 resolution)
|
||||||
{
|
{
|
||||||
Log::Notify("Creating Source with pattern '%s'", Pattern::pattern_types[type].c_str());
|
Log::Notify("Creating Source with pattern '%s'", Pattern::pattern_types[type].c_str());
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ public:
|
|||||||
|
|
||||||
// specific interface
|
// specific interface
|
||||||
Pattern *pattern() const;
|
Pattern *pattern() const;
|
||||||
void setPattern(int type, glm::ivec2 resolution);
|
void setPattern(uint type, glm::ivec2 resolution);
|
||||||
|
|
||||||
glm::ivec2 icon() const override { return glm::ivec2(12, 5); }
|
glm::ivec2 icon() const override { return glm::ivec2(12, 5); }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user