# FFmpegKit iOS / macOS / tvOS API: FFmpegKitConfig.m File Reference

Loading...
Searching...
No Matches
FFmpegKitConfig.m File Reference

Go to the source code of this file.

## Data Structures

class | CallbackData

## Macros

#define | SESSION_MAP_SIZE 1000

## Functions

int | ffmpeg_execute (int argc, char **argv)
int | ffprobe_execute (int argc, char **argv)
typedef | NS_ENUM (NSUInteger, CallbackType)
void | deleteExpiredSessions ()
void | addSessionToSessionHistory (id< Session > session)
void | callbackWait (int milliSeconds)
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 (uint8_t *line)
void | logCallbackDataAdd (int level, AVBPrint *data)
void | statisticsCallbackDataAdd (int frameNumber, float fps, float quality, int64_t size, double time, double bitrate, double speed)
CallbackData * | callbackDataRemove ()
void | registerSessionId (long sessionId)
void | removeSession (long sessionId)
void | cancelSession (long sessionId)
int | cancelRequested (long sessionId)
void | resetMessagesInTransmit (long sessionId)
void | ffmpegkit_log_callback_function (void *ptr, int level, const char *format, va_list vargs)
void | ffmpegkit_statistics_callback_function (int frameNumber, float fps, float quality, int64_t size, double time, double bitrate, double speed)
void | process_log (long sessionId, int levelValue, AVBPrint *logMessage)
void | process_statistics (long sessionId, int videoFrameNumber, float videoFps, float videoQuality, long size, double time, double bitrate, double speed)
void | callbackBlockFunction ()
int | executeFFmpeg (long sessionId, NSArray *arguments)
int | executeFFprobe (long sessionId, NSArray *arguments)

## Variables

NSString *const | FFmpegKitVersion = @"6.0"
NSString *const | FFmpegKitNamedPipePrefix = @"fk_pipe_"
static AtomicLong * | pipeIndexGenerator
static int | sessionHistorySize
static volatile NSMutableDictionary * | sessionHistoryMap
static NSMutableArray * | sessionHistoryList
static NSRecursiveLock * | sessionHistoryLock
static atomic_short | sessionMap [SESSION_MAP_SIZE]
static atomic_int | sessionInTransitMessageCountMap [SESSION_MAP_SIZE]
static dispatch_queue_t | asyncDispatchQueue
static LogCallback | logCallback
static StatisticsCallback | statisticsCallback
static FFmpegSessionCompleteCallback | ffmpegSessionCompleteCallback
static FFprobeSessionCompleteCallback | ffprobeSessionCompleteCallback
static MediaInformationSessionCompleteCallback | mediaInformationSessionCompleteCallback
static LogRedirectionStrategy | globalLogRedirectionStrategy
static int | redirectionEnabled
static NSRecursiveLock * | lock
static dispatch_semaphore_t | semaphore
static NSMutableArray * | callbackDataArray
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 = LevelAVLogInfo
long | _sessionId
int | _logLevel
AVBPrint | _logData
int | _statisticsFrameNumber
float | _statisticsFps
float | _statisticsQuality
int64_t | _statisticsSize
double | _statisticsTime
double | _statisticsBitrate
double | _statisticsSpeed

## Macro Definition Documentation

## SESSION_MAP_SIZE

#define SESSION_MAP_SIZE 1000

Session control variables

Definition at line 58 of file FFmpegKitConfig.m.

## Function Documentation

## addSessionToSessionHistory()

void addSessionToSessionHistory | ( | id< Session > | session | ) |

Definition at line 117 of file FFmpegKitConfig.m.

## 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 282 of file FFmpegKitConfig.m.

## avutil_log_get_level_str()

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

static

Definition at line 257 of file FFmpegKitConfig.m.

## avutil_log_sanitize()

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

static

Definition at line 314 of file FFmpegKitConfig.m.

## callbackBlockFunction()

void callbackBlockFunction | ( |  | ) |

Forwards asynchronous messages to Callbacks.

Definition at line 612 of file FFmpegKitConfig.m.

## callbackDataRemove()

CallbackData * callbackDataRemove | ( |  | ) |

Removes head of callback data list.

Definition at line 358 of file FFmpegKitConfig.m.

## callbackNotify()

void callbackNotify | ( |  | ) |

Notifies threads waiting on callback semaphore.

Definition at line 253 of file FFmpegKitConfig.m.

## callbackWait()

void callbackWait | ( | int | milliSeconds | ) |

Waits on the callback semaphore for the given time.

Parameters

  milliSeconds | wait time in milliseconds

Definition at line 246 of file FFmpegKitConfig.m.

## 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 410 of file FFmpegKitConfig.m.

## cancelSession()

void cancelSession | ( | long | sessionId | ) |

Adds a cancel session request to the session map.

Parameters

  sessionId | session id

Definition at line 400 of file FFmpegKitConfig.m.

## deleteExpiredSessions()

void deleteExpiredSessions | ( |  | ) |

Definition at line 107 of file FFmpegKitConfig.m.

## executeFFmpeg()

int executeFFmpeg | ( | long | sessionId,
|  | NSArray * | arguments
| ) |  |

Definition at line 661 of file FFmpegKitConfig.m.

## executeFFprobe()

int executeFFprobe | ( | long | sessionId,
|  | NSArray * | arguments
| ) |  |

Definition at line 701 of file FFmpegKitConfig.m.

## 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 435 of file FFmpegKitConfig.m.

## 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 484 of file FFmpegKitConfig.m.

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

## logCallbackDataAdd()

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

Adds log data to the end of callback data list.

Parameters

  level | log level
  data | log data

Definition at line 328 of file FFmpegKitConfig.m.

## NS_ENUM()

typedef NS_ENUM | ( | NSUInteger | ,
|  | CallbackType |
| ) |  |

Definition at line 102 of file FFmpegKitConfig.m.

## process_log()

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

Definition at line 488 of file FFmpegKitConfig.m.

## process_statistics()

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

Definition at line 578 of file FFmpegKitConfig.m.

## registerSessionId()

void registerSessionId | ( | long | sessionId | ) |

Registers a session id to the session map.

Parameters

  sessionId | session id

Definition at line 382 of file FFmpegKitConfig.m.

## removeSession()

void removeSession | ( | long | sessionId | ) |

Removes a session id from the session map.

Parameters

  sessionId | session id

Definition at line 391 of file FFmpegKitConfig.m.

## resetMessagesInTransmit()

void resetMessagesInTransmit | ( | long | sessionId | ) |

Resets the number of messages in transmit for this session.

Parameters

  sessionId | session id

Definition at line 423 of file FFmpegKitConfig.m.

## statisticsCallbackDataAdd()

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

Adds statistics data to the end of callback data list.

Definition at line 343 of file FFmpegKitConfig.m.

## Variable Documentation

## _logData

AVBPrint _logData

Definition at line 147 of file FFmpegKitConfig.m.

## _logLevel

int _logLevel

Definition at line 146 of file FFmpegKitConfig.m.

## _sessionId

long _sessionId

Initial value:
{
CallbackType _type

Definition at line 144 of file FFmpegKitConfig.m.

## _statisticsBitrate

double _statisticsBitrate

Definition at line 154 of file FFmpegKitConfig.m.

## _statisticsFps

float _statisticsFps

Definition at line 150 of file FFmpegKitConfig.m.

## _statisticsFrameNumber

int _statisticsFrameNumber

Definition at line 149 of file FFmpegKitConfig.m.

## _statisticsQuality

float _statisticsQuality

Definition at line 151 of file FFmpegKitConfig.m.

## _statisticsSize

int64_t _statisticsSize

Definition at line 152 of file FFmpegKitConfig.m.

## _statisticsSpeed

double _statisticsSpeed

Definition at line 155 of file FFmpegKitConfig.m.

## _statisticsTime

double _statisticsTime

Definition at line 153 of file FFmpegKitConfig.m.

## asyncDispatchQueue

dispatch_queue_t asyncDispatchQueue

static

Definition at line 62 of file FFmpegKitConfig.m.

## callbackDataArray

NSMutableArray* callbackDataArray

static

Definition at line 81 of file FFmpegKitConfig.m.

## configuredLogLevel

int configuredLogLevel = LevelAVLogInfo

Holds the default log level

Definition at line 94 of file FFmpegKitConfig.m.

## FFmpegKitNamedPipePrefix

NSString* const FFmpegKitNamedPipePrefix = @"fk_pipe_"

Prefix of named pipes created by ffmpeg-kit.

Definition at line 44 of file FFmpegKitConfig.m.

## FFmpegKitVersion

NSString* const FFmpegKitVersion = @"6.0"

Global library version

Definition at line 39 of file FFmpegKitConfig.m.

## ffmpegSessionCompleteCallback

FFmpegSessionCompleteCallback ffmpegSessionCompleteCallback

static

Holds complete callbacks defined to redirect asynchronous execution results

Definition at line 71 of file FFmpegKitConfig.m.

## ffprobeSessionCompleteCallback

FFprobeSessionCompleteCallback ffprobeSessionCompleteCallback

static

Definition at line 72 of file FFmpegKitConfig.m.

## globalLogRedirectionStrategy

LogRedirectionStrategy globalLogRedirectionStrategy

static

Definition at line 75 of file FFmpegKitConfig.m.

## globalSessionId

__thread long globalSessionId = 0

Holds the id of the current execution

Definition at line 91 of file FFmpegKitConfig.m.

## handleSIGINT

volatile int handleSIGINT = 1

Definition at line 85 of file FFmpegKitConfig.m.

## handleSIGPIPE

volatile int handleSIGPIPE = 1

Definition at line 88 of file FFmpegKitConfig.m.

## handleSIGQUIT

volatile int handleSIGQUIT = 1

Fields that control the handling of SIGNALs

Definition at line 84 of file FFmpegKitConfig.m.

## handleSIGTERM

volatile int handleSIGTERM = 1

Definition at line 86 of file FFmpegKitConfig.m.

## handleSIGXCPU

volatile int handleSIGXCPU = 1

Definition at line 87 of file FFmpegKitConfig.m.

## lock

NSRecursiveLock* lock

static

Definition at line 79 of file FFmpegKitConfig.m.

## logCallback

LogCallback logCallback

static

Holds callback defined to redirect logs

Definition at line 65 of file FFmpegKitConfig.m.

## mediaInformationSessionCompleteCallback

MediaInformationSessionCompleteCallback mediaInformationSessionCompleteCallback

static

Definition at line 73 of file FFmpegKitConfig.m.

## pipeIndexGenerator

AtomicLong* pipeIndexGenerator

static

Generates ids for named ffmpeg kit pipes.

Definition at line 49 of file FFmpegKitConfig.m.

## redirectionEnabled

int redirectionEnabled

static

Redirection control variables

Definition at line 78 of file FFmpegKitConfig.m.

## semaphore

dispatch_semaphore_t semaphore

static

Definition at line 80 of file FFmpegKitConfig.m.

## sessionHistoryList

NSMutableArray* sessionHistoryList

static

Definition at line 54 of file FFmpegKitConfig.m.

## sessionHistoryLock

NSRecursiveLock* sessionHistoryLock

static

Definition at line 55 of file FFmpegKitConfig.m.

## sessionHistoryMap

volatile NSMutableDictionary* sessionHistoryMap

static

Definition at line 53 of file FFmpegKitConfig.m.

## sessionHistorySize

int sessionHistorySize

static

Definition at line 52 of file FFmpegKitConfig.m.

## sessionInTransitMessageCountMap

atomic_int sessionInTransitMessageCountMap[SESSION_MAP_SIZE]

static

Definition at line 60 of file FFmpegKitConfig.m.

## sessionMap

atomic_short sessionMap[SESSION_MAP_SIZE]

static

Definition at line 59 of file FFmpegKitConfig.m.

## statisticsCallback

StatisticsCallback statisticsCallback

static

Holds callback defined to redirect statistics

Definition at line 68 of file FFmpegKitConfig.m.