Skip to content

Commit

Permalink
Added preferences to control ffmpeg errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
ggarra13 committed Mar 8, 2024
1 parent f423537 commit 352189a
Show file tree
Hide file tree
Showing 9 changed files with 83 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

set( mrv2_VERSION_MAJOR 1 )
set( mrv2_VERSION_MINOR 0 )
set( mrv2_VERSION_PATCH 8 )
set( mrv2_VERSION_PATCH 9 )
set( mrv2_VERSION
"${mrv2_VERSION_MAJOR}.${mrv2_VERSION_MINOR}.${mrv2_VERSION_PATCH}"
)
8 changes: 6 additions & 2 deletions docs/release_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,14 @@ Here's the full list:
Main Web page:
https://mrv2.sourceforge.io

Release History:
https://github.com/ggarra13/mrv2/releases/

Source code and build instructions:
https://www.github.com/ggarra13/mrv2

Binaries:
https://sourceforge.net/projects/mrv2/files/v1.0.7/
https://github.com/ggarra13/mrv2/releases/tag/v1.0.8
https://sourceforge.net/projects/mrv2/files/v1.0.8/

#vr #player #movie #flipbook #usd #openusd #opentimelineio #mrv2 #mrViewer #mrViewer2 #vp9 #av1 #h264 #mp4 #mov #avi #webm #prores #prores4444 #cfhd #cineform #gopro #vpx #vfx #animation #games #filmmaking #opensource #environmentmaps #stereo
#player #movie #flipbook #usd #openusd #opentimelineio #mrv2 #mrViewer #mrViewer2 #vp9 #av1 #h264 #mp4 #mov #avi #webm #prores #prores4444 #cfhd #cineform #gopro #vpx #vfx #vr #animation #games #filmmaking #opensource #environmentmaps #stereo
6 changes: 6 additions & 0 deletions mrv2/docs/HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
v1.0.9
======

- Added a preference setting on Preferences->Errors to control what to do
on FFmpeg errors.

v1.0.8
======

Expand Down
33 changes: 32 additions & 1 deletion mrv2/lib/mrvFl/mrvIO.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,32 @@ namespace mrv
out.close();
};

void logbuffer::open_ffmpeg_log_panel()
{
if (!App::ui || !App::app->isRunning())
return;

if (Flu_File_Chooser::window)
return;

bool local = std::this_thread::get_id() == mainThread;

if (LogDisplay::ffmpegPrefs == LogDisplay::kDockOnError)
{
if (local)
open_log_panel_cb(App::ui);
else
Fl::awake((Fl_Awake_Handler)open_log_panel_cb, App::ui);
}
else if (LogDisplay::ffmpegPrefs == LogDisplay::kWindowOnError)
{
if (local)
open_log_window_cb(App::ui);
else
Fl::awake((Fl_Awake_Handler)open_log_window_cb, App::ui);
}
}

void logbuffer::open_log_panel()
{
if (!App::ui || !App::app->isRunning())
Expand Down Expand Up @@ -109,7 +135,12 @@ namespace mrv
void errorbuffer::print(const char* c)
{
std::cerr << c;
open_log_panel();
const std::string& error = c;
std::cerr << error.substr(8, 6) << std::endl;
if (error.substr(8, 6) == "ffmpeg")
open_ffmpeg_log_panel();
else
open_log_panel();
if (uiLogDisplay)
uiLogDisplay->error(c);
}
Expand Down
1 change: 1 addition & 0 deletions mrv2/lib/mrvFl/mrvIO.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ namespace mrv
logbuffer();
virtual ~logbuffer();

void open_ffmpeg_log_panel();
void open_log_panel();

//! from basic_streambuf, stl function used to sync stream
Expand Down
10 changes: 10 additions & 0 deletions mrv2/lib/mrvFl/mrvPreferences.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ namespace mrv

uiPrefs->uiPrefsRaiseLogWindowOnError->value(tmp);
LogDisplay::prefs = (LogDisplay::ShowPreferences)tmp;

errors.get("ffmpeg_log_display", tmp, 0);
uiPrefs->uiPrefsRaiseLogWindowOnFFmpegError->value(tmp);
LogDisplay::ffmpegPrefs = (LogDisplay::ShowPreferences)tmp;

Fl_Preferences opengl(base, "opengl");

Expand Down Expand Up @@ -1414,6 +1418,9 @@ namespace mrv
Fl_Preferences errors(base, "errors");
errors.set(
"log_display", (int)uiPrefs->uiPrefsRaiseLogWindowOnError->value());
errors.set(
"ffmpeg_log_display",
(int)uiPrefs->uiPrefsRaiseLogWindowOnFFmpegError->value());

Fl_Preferences opengl(base, "opengl");
opengl.set("vsync", (int)uiPrefs->uiPrefsOpenGLVsync->value());
Expand Down Expand Up @@ -1746,6 +1753,9 @@ namespace mrv

LogDisplay::prefs = (LogDisplay::ShowPreferences)
uiPrefs->uiPrefsRaiseLogWindowOnError->value();
LogDisplay::ffmpegPrefs =
(LogDisplay::ShowPreferences)
uiPrefs->uiPrefsRaiseLogWindowOnFFmpegError->value();

Fl_Round_Button* r;
r = (Fl_Round_Button*)uiPrefs->uiPrefsOpenMode->child(1);
Expand Down
2 changes: 2 additions & 0 deletions mrv2/lib/mrvWidgets/mrvLogDisplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ namespace mrv
static const int kMaxLines = 300;

LogDisplay::ShowPreferences LogDisplay::prefs = LogDisplay::kDockOnError;
LogDisplay::ShowPreferences LogDisplay::ffmpegPrefs =
LogDisplay::kNoRaise;

class LogData
{
Expand Down
3 changes: 2 additions & 1 deletion mrv2/lib/mrvWidgets/mrvLogDisplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ namespace mrv
};

static ShowPreferences prefs;

static ShowPreferences ffmpegPrefs;

public:
LogDisplay(int x, int y, int w, int h, const char* l = 0);
~LogDisplay();
Expand Down
28 changes: 23 additions & 5 deletions mrv2/lib/mrvWidgets/mrvPreferencesUI.fl
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ If you try to open several mrv2s with different images, all these images will be
}
Fl_Group {} {
label {View Window} open
xywh {288 35 555 349} box EMBOSSED_BOX align 5
xywh {288 35 555 349} box EMBOSSED_BOX align 5 hide
} {
Fl_Group {} {
label Defaults open
Expand Down Expand Up @@ -248,7 +248,7 @@ If you try to open several mrv2s with different images, all these images will be
}
Fl_Check_Button uiPrefsAutoFrame {
label {Auto Frame}
user_data this user_data_type {PreferencesUI*} selected
user_data this user_data_type {PreferencesUI*}
tooltip {When this is on, View/Auto Frame will be active.} xywh {685 124 20 20} box UP_BOX down_box DOWN_BOX align 4
}
Fl_Check_Button uiPrefsSafeAreas {
Expand Down Expand Up @@ -614,7 +614,7 @@ v->uiWindowYSize->value( v->main->uiMain->h() );}
}
}
Fl_Group {} {
label Playback open
label Playback
xywh {299 34 530 362} box EMBOSSED_BOX align 5 hide
} {
Fl_Group {} {
Expand Down Expand Up @@ -1323,12 +1323,30 @@ v->uiOCIO_Look->do_callback();}
}
}
Fl_Group {} {
label Errors
xywh {303 39 532 362} box EMBOSSED_BOX align 5 hide
label Errors open
xywh {303 39 532 362} box EMBOSSED_BOX align 5
} {
Fl_Group {} {open
xywh {341 39 446 313}
} {
Fl_Choice uiPrefsRaiseLogWindowOnFFmpegError {
label {On FFmpeg Error} open selected
tooltip {Adjusts how Log Window behaves in case of an FFmpeg error.} xywh {493 128 255 25} down_box BORDER_BOX align 132 textcolor 32
class {mrv::Choice}
} {
MenuItem {} {
label {Do Nothing}
xywh {30 30 100 20}
}
MenuItem {} {
label {Open Logs on Dock}
xywh {30 30 100 20}
}
MenuItem {} {
label {Open Logs on Window}
xywh {40 40 100 20}
}
}
Fl_Choice uiPrefsRaiseLogWindowOnError {
label {On Error} open
tooltip {Adjusts how Log Window behaves in case of error.} xywh {493 173 255 25} down_box BORDER_BOX align 132 textcolor 32
Expand Down

0 comments on commit 352189a

Please sign in to comment.