24 #include "libavutil/ffversion.h"
25 #include "libavutil/bprint.h"
42#include <condition_variable>
48 void set_report_callback(
void (*callback)(
int,
float,
float, int64_t,
double,
double,
double));
64#define SESSION_MAP_SIZE 1000
130static bool fs_exists(
const std::string& s,
const bool isFile,
const bool isDirectory) {
131 struct stat dir_info;
133 if (stat(s.c_str(), &dir_info) == 0) {
134 if (isFile && S_ISREG(dir_info.st_mode)) {
137 if (isDirectory && S_ISDIR(dir_info.st_mode)) {
147 if (mkdir(s.c_str(), S_IRWXU | S_IRWXG | S_IROTH) != 0) {
148 std::cout <<
"Failed to create directory: " << s <<
". Operation failed with " << errno <<
"." << std::endl;
158 if (first !=
nullptr) {
166 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
168 const long sessionId = session->getSessionId();
190 CallbackData(
const long sessionId,
const int logLevel,
const AVBPrint* data) :
192 av_bprint_init(&
_logData, 0, AV_BPRINT_SIZE_UNLIMITED);
193 av_bprintf(&
_logData,
"%s", data->str);
197 const int videoFrameNumber,
198 const float videoFps,
199 const float videoQuality,
202 const double bitrate,
203 const double speed) :
282 callbackMonitor.wait_for(callbackLock, std::chrono::milliseconds(milliSeconds));
317static void avutil_log_format_line(
void *avcl,
int level,
const char *fmt, va_list vl, AVBPrint part[4],
int *print_prefix) {
318 int flags = av_log_get_flags();
319 AVClass* avc = avcl ? *(AVClass **) avcl : NULL;
320 av_bprint_init(part+0, 0, 1);
321 av_bprint_init(part+1, 0, 1);
322 av_bprint_init(part+2, 0, 1);
323 av_bprint_init(part+3, 0, 65536);
325 if (*print_prefix && avc) {
326 if (avc->parent_log_context_offset) {
327 AVClass** parent = *(AVClass ***) (((uint8_t *) avcl) +
328 avc->parent_log_context_offset);
329 if (parent && *parent) {
330 av_bprintf(part+0,
"[%s @ %p] ",
331 (*parent)->item_name(parent), parent);
334 av_bprintf(part+1,
"[%s @ %p] ",
335 avc->item_name(avcl), avcl);
338 if (*print_prefix && (level > AV_LOG_QUIET) && (flags & AV_LOG_PRINT_LEVEL))
341 av_vbprintf(part+3, fmt, vl);
343 if(*part[0].str || *part[1].str || *part[2].str || *part[3].str) {
344 char lastc = part[3].len && part[3].len <= part[3].size ? part[3].str[part[3].len - 1] : 0;
345 *print_prefix = lastc ==
'\n' || lastc ==
'\r';
351 if(*line < 0x08 || (*line > 0x0D && *line < 0x20))
478 int print_prefix = 1;
484 int activeLogLevel = av_log_get_level();
491 av_bprint_init(&fullLine, 0, AV_BPRINT_SIZE_UNLIMITED);
500 av_bprintf(&fullLine,
"%s%s%s%s", part[0].str, part[1].str, part[2].str, part[3].str);
502 if (fullLine.len > 0) {
506 av_bprint_finalize(part, NULL);
507 av_bprint_finalize(part+1, NULL);
508 av_bprint_finalize(part+2, NULL);
509 av_bprint_finalize(part+3, NULL);
510 av_bprint_finalize(&fullLine, NULL);
528static void process_log(
long sessionId,
int levelValueInt, AVBPrint* logMessage) {
529 int activeLogLevel = av_log_get_level();
531 std::shared_ptr<ffmpegkit::Log> log = std::make_shared<ffmpegkit::Log>(sessionId, levelValue, logMessage->str);
532 bool globalCallbackDefined =
false;
533 bool sessionCallbackDefined =
false;
543 if (session !=
nullptr) {
544 activeLogRedirectionStrategy = session->getLogRedirectionStrategy();
545 session->addLog(log);
548 if (sessionLogCallback !=
nullptr) {
549 sessionCallbackDefined =
true;
553 sessionLogCallback(log);
554 }
catch(
const std::exception& exception) {
555 std::cout <<
"Exception thrown inside session log callback. " << exception.what() << std::endl;
561 if (globalLogCallback !=
nullptr) {
562 globalCallbackDefined =
true;
566 globalLogCallback(log);
567 }
catch(
const std::exception& exception) {
568 std::cout <<
"Exception thrown inside global log callback. " << exception.what() << std::endl;
573 switch (activeLogRedirectionStrategy) {
578 if (globalCallbackDefined) {
584 if (sessionCallbackDefined) {
590 if (globalCallbackDefined || sessionCallbackDefined) {
601 switch (levelValue) {
612void process_statistics(
long sessionId,
int videoFrameNumber,
float videoFps,
float videoQuality,
long size,
double time,
double bitrate,
double speed) {
613 std::shared_ptr<ffmpegkit::Statistics> statistics = std::make_shared<ffmpegkit::Statistics>(sessionId, videoFrameNumber, videoFps, videoQuality, size, time, bitrate, speed);
616 if (session !=
nullptr && session->isFFmpeg()) {
617 std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegSession = std::static_pointer_cast<ffmpegkit::FFmpegSession>(session);
618 ffmpegSession->addStatistics(statistics);
621 if (sessionStatisticsCallback !=
nullptr) {
623 sessionStatisticsCallback(statistics);
624 }
catch(
const std::exception& exception) {
625 std::cout <<
"Exception thrown inside session statistics callback. " << exception.what() << std::endl;
631 if (globalStatisticsCallback !=
nullptr) {
633 globalStatisticsCallback(statistics);
634 }
catch(
const std::exception& exception) {
635 std::cout <<
"Exception thrown inside global statistics callback. " << exception.what() << std::endl;
644 int activeLogLevel = av_log_get_level();
646 std::cout <<
"Async callback block started." << std::endl;
653 if (callbackData !=
nullptr) {
657 av_bprint_finalize(callbackData->
getLogData(), NULL);
675 }
catch(
const std::exception& exception) {
676 activeLogLevel = av_log_get_level();
678 std::cout <<
"Async callback block received error: " << exception.what() << std::endl;
683 activeLogLevel = av_log_get_level();
685 std::cout <<
"Async callback block stopped." << std::endl;
691static int executeFFmpeg(
const long sessionId,
const std::shared_ptr<std::list<std::string>> arguments) {
692 const char* LIB_NAME =
"ffmpeg";
697 char **commandCharPArray = (
char **)av_malloc(
sizeof(
char*) * (arguments->size() + 1));
703 commandCharPArray[0] = (
char *)av_malloc(
sizeof(
char) * (strlen(LIB_NAME) + 1));
704 strcpy(commandCharPArray[0], LIB_NAME);
708 for (
auto it=arguments->begin(); it != arguments->end(); it++, i++) {
709 commandCharPArray[i + 1] = (
char*)it->c_str();
719 int returnCode =
ffmpeg_execute((arguments->size() + 1), commandCharPArray);
725 av_free(commandCharPArray[0]);
726 av_free(commandCharPArray);
731int executeFFprobe(
const long sessionId,
const std::shared_ptr<std::list<std::string>> arguments) {
732 const char* LIB_NAME =
"ffprobe";
737 char **commandCharPArray = (
char **)av_malloc(
sizeof(
char*) * (arguments->size() + 1));
743 commandCharPArray[0] = (
char *)av_malloc(
sizeof(
char) * (strlen(LIB_NAME) + 1));
744 strcpy(commandCharPArray[0], LIB_NAME);
748 for (
auto it=arguments->begin(); it != arguments->end(); it++, i++) {
749 commandCharPArray[i + 1] = (
char*)it->c_str();
759 int returnCode =
ffprobe_execute((arguments->size() + 1), commandCharPArray);
765 av_free(commandCharPArray[0]);
766 av_free(commandCharPArray);
773 std::cout <<
"Loading ffmpeg-kit." << std::endl;
814 std::cout <<
"Failed to create async callback block: %d" << rc << std::endl;
840 av_log_set_callback(av_log_default_callback);
853 int validFontNameMappingCount = 0;
855 const char *parentDirectory = std::getenv(
"HOME");
856 if (parentDirectory == NULL) {
857 parentDirectory = std::getenv(
"TMPDIR");
858 if (parentDirectory == NULL) {
859 parentDirectory =
".";
863 std::string cacheDir = std::string(parentDirectory) +
"/.cache";
864 std::string ffmpegKitDir = cacheDir +
"/ffmpegkit";
865 auto tempConfigurationDirectory = ffmpegKitDir +
"/fontconfig";
866 auto fontConfigurationFile = std::string(tempConfigurationDirectory) +
"/fonts.conf";
871 std::cout <<
"Created temporary font conf directory: TRUE." << std::endl;
873 if (
fs_exists(fontConfigurationFile,
true,
false)) {
874 bool fontConfigurationDeleted = std::remove(fontConfigurationFile.c_str());
875 std::cout <<
"Deleted old temporary font configuration: " << (fontConfigurationDeleted == 0?
"TRUE":
"FALSE") <<
"." << std::endl;
879 std::string fontNameMappingBlock =
"";
880 for (
auto const& pair : fontNameMapping) {
881 if ((pair.first.size() > 0) && (pair.second.size() > 0)) {
883 fontNameMappingBlock +=
" <match target=\"pattern\">\n";
884 fontNameMappingBlock +=
" <test qual=\"any\" name=\"family\">\n";
885 fontNameMappingBlock +=
" <string>";
886 fontNameMappingBlock += pair.first;
887 fontNameMappingBlock +=
"</string>\n";
888 fontNameMappingBlock +=
" </test>\n";
889 fontNameMappingBlock +=
" <edit name=\"family\" mode=\"assign\" binding=\"same\">\n";
890 fontNameMappingBlock +=
" <string>";
891 fontNameMappingBlock += pair.second;
892 fontNameMappingBlock +=
"</string>\n";
893 fontNameMappingBlock +=
" </edit>\n";
894 fontNameMappingBlock +=
" </match>\n";
896 validFontNameMappingCount++;
900 std::string fontConfiguration;
901 fontConfiguration +=
"<?xml version=\"1.0\"?>\n";
902 fontConfiguration +=
"<!DOCTYPE fontconfig SYSTEM \"fonts.dtd\">\n";
903 fontConfiguration +=
"<fontconfig>\n";
904 fontConfiguration +=
" <dir prefix=\"cwd\">.</dir>\n";
906 for (
const auto& fontDirectoryPath : fontDirectoryList) {
907 fontConfiguration +=
" <dir>";
908 fontConfiguration += fontDirectoryPath;
909 fontConfiguration +=
"</dir>\n";
911 fontConfiguration += fontNameMappingBlock;
912 fontConfiguration +=
"</fontconfig>\n";
914 std::ofstream fontConfigurationStream(fontConfigurationFile, std::ios::out | std::ios::trunc);
915 if (fontConfigurationStream) {
916 fontConfigurationStream << fontConfiguration;
918 if (fontConfigurationStream.bad()) {
919 std::cout <<
"Failed to set font directory. Error received while saving font configuration: " << fontConfigurationStream.rdbuf() <<
"." << std::endl;
921 fontConfigurationStream.close();
923 std::cout <<
"Saved new temporary font configuration with " << validFontNameMappingCount <<
" font name mappings." << std::endl;
927 for (
const auto& fontDirectoryPath : fontDirectoryList) {
928 std::cout <<
"Font directory " << fontDirectoryPath <<
" registered successfully." << std::endl;
933 const char *parentDirectory = std::getenv(
"HOME");
934 if (parentDirectory == NULL) {
935 parentDirectory = std::getenv(
"TMPDIR");
936 if (parentDirectory == NULL) {
937 parentDirectory =
".";
942 std::string cacheDir = std::string(parentDirectory) +
"/.cache";
943 std::string ffmpegKitDir = cacheDir +
"/ffmpegkit";
944 std::string pipesDir = ffmpegKitDir +
"/pipes";
950 std::shared_ptr<std::string> newFFmpegPipePath = std::make_shared<std::string>(pipesDir +
"/" + FFmpegKitNamedPipePrefix + std::to_string(
pipeIndexGenerator++));
955 int rc = mkfifo(newFFmpegPipePath->c_str(), S_IRWXU | S_IRWXG | S_IROTH);
957 return newFFmpegPipePath;
959 std::cout <<
"Failed to register new FFmpeg pipe " << newFFmpegPipePath <<
". Operation failed with rc=" << rc <<
"." << std::endl;
965 std::remove(ffmpegPipePath.c_str());
969 return FFMPEG_VERSION;
974 return std::string(
"").append(FFmpegKitVersion).append(
"-lts");
976 return FFmpegKitVersion;
981 #if defined(FFMPEG_KIT_LTS)
990 sprintf(buildDate,
"%d", FFMPEG_KIT_BUILD_DATE);
991 return std::string(buildDate);
995 return setenv(variableName.c_str(), variableValue.c_str(),
true);
1013 ffmpegSession->startRunning();
1016 int returnCode =
executeFFmpeg(ffmpegSession->getSessionId(), ffmpegSession->getArguments());
1017 ffmpegSession->complete(std::make_shared<ffmpegkit::ReturnCode>(returnCode));
1018 }
catch(
const std::exception& exception) {
1019 ffmpegSession->fail(exception.what());
1025 ffprobeSession->startRunning();
1028 int returnCode =
executeFFprobe(ffprobeSession->getSessionId(), ffprobeSession->getArguments());
1029 ffprobeSession->complete(std::make_shared<ffmpegkit::ReturnCode>(returnCode));
1030 }
catch(
const std::exception& exception) {
1031 ffprobeSession->fail(exception.what());
1037 mediaInformationSession->startRunning();
1040 int returnCodeValue =
executeFFprobe(mediaInformationSession->getSessionId(), mediaInformationSession->getArguments());
1041 auto returnCode = std::make_shared<ffmpegkit::ReturnCode>(returnCodeValue);
1042 mediaInformationSession->complete(returnCode);
1043 if (returnCode->isValueSuccess()) {
1044 auto allLogs = mediaInformationSession->getAllLogsWithTimeout(waitTimeout);
1045 std::string ffprobeJsonOutput;
1046 std::for_each(allLogs->cbegin(), allLogs->cend(), [&](std::shared_ptr<ffmpegkit::Log> log) {
1047 if (log->getLevel() == LevelAVLogStdErr) {
1048 ffprobeJsonOutput.append(log->getMessage());
1052 mediaInformationSession->setMediaInformation(mediaInformation);
1054 }
catch(
const std::exception& exception) {
1055 mediaInformationSession->fail(exception.what());
1061 auto thread = std::thread([ffmpegSession]() {
1065 if (completeCallback !=
nullptr) {
1068 completeCallback(ffmpegSession);
1069 }
catch(
const std::exception& exception) {
1070 std::cout <<
"Exception thrown inside session complete callback. " << exception.what() << std::endl;
1075 if (globalFFmpegSessionCompleteCallback !=
nullptr) {
1078 globalFFmpegSessionCompleteCallback(ffmpegSession);
1079 }
catch(
const std::exception& exception) {
1080 std::cout <<
"Exception thrown inside global complete callback. " << exception.what() << std::endl;
1089 auto thread = std::thread([ffprobeSession]() {
1093 if (completeCallback !=
nullptr) {
1096 completeCallback(ffprobeSession);
1097 }
catch(
const std::exception& exception) {
1098 std::cout <<
"Exception thrown inside session complete callback. " << exception.what() << std::endl;
1103 if (globalFFprobeSessionCompleteCallback !=
nullptr) {
1106 globalFFprobeSessionCompleteCallback(ffprobeSession);
1107 }
catch(
const std::exception& exception) {
1108 std::cout <<
"Exception thrown inside global complete callback. " << exception.what() << std::endl;
1117 auto thread = std::thread([mediaInformationSession,waitTimeout]() {
1121 if (completeCallback !=
nullptr) {
1124 completeCallback(mediaInformationSession);
1125 }
catch(
const std::exception& exception) {
1126 std::cout <<
"Exception thrown inside session complete callback. " << exception.what() << std::endl;
1131 if (globalMediaInformationSessionCompleteCallback !=
nullptr) {
1134 globalMediaInformationSessionCompleteCallback(mediaInformationSession);
1135 }
catch(
const std::exception& exception) {
1136 std::cout <<
"Exception thrown inside global complete callback. " << exception.what() << std::endl;
1210 throw std::runtime_error(
"Session history size must not exceed the hard limit!");
1211 }
else if (newSessionHistorySize > 0) {
1218 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1223 return session->second;
1230 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1237 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1242 auto session = *rit;
1252 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1255 auto sessionHistoryListCopy = std::make_shared<std::list<std::shared_ptr<ffmpegkit::Session>>>(
sessionHistoryList);
1259 return sessionHistoryListCopy;
1263 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1273 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1274 const auto ffmpegSessions = std::make_shared<std::list<std::shared_ptr<ffmpegkit::FFmpegSession>>>();
1280 if (session->isFFmpeg()) {
1281 ffmpegSessions->push_back(std::static_pointer_cast<ffmpegkit::FFmpegSession>(session));
1287 return ffmpegSessions;
1291 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1292 const auto ffprobeSessions = std::make_shared<std::list<std::shared_ptr<ffmpegkit::FFprobeSession>>>();
1298 if (session->isFFprobe()) {
1299 ffprobeSessions->push_back(std::static_pointer_cast<ffmpegkit::FFprobeSession>(session));
1305 return ffprobeSessions;
1309 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1310 const auto mediaInformationSessions = std::make_shared<std::list<std::shared_ptr<ffmpegkit::MediaInformationSession>>>();
1316 if (session->isMediaInformation()) {
1317 mediaInformationSessions->push_back(std::static_pointer_cast<ffmpegkit::MediaInformationSession>(session));
1323 return mediaInformationSessions;
1327 std::unique_lock<std::recursive_mutex> lock(
sessionMutex, std::defer_lock);
1328 auto sessions = std::make_shared<std::list<std::shared_ptr<ffmpegkit::Session>>>();
1334 if (session->getState() == state) {
1335 sessions->push_back(session);
1367 std::list<std::string> argumentList;
1368 std::string currentArgument;
1370 bool singleQuoteStarted =
false;
1371 bool doubleQuoteStarted =
false;
1373 for (
int i = 0; i < command.size(); i++) {
1376 previousChar = command[i - 1];
1380 char currentChar = command[i];
1382 if (currentChar ==
' ') {
1383 if (singleQuoteStarted || doubleQuoteStarted) {
1384 currentArgument += currentChar;
1385 }
else if (currentArgument.size() > 0) {
1386 argumentList.push_back(currentArgument);
1387 currentArgument =
"";
1389 }
else if (currentChar ==
'\'' && (previousChar == 0 || previousChar !=
'\\')) {
1390 if (singleQuoteStarted) {
1391 singleQuoteStarted =
false;
1392 }
else if (doubleQuoteStarted) {
1393 currentArgument += currentChar;
1395 singleQuoteStarted =
true;
1397 }
else if (currentChar ==
'\"' && (previousChar == 0 || previousChar !=
'\\')) {
1398 if (doubleQuoteStarted) {
1399 doubleQuoteStarted =
false;
1400 }
else if (singleQuoteStarted) {
1401 currentArgument += currentChar;
1403 doubleQuoteStarted =
true;
1406 currentArgument += currentChar;
1410 if (currentArgument.size() > 0) {
1411 argumentList.push_back(currentArgument);
1414 return argumentList;
1418 if (arguments ==
nullptr) {
1423 for(
auto it=arguments->begin(); it != arguments->end(); ++it) {
1424 auto argument = *it;
1425 if (it != arguments->begin()) {
static std::mutex callbackMutex
void ffmpegkit_log_callback_function(void *ptr, int level, const char *format, va_list vargs)
static void process_log(long sessionId, int levelValueInt, AVBPrint *logMessage)
void * callbackThreadFunction(void *pointer)
int executeFFprobe(const long sessionId, const std::shared_ptr< std::list< std::string > > arguments)
static std::atomic< long > pipeIndexGenerator(1)
static void statisticsCallbackDataAdd(int frameNumber, float fps, float quality, int64_t size, int time, double bitrate, double speed)
void cancelSession(long sessionId)
static int sessionHistorySize
static bool fs_exists(const std::string &s, const bool isFile, const bool isDirectory)
static std::list< CallbackData * > callbackDataList
static std::recursive_mutex callbackDataMutex
static void logCallbackDataAdd(int level, AVBPrint *data)
static void avutil_log_sanitize(char *line)
volatile int handleSIGINT
static void registerSessionId(long sessionId)
int ffprobe_execute(int argc, char **argv)
volatile int handleSIGTERM
void set_report_callback(void(*callback)(int, float, float, int64_t, double, double, double))
static ffmpegkit::FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback
void ffmpegkit_statistics_callback_function(int frameNumber, float fps, float quality, int64_t size, double time, double bitrate, double speed)
static std::atomic< int > sessionInTransitMessageCountMap[SESSION_MAP_SIZE]
static const char * avutil_log_get_level_str(int level)
static void avutil_log_format_line(void *avcl, int level, const char *fmt, va_list vl, AVBPrint part[4], int *print_prefix)
static std::recursive_mutex sessionMutex
static std::atomic< short > sessionMap[SESSION_MAP_SIZE]
void addSessionToSessionHistory(const std::shared_ptr< ffmpegkit::Session > session)
static void resetMessagesInTransmit(long sessionId)
static ffmpegkit::LogCallback logCallback
void cancel_operation(long id)
static void callbackNotify()
static pthread_t callbackThread
static std::condition_variable callbackMonitor
static std::list< std::shared_ptr< ffmpegkit::Session > > sessionHistoryList
static std::map< long, std::shared_ptr< ffmpegkit::Session > > sessionHistoryMap
static ffmpegkit::StatisticsCallback statisticsCallback
static ffmpegkit::LogRedirectionStrategy globalLogRedirectionStrategy
static std::once_flag ffmpegKitInitializerFlag
void * ffmpegKitInitialize()
static int executeFFmpeg(const long sessionId, const std::shared_ptr< std::list< std::string > > arguments)
void deleteExpiredSessions()
__thread long globalSessionId
static int redirectionEnabled
static void callbackWait(int milliSeconds)
int cancelRequested(long sessionId)
volatile int handleSIGPIPE
static CallbackData * callbackDataRemove()
void process_statistics(long sessionId, int videoFrameNumber, float videoFps, float videoQuality, long size, double time, double bitrate, double speed)
volatile int handleSIGXCPU
static ffmpegkit::FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback
static void removeSession(long sessionId)
static bool fs_create_dir(const std::string &s)
static ffmpegkit::MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback
int ffmpeg_execute(int argc, char **argv)
const void * _ffmpegKitConfigInitializer
volatile int handleSIGQUIT
float getStatisticsQuality()
double _statisticsBitrate
double getStatisticsSpeed()
int getStatisticsFrameNumber()
CallbackData(const long sessionId, const int videoFrameNumber, const float videoFps, const float videoQuality, const int64_t size, const double time, const double bitrate, const double speed)
int64_t getStatisticsSize()
CallbackData(const long sessionId, const int logLevel, const AVBPrint *data)
int _statisticsFrameNumber
double getStatisticsBitrate()
double getStatisticsTime()
static std::string getArch()
static std::string getVersion()
static void disableRedirection()
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::MediaInformationSession > > > getMediaInformationSessions()
static void enableFFmpegSessionCompleteCallback(const FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback)
static int getSessionHistorySize()
static std::shared_ptr< ffmpegkit::Session > getLastSession()
static void enableRedirection()
static void enableLogCallback(const ffmpegkit::LogCallback logCallback)
static std::shared_ptr< std::string > registerNewFFmpegPipe()
static LogRedirectionStrategy getLogRedirectionStrategy()
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > getFFprobeSessions()
static int messagesInTransmit(const long sessionId)
static void closeFFmpegPipe(const std::string &ffmpegPipePath)
static void asyncFFprobeExecute(const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
static ffmpegkit::Level getLogLevel()
static std::shared_ptr< ffmpegkit::Session > getSession(const long sessionId)
static void asyncGetMediaInformationExecute(const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, int waitTimeout)
static void setLogRedirectionStrategy(const LogRedirectionStrategy logRedirectionStrategy)
static void getMediaInformationExecute(const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, const int waitTimeout)
static int setEnvironmentVariable(const std::string &variableName, const std::string &variableValue)
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > getSessionsByState(const SessionState state)
static void enableStatisticsCallback(const ffmpegkit::StatisticsCallback statisticsCallback)
static std::list< std::string > parseArguments(const std::string &command)
static void ffprobeExecute(const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
static void setSessionHistorySize(const int sessionHistorySize)
static void setLogLevel(const ffmpegkit::Level level)
static void setFontDirectory(const std::string &fontDirectoryPath, const std::map< std::string, std::string > &fontNameMapping)
static void asyncFFmpegExecute(const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
static FFmpegSessionCompleteCallback getFFmpegSessionCompleteCallback()
static void ignoreSignal(const ffmpegkit::Signal signal)
static FFprobeSessionCompleteCallback getFFprobeSessionCompleteCallback()
static std::shared_ptr< ffmpegkit::Session > getLastCompletedSession()
static void clearSessions()
static std::string sessionStateToString(SessionState state)
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > getFFmpegSessions()
static int setFontconfigConfigurationPath(const std::string &path)
static std::string argumentsToString(std::shared_ptr< std::list< std::string > > arguments)
static std::string logLevelToString(const ffmpegkit::Level level)
static void setFontDirectoryList(const std::list< std::string > &fontDirectoryList, const std::map< std::string, std::string > &fontNameMapping)
static void enableMediaInformationSessionCompleteCallback(const MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback)
static void enableFFprobeSessionCompleteCallback(const FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback)
static std::string getFFmpegVersion()
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > getSessions()
static std::string getBuildDate()
static void ffmpegExecute(const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
static MediaInformationSessionCompleteCallback getMediaInformationSessionCompleteCallback()
static std::string getPackageName()
@ LogRedirectionStrategyPrintLogsWhenSessionCallbackNotDefined
@ LogRedirectionStrategyAlwaysPrintLogs
@ LogRedirectionStrategyNeverPrintLogs
@ LogRedirectionStrategyPrintLogsWhenNoCallbacksDefined
@ LogRedirectionStrategyPrintLogsWhenGlobalCallbackNotDefined
std::function< void(const std::shared_ptr< ffmpegkit::Statistics > statistics)> StatisticsCallback
std::function< void(const std::shared_ptr< ffmpegkit::MediaInformationSession > session)> MediaInformationSessionCompleteCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
std::function< void(const std::shared_ptr< ffmpegkit::FFprobeSession > session)> FFprobeSessionCompleteCallback
std::function< void(const std::shared_ptr< ffmpegkit::FFmpegSession > session)> FFmpegSessionCompleteCallback