Skip to content

Commit

Permalink
Used a regex to check for [ffmpeg] string errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 8, 2024
1 parent fc23b30 commit 852da24
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions mrv2/lib/mrvFl/mrvIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// Copyright Contributors to the mrv2 Project. All rights reserved.

#include <cstring> // for strcpy
#include <regex>

#include "mrvCore/mrvHome.h"

Expand All @@ -20,6 +21,14 @@

namespace mrv
{
namespace
{
bool contains_ffmpeg(const std::string& text) {
std::regex pattern("\\[ffmpeg\\]");
return std::regex_search(text, pattern);
}
}

namespace
{
static void open_log_panel_cb(ViewerUI* ui)
Expand Down Expand Up @@ -135,9 +144,7 @@ namespace mrv
void errorbuffer::print(const char* c)
{
std::cerr << c;
const std::string& error = c;
std::cerr << error.substr(8, 6) << std::endl;
if (error.substr(8, 6) == "ffmpeg")
if (contains_ffmpeg(c))
open_ffmpeg_log_panel();
else
open_log_panel();
Expand Down

0 comments on commit 852da24

Please sign in to comment.