Skip to content

Commit

Permalink
mkvmerge: output progress in GUI mode as »#GUI#progress …%«
Browse files Browse the repository at this point in the history
  • Loading branch information
mbunkus committed May 31, 2015
1 parent 726f041 commit 97f8311
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
2015-05-31 Moritz Bunkus <moritz@bunkus.org>

* mkvmerge: enhancement: if running in GUI mode (parameter
»--gui-mode«) then the progress will be output as the untranslated
»#GUI#progress …%« in order to facilitate parsing of progress by
GUIs.

* mkvmerge: bug fix: fixed key frame designation for video tracks
in MP4 DASH files.

Expand Down
6 changes: 5 additions & 1 deletion src/merge/mkvmerge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2353,7 +2353,11 @@ display_playlist_scan_progress(size_t num_scanned,
return;

auto current_percentage = (num_scanned * 1000 + 5) / total_num_to_scan / 10;
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % current_percentage % "\r");

if (g_gui_mode)
mxinfo(boost::format("#GUI#progress %1%%%\n") % current_percentage);
else
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % current_percentage % "\r");
}

static filelist_cptr
Expand Down
11 changes: 9 additions & 2 deletions src/merge/output_control.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
#include <matroska/KaxVersion.h>

#include "common/chapters/chapters.h"
#include "common/command_line.h"
#include "common/container.h"
#include "common/date_time.h"
#include "common/debugging.h"
Expand Down Expand Up @@ -297,7 +298,10 @@ display_progress(bool is_100percent = false) {
return;

if (is_100percent) {
mxinfo(boost::format(Y("Progress: 100%%%1%")) % "\r");
if (g_gui_mode)
mxinfo(boost::format("#GUI#progress 100%%\n"));
else
mxinfo(boost::format(Y("Progress: 100%%%1%")) % "\r");
return;
}

Expand All @@ -319,7 +323,10 @@ display_progress(bool is_100percent = false) {
// if (2 < current_percentage)
// exit(42);

mxinfo(boost::format(Y("Progress: %1%%%%2%")) % current_percentage % "\r");
if (g_gui_mode)
mxinfo(boost::format("#GUI#progress %1%%%\n") % current_percentage);
else
mxinfo(boost::format(Y("Progress: %1%%%%2%")) % current_percentage % "\r");

s_previous_percentage = current_percentage;
s_previous_progress_on = current_time;
Expand Down

0 comments on commit 97f8311

Please sign in to comment.