diff options
author | HunterZ <108939+HunterZ@users.noreply.github.com> | 2020-10-20 19:45:53 -0700 |
---|---|---|
committer | Vitaly Novichkov <Wohlstand@users.noreply.github.com> | 2020-10-21 10:06:14 +0300 |
commit | 9d1370b2490bec28ff2ea584a6f73488b886c915 (patch) | |
tree | 745ea1e1bb85598022dfa005fbbb411e97f8ef9d /utils/adlmidi-2 | |
parent | b200f34c59840cfbe40f2d956cc0f3dc7f31aaae (diff) | |
download | libADLMIDI-9d1370b2490bec28ff2ea584a6f73488b886c915.tar.gz libADLMIDI-9d1370b2490bec28ff2ea584a6f73488b886c915.tar.bz2 libADLMIDI-9d1370b2490bec28ff2ea584a6f73488b886c915.zip |
Fix issue Wohlstand/libADLMIDI#239 by using _popen() plus a couple of other minor tweaks
Diffstat (limited to 'utils/adlmidi-2')
-rw-r--r-- | utils/adlmidi-2/CMakeLists.txt | 2 | ||||
-rw-r--r-- | utils/adlmidi-2/midiplay.cc | 13 |
2 files changed, 15 insertions, 0 deletions
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 <windows.h> # include <mmsystem.h> +# 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) |