public class Config
extends java.lang.Object
This class is used to configure MobileFFmpeg library utilities/tools.
1. LogCallback
: This class redirects FFmpeg/FFprobe output to Logcat by default. As
an alternative, it is possible not to print messages to Logcat and pass them to a
LogCallback
function. This function can decide whether to print these logs, show them
inside another container or ignore them.
2. setLogLevel(Level)
/getLogLevel()
: Use this methods to set/get
FFmpeg/FFprobe log severity.
3. StatisticsCallback
: It is possible to receive statistics about an ongoing
operation by defining a StatisticsCallback
function or by calling
getLastReceivedStatistics()
method.
4. Font configuration: It is possible to register custom fonts with
setFontconfigConfigurationPath(String)
and
setFontDirectory(Context, String, Map)
methods.
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
MOBILE_FFMPEG_PIPE_PREFIX |
static int |
RETURN_CODE_CANCEL |
static int |
RETURN_CODE_SUCCESS |
static java.lang.String |
TAG
Defines tag used for logging.
|
Modifier and Type | Method and Description |
---|---|
static void |
closeFFmpegPipe(java.lang.String ffmpegPipePath)
Closes a previously created
FFmpeg pipe. |
static void |
disableRedirection()
Disables log and statistics redirection.
|
static void |
enableLogCallback(LogCallback newLogCallback)
Sets a callback function to redirect FFmpeg/FFprobe logs.
|
static void |
enableRedirection()
Enables log and statistics redirection.
|
static void |
enableStatisticsCallback(StatisticsCallback statisticsCallback)
Sets a callback function to redirect FFmpeg statistics.
|
static java.lang.String |
getBuildDate()
Returns MobileFFmpeg library build date.
|
static java.util.List<java.lang.String> |
getExternalLibraries()
Returns supported external libraries.
|
static java.lang.String |
getFFmpegVersion()
Returns FFmpeg version bundled within the library.
|
static java.lang.String |
getLastCommandOutput()
Returns log output of last executed single FFmpeg/FFprobe command.
|
static Statistics |
getLastReceivedStatistics()
Returns the last received statistics data.
|
static int |
getLastReturnCode()
Returns return code of last executed command.
|
static Level |
getLogLevel()
Returns log level.
|
static java.lang.String |
getPackageName()
Returns package name.
|
static java.util.List<java.lang.String> |
getSupportedCameraIds(android.content.Context context)
Returns the list of camera ids supported.
|
static java.lang.String |
getVersion()
Returns MobileFFmpeg library version.
|
static void |
ignoreSignal(Signal signal)
Registers a new ignored signal.
|
static boolean |
isLTSBuild()
Returns whether MobileFFmpeg release is a long term release or not.
|
static void |
printLastCommandOutput(int logPriority)
Prints the output of the last executed FFmpeg/FFprobe command to the Logcat at the
specified priority.
|
static java.lang.String |
registerNewFFmpegPipe(android.content.Context context)
Creates a new named pipe to use in
FFmpeg operations. |
static void |
resetStatistics()
Resets last received statistics.
|
static int |
setEnvironmentVariable(java.lang.String variableName,
java.lang.String variableValue)
Sets an environment variable.
|
static int |
setFontconfigConfigurationPath(java.lang.String path)
Sets and overrides
fontconfig configuration directory. |
static void |
setFontDirectory(android.content.Context context,
java.lang.String fontDirectoryPath,
java.util.Map<java.lang.String,java.lang.String> fontNameMapping)
Registers fonts inside the given path, so they are available to use in FFmpeg filters.
|
static void |
setLogLevel(Level level)
Sets log level.
|
public static final int RETURN_CODE_SUCCESS
public static final int RETURN_CODE_CANCEL
public static final java.lang.String TAG
public static final java.lang.String MOBILE_FFMPEG_PIPE_PREFIX
public static void enableRedirection()
Enables log and statistics redirection.
When redirection is not enabled FFmpeg/FFprobe logs are printed to stderr. By enabling redirection, they are routed to Logcat and can be routed further to a callback function.
Statistics redirection behaviour is similar. Statistics are not printed at all if
redirection is not enabled. If it is enabled then it is possible to define a statistics
callback function but if you don't, they are not printed anywhere and only saved as
lastReceivedStatistics
data which can be polled with
getLastReceivedStatistics()
.
Note that redirection is enabled by default. If you do not want to use its functionality
please use disableRedirection()
to disable it.
public static void disableRedirection()
Disables log and statistics redirection.
public static Level getLogLevel()
public static void setLogLevel(Level level)
level
- log levelpublic static void enableLogCallback(LogCallback newLogCallback)
Sets a callback function to redirect FFmpeg/FFprobe logs.
newLogCallback
- new log callback function or NULL to disable a previously defined callbackpublic static void enableStatisticsCallback(StatisticsCallback statisticsCallback)
Sets a callback function to redirect FFmpeg statistics.
statisticsCallback
- new statistics callback function or NULL to disable a previously defined callbackpublic static Statistics getLastReceivedStatistics()
Returns the last received statistics data.
public static void resetStatistics()
Resets last received statistics. It is recommended to call it before starting a new execution.
public static int setFontconfigConfigurationPath(java.lang.String path)
Sets and overrides fontconfig
configuration directory.
path
- directory which contains fontconfig configuration (fonts.conf)public static void setFontDirectory(android.content.Context context, java.lang.String fontDirectoryPath, java.util.Map<java.lang.String,java.lang.String> fontNameMapping)
Registers fonts inside the given path, so they are available to use in FFmpeg filters.
Note that you need to build MobileFFmpeg
with fontconfig
enabled or use a prebuilt package with fontconfig
inside to use this feature.
context
- application context to access application datafontDirectoryPath
- directory which contains fonts (.ttf and .otf files)fontNameMapping
- custom font name mappings, useful to access your fonts with more friendly namespublic static java.lang.String getPackageName()
Returns package name.
public static java.util.List<java.lang.String> getExternalLibraries()
Returns supported external libraries.
public static java.lang.String registerNewFFmpegPipe(android.content.Context context)
Creates a new named pipe to use in FFmpeg
operations.
Please note that creator is responsible of closing created pipes.
context
- application contextpublic static void closeFFmpegPipe(java.lang.String ffmpegPipePath)
Closes a previously created FFmpeg
pipe.
ffmpegPipePath
- full path of ffmpeg pipepublic static java.util.List<java.lang.String> getSupportedCameraIds(android.content.Context context)
context
- application contextpublic static java.lang.String getFFmpegVersion()
Returns FFmpeg version bundled within the library.
public static java.lang.String getVersion()
Returns MobileFFmpeg library version.
public static boolean isLTSBuild()
Returns whether MobileFFmpeg release is a long term release or not.
public static java.lang.String getBuildDate()
Returns MobileFFmpeg library build date.
public static int getLastReturnCode()
Returns return code of last executed command.
public static java.lang.String getLastCommandOutput()
Returns log output of last executed single FFmpeg/FFprobe command.
This method does not support executing multiple concurrent commands. If you execute multiple commands at the same time, this method will return output from all executions.
Please note that disabling redirection using disableRedirection()
method
also disables this functionality.
public static void printLastCommandOutput(int logPriority)
Prints the output of the last executed FFmpeg/FFprobe command to the Logcat at the specified priority.
This method does not support executing multiple concurrent commands. If you execute multiple commands at the same time, this method will print output from all executions.
logPriority
- one of Log.VERBOSE
, Log.DEBUG
, Log.INFO
,
Log.WARN
, Log.ERROR
, Log.ASSERT
public static int setEnvironmentVariable(java.lang.String variableName, java.lang.String variableValue)
Sets an environment variable.
variableName
- environment variable namevariableValue
- environment variable valuepublic static void ignoreSignal(Signal signal)
Registers a new ignored signal. Ignored signals are not handled by the library.
signal
- signal number to ignore