| FFmpegKit Linux API 6.0

Loading...
Searching...
No Matches
Data Structures | Macros | Enumerations | Functions | Variables
FFmpegKitConfig.cpp File Reference

Go to the source code of this file.

## Data Structures
class | CallbackData

## Macros
#define | SESSION_MAP_SIZE 1000

## Enumerations
enum | CallbackType { LogType , StatisticsType }

## Functions
void | set_report_callback (void(*callback)(int, float, float, int64_t, double, double, double))
void | cancel_operation (long id)
static std::atomic< long > | pipeIndexGenerator (1)
int | ffmpeg_execute (int argc, char **argv)
int | ffprobe_execute (int argc, char **argv)
void | ffmpegkit_log_callback_function (void *ptr, int level, const char *format, va_list vargs)
void * | ffmpegKitInitialize ()
static bool | fs_exists (const std::string &s, const bool isFile, const bool isDirectory)
static bool | fs_create_dir (const std::string &s)
void | deleteExpiredSessions ()
void | addSessionToSessionHistory (const std::shared_ptr< ffmpegkit::Session > session)
static void | callbackWait (int milliSeconds)
static void | callbackNotify ()
static const char * | avutil_log_get_level_str (int level)
static void | avutil_log_format_line (void *avcl, int level, const char *fmt, va_list vl, AVBPrint part[4], int *print_prefix)
static void | avutil_log_sanitize (char *line)
static void | logCallbackDataAdd (int level, AVBPrint *data)
static void | statisticsCallbackDataAdd (int frameNumber, float fps, float quality, int64_t size, int time, double bitrate, double speed)
static CallbackData * | callbackDataRemove ()
static void | registerSessionId (long sessionId)
static void | removeSession (long sessionId)
void | cancelSession (long sessionId)
int | cancelRequested (long sessionId)
static void | resetMessagesInTransmit (long sessionId)
void | ffmpegkit_statistics_callback_function (int frameNumber, float fps, float quality, int64_t size, double time, double bitrate, double speed)
static void | process_log (long sessionId, int levelValueInt, AVBPrint *logMessage)
void | process_statistics (long sessionId, int videoFrameNumber, float videoFps, float videoQuality, long size, double time, double bitrate, double speed)
void * | callbackThreadFunction (void *pointer)
static int | executeFFmpeg (const long sessionId, const std::shared_ptr< std::list< std::string > > arguments)
int | executeFFprobe (const long sessionId, const std::shared_ptr< std::list< std::string > > arguments)

## Variables
static int | sessionHistorySize
static std::map< long, std::shared_ptr< ffmpegkit::Session > > | sessionHistoryMap
static std::list< std::shared_ptr< ffmpegkit::Session > > | sessionHistoryList
static std::recursive_mutex | sessionMutex
static std::atomic< short > | sessionMap [SESSION_MAP_SIZE]
static std::atomic< int > | sessionInTransitMessageCountMap [SESSION_MAP_SIZE]
static ffmpegkit::LogCallback | logCallback
static ffmpegkit::StatisticsCallback | statisticsCallback
static ffmpegkit::FFmpegSessionCompleteCallback | ffmpegSessionCompleteCallback
static ffmpegkit::FFprobeSessionCompleteCallback | ffprobeSessionCompleteCallback
static ffmpegkit::MediaInformationSessionCompleteCallback | mediaInformationSessionCompleteCallback
static ffmpegkit::LogRedirectionStrategy | globalLogRedirectionStrategy
static int | redirectionEnabled
static std::recursive_mutex | callbackDataMutex
static std::mutex | callbackMutex
static std::condition_variable | callbackMonitor
static std::list< CallbackData * > | callbackDataList
volatile int | handleSIGQUIT = 1
volatile int | handleSIGINT = 1
volatile int | handleSIGTERM = 1
volatile int | handleSIGXCPU = 1
volatile int | handleSIGPIPE = 1
__thread long | globalSessionId = 0
int | configuredLogLevel = ffmpegkit::LevelAVLogInfo
static std::once_flag | ffmpegKitInitializerFlag
static pthread_t | callbackThread
const void * | _ffmpegKitConfigInitializer {ffmpegKitInitialize()}

## Macro Definition Documentation

## ◆ SESSION_MAP_SIZE

#define SESSION_MAP_SIZE 1000

Session control variables

Definition at line 64 of file FFmpegKitConfig.cpp.

## Enumeration Type Documentation

## ◆ CallbackType

enum CallbackType

Enumerator
LogType |
StatisticsType |

Definition at line 125 of file FFmpegKitConfig.cpp.

## Function Documentation

## ◆ addSessionToSessionHistory()

void addSessionToSessionHistory | ( | const std::shared_ptr< ffmpegkit::Session > | session | ) |

Definition at line 165 of file FFmpegKitConfig.cpp.

## ◆ avutil_log_format_line()

static void avutil_log_format_line | ( | void * | avcl,
|  | int | level,
|  | const char * | fmt,
|  | va_list | vl,
|  | AVBPrint | part[4],
|  | int * | print_prefix
| ) |  |
| static

Definition at line 317 of file FFmpegKitConfig.cpp.

## ◆ avutil_log_get_level_str()

static const char * avutil_log_get_level_str | ( | int | level | ) |
| static

Definition at line 292 of file FFmpegKitConfig.cpp.

## ◆ avutil_log_sanitize()

static void avutil_log_sanitize | ( | char * | line | ) |
| static

Definition at line 349 of file FFmpegKitConfig.cpp.

## ◆ callbackDataRemove()

static CallbackData * callbackDataRemove | ( |  | ) |
| static

Removes head of callback data list.

Definition at line 395 of file FFmpegKitConfig.cpp.

## ◆ callbackNotify()

static void callbackNotify | ( |  | ) |
| static

Notifies threads waiting on callback semaphore.

Definition at line 288 of file FFmpegKitConfig.cpp.

## ◆ callbackThreadFunction()

void * callbackThreadFunction | ( | void * | pointer | ) |

Forwards asynchronous messages to Callbacks.

Definition at line 643 of file FFmpegKitConfig.cpp.

## ◆ callbackWait()

static void callbackWait | ( | int | milliSeconds | ) |
| static

Waits on the callback semaphore for the given time.

Parameters

  milliSeconds | wait time in milliseconds

Definition at line 280 of file FFmpegKitConfig.cpp.

## ◆ cancel_operation()

void cancel_operation | ( | long | id | ) |

Definition at line 4367 of file fftools_ffmpeg.c.

## ◆ cancelRequested()

int cancelRequested | ( | long | sessionId | ) |

Checks whether a cancel request for the given session id exists in the session map.

Parameters

  sessionId | session id

Returns
  1 if exists, false otherwise

Definition at line 446 of file FFmpegKitConfig.cpp.

## ◆ cancelSession()

void cancelSession | ( | long | sessionId | ) |

Adds a cancel session request to the session map.

Parameters

  sessionId | session id

Definition at line 436 of file FFmpegKitConfig.cpp.

## ◆ deleteExpiredSessions()

void deleteExpiredSessions | ( |  | ) |

Definition at line 155 of file FFmpegKitConfig.cpp.

## ◆ executeFFmpeg()

static int executeFFmpeg | ( | const long | sessionId,
|  | const std::shared_ptr< std::list< std::string > > | arguments
| ) |  |
| static

Definition at line 691 of file FFmpegKitConfig.cpp.

## ◆ executeFFprobe()

int executeFFprobe | ( | const long | sessionId,
|  | const std::shared_ptr< std::list< std::string > > | arguments
| ) |  |

Definition at line 731 of file FFmpegKitConfig.cpp.

## ◆ ffmpeg_execute()

int ffmpeg_execute | ( | int | argc,
|  | char ** | argv
| ) |  |

Forward declaration for function defined in fftools_ffmpeg.c

Definition at line 4378 of file fftools_ffmpeg.c.

## ◆ ffmpegkit_log_callback_function()

void ffmpegkit_log_callback_function | ( | void * | ptr,
|  | int | level,
|  | const char * | format,
|  | va_list | vargs
| ) |  |

Callback function for FFmpeg/FFprobe logs.

Parameters

  ptr | pointer to AVClass struct
  level | log level
  format | format string
  vargs | arguments

Definition at line 475 of file FFmpegKitConfig.cpp.

## ◆ ffmpegkit_statistics_callback_function()

void ffmpegkit_statistics_callback_function | ( | int | frameNumber,
|  | float | fps,
|  | float | quality,
|  | int64_t | size,
|  | double | time,
|  | double | bitrate,
|  | double | speed
| ) |  |

Callback function for FFmpeg statistics.

Parameters

  frameNumber | last processed frame number
  fps | frames processed per second
  quality | quality of the output stream (video only)
  size | size in bytes
  time | processed output duration
  bitrate | output bit rate in kbits/s
  speed | processing speed = processed duration / operation duration

Definition at line 524 of file FFmpegKitConfig.cpp.

## ◆ ffmpegKitInitialize()

void * ffmpegKitInitialize | ( |  | ) |

Definition at line 771 of file FFmpegKitConfig.cpp.

## ◆ ffprobe_execute()

int ffprobe_execute | ( | int | argc,
|  | char ** | argv
| ) |  |

Forward declaration for function defined in fftools_ffprobe.c

Definition at line 4096 of file fftools_ffprobe.c.

## ◆ fs_create_dir()

static bool fs_create_dir | ( | const std::string & | s | ) |
| static

Definition at line 145 of file FFmpegKitConfig.cpp.

## ◆ fs_exists()

static bool fs_exists | ( | const std::string & | s,
|  | const bool | isFile,
|  | const bool | isDirectory
| ) |  |
| static

Definition at line 130 of file FFmpegKitConfig.cpp.

## ◆ logCallbackDataAdd()

static void logCallbackDataAdd | ( | int | level,
|  | AVBPrint * | data
| ) |  |
| static

Adds log data to the end of callback data list.

Parameters

  level | log level
  data | log data

Definition at line 363 of file FFmpegKitConfig.cpp.

## ◆ pipeIndexGenerator()

static std::atomic< long > pipeIndexGenerator | ( | 1 |  | ) |
| static

Generates ids for named ffmpeg kit pipes.

## ◆ process_log()

static void process_log | ( | long | sessionId,
|  | int | levelValueInt,
|  | AVBPrint * | logMessage
| ) |  |
| static

Definition at line 528 of file FFmpegKitConfig.cpp.

## ◆ process_statistics()

void process_statistics | ( | long | sessionId,
|  | int | videoFrameNumber,
|  | float | videoFps,
|  | float | videoQuality,
|  | long | size,
|  | double | time,
|  | double | bitrate,
|  | double | speed
| ) |  |

Definition at line 612 of file FFmpegKitConfig.cpp.

## ◆ registerSessionId()

static void registerSessionId | ( | long | sessionId | ) |
| static

Registers a session id to the session map.

Parameters

  sessionId | session id

Definition at line 414 of file FFmpegKitConfig.cpp.

## ◆ removeSession()

static void removeSession | ( | long | sessionId | ) |
| static

Removes a session id from the session map.

Parameters

  sessionId | session id

Definition at line 423 of file FFmpegKitConfig.cpp.

## ◆ resetMessagesInTransmit()

static void resetMessagesInTransmit | ( | long | sessionId | ) |
| static

Resets the number of messages in transmit for this session.

Parameters

  sessionId | session id

Definition at line 463 of file FFmpegKitConfig.cpp.

## ◆ set_report_callback()

void set_report_callback | ( | void(*)(int, float, float, int64_t, double, double, double) | callback | ) |

Definition at line 4362 of file fftools_ffmpeg.c.

## ◆ statisticsCallbackDataAdd()

static void statisticsCallbackDataAdd | ( | int | frameNumber,
|  | float | fps,
|  | float | quality,
|  | int64_t | size,
|  | int | time,
|  | double | bitrate,
|  | double | speed
| ) |  |
| static

Adds statistics data to the end of callback data list.

Definition at line 379 of file FFmpegKitConfig.cpp.

## Variable Documentation

## ◆ _ffmpegKitConfigInitializer

const void* _ffmpegKitConfigInitializer {ffmpegKitInitialize()}

Definition at line 123 of file FFmpegKitConfig.cpp.

## ◆ callbackDataList

std::list<CallbackData*> callbackDataList
| static

Definition at line 87 of file FFmpegKitConfig.cpp.

## ◆ callbackDataMutex

std::recursive_mutex callbackDataMutex
| static

Definition at line 83 of file FFmpegKitConfig.cpp.

## ◆ callbackMonitor

std::condition_variable callbackMonitor
| static

Definition at line 85 of file FFmpegKitConfig.cpp.

## ◆ callbackMutex

std::mutex callbackMutex
| static

Definition at line 84 of file FFmpegKitConfig.cpp.

## ◆ callbackThread

pthread_t callbackThread
| static

Definition at line 119 of file FFmpegKitConfig.cpp.

## ◆ configuredLogLevel

int configuredLogLevel = ffmpegkit::LevelAVLogInfo

Holds the default log level

Definition at line 100 of file FFmpegKitConfig.cpp.

## ◆ ffmpegKitInitializerFlag

std::once_flag ffmpegKitInitializerFlag
| static

Definition at line 118 of file FFmpegKitConfig.cpp.

## ◆ ffmpegSessionCompleteCallback

ffmpegkit::FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback
| static

Holds complete callbacks defined to redirect asynchronous execution results

Definition at line 75 of file FFmpegKitConfig.cpp.

## ◆ ffprobeSessionCompleteCallback

ffmpegkit::FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback
| static

Definition at line 76 of file FFmpegKitConfig.cpp.

## ◆ globalLogRedirectionStrategy

ffmpegkit::LogRedirectionStrategy globalLogRedirectionStrategy
| static

Definition at line 79 of file FFmpegKitConfig.cpp.

## ◆ globalSessionId

__thread long globalSessionId = 0

Holds the id of the current execution

Definition at line 97 of file FFmpegKitConfig.cpp.

## ◆ handleSIGINT

volatile int handleSIGINT = 1

Definition at line 91 of file FFmpegKitConfig.cpp.

## ◆ handleSIGPIPE

volatile int handleSIGPIPE = 1

Definition at line 94 of file FFmpegKitConfig.cpp.

## ◆ handleSIGQUIT

volatile int handleSIGQUIT = 1

Fields that control the handling of SIGNALs

Definition at line 90 of file FFmpegKitConfig.cpp.

## ◆ handleSIGTERM

volatile int handleSIGTERM = 1

Definition at line 92 of file FFmpegKitConfig.cpp.

## ◆ handleSIGXCPU

volatile int handleSIGXCPU = 1

Definition at line 93 of file FFmpegKitConfig.cpp.

## ◆ logCallback

ffmpegkit::LogCallback logCallback
| static

Holds callback defined to redirect logs

Definition at line 69 of file FFmpegKitConfig.cpp.

## ◆ mediaInformationSessionCompleteCallback

ffmpegkit::MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback
| static

Definition at line 77 of file FFmpegKitConfig.cpp.

## ◆ redirectionEnabled

int redirectionEnabled
| static

Redirection control variables

Definition at line 82 of file FFmpegKitConfig.cpp.

## ◆ sessionHistoryList

std::list<std::shared_ptr<ffmpegkit::Session> > sessionHistoryList
| static

Definition at line 60 of file FFmpegKitConfig.cpp.

## ◆ sessionHistoryMap

std::map<long, std::shared_ptr<ffmpegkit::Session> > sessionHistoryMap
| static

Definition at line 59 of file FFmpegKitConfig.cpp.

## ◆ sessionHistorySize

int sessionHistorySize
| static

Definition at line 58 of file FFmpegKitConfig.cpp.

## ◆ sessionInTransitMessageCountMap

std::atomic<int> sessionInTransitMessageCountMap[SESSION_MAP_SIZE]
| static

Definition at line 66 of file FFmpegKitConfig.cpp.

## ◆ sessionMap

std::atomic<short> sessionMap[SESSION_MAP_SIZE]
| static

Definition at line 65 of file FFmpegKitConfig.cpp.

## ◆ sessionMutex

std::recursive_mutex sessionMutex
| static

Definition at line 61 of file FFmpegKitConfig.cpp.

## ◆ statisticsCallback

ffmpegkit::StatisticsCallback statisticsCallback
| static

Holds callback defined to redirect statistics

Definition at line 72 of file FFmpegKitConfig.cpp.