Skip to content
This repository was archived by the owner on Mar 28, 2022. It is now read-only.

Commit 6b20c61

Browse files
committed
Redirect stderr to nul on windows
1 parent bebfd4c commit 6b20c61

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/AudioStreamInput.h

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
#include "File.h"
1515
#if defined(_WIN32) && !defined(__MINGW32__)
1616
#define snprintf _snprintf
17+
#define DEVNULL "nul"
18+
#else
19+
#define DEVNULL "/dev/null"
1720
#endif
1821

1922
class AudioStreamInput {
@@ -59,11 +62,11 @@ class FfmpegStreamInput : public AudioStreamInput {
5962
// TODO: Windows
6063
char message[4096] = {0};
6164
if (_Offset_s == 0 && _Seconds == 0)
62-
snprintf(message, NELEM(message), "ffmpeg -i \"%s\" -ac %d -ar %d -f s16le - 2>/dev/null",
63-
filename, Params::AudioStreamInput::Channels, (uint) Params::AudioStreamInput::SamplingRate);
65+
snprintf(message, NELEM(message), "ffmpeg -i \"%s\" -ac %d -ar %d -f s16le - 2>%s",
66+
filename, Params::AudioStreamInput::Channels, (uint) Params::AudioStreamInput::SamplingRate, DEVNULL);
6467
else
65-
snprintf(message, NELEM(message), "ffmpeg -i \"%s\" -ac %d -ar %d -f s16le -t %d -ss %d - 2>/dev/null",
66-
filename, Params::AudioStreamInput::Channels, (uint) Params::AudioStreamInput::SamplingRate, _Seconds, _Offset_s);
68+
snprintf(message, NELEM(message), "ffmpeg -i \"%s\" -ac %d -ar %d -f s16le -t %d -ss %d - 2>%s",
69+
filename, Params::AudioStreamInput::Channels, (uint) Params::AudioStreamInput::SamplingRate, _Seconds, _Offset_s, DEVNULL);
6770

6871
return std::string(message);
6972
}

0 commit comments

Comments
 (0)