0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 21:13:04 +02:00

text-freetype2: Avoid spamming the log

When polling the file for changes, if the file doesn't exist, avoid
repeating the message over and over again that it couldn't find the
file.
This commit is contained in:
jp9000 2014-08-24 16:59:02 -07:00
parent 4ec0861481
commit d95d20aa46
3 changed files with 10 additions and 2 deletions

View File

@ -318,6 +318,7 @@ static void ft2_source_update(void *data, obs_data_t settings)
srcdata->from_file != from_file)
vbuf_needs_update = true;
srcdata->file_load_failed = false;
srcdata->from_file = from_file;
if (srcdata->font_name != NULL) {

View File

@ -33,6 +33,7 @@ struct ft2_source {
uint16_t font_size;
uint32_t font_flags;
bool file_load_failed;
bool from_file;
char *text_file;
wchar_t *text;

View File

@ -314,7 +314,10 @@ void load_text_from_file(struct ft2_source *srcdata, const char *filename)
tmp_file = fopen(filename, "rb");
if (tmp_file == NULL) {
blog(LOG_WARNING, "Failed to open file %s", filename);
if (!srcdata->file_load_failed) {
blog(LOG_WARNING, "Failed to open file %s", filename);
srcdata->file_load_failed = true;
}
return;
}
fseek(tmp_file, 0, SEEK_END);
@ -368,7 +371,10 @@ void read_from_end(struct ft2_source *srcdata, const char *filename)
tmp_file = fopen(filename, "rb");
if (tmp_file == NULL) {
blog(LOG_WARNING, "Failed to open file %s", filename);
if (!srcdata->file_load_failed) {
blog(LOG_WARNING, "Failed to open file %s", filename);
srcdata->file_load_failed = true;
}
return;
}
fread(&value, 2, 1, tmp_file);