From 22ca6060fa5dac9f5743fa63f2a25dd439b87abf Mon Sep 17 00:00:00 2001 From: yohannd1 Date: Sun, 29 Dec 2024 20:25:33 -0300 Subject: [PATCH] ffmpeg export: don't error on windows the feature is still not implemented, but at least now it compiles with a message saying it's not yet supported --- src/engine/wavOps.cpp | 11 ++++++++++- src/gui/exportOptions.cpp | 11 +++++++++++ src/subprocess.cpp | 6 ++++-- src/subprocess.h | 2 ++ 4 files changed, 27 insertions(+), 3 deletions(-) diff --git a/src/engine/wavOps.cpp b/src/engine/wavOps.cpp index 11d1162a5b..1325f6761f 100644 --- a/src/engine/wavOps.cpp +++ b/src/engine/wavOps.cpp @@ -19,10 +19,13 @@ #include "engine.h" #include "../ta-log.h" -#include "../subprocess.h" #include "../stringutils.h" +#include "../subprocess.h" + +#ifndef _WIN32 #include #include +#endif #ifdef HAVE_SNDFILE #include "sfWrapper.h" @@ -132,6 +135,7 @@ class SndfileWavWriter { } }; +#ifndef _WIN32 class ProcWriter { private: Subprocess* proc; @@ -192,6 +196,7 @@ class ProcWriter { } } }; +#endif #ifdef HAVE_SNDFILE void DivEngine::runExportThread() { @@ -295,6 +300,9 @@ void DivEngine::runExportThread() { } doExport(&wr); } else { +#ifdef _WIN32 + logE("ffmpeg export is not yet supported"); +#else String inputFormatArg=(exportFormat==DIV_EXPORT_FORMAT_S16)?"s16le":"f32le"; // build command vector @@ -342,6 +350,7 @@ void DivEngine::runExportThread() { // be sure we closed the write pipe to avoid stalling ffmpeg proc.closeStdinPipe(false); +#endif } logI("exporting done!"); diff --git a/src/gui/exportOptions.cpp b/src/gui/exportOptions.cpp index c11f0150b8..2c3f2aaa46 100644 --- a/src/gui/exportOptions.cpp +++ b/src/gui/exportOptions.cpp @@ -26,6 +26,12 @@ void FurnaceGUI::drawExportAudio(bool onWindow) { exitDisabledTimer=1; +#ifdef _WIN32 + const bool allowNonWav=false; +#else + const bool allowNonWav=true; +#endif + const auto formatEF = [](const FurnaceGUIExportFormat& ef) { return fmt::sprintf("%s (%s)",_(ef.name),ef.fileExt); }; @@ -34,13 +40,18 @@ void FurnaceGUI::drawExportAudio(bool onWindow) { if (ImGui::BeginCombo(_("file format"),formatEF(currentFormat).c_str())) { for (int i=0; i0) ImGui::BeginDisabled(); if (ImGui::Selectable(formatEF(ef).c_str())) { curAudioExportFormat=i; audioExportOptions.fileExt=ef.fileExt; } + if (!allowNonWav && i>0) ImGui::EndDisabled(); } ImGui::EndCombo(); } +#ifdef _WIN32 + ImGui::Text("Note: non-wav file formats are not yet supported on windows. Sorry!"); +#endif if (curAudioExportFormat>0) { ImGui::InputText(_("extra ffmpeg flags"),&audioExportOptions.ffmpegFlags,ImGuiInputTextFlags_UndoRedo); diff --git a/src/subprocess.cpp b/src/subprocess.cpp index 67dfa53018..a5d59cd1b7 100644 --- a/src/subprocess.cpp +++ b/src/subprocess.cpp @@ -17,11 +17,12 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#include -#include #include "subprocess.h" #include "ta-log.h" +#ifndef _WIN32 +#include +#include #include #include @@ -204,3 +205,4 @@ bool Subprocess::waitStdinOrExit() { } } } +#endif diff --git a/src/subprocess.h b/src/subprocess.h index efc50da896..584470a4cb 100644 --- a/src/subprocess.h +++ b/src/subprocess.h @@ -22,6 +22,7 @@ #include "ta-utils.h" +#ifndef _WIN32 // TODO: windows impl class Subprocess { public: struct Pipe { @@ -78,5 +79,6 @@ class Subprocess { bool waitForExitCode(int *outCode); bool getExitCodeNoWait(int *outCode); }; +#endif #endif