Skip to content

Commit 0eef537

Browse files
author
litongjava
committed
fix windows error
1 parent e1acc38 commit 0eef537

File tree

3 files changed

+6
-21
lines changed

3 files changed

+6
-21
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,4 +152,6 @@ venv/
152152
.vs/
153153
Debug/
154154
*.bin
155-
*.wav
155+
*.wav
156+
cmake-build-release/
157+
whisper-cpp-server.zip

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ endif ()
5252
add_executable(sdl_version examples/sdl_version.cpp)
5353
target_link_libraries(sdl_version ${SDL2_LIBRARIES})
5454

55-
add_executable(simplest examples/simplest.cpp common/common.cpp)
55+
add_executable(simplest examples/simplest.cpp common/common.cpp common/utils.cpp)
5656
target_link_libraries(simplest whisper SampleRate::samplerate)
5757

58-
add_executable(stream_local examples/stream_local.cpp common/common.cpp common/common-sdl.cpp
58+
add_executable(stream_local examples/stream_local.cpp common/common.cpp common/common-sdl.cpp common/utils.cpp
5959
stream/stream_components_service.cpp stream/stream_components_audio.cpp
6060
stream/stream_components_output.cpp
6161
)

stream/stream_components_output.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
11
#include "stream_components_output.h"
2-
2+
#include "../common/utils.h"
33
using namespace stream_components;
44

5-
// -- utility methods --
6-
7-
// 500 -> 00:05.000
8-
// 6000 -> 01:00.000
9-
std::string to_timestamp(int64_t t, bool comma = false) {
10-
int64_t msec = t * 10;
11-
int64_t hr = msec / (1000 * 60 * 60);
12-
msec = msec - hr * (1000 * 60 * 60);
13-
int64_t min = msec / (1000 * 60);
14-
msec = msec - min * (1000 * 60);
15-
int64_t sec = msec / 1000;
16-
msec = msec - sec * 1000;
175

18-
char buf[32];
19-
snprintf(buf, sizeof(buf), "%02d:%02d:%02d%s%03d", (int) hr, (int) min, (int) sec, comma ? "," : ".", (int) msec);
20-
21-
return std::string(buf);
22-
}
236

247
char *escape_double_quotes_and_backslashes(const char *str) {
258
if (str == NULL) {

0 commit comments

Comments
 (0)