Skip to content

Commit bfb0151

Browse files
author
Clement Champetier
committed
log: skip call of 'av_log_format_line' if depend on libav
1 parent 2625f45 commit bfb0151

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

src/AvTranscoder/log.cpp

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,19 @@ namespace avtranscoder
55

66
void callbackToWriteInFile( void *ptr, int level, const char *fmt, va_list vl )
77
{
8+
std::ofstream outputFile;
9+
outputFile.open( LOG_FILE, std::ios::out | std::ios::app );
10+
11+
#ifdef AVTRANSCODER_FFMPEG_DEPENDENCY
812
// Format a line of log the same way as the default callback
913
char line[1024];
1014
static int print_prefix = 1;
11-
av_log_format_line(ptr, level, fmt, vl, line, sizeof(line), &print_prefix);
12-
13-
// Print line in log file
14-
std::ofstream outputFile;
15-
outputFile.open( LOG_FILE, std::ios::out | std::ios::app );
15+
av_log_format_line(ptr, level, fmt, vl, line, sizeof(line), &print_prefix); //only available with ffmpeg
1616
outputFile << line;
17+
#else
18+
outputFile << "Warning: currently can't log in file with avtranscoder when depending on libav" << std::endl;
19+
#endif
20+
1721
outputFile.close();
1822
}
1923

0 commit comments

Comments
 (0)