FFmpegKit Linux API 5.1
Static Public Member Functions | Static Public Attributes
ffmpegkit::FFmpegKitConfig Class Reference

#include <FFmpegKitConfig.h>

Static Public Member Functions

static void enableRedirection ()
 
static void disableRedirection ()
 
static int setFontconfigConfigurationPath (const std::string &path)
 
static void setFontDirectory (const std::string &fontDirectoryPath, const std::map< std::string, std::string > &fontNameMapping)
 
static void setFontDirectoryList (const std::list< std::string > &fontDirectoryList, const std::map< std::string, std::string > &fontNameMapping)
 
static std::shared_ptr< std::string > registerNewFFmpegPipe ()
 
static void closeFFmpegPipe (const std::string &ffmpegPipePath)
 
static std::string getFFmpegVersion ()
 
static std::string getVersion ()
 
static bool isLTSBuild ()
 
static std::string getBuildDate ()
 
static int setEnvironmentVariable (const std::string &variableName, const std::string &variableValue)
 
static void ignoreSignal (const ffmpegkit::Signal signal)
 
static void ffmpegExecute (const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
 
static void ffprobeExecute (const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
 
static void getMediaInformationExecute (const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, const int waitTimeout)
 
static void asyncFFmpegExecute (const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
 
static void asyncFFprobeExecute (const std::shared_ptr< ffmpegkit::FFprobeSession > ffprobeSession)
 
static void asyncGetMediaInformationExecute (const std::shared_ptr< ffmpegkit::MediaInformationSession > mediaInformationSession, int waitTimeout)
 
static void enableLogCallback (const ffmpegkit::LogCallback logCallback)
 
static void enableStatisticsCallback (const ffmpegkit::StatisticsCallback statisticsCallback)
 
static void enableFFmpegSessionCompleteCallback (const FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback)
 
static FFmpegSessionCompleteCallback getFFmpegSessionCompleteCallback ()
 
static void enableFFprobeSessionCompleteCallback (const FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback)
 
static FFprobeSessionCompleteCallback getFFprobeSessionCompleteCallback ()
 
static void enableMediaInformationSessionCompleteCallback (const MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback)
 
static MediaInformationSessionCompleteCallback getMediaInformationSessionCompleteCallback ()
 
static ffmpegkit::Level getLogLevel ()
 
static void setLogLevel (const ffmpegkit::Level level)
 
static std::string logLevelToString (const ffmpegkit::Level level)
 
static int getSessionHistorySize ()
 
static void setSessionHistorySize (const int sessionHistorySize)
 
static std::shared_ptr< ffmpegkit::SessiongetSession (const long sessionId)
 
static std::shared_ptr< ffmpegkit::SessiongetLastSession ()
 
static std::shared_ptr< ffmpegkit::SessiongetLastCompletedSession ()
 
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > getSessions ()
 
static void clearSessions ()
 
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > getFFmpegSessions ()
 
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > getFFprobeSessions ()
 
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::MediaInformationSession > > > getMediaInformationSessions ()
 
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > getSessionsByState (const SessionState state)
 
static LogRedirectionStrategy getLogRedirectionStrategy ()
 
static void setLogRedirectionStrategy (const LogRedirectionStrategy logRedirectionStrategy)
 
static int messagesInTransmit (const long sessionId)
 
static std::string sessionStateToString (SessionState state)
 
static std::list< std::string > parseArguments (const std::string &command)
 
static std::string argumentsToString (std::shared_ptr< std::list< std::string > > arguments)
 

Static Public Attributes

static constexpr const char * FFmpegKitVersion = "5.1"
 
static constexpr const char * FFmpegKitNamedPipePrefix = "fk_pipe_"
 

Detailed Description

Configuration class of FFmpegKit library. Allows customizing the global library options. Provides helper methods to support additional resources.

Definition at line 41 of file FFmpegKitConfig.h.

Member Function Documentation

◆ argumentsToString()

std::string ffmpegkit::FFmpegKitConfig::argumentsToString ( std::shared_ptr< std::list< std::string > >  arguments)
static

Concatenates arguments into a string adding a space character between two arguments.

Parameters
argumentsarguments
Returns
concatenated string containing all arguments

Definition at line 1412 of file FFmpegKitConfig.cpp.

◆ asyncFFmpegExecute()

void ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute ( const std::shared_ptr< ffmpegkit::FFmpegSession ffmpegSession)
static

Starts an asynchronous FFmpeg execution for the given session.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFmpegSessionCompleteCallback if you want to be notified about the result.

Parameters
ffmpegSessionFFmpeg session which includes command options/arguments

Definition at line 1055 of file FFmpegKitConfig.cpp.

◆ asyncFFprobeExecute()

void ffmpegkit::FFmpegKitConfig::asyncFFprobeExecute ( const std::shared_ptr< ffmpegkit::FFprobeSession ffprobeSession)
static

Starts an asynchronous FFprobe execution for the given session.

Note that this method returns immediately and does not wait the execution to complete. You must use an FFprobeSessionCompleteCallback if you want to be notified about the result.

Parameters
ffprobeSessionFFprobe session which includes command options/arguments

Definition at line 1083 of file FFmpegKitConfig.cpp.

◆ asyncGetMediaInformationExecute()

void ffmpegkit::FFmpegKitConfig::asyncGetMediaInformationExecute ( const std::shared_ptr< ffmpegkit::MediaInformationSession mediaInformationSession,
int  waitTimeout 
)
static

Starts an asynchronous FFprobe execution for the given media information session.

Note that this method returns immediately and does not wait the execution to complete. You must use an MediaInformationSessionCompleteCallback if you want to be notified about the result.

Parameters
mediaInformationSessionmedia information session which includes command options/arguments
waitTimeoutmax time to wait until media information is transmitted

Definition at line 1111 of file FFmpegKitConfig.cpp.

◆ clearSessions()

void ffmpegkit::FFmpegKitConfig::clearSessions ( )
static

Clears all, including ongoing, sessions in the session history.

Note that callbacks cannot be triggered for deleted sessions.

Definition at line 1257 of file FFmpegKitConfig.cpp.

◆ closeFFmpegPipe()

void ffmpegkit::FFmpegKitConfig::closeFFmpegPipe ( const std::string &  ffmpegPipePath)
static

Closes a previously created FFmpeg pipe.

Parameters
ffmpegPipePathfull path of the FFmpeg pipe

Definition at line 959 of file FFmpegKitConfig.cpp.

◆ disableRedirection()

void ffmpegkit::FFmpegKitConfig::disableRedirection ( )
static

Disables log and statistics redirection.

When redirection is disabled logs are printed to stderr, all logs and statistics callbacks are disabled and FFprobe's getMediaInformation methods do not work.

Definition at line 818 of file FFmpegKitConfig.cpp.

◆ enableFFmpegSessionCompleteCallback()

void ffmpegkit::FFmpegKitConfig::enableFFmpegSessionCompleteCallback ( const FFmpegSessionCompleteCallback  ffmpegSessionCompleteCallback)
static

Sets a global FFmpegSessionCompleteCallback to receive execution results for FFmpeg sessions.

Parameters
ffmpegSessionCompleteCallbackcomplete callback or nullptr to disable a previously defined callback

Definition at line 1147 of file FFmpegKitConfig.cpp.

◆ enableFFprobeSessionCompleteCallback()

void ffmpegkit::FFmpegKitConfig::enableFFprobeSessionCompleteCallback ( const FFprobeSessionCompleteCallback  ffprobeSessionCompleteCallback)
static

Sets a global FFprobeSessionCompleteCallback to receive execution results for FFprobe sessions.

Parameters
ffprobeSessionCompleteCallbackcomplete callback or nullptr to disable a previously defined callback

Definition at line 1155 of file FFmpegKitConfig.cpp.

◆ enableLogCallback()

void ffmpegkit::FFmpegKitConfig::enableLogCallback ( const ffmpegkit::LogCallback  logCallback)
static

Sets a global log callback to redirect FFmpeg/FFprobe logs.

Parameters
logCallbacklog callback or nullptr to disable a previously defined log callback

Definition at line 1139 of file FFmpegKitConfig.cpp.

◆ enableMediaInformationSessionCompleteCallback()

void ffmpegkit::FFmpegKitConfig::enableMediaInformationSessionCompleteCallback ( const MediaInformationSessionCompleteCallback  mediaInformationSessionCompleteCallback)
static

Sets a global MediaInformationSessionCompleteCallback to receive execution results for MediaInformation sessions.

Parameters
mediaInformationSessionCompleteCallbackcomplete callback or nullptr to disable a previously defined callback

Definition at line 1163 of file FFmpegKitConfig.cpp.

◆ enableRedirection()

void ffmpegkit::FFmpegKitConfig::enableRedirection ( )
static

Enables log and statistics redirection.

When redirection is enabled FFmpeg/FFprobe sessions collect log and statistics entries for the executions. It is possible to define global or session specific log/statistics callbacks as well.

Note that redirection is enabled by default. If you do not want to use its functionality please use disableRedirection method to disable it.

Definition at line 795 of file FFmpegKitConfig.cpp.

◆ enableStatisticsCallback()

void ffmpegkit::FFmpegKitConfig::enableStatisticsCallback ( const ffmpegkit::StatisticsCallback  statisticsCallback)
static

Sets a global statistics callback to redirect FFmpeg statistics.

Parameters
statisticsCallbackstatistics callback or nullptr to disable a previously defined statistics callback

Definition at line 1143 of file FFmpegKitConfig.cpp.

◆ ffmpegExecute()

void ffmpegkit::FFmpegKitConfig::ffmpegExecute ( const std::shared_ptr< ffmpegkit::FFmpegSession ffmpegSession)
static

Synchronously executes the FFmpeg session provided.

Parameters
ffmpegSessionFFmpeg session which includes command options/arguments

Definition at line 1007 of file FFmpegKitConfig.cpp.

◆ ffprobeExecute()

void ffmpegkit::FFmpegKitConfig::ffprobeExecute ( const std::shared_ptr< ffmpegkit::FFprobeSession ffprobeSession)
static

Synchronously executes the FFprobe session provided.

Parameters
ffprobeSessionFFprobe session which includes command options/arguments

Definition at line 1019 of file FFmpegKitConfig.cpp.

◆ getBuildDate()

std::string ffmpegkit::FFmpegKitConfig::getBuildDate ( )
static

Returns FFmpegKit library build date.

Returns
FFmpegKit library build date

Definition at line 983 of file FFmpegKitConfig.cpp.

◆ getFFmpegSessionCompleteCallback()

ffmpegkit::FFmpegSessionCompleteCallback ffmpegkit::FFmpegKitConfig::getFFmpegSessionCompleteCallback ( )
static

Returns the global FFmpegSessionCompleteCallback set.

Returns
global FFmpegSessionCompleteCallback or nullptr if it is not set

Definition at line 1151 of file FFmpegKitConfig.cpp.

◆ getFFmpegSessions()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > ffmpegkit::FFmpegKitConfig::getFFmpegSessions ( )
static

Returns all FFmpeg sessions in the session history.

Returns
all FFmpeg sessions in the session history

Definition at line 1267 of file FFmpegKitConfig.cpp.

◆ getFFmpegVersion()

std::string ffmpegkit::FFmpegKitConfig::getFFmpegVersion ( )
static

Returns the version of FFmpeg bundled within FFmpegKit library.

Returns
the version of FFmpeg

Definition at line 963 of file FFmpegKitConfig.cpp.

◆ getFFprobeSessionCompleteCallback()

ffmpegkit::FFprobeSessionCompleteCallback ffmpegkit::FFmpegKitConfig::getFFprobeSessionCompleteCallback ( )
static

Returns the global FFprobeSessionCompleteCallback set.

Returns
global FFprobeSessionCompleteCallback or nullptr if it is not set

Definition at line 1159 of file FFmpegKitConfig.cpp.

◆ getFFprobeSessions()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFprobeSession > > > ffmpegkit::FFmpegKitConfig::getFFprobeSessions ( )
static

Returns all FFprobe sessions in the session history.

Returns
all FFprobe sessions in the session history

Definition at line 1285 of file FFmpegKitConfig.cpp.

◆ getLastCompletedSession()

std::shared_ptr< ffmpegkit::Session > ffmpegkit::FFmpegKitConfig::getLastCompletedSession ( )
static

Returns the last session completed from the session history.

Returns
the last session completed. If there are no completed sessions in the history this method will return nullptr

Definition at line 1231 of file FFmpegKitConfig.cpp.

◆ getLastSession()

std::shared_ptr< ffmpegkit::Session > ffmpegkit::FFmpegKitConfig::getLastSession ( )
static

Returns the last session created from the session history.

Returns
the last session created or nullptr if session history is empty

Definition at line 1224 of file FFmpegKitConfig.cpp.

◆ getLogLevel()

ffmpegkit::Level ffmpegkit::FFmpegKitConfig::getLogLevel ( )
static

Returns the current log level.

Returns
current log level

Definition at line 1171 of file FFmpegKitConfig.cpp.

◆ getLogRedirectionStrategy()

ffmpegkit::LogRedirectionStrategy ffmpegkit::FFmpegKitConfig::getLogRedirectionStrategy ( )
static

Returns the active log redirection strategy.

Returns
log redirection strategy

Definition at line 1339 of file FFmpegKitConfig.cpp.

◆ getMediaInformationExecute()

void ffmpegkit::FFmpegKitConfig::getMediaInformationExecute ( const std::shared_ptr< ffmpegkit::MediaInformationSession mediaInformationSession,
const int  waitTimeout 
)
static

Synchronously executes the media information session provided.

Parameters
mediaInformationSessionmedia information session which includes command options/arguments
waitTimeoutmax time to wait until media information is transmitted

Definition at line 1031 of file FFmpegKitConfig.cpp.

◆ getMediaInformationSessionCompleteCallback()

ffmpegkit::MediaInformationSessionCompleteCallback ffmpegkit::FFmpegKitConfig::getMediaInformationSessionCompleteCallback ( )
static

Returns the global MediaInformationSessionCompleteCallback set.

Returns
global MediaInformationSessionCompleteCallback or nullptr if it is not set

Definition at line 1167 of file FFmpegKitConfig.cpp.

◆ getMediaInformationSessions()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::MediaInformationSession > > > ffmpegkit::FFmpegKitConfig::getMediaInformationSessions ( )
static

Returns all MediaInformation sessions in the session history.

Returns
all MediaInformation sessions in the session history

Definition at line 1303 of file FFmpegKitConfig.cpp.

◆ getSession()

std::shared_ptr< ffmpegkit::Session > ffmpegkit::FFmpegKitConfig::getSession ( const long  sessionId)
static

Returns the session specified with sessionId from the session history.

Parameters
sessionIdsession identifier
Returns
session specified with sessionId or nullptr if it is not found in the history

Definition at line 1212 of file FFmpegKitConfig.cpp.

◆ getSessionHistorySize()

int ffmpegkit::FFmpegKitConfig::getSessionHistorySize ( )
static

Returns the session history size.

Returns
session history size

Definition at line 1195 of file FFmpegKitConfig.cpp.

◆ getSessions()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > ffmpegkit::FFmpegKitConfig::getSessions ( )
static

Returns all sessions in the session history.

Returns
all sessions in the session history

Definition at line 1246 of file FFmpegKitConfig.cpp.

◆ getSessionsByState()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Session > > > ffmpegkit::FFmpegKitConfig::getSessionsByState ( const SessionState  state)
static

Returns sessions that have the given state.

Returns
sessions that have the given state from the session history

Definition at line 1321 of file FFmpegKitConfig.cpp.

◆ getVersion()

std::string ffmpegkit::FFmpegKitConfig::getVersion ( )
static

Returns FFmpegKit library version.

Returns
FFmpegKit version

Definition at line 967 of file FFmpegKitConfig.cpp.

◆ ignoreSignal()

void ffmpegkit::FFmpegKitConfig::ignoreSignal ( const ffmpegkit::Signal  signal)
static

Registers a new ignored signal. Ignored signals are not handled by FFmpegKit library.

Parameters
signalsignal to be ignored

Definition at line 993 of file FFmpegKitConfig.cpp.

◆ isLTSBuild()

bool ffmpegkit::FFmpegKitConfig::isLTSBuild ( )
static

Returns whether FFmpegKit release is a Long Term Release or not.

Returns
true/yes or false/no

Definition at line 975 of file FFmpegKitConfig.cpp.

◆ logLevelToString()

std::string ffmpegkit::FFmpegKitConfig::logLevelToString ( const ffmpegkit::Level  level)
static

Converts log level to string.

Parameters
levelvalue
Returns
string value

Definition at line 1179 of file FFmpegKitConfig.cpp.

◆ messagesInTransmit()

int ffmpegkit::FFmpegKitConfig::messagesInTransmit ( const long  sessionId)
static

Returns the number of async messages that are not transmitted to the callbacks for this session.

Parameters
sessionIdid of the session
Returns
number of async messages that are not transmitted to the callbacks for this session

Definition at line 1347 of file FFmpegKitConfig.cpp.

◆ parseArguments()

std::list< std::string > ffmpegkit::FFmpegKitConfig::parseArguments ( const std::string &  command)
static

Parses the given command into arguments. Uses space character to split the arguments. Supports single and double quote characters.

Parameters
commandstring command
Returns
list of arguments

Definition at line 1361 of file FFmpegKitConfig.cpp.

◆ registerNewFFmpegPipe()

std::shared_ptr< std::string > ffmpegkit::FFmpegKitConfig::registerNewFFmpegPipe ( )
static

Creates a new named pipe to use in FFmpeg operations.

Please note that creator is responsible of closing created pipes.

Returns
the full path of the named pipe

Definition at line 927 of file FFmpegKitConfig.cpp.

◆ sessionStateToString()

std::string ffmpegkit::FFmpegKitConfig::sessionStateToString ( SessionState  state)
static

Converts session state to string.

Parameters
statesession state
Returns
string value

Definition at line 1351 of file FFmpegKitConfig.cpp.

◆ setEnvironmentVariable()

int ffmpegkit::FFmpegKitConfig::setEnvironmentVariable ( const std::string &  variableName,
const std::string &  variableValue 
)
static

Sets an environment variable.

Parameters
variableNameenvironment variable name
variableValueenvironment variable value
Returns
zero on success, non-zero on error

Definition at line 989 of file FFmpegKitConfig.cpp.

◆ setFontconfigConfigurationPath()

int ffmpegkit::FFmpegKitConfig::setFontconfigConfigurationPath ( const std::string &  path)
static

Sets and overrides fontconfig configuration directory.

Parameters
pathdirectory that contains fontconfig configuration (fonts.conf)
Returns
zero on success, non-zero on error

Definition at line 839 of file FFmpegKitConfig.cpp.

◆ setFontDirectory()

void ffmpegkit::FFmpegKitConfig::setFontDirectory ( const std::string &  fontDirectoryPath,
const std::map< std::string, std::string > &  fontNameMapping 
)
static

Registers the fonts inside the given path, so they become available to use in FFmpeg filters.

Note that you need to build FFmpegKit with fontconfig enabled or use a prebuilt package with fontconfig inside to be able to use fonts in FFmpeg.

Parameters
fontDirectoryPathdirectory that contains fonts (.ttf and .otf files)
fontNameMappingcustom font name mappings, useful to access your fonts with more friendly names

Definition at line 843 of file FFmpegKitConfig.cpp.

◆ setFontDirectoryList()

void ffmpegkit::FFmpegKitConfig::setFontDirectoryList ( const std::list< std::string > &  fontDirectoryList,
const std::map< std::string, std::string > &  fontNameMapping 
)
static

Registers the fonts inside the given list of font directories, so they become available to use in FFmpeg filters.

Note that you need to build FFmpegKit with fontconfig enabled or use a prebuilt package with fontconfig inside to be able to use fonts in FFmpeg.

Parameters
fontDirectoryListlist of directories that contain fonts (.ttf and .otf files)
fontNameMappingcustom font name mappings, useful to access your fonts with more friendly names

Definition at line 847 of file FFmpegKitConfig.cpp.

◆ setLogLevel()

void ffmpegkit::FFmpegKitConfig::setLogLevel ( const ffmpegkit::Level  level)
static

Sets the log level.

Parameters
levelnew log level

Definition at line 1175 of file FFmpegKitConfig.cpp.

◆ setLogRedirectionStrategy()

void ffmpegkit::FFmpegKitConfig::setLogRedirectionStrategy ( const LogRedirectionStrategy  logRedirectionStrategy)
static

Sets the log redirection strategy

Parameters
logRedirectionStrategylog redirection strategy

Definition at line 1343 of file FFmpegKitConfig.cpp.

◆ setSessionHistorySize()

void ffmpegkit::FFmpegKitConfig::setSessionHistorySize ( const int  sessionHistorySize)
static

Sets the session history size.

Parameters
sessionHistorySizesession history size, should be smaller than 1000

Definition at line 1199 of file FFmpegKitConfig.cpp.

Field Documentation

◆ FFmpegKitNamedPipePrefix

constexpr const char* ffmpegkit::FFmpegKitConfig::FFmpegKitNamedPipePrefix = "fk_pipe_"
staticconstexpr

Prefix of named pipes created by ffmpeg-kit.

Definition at line 50 of file FFmpegKitConfig.h.

◆ FFmpegKitVersion

constexpr const char* ffmpegkit::FFmpegKitConfig::FFmpegKitVersion = "5.1"
staticconstexpr

Global library version

Definition at line 45 of file FFmpegKitConfig.h.


The documentation for this class was generated from the following files: