diff options
| author | 2025-01-05 20:42:51 -0500 | |
|---|---|---|
| committer | 2025-01-05 20:42:51 -0500 | |
| commit | 240ee00a9177d6ff80ef48ce577b06d93cb554c2 (patch) | |
| tree | 0f759e7a9fe28ae0d21a54917ca893131aef9dda /src/codec/ffmpeg | |
| parent | 9362f2223038b59954c8402963932b4eb77030be (diff) | |
| download | camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.tar.gz camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.tar.bz2 camu-240ee00a9177d6ff80ef48ce577b06d93cb554c2.zip | |
Temp fix for stream selection, compile fixes
Signed-off-by: Andrew Opalach <andrew@akon.city>
Diffstat (limited to 'src/codec/ffmpeg')
| -rw-r--r-- | src/codec/ffmpeg/common.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/codec/ffmpeg/common.c b/src/codec/ffmpeg/common.c index b2e727d..95bf247 100644 --- a/src/codec/ffmpeg/common.c +++ b/src/codec/ffmpeg/common.c @@ -10,18 +10,20 @@ void camu_ff_set_log_callback(void (*callback)(void *, s32, const char *, va_lis } static char *buf = NULL; -static s32 pos = 0; +static size_t pos = 0; // If a line takes more than 2 steps to print, make sure we stay within AL_LOG_MESSAGE_SIZE. -#define CHUNK_SIZE (AL_LOG_MESSAGE_SIZE / 2) +#define CHUNK_SIZE (AL_LOG_MESSAGE_SIZE / 2u) static void av_log_callback(void *userdata, s32 level, const char *fmt, va_list args) { (void)userdata; al_assert(buf); if (level < AV_LOG_DEBUG) { - pos += al_vsnprintf(&buf[pos], CHUNK_SIZE, fmt, args); - if (buf[pos - 1] == '\n' || pos >= CHUNK_SIZE) { + s32 ret = al_vsnprintf(&buf[pos], CHUNK_SIZE, fmt, args); + al_assert(ret > 0); + pos += ret; + if ((pos > 0 && buf[pos - 1] == '\n') || pos >= CHUNK_SIZE) { if (level <= AV_LOG_INFO) { al_log_info("ff", buf); } else { |