# FFmpegKit Linux API: ffmpegkit::Session Class Reference

ffmpegkit::Session Class Referenceabstract

`#include <Session.h>`

## Public Member Functions

virtual ffmpegkit::LogCallback | getLogCallback () const =0
virtual long | getSessionId () const =0
virtual std::chrono::time_point< std::chrono::system_clock > | getCreateTime () const =0
virtual std::chrono::time_point< std::chrono::system_clock > | getStartTime () const =0
virtual std::chrono::time_point< std::chrono::system_clock > | getEndTime () const =0
virtual long | getDuration () const =0
virtual std::shared_ptr< std::list< std::string > > | getArguments () const =0
virtual std::string | getCommand () const =0
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getAllLogsWithTimeout (const int waitTimeout) const =0
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getAllLogs () const =0
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getLogs () const =0
virtual std::string | getAllLogsAsStringWithTimeout (const int waitTimeout) const =0
virtual std::string | getAllLogsAsString () const =0
virtual std::string | getLogsAsString () const =0
virtual std::string | getOutput () const =0
virtual ffmpegkit::SessionState | getState () const =0
virtual std::shared_ptr< ffmpegkit::ReturnCode > | getReturnCode () const =0
virtual std::string | getFailStackTrace () const =0
virtual LogRedirectionStrategy | getLogRedirectionStrategy () const =0
virtual bool | thereAreAsynchronousMessagesInTransmit () const =0
virtual void | addLog (const std::shared_ptr< ffmpegkit::Log > log)=0
virtual void | startRunning ()=0
virtual void | complete (const std::shared_ptr< ffmpegkit::ReturnCode > returnCode)=0
virtual void | fail (const char *error)=0
virtual bool | isFFmpeg () const =0
virtual bool | isFFprobe () const =0
virtual bool | isMediaInformation () const =0
virtual void | cancel ()=0

## Detailed Description

Common interface for all `FFmpegKit` sessions.

Definition at line 37 of file Session.h.

## Member Function Documentation

## addLog()

virtual void ffmpegkit::Session::addLog | ( | const std::shared_ptr< ffmpegkit::Log > | log | ) |

pure virtual

Adds a new log entry for this session.

It is invoked internally by `FFmpegKit` library methods. Must not be used by user applications.

Parameters

  log | log entry

Implemented in ffmpegkit::AbstractSession.

## cancel()

virtual void ffmpegkit::Session::cancel | ( |  | ) |

pure virtual

Cancels running the session.

Implemented in ffmpegkit::AbstractSession.

## complete()

virtual void ffmpegkit::Session::complete | ( | const std::shared_ptr< ffmpegkit::ReturnCode > | returnCode | ) |

pure virtual

Completes running the session with the provided return code.

Parameters

  returnCode | return code of the execution

Implemented in ffmpegkit::AbstractSession.

## fail()

virtual void ffmpegkit::Session::fail | ( | const char * | error | ) |

pure virtual

Ends running the session with a failure.

Parameters

  error | error received

Implemented in ffmpegkit::AbstractSession.

## getAllLogs()

virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > ffmpegkit::Session::getAllLogs | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getAllLogsAsString()

virtual std::string ffmpegkit::Session::getAllLogsAsString | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getAllLogsAsStringWithTimeout()

virtual std::string ffmpegkit::Session::getAllLogsAsStringWithTimeout | ( | const int | waitTimeout | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getAllLogsWithTimeout()

virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > ffmpegkit::Session::getAllLogsWithTimeout | ( | const int | waitTimeout | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getArguments()

virtual std::shared_ptr< std::list< std::string > > ffmpegkit::Session::getArguments | ( |  | ) | const

pure virtual

Returns command arguments as a list.

Returns
  command arguments as a list

Implemented in ffmpegkit::AbstractSession.

## getCommand()

virtual std::string ffmpegkit::Session::getCommand | ( |  | ) | const

pure virtual

Returns command arguments as a concatenated string.

Returns
  command arguments as a concatenated string

Implemented in ffmpegkit::AbstractSession.

## getCreateTime()

virtual std::chrono::time_point< std::chrono::system_clock > ffmpegkit::Session::getCreateTime | ( |  | ) | const

pure virtual

Returns session create time.

Returns
  session create time

Implemented in ffmpegkit::AbstractSession.

## getDuration()

virtual long ffmpegkit::Session::getDuration | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getEndTime()

virtual std::chrono::time_point< std::chrono::system_clock > ffmpegkit::Session::getEndTime | ( |  | ) | const

pure virtual

Returns session end time.

Returns
  session end time

Implemented in ffmpegkit::AbstractSession.

## getFailStackTrace()

virtual std::string ffmpegkit::Session::getFailStackTrace | ( |  | ) | const

pure virtual

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 an empty string.

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

Implemented in ffmpegkit::AbstractSession.

## getLogCallback()

virtual ffmpegkit::LogCallback ffmpegkit::Session::getLogCallback | ( |  | ) | const

pure virtual

Returns the session specific log callback.

Returns
  session specific log callback

Implemented in ffmpegkit::AbstractSession.

## getLogRedirectionStrategy()

virtual LogRedirectionStrategy ffmpegkit::Session::getLogRedirectionStrategy | ( |  | ) | const

pure virtual

Returns session specific log redirection strategy.

Returns
  session specific log redirection strategy

Implemented in ffmpegkit::AbstractSession.

## getLogs()

virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > ffmpegkit::Session::getLogs | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getLogsAsString()

virtual std::string ffmpegkit::Session::getLogsAsString | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

## getOutput()

virtual std::string ffmpegkit::Session::getOutput | ( |  | ) | const

pure virtual

Returns the log output generated while running the session.

Returns
  log output generated

Implemented in ffmpegkit::AbstractSession.

## getReturnCode()

virtual std::shared_ptr< ffmpegkit::ReturnCode > ffmpegkit::Session::getReturnCode | ( |  | ) | const

pure virtual

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 nullptr.

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

Implemented in ffmpegkit::AbstractSession.

## getSessionId()

virtual long ffmpegkit::Session::getSessionId | ( |  | ) | const

pure virtual

Returns the session identifier.

Returns
  session identifier

Implemented in ffmpegkit::AbstractSession.

## getStartTime()

virtual std::chrono::time_point< std::chrono::system_clock > ffmpegkit::Session::getStartTime | ( |  | ) | const

pure virtual

Returns session start time.

Returns
  session start time

Implemented in ffmpegkit::AbstractSession.

## getState()

virtual ffmpegkit::SessionState ffmpegkit::Session::getState | ( |  | ) | const

pure virtual

Returns the state of the session.

Returns
  state of the session

Implemented in ffmpegkit::AbstractSession.

## isFFmpeg()

virtual bool ffmpegkit::Session::isFFmpeg | ( |  | ) | const

pure virtual

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

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

Implemented in ffmpegkit::AbstractSession, ffmpegkit::FFmpegSession, ffmpegkit::FFprobeSession, and ffmpegkit::MediaInformationSession.

## isFFprobe()

virtual bool ffmpegkit::Session::isFFprobe | ( |  | ) | const

pure virtual

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

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

Implemented in ffmpegkit::AbstractSession, ffmpegkit::FFmpegSession, ffmpegkit::FFprobeSession, and ffmpegkit::MediaInformationSession.

## isMediaInformation()

virtual bool ffmpegkit::Session::isMediaInformation | ( |  | ) | const

pure virtual

Returns whether it is a `MediaInformation` session or not.

Returns
  true if it is a `MediaInformation` session, false otherwise

Implemented in ffmpegkit::AbstractSession, ffmpegkit::FFmpegSession, ffmpegkit::FFprobeSession, and ffmpegkit::MediaInformationSession.

## startRunning()

virtual void ffmpegkit::Session::startRunning | ( |  | ) |

pure virtual

Starts running the session.

Implemented in ffmpegkit::AbstractSession.

## thereAreAsynchronousMessagesInTransmit()

virtual bool ffmpegkit::Session::thereAreAsynchronousMessagesInTransmit | ( |  | ) | const

pure virtual

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

Implemented in ffmpegkit::AbstractSession.

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

- Session.h