mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-19 14:19:57 +01:00
BugFix Accept empty string to create Text source
This commit is contained in:
@@ -444,10 +444,14 @@ Source *Mixer::createSourceText(const std::string &contents, glm::ivec2 res)
|
||||
s->setContents(contents, res);
|
||||
|
||||
// propose a new name based on contents
|
||||
std::string basestring = BaseToolkit::transliterate(contents);
|
||||
basestring = BaseToolkit::splitted(basestring, '\n').front();
|
||||
std::string basestring = "Text";
|
||||
if (contents.size() > 1) {
|
||||
basestring = BaseToolkit::transliterate(contents);
|
||||
if (SystemToolkit::file_exists(basestring))
|
||||
basestring = SystemToolkit::base_filename(basestring);
|
||||
else
|
||||
basestring = BaseToolkit::splitted(basestring, '\n').front();
|
||||
}
|
||||
s->setName( basestring );
|
||||
|
||||
return s;
|
||||
|
||||
@@ -220,9 +220,8 @@ void TextContents::open(const std::string &text, glm::ivec2 res)
|
||||
{
|
||||
std::string gstreamer_pattern
|
||||
= "videotestsrc pattern=black background-color=0x00000000 ! "
|
||||
"textoverlay text=\"! no text !\" halignment=center valignment=center ";
|
||||
"textoverlay text=\"\" halignment=center valignment=center ";
|
||||
|
||||
if (!text.empty() && text_.compare(text) != 0) {
|
||||
// set text
|
||||
text_ = text;
|
||||
// test if text is the filename of a subtitle
|
||||
@@ -237,7 +236,6 @@ void TextContents::open(const std::string &text, glm::ivec2 res)
|
||||
}
|
||||
gstreamer_pattern += "videotestsrc name=bg pattern=black background-color=0x00000000 ! "
|
||||
"textoverlay name=txt ";
|
||||
}
|
||||
|
||||
// (private) open stream
|
||||
Stream::open(gstreamer_pattern, res.x, res.y);
|
||||
|
||||
Reference in New Issue
Block a user