-
- All Implemented Interfaces:
-
com.arthenica.ffmpegkit.Session
public abstract class AbstractSession implements Session
Abstract session implementation which includes common features shared by
FFmpeg,FFprobeandMediaInformationsessions.
-
-
Field Summary
Fields Modifier and Type Field Description public final static intDEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMITprotected final longsessionIdprotected final LogCallbacklogCallbackprotected final DatecreateTimeprotected DatestartTimeprotected DateendTimeprotected final Array<String>argumentsprotected final List<Log>logsprotected Future<out Object>futureprotected SessionStatestateprotected ReturnCodereturnCodeprotected StringfailStackTraceprotected final LogRedirectionStrategylogRedirectionStrategy
-
Method Summary
Modifier and Type Method Description longgetSessionId()Returns the session identifier. LogCallbackgetLogCallback()Returns the session specific log callback. DategetCreateTime()Returns session create time. DategetStartTime()Returns session start time. DategetEndTime()Returns session end time. Array<String>getArguments()Returns command arguments as an array. List<Log>getLogs()Returns all log entries delivered for this session. Future<out Object>getFuture()Returns the future created for this session, if it is executed asynchronously. voidsetFuture(Future<out Object> future)Sets the future created for this session. SessionStategetState()Returns the state of the session. ReturnCodegetReturnCode()Returns the return code for this session. StringgetFailStackTrace()Returns the stack trace of the exception received while executing this session. LogRedirectionStrategygetLogRedirectionStrategy()Returns session specific log redirection strategy. longgetDuration()Returns the time taken to execute this session. StringgetCommand()Returns command arguments as a concatenated string. List<Log>getAllLogs(int waitTimeout)Returns all log entries generated for this session. List<Log>getAllLogs()Returns all log entries generated for this session. StringgetAllLogsAsString(int waitTimeout)Returns all log entries generated for this session as a concatenated string. StringgetAllLogsAsString()Returns all log entries generated for this session as a concatenated string. StringgetLogsAsString()Returns all log entries delivered for this session as a concatenated string. StringgetOutput()Returns the log output generated while running the session. booleanthereAreAsynchronousMessagesInTransmit()Returns whether there are still asynchronous messages being transmitted for thissession or not. voidaddLog(Log log)Adds a new log entry for this session. voidcancel()Cancels running the session. -
-
Method Detail
-
getSessionId
long getSessionId()
Returns the session identifier.
-
getLogCallback
LogCallback getLogCallback()
Returns the session specific log callback.
-
getCreateTime
Date getCreateTime()
Returns session create time.
-
getStartTime
Date getStartTime()
Returns session start time.
-
getEndTime
Date getEndTime()
Returns session end time.
-
getArguments
Array<String> getArguments()
Returns command arguments as an array.
-
getLogs
List<Log> getLogs()
Returns all log entries delivered for this session. Note that if there are asynchronous logmessages that are not delivered yet, this method will not wait for them and will returnimmediately.
-
getFuture
Future<out Object> getFuture()
Returns the future created for this session, if it is executed asynchronously.
-
setFuture
void setFuture(Future<out Object> future)
Sets the future created for this session.
- Parameters:
future- future that runs this session asynchronously
-
getState
SessionState getState()
Returns the state of the session.
-
getReturnCode
ReturnCode getReturnCode()
Returns the return code for this session. Note that return code is only set for sessionsthat end with COMPLETED state. If a session is not started, still running or failed thenthis method returns null.
-
getFailStackTrace
String getFailStackTrace()
Returns the stack trace of the exception received while executing this session.
The stack trace is only set for sessions that end with FAILED state. For sessions that hasCOMPLETED state this method returns null.
-
getLogRedirectionStrategy
LogRedirectionStrategy getLogRedirectionStrategy()
Returns session specific log redirection strategy.
-
getDuration
long getDuration()
Returns the time taken to execute this session.
-
getCommand
String getCommand()
Returns command arguments as a concatenated string.
-
getAllLogs
List<Log> getAllLogs(int waitTimeout)
Returns all log entries generated for this session. If there are asynchronousmessages that are not delivered yet, this method waits for them until the given timeout.
- Parameters:
waitTimeout- wait timeout for asynchronous messages in milliseconds
-
getAllLogs
List<Log> getAllLogs()
Returns all log entries generated for this session. If there are asynchronousmessages that are not delivered yet, this method waits for them until DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT expires.
-
getAllLogsAsString
String getAllLogsAsString(int waitTimeout)
Returns all log entries generated for this session as a concatenated string. If there areasynchronous messages that are not delivered yet, this method waits for them untilthe given timeout.
- Parameters:
waitTimeout- wait timeout for asynchronous messages in milliseconds
-
getAllLogsAsString
String getAllLogsAsString()
Returns all log entries generated for this session as a concatenated string. If there areasynchronous messages that are not delivered yet, this method waits for them until DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT expires.
-
getLogsAsString
String getLogsAsString()
Returns all log entries delivered for this session as a concatenated string. Note that ifthere are asynchronous log messages that are not delivered yet, this method will not waitfor them and will return immediately.
-
thereAreAsynchronousMessagesInTransmit
boolean thereAreAsynchronousMessagesInTransmit()
Returns whether there are still asynchronous messages being transmitted for thissession or not.
-
addLog
void addLog(Log log)
Adds a new log entry for this session.
It is invoked internally by
FFmpegKitlibrary methods. Must not be used by userapplications.- Parameters:
log- log entry
-
cancel
void cancel()
Cancels running the session.
-
-
-
-