| FFmpegKit iOS / macOS / tvOS API 4.5

Instance Methods
<Session> Protocol Reference

`#import <Session.h>`

## Instance Methods
(ExecuteCallback) | - getExecuteCallback
(LogCallback) | - getLogCallback
(long) | - getSessionId
(NSDate *) | - getCreateTime
(NSDate *) | - getStartTime
(NSDate *) | - getEndTime
(long) | - getDuration
(NSArray *) | - getArguments
(NSString *) | - getCommand
(NSArray *) | - getAllLogsWithTimeout:
(NSArray *) | - getAllLogs
(NSArray *) | - getLogs
(NSString *) | - getAllLogsAsStringWithTimeout:
(NSString *) | - getAllLogsAsString
(NSString *) | - getLogsAsString
(NSString *) | - getOutput
(SessionState) | - getState
(ReturnCode *) | - getReturnCode
(NSString *) | - getFailStackTrace
(LogRedirectionStrategy) | - getLogRedirectionStrategy
(BOOL) | - thereAreAsynchronousMessagesInTransmit
(void) | - addLog:
(void) | - startRunning
(void) | - complete:
(void) | - fail:
(BOOL) | - isFFmpeg
(BOOL) | - isFFprobe
(void) | - cancel

## Detailed Description

Common interface for all `FFmpegKit` sessions.

Definition at line 34 of file Session.h.

## Method Documentation

## ◆ addLog:

- (void) addLog: |  | (Log *) | log |
| required

Adds a new log entry for this session.

Parameters

  log | log entry

Reimplemented in AbstractSession.

## ◆ cancel

- (void) cancel |  |  |
| required

Cancels running the session.

Reimplemented in AbstractSession.

## ◆ complete:

- (void) complete: |  | (ReturnCode *) | returnCode |
| required

Completes running the session with the provided return code.

Parameters

  returnCode | return code of the execution

Reimplemented in AbstractSession.

## ◆ fail:

- (void) fail: |  | (NSException *) | exception |
| required

Ends running the session with a failure.

Parameters

  exception | execution received

Reimplemented in AbstractSession.

## ◆ getAllLogs

- (NSArray *) getAllLogs |  |  |
| required

Returns all log entries generated for this session. If there are asynchronous messages that are not delivered yet, this method waits for them.

Returns
  list of log entries generated for this session

Reimplemented in AbstractSession.

## ◆ getAllLogsAsString

- (NSString *) getAllLogsAsString |  |  |
| required

Returns all log entries generated for this session as a concatenated string. If there are asynchronous messages that are not delivered yet, this method waits for them.

Returns
  all log entries generated for this session as a concatenated string

Reimplemented in AbstractSession.

## ◆ getAllLogsAsStringWithTimeout:

- (NSString *) getAllLogsAsStringWithTimeout: |  | (int) | waitTimeout |
| required

Returns all log entries generated for this session as a concatenated string. 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
  all log entries generated for this session as a concatenated string

Reimplemented in AbstractSession.

## ◆ getAllLogsWithTimeout:

- (NSArray *) getAllLogsWithTimeout: |  | (int) | waitTimeout |
| required

Returns all log 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 log entries generated for this session

Reimplemented in AbstractSession.

## ◆ getArguments

- (NSArray *) getArguments |  |  |
| required

Returns command arguments as an array.

Returns
  command arguments as an array

Reimplemented in AbstractSession.

## ◆ getCommand

- (NSString *) getCommand |  |  |
| required

Returns command arguments as a concatenated string.

Returns
  command arguments as a concatenated string

Reimplemented in AbstractSession.

## ◆ getCreateTime

- (NSDate *) getCreateTime |  |  |
| required

Returns session create time.

Returns
  session create time

Reimplemented in AbstractSession.

## ◆ getDuration

- (long) getDuration |  |  |
| required

Returns the time taken to execute this session.

Returns
  time taken to execute this session in milliseconds or zero (0) if the session is not over yet

Reimplemented in AbstractSession.

## ◆ getEndTime

- (NSDate *) getEndTime |  |  |
| required

Returns session end time.

Returns
  session end time

Reimplemented in AbstractSession.

## ◆ getExecuteCallback

- (ExecuteCallback) getExecuteCallback |  |  |
| required

Returns the session specific execute callback.

Returns
  session specific execute callback

Reimplemented in AbstractSession.

## ◆ getFailStackTrace

- (NSString *) getFailStackTrace |  |  |
| required

Returns the stack trace of the exception received while executing this session.

The stack trace is only set for sessions that end with SessionStateFailed state. For sessions that has SessionStateCompleted state this method returns nil.

Returns
  stack trace of the exception received while executing this session, nil if session is not started, still running or completed

Reimplemented in AbstractSession.

## ◆ getLogCallback

- (LogCallback) getLogCallback |  |  |
| required

Returns the session specific log callback.

Returns
  session specific log callback

Reimplemented in AbstractSession.

## ◆ getLogRedirectionStrategy

- (LogRedirectionStrategy) getLogRedirectionStrategy |  |  |
| required

Returns session specific log redirection strategy.

Returns
  session specific log redirection strategy

Reimplemented in AbstractSession.

## ◆ getLogs

- (NSArray *) getLogs |  |  |
| required

Returns all log 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 log entries received for this session

Reimplemented in AbstractSession.

## ◆ getLogsAsString

- (NSString *) getLogsAsString |  |  |
| required

Returns all log entries delivered for this session as a concatenated string. 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 log entries received for this session

Reimplemented in AbstractSession.

## ◆ getOutput

- (NSString *) getOutput |  |  |
| required

Returns the log output generated while running the session.

Returns
  log output generated

Reimplemented in AbstractSession.

## ◆ getReturnCode

- (ReturnCode *) getReturnCode |  |  |
| required

Returns the return code for this session. Note that return code is only set for sessions that end with SessionStateCompleted state. If a session is not started, still running or failed then this method returns nil.

Returns
  the return code for this session if the session is completed, nil if session is not started, still running or failed

Reimplemented in AbstractSession.

## ◆ getSessionId

- (long) getSessionId |  |  |
| required

Returns the session identifier.

Returns
  session identifier

Reimplemented in AbstractSession.

## ◆ getStartTime

- (NSDate *) getStartTime |  |  |
| required

Returns session start time.

Returns
  session start time

Reimplemented in AbstractSession.

## ◆ getState

- (SessionState) getState |  |  |
| required

Returns the state of the session.

Returns
  state of the session

Reimplemented in AbstractSession.

## ◆ isFFmpeg

- (BOOL) isFFmpeg |  |  |
| required

Returns whether it is an `FFmpeg` session or not.

Returns
  true if it is an `FFmpeg` session, false otherwise

Reimplemented in AbstractSession, FFmpegSession, and FFprobeSession.

## ◆ isFFprobe

- (BOOL) isFFprobe |  |  |
| required

Returns whether it is an `FFprobe` session or not.

Returns
  true if it is an `FFprobe` session, false otherwise

Reimplemented in AbstractSession, FFmpegSession, and FFprobeSession.

## ◆ startRunning

- (void) startRunning |  |  |
| required

Starts running the session.

Reimplemented in AbstractSession.

## ◆ thereAreAsynchronousMessagesInTransmit

- (BOOL) thereAreAsynchronousMessagesInTransmit |  |  |
| required

Returns whether there are still asynchronous messages being transmitted for this session or not.

Returns
  true if there are still asynchronous messages being transmitted, false otherwise

Reimplemented in AbstractSession.

The documentation for this protocol was generated from the following file:

- Session.h