Package com.arthenica.ffmpegkit

## Class FFmpegSession

- java.lang.Object
- - com.arthenica.ffmpegkit.AbstractSession
  - - com.arthenica.ffmpegkit.FFmpegSession

All Implemented Interfaces:
  `Session`

    public class FFmpegSession
    extends AbstractSession
    implements Session

An FFmpeg session.

### Field Summary

### Fields inherited from class com.arthenica.ffmpegkit.AbstractSession

`arguments, createTime, DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT, endTime, executeCallback, failStackTrace, future, logCallback, logRedirectionStrategy, logs, logsLock, returnCode, sessionId, sessionIdGenerator, startTime, state`

### Constructor Summary

Constructors
`FFmpegSession​(java.lang.String[] arguments)` Builds a new FFmpeg session.
`FFmpegSession​(java.lang.String[] arguments, ExecuteCallback executeCallback)` Builds a new FFmpeg session.
`FFmpegSession​(java.lang.String[] arguments, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback)` Builds a new FFmpeg session.
`FFmpegSession​(java.lang.String[] arguments, ExecuteCallback executeCallback, LogCallback logCallback, StatisticsCallback statisticsCallback, LogRedirectionStrategy logRedirectionStrategy)` Builds a new FFmpeg session.

### Method Summary

All Methods Instance Methods Concrete Methods
`void` `addStatistics​(Statistics statistics)` Adds a new statistics entry for this session.
`java.util.List<Statistics>` `getAllStatistics()` Returns all statistics entries generated for this session.
`java.util.List<Statistics>` `getAllStatistics​(int waitTimeout)` Returns all statistics entries generated for this session.
`Statistics` `getLastReceivedStatistics()` Returns the last received statistics entry.
`java.util.List<Statistics>` `getStatistics()` Returns all statistics entries delivered for this session.
`StatisticsCallback` `getStatisticsCallback()` Returns the session specific statistics callback function.
`boolean` `isFFmpeg()` Returns whether it is an `FFmpeg` session or not.
`boolean` `isFFprobe()` Returns whether it is an `FFprobe` session or not.
`java.lang.String` `toString()`

### Methods inherited from class com.arthenica.ffmpegkit.AbstractSession

`addLog, cancel, getAllLogs, getAllLogs, getAllLogsAsString, getAllLogsAsString, getArguments, getCommand, getCreateTime, getDuration, getEndTime, getExecuteCallback, getFailStackTrace, getFuture, getLogCallback, getLogRedirectionStrategy, getLogs, getLogsAsString, getOutput, getReturnCode, getSessionId, getStartTime, getState, thereAreAsynchronousMessagesInTransmit, waitForAsynchronousMessagesInTransmit`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

### Methods inherited from interface com.arthenica.ffmpegkit.Session

`addLog, cancel, getAllLogs, getAllLogs, getAllLogsAsString, getAllLogsAsString, getArguments, getCommand, getCreateTime, getDuration, getEndTime, getExecuteCallback, getFailStackTrace, getFuture, getLogCallback, getLogRedirectionStrategy, getLogs, getLogsAsString, getOutput, getReturnCode, getSessionId, getStartTime, getState, thereAreAsynchronousMessagesInTransmit`

### Constructor Detail

#### FFmpegSession

    public FFmpegSession​(java.lang.String[] arguments)

Builds a new FFmpeg session.

Parameters:
  `arguments` - command arguments

#### FFmpegSession

    public FFmpegSession​(java.lang.String[] arguments,
                         ExecuteCallback executeCallback)

Builds a new FFmpeg session.

Parameters:
  `arguments` - command arguments
  `executeCallback` - session specific execute callback function

#### FFmpegSession

    public FFmpegSession​(java.lang.String[] arguments,
                         ExecuteCallback executeCallback,
                         LogCallback logCallback,
                         StatisticsCallback statisticsCallback)

Builds a new FFmpeg session.

Parameters:
  `arguments` - command arguments
  `executeCallback` - session specific execute callback function
  `logCallback` - session specific log callback function
  `statisticsCallback` - session specific statistics callback function

#### FFmpegSession

    public FFmpegSession​(java.lang.String[] arguments,
                         ExecuteCallback executeCallback,
                         LogCallback logCallback,
                         StatisticsCallback statisticsCallback,
                         LogRedirectionStrategy logRedirectionStrategy)

Builds a new FFmpeg session.

Parameters:
  `arguments` - command arguments
  `executeCallback` - session specific execute callback function
  `logCallback` - session specific log callback function
  `statisticsCallback` - session specific statistics callback function
  `logRedirectionStrategy` - session specific log redirection strategy

### Method Detail

#### getStatisticsCallback

    public StatisticsCallback getStatisticsCallback()

Returns the session specific statistics callback function.

Returns:
  session specific statistics callback function

#### getAllStatistics

    public java.util.List<Statistics> getAllStatistics​(int waitTimeout)

Returns all statistics entries generated for this session. If there are asynchronous messages that are not delivered yet, this method waits for them until the given timeout.

Parameters:
  `waitTimeout` - wait timeout for asynchronous messages in milliseconds
Returns:
  list of statistics entries generated for this session

#### getAllStatistics

    public java.util.List<Statistics> getAllStatistics()

Returns all statistics entries generated for this session. If there are asynchronous messages that are not delivered yet, this method waits for them until `AbstractSession.DEFAULT_TIMEOUT_FOR_ASYNCHRONOUS_MESSAGES_IN_TRANSMIT` expires.

Returns:
  list of statistics entries generated for this session

#### getStatistics

    public java.util.List<Statistics> getStatistics()

Returns all statistics entries delivered for this session. Note that if there are asynchronous messages that are not delivered yet, this method will not wait for them and will return immediately.

Returns:
  list of statistics entries received for this session

#### getLastReceivedStatistics

    public Statistics getLastReceivedStatistics()

Returns the last received statistics entry.

Returns:
  the last received statistics entry or null if there are not any statistics entries received

#### addStatistics

    public void addStatistics​(Statistics statistics)

Adds a new statistics entry for this session.

Parameters:
  `statistics` - statistics entry

#### isFFmpeg

    public boolean isFFmpeg()

Description copied from interface: `Session`
Returns whether it is an `FFmpeg` session or not.

Specified by:
  `isFFmpeg` in interface `Session`
Returns:
  true if it is an `FFmpeg` session, false otherwise

#### isFFprobe

    public boolean isFFprobe()

Description copied from interface: `Session`
Returns whether it is an `FFprobe` session or not.

Specified by:
  `isFFprobe` in interface `Session`
Returns:
  true if it is an `FFprobe` session, false otherwise

#### toString

    public java.lang.String toString()

Overrides:
  `toString` in class `java.lang.Object`