From 9d1370b2490bec28ff2ea584a6f73488b886c915 Mon Sep 17 00:00:00 2001 From: HunterZ <108939+HunterZ@users.noreply.github.com> Date: Tue, 20 Oct 2020 19:45:53 -0700 Subject: Fix issue Wohlstand/libADLMIDI#239 by using _popen() plus a couple of other minor tweaks --- utils/adlmidi-2/CMakeLists.txt | 2 ++ utils/adlmidi-2/midiplay.cc | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'utils') diff --git a/utils/adlmidi-2/CMakeLists.txt b/utils/adlmidi-2/CMakeLists.txt index 1809000..dd42e18 100644 --- a/utils/adlmidi-2/CMakeLists.txt +++ b/utils/adlmidi-2/CMakeLists.txt @@ -8,6 +8,8 @@ endif() if(NOT WIN32 AND NOT ADLMIDI_DOS) option(ADLMIDI2_HAS_PUZZLE_GAME "Enable the built-in puzzle game" ON) +endif() +if(NOT ADLMIDI_DOS) option(ADLMIDI2_VIDEO_OUT_SUPPORT "Allow video recording with using of FFMPEG" ON) endif() diff --git a/utils/adlmidi-2/midiplay.cc b/utils/adlmidi-2/midiplay.cc index b8f9551..a2abf23 100644 --- a/utils/adlmidi-2/midiplay.cc +++ b/utils/adlmidi-2/midiplay.cc @@ -43,6 +43,9 @@ # endif # include # include +# ifdef SUPPORT_VIDEO_OUTPUT +# define popen _popen +# endif #endif #if defined(_WIN32) || defined(__DJGPP__) @@ -397,7 +400,12 @@ public: if(NDirty) { #pragma omp parallel for schedule(static) +# ifdef _WIN32 + // MSVC refuses to compile unless scan is a signed variable + for(long scan = 0; scan < TxWidth * TxHeight; ++scan) +# else for(unsigned scan = 0; scan < TxWidth * TxHeight; ++scan) +# endif if(DirtyCells[scan]) { --NDirty; @@ -1274,8 +1282,13 @@ static void SendStereoAudio(unsigned long count, short* samples) " -c:v h264" " -aspect " + std::to_string(UI.VidWidth) + "/" + std::to_string(UI.VidHeight) + " -pix_fmt yuv420p" +# ifdef _WIN32 + " -preset superfast -partitions all -refs 2 -tune animation -y \"" + VidFilepath + "\""; + cmdline += " > nul 2> nul"; +# else " -preset superfast -partitions all -refs 2 -tune animation -y '" + VidFilepath + "'"; // FIXME: escape filename cmdline += " >/dev/null 2>/dev/null"; +# endif fp = popen(cmdline.c_str(), "w"); } if(fp) -- cgit v1.2.3