Skip to content
This repository was archived by the owner on Jan 6, 2025. It is now read-only.

Commit 9aa8afb

Browse files
committed
Process log level earlier, fix #50
1 parent 4d5e759 commit 9aa8afb

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

android/app/src/main/cpp/mobileffmpeg.c

+4
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,10 @@ void mobileffmpeg_log_callback_function(void *ptr, int level, const char* format
358358
if (level >= 0) {
359359
level &= 0xff;
360360
}
361+
int activeLogLevel = av_log_get_level();
362+
if ((activeLogLevel == AV_LOG_QUIET) || (level > activeLogLevel)) {
363+
return;
364+
}
361365

362366
avutil_log_format_line(ptr, level, format, vargs, part, &print_prefix);
363367
snprintf(line, sizeof(line), "%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);

ios/src/MobileFFmpegConfig.m

+10
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,16 @@ void statisticsCallbackDataAdd(int frameNumber, float fps, float quality, int64_
213213
* \param arguments
214214
*/
215215
void mobileffmpeg_log_callback_function(void *ptr, int level, const char* format, va_list vargs) {
216+
217+
// DO NOT PROCESS UNWANTED LOGS
218+
if (level >= 0) {
219+
level &= 0xff;
220+
}
221+
int activeLogLevel = [MobileFFmpegConfig getLogLevel];
222+
if ((activeLogLevel == AV_LOG_QUIET) || (level > activeLogLevel)) {
223+
return;
224+
}
225+
216226
NSString *logData = [[NSString alloc] initWithFormat:[NSString stringWithCString:format encoding:NSUTF8StringEncoding] arguments:vargs];
217227

218228
logCallbackDataAdd(level, logData);

0 commit comments

Comments
 (0)