# FFmpegKit Linux API: ffmpegkit::FFmpegSession Class Reference

ffmpegkit::FFmpegSession Class Reference

`#include <FFmpegSession.h>`

## Data Structures

struct | PublicFFmpegSession

## Public Member Functions

ffmpegkit::StatisticsCallback | getStatisticsCallback ()
ffmpegkit::FFmpegSessionCompleteCallback | getCompleteCallback ()
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > | getAllStatisticsWithTimeout (const int waitTimeout)
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > | getAllStatistics ()
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > | getStatistics ()
std::shared_ptr< ffmpegkit::Statistics > | getLastReceivedStatistics ()
void | addStatistics (const std::shared_ptr< ffmpegkit::Statistics > statistics)
bool | isFFmpeg () const override
bool | isFFprobe () const override
bool | isMediaInformation () const override
Public Member Functions inherited from ffmpegkit::AbstractSession
| AbstractSession (const std::list< std::string > &arguments, const ffmpegkit::LogCallback logCallback, const LogRedirectionStrategy logRedirectionStrategy)
void | waitForAsynchronousMessagesInTransmit (const int timeout) const
ffmpegkit::LogCallback | getLogCallback () const override
long | getSessionId () const override
std::chrono::time_point< std::chrono::system_clock > | getCreateTime () const override
std::chrono::time_point< std::chrono::system_clock > | getStartTime () const override
std::chrono::time_point< std::chrono::system_clock > | getEndTime () const override
long | getDuration () const override
std::shared_ptr< std::list< std::string > > | getArguments () const override
std::string | getCommand () const override
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getAllLogsWithTimeout (const int waitTimeout) const override
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getAllLogs () const override
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > | getLogs () const override
std::string | getAllLogsAsStringWithTimeout (const int waitTimeout) const override
std::string | getAllLogsAsString () const override
std::string | getLogsAsString () const override
std::string | getOutput () const override
ffmpegkit::SessionState | getState () const override
std::shared_ptr< ffmpegkit::ReturnCode > | getReturnCode () const override
std::string | getFailStackTrace () const override
ffmpegkit::LogRedirectionStrategy | getLogRedirectionStrategy () const override
bool | thereAreAsynchronousMessagesInTransmit () const override
void | addLog (const std::shared_ptr< ffmpegkit::Log > log) override
void | startRunning () override
void | complete (const std::shared_ptr< ffmpegkit::ReturnCode > returnCode) override
void | fail (const char *error) override
virtual bool | isFFmpeg () const override
virtual bool | isFFprobe () const override
virtual bool | isMediaInformation () const override
void | cancel () override
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

## Static Public Member Functions

static std::shared_ptr< ffmpegkit::FFmpegSession > | create (const std::list< std::string > &arguments)
static std::shared_ptr< ffmpegkit::FFmpegSession > | create (const std::list< std::string > &arguments, ffmpegkit::FFmpegSessionCompleteCallback completeCallback)
static std::shared_ptr< ffmpegkit::FFmpegSession > | create (const std::list< std::string > &arguments, ffmpegkit::FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback)
static std::shared_ptr< ffmpegkit::FFmpegSession > | create (const std::list< std::string > &arguments, ffmpegkit::FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback, ffmpegkit::LogRedirectionStrategy logRedirectionStrategy)

## Private Member Functions

| FFmpegSession (const std::list< std::string > &arguments, ffmpegkit::FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback, ffmpegkit::LogRedirectionStrategy logRedirectionStrategy)

## Private Attributes

ffmpegkit::StatisticsCallback | _statisticsCallback
FFmpegSessionCompleteCallback | _completeCallback
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > | _statistics

## Additional Inherited Members

Static Public Attributes inherited from ffmpegkit::AbstractSession
static constexpr int | DefaultTimeoutForAsynchronousMessagesInTransmit = 5000

## Detailed Description

An FFmpeg session.

Definition at line 32 of file FFmpegSession.h.

## Constructor & Destructor Documentation

## FFmpegSession()

ffmpegkit::FFmpegSession::FFmpegSession | ( | const std::list< std::string > & | arguments,
|  | ffmpegkit::FFmpegSessionCompleteCallback | completeCallback,
|  | ffmpegkit::LogCallback | logCallback,
|  | ffmpegkit::StatisticsCallback | statisticsCallback,
|  | ffmpegkit::LogRedirectionStrategy | logRedirectionStrategy
| ) |  |

private

Builds a new FFmpeg session.

Parameters

  arguments | command arguments
  completeCallback | session specific complete callback
  logCallback | session specific log callback
  statisticsCallback | session specific statistics callback
  logRedirectionStrategy | session specific log redirection strategy

Definition at line 57 of file FFmpegSession.cpp.

## Member Function Documentation

## addStatistics()

void ffmpegkit::FFmpegSession::addStatistics | ( | const std::shared_ptr< ffmpegkit::Statistics > | statistics | ) |

Adds a new statistics entry for this session. It is invoked internally by `FFmpegKit` library methods. Must not be used by user applications.

Parameters

  statistics | statistics entry

Definition at line 95 of file FFmpegSession.cpp.

## create() [1/4]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegSession::create | ( | const std::list< std::string > & | arguments | ) |

static

Builds a new FFmpeg session.

Parameters

  arguments | command arguments

Definition at line 27 of file FFmpegSession.cpp.

## create() [2/4]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegSession::create | ( | const std::list< std::string > & | arguments,
|  | ffmpegkit::FFmpegSessionCompleteCallback | completeCallback
| ) |  |

static

Builds a new FFmpeg session.

Parameters

  arguments | command arguments
  completeCallback | session specific complete callback

Definition at line 33 of file FFmpegSession.cpp.

## create() [3/4]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegSession::create | ( | const std::list< std::string > & | arguments,
|  | ffmpegkit::FFmpegSessionCompleteCallback | completeCallback,
|  | ffmpegkit::LogCallback | logCallback,
|  | ffmpegkit::StatisticsCallback | statisticsCallback
| ) |  |

static

Builds a new FFmpeg session.

Parameters

  arguments | command arguments
  completeCallback | session specific complete callback
  logCallback | session specific log callback
  statisticsCallback | session specific statistics callback

Definition at line 39 of file FFmpegSession.cpp.

## create() [4/4]

std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegkit::FFmpegSession::create | ( | const std::list< std::string > & | arguments,
|  | ffmpegkit::FFmpegSessionCompleteCallback | completeCallback,
|  | ffmpegkit::LogCallback | logCallback,
|  | ffmpegkit::StatisticsCallback | statisticsCallback,
|  | ffmpegkit::LogRedirectionStrategy | logRedirectionStrategy
| ) |  |

static

Builds a new FFmpeg session.

Parameters

  arguments | command arguments
  completeCallback | session specific complete callback
  logCallback | session specific log callback
  statisticsCallback | session specific statistics callback
  logRedirectionStrategy | session specific log redirection strategy

Definition at line 45 of file FFmpegSession.cpp.

## getAllStatistics()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > ffmpegkit::FFmpegSession::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 AbstractSessionDefaultTimeoutForAsynchronousMessagesInTransmit expires.

Returns
  list of statistics entries generated for this session

Definition at line 79 of file FFmpegSession.cpp.

## getAllStatisticsWithTimeout()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > ffmpegkit::FFmpegSession::getAllStatisticsWithTimeout | ( | const 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

Definition at line 69 of file FFmpegSession.cpp.

## getCompleteCallback()

ffmpegkit::FFmpegSessionCompleteCallback ffmpegkit::FFmpegSession::getCompleteCallback | ( |  | ) |

Returns the session specific complete callback.

Returns
  session specific complete callback

Definition at line 65 of file FFmpegSession.cpp.

## getLastReceivedStatistics()

std::shared_ptr< ffmpegkit::Statistics > ffmpegkit::FFmpegSession::getLastReceivedStatistics | ( |  | ) |

Returns the last received statistics entry.

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

Definition at line 87 of file FFmpegSession.cpp.

## getStatistics()

std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Statistics > > > ffmpegkit::FFmpegSession::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

Definition at line 83 of file FFmpegSession.cpp.

## getStatisticsCallback()

ffmpegkit::StatisticsCallback ffmpegkit::FFmpegSession::getStatisticsCallback | ( |  | ) |

Returns the session specific statistics callback.

Returns
  session specific statistics callback

Definition at line 61 of file FFmpegSession.cpp.

## isFFmpeg()

bool ffmpegkit::FFmpegSession::isFFmpeg | ( |  | ) | const

overridevirtual

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

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

Reimplemented from ffmpegkit::AbstractSession.

Definition at line 99 of file FFmpegSession.cpp.

## isFFprobe()

bool ffmpegkit::FFmpegSession::isFFprobe | ( |  | ) | const

overridevirtual

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

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

Reimplemented from ffmpegkit::AbstractSession.

Definition at line 103 of file FFmpegSession.cpp.

## isMediaInformation()

bool ffmpegkit::FFmpegSession::isMediaInformation | ( |  | ) | const

overridevirtual

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

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

Reimplemented from ffmpegkit::AbstractSession.

Definition at line 107 of file FFmpegSession.cpp.

## Field Documentation

## _completeCallback

FFmpegSessionCompleteCallback ffmpegkit::FFmpegSession::_completeCallback

private

Definition at line 165 of file FFmpegSession.h.

## _statistics

std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Statistics> > > ffmpegkit::FFmpegSession::_statistics

private

Definition at line 166 of file FFmpegSession.h.

## _statisticsCallback

ffmpegkit::StatisticsCallback ffmpegkit::FFmpegSession::_statisticsCallback

private

Definition at line 164 of file FFmpegSession.h.

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

- FFmpegSession.h
- FFmpegSession.cpp