FFmpegKitConfig.m File Reference

Go to the source code of this file.

## Data Structures

class | CallbackData

## Functions

int | ffmpeg_execute (int argc, char **argv)
int | ffprobe_execute (int argc, char **argv)
typedef | NS_ENUM (NSUInteger, CallbackType)
void | callbackWait (int milliSeconds)
void | callbackNotify ()
void | logCallbackDataAdd (int level, NSString *logData)
void | statisticsCallbackDataAdd (int frameNumber, float fps, float quality, int64_t size, int time, double bitrate, double speed)
CallbackData * | callbackDataRemove ()
void | addSession (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, int time, double bitrate, double speed)
void | process_log (long sessionId, int levelValue, NSString *logMessage)
void | process_statistics (long sessionId, int videoFrameNumber, float videoFps, float videoQuality, long size, int time, double bitrate, double speed)
void | callbackBlockFunction ()
int | executeFFmpeg (long sessionId, NSArray *arguments)
int | executeFFprobe (long sessionId, NSArray *arguments)

## Variables

NSString *const | FFmpegKitVersion = @"4.4"
NSString *const | FFmpegKitNamedPipePrefix = @"fk_pipe_"
static AtomicLong * | pipeIndexGenerator
static int | sessionHistorySize
static volatile NSMutableDictionary * | sessionHistoryMap
static NSMutableArray * | sessionHistoryList
static NSRecursiveLock * | sessionHistoryLock
const int | SESSION_MAP_SIZE = 1000
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 ExecuteCallback | executeCallback
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 volatile long | _sessionId = 0
int | configuredLogLevel = LevelAVLogInfo
int | _logLevel
NSString * | _logData
int | _statisticsFrameNumber
float | _statisticsFps
float | _statisticsQuality
int64_t | _statisticsSize
int | _statisticsTime
double | _statisticsBitrate
double | _statisticsSpeed

## Function Documentation

## addSession()

void addSession | ( | long | sessionId | ) |

Adds a session id to the session map.

Parameters

  sessionId | session id

Definition at line 285 of file FFmpegKitConfig.m.

## callbackBlockFunction()

void callbackBlockFunction | ( |  | ) |

Forwards asynchronous messages to Callbacks.

Definition at line 489 of file FFmpegKitConfig.m.

## callbackDataRemove()

CallbackData* callbackDataRemove | ( |  | ) |

Removes head of callback data list.

Definition at line 261 of file FFmpegKitConfig.m.

## callbackNotify()

void callbackNotify | ( |  | ) |

Notifies threads waiting on callback semaphore.

Definition at line 221 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 214 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 313 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 303 of file FFmpegKitConfig.m.

## executeFFmpeg()

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

Definition at line 537 of file FFmpegKitConfig.m.

## executeFFprobe()

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

Definition at line 577 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 5162 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 338 of file FFmpegKitConfig.m.

## ffmpegkit_statistics_callback_function()

void ffmpegkit_statistics_callback_function | ( | int | frameNumber,
|  | float | fps,
|  | float | quality,
|  | int64_t | size,
|  | int | 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 369 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 3713 of file fftools_ffprobe.c.

## logCallbackDataAdd()

void logCallbackDataAdd | ( | int | level,
|  | NSString * | logData
| ) |  |

Adds log data to the end of callback data list.

Parameters

  level | log level
  logData | log data

Definition at line 231 of file FFmpegKitConfig.m.

## NS_ENUM()

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

Definition at line 99 of file FFmpegKitConfig.m.

## process_log()

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

Definition at line 373 of file FFmpegKitConfig.m.

## process_statistics()

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

Definition at line 455 of file FFmpegKitConfig.m.

## removeSession()

void removeSession | ( | long | sessionId | ) |

Removes a session id from the session map.

Parameters

  sessionId | session id

Definition at line 294 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 326 of file FFmpegKitConfig.m.

## statisticsCallbackDataAdd()

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

Adds statistics data to the end of callback data list.

Definition at line 246 of file FFmpegKitConfig.m.

## Variable Documentation

## _logData

NSString* _logData

Definition at line 116 of file FFmpegKitConfig.m.

## _logLevel

int _logLevel

Definition at line 115 of file FFmpegKitConfig.m.

## _sessionId

long _sessionId = 0

Holds the id of the current execution

Definition at line 88 of file FFmpegKitConfig.m.

## _statisticsBitrate

double _statisticsBitrate

Definition at line 123 of file FFmpegKitConfig.m.

## _statisticsFps

float _statisticsFps

Definition at line 119 of file FFmpegKitConfig.m.

## _statisticsFrameNumber

int _statisticsFrameNumber

Definition at line 118 of file FFmpegKitConfig.m.

## _statisticsQuality

float _statisticsQuality

Definition at line 120 of file FFmpegKitConfig.m.

## _statisticsSize

int64_t _statisticsSize

Definition at line 121 of file FFmpegKitConfig.m.

## _statisticsSpeed

double _statisticsSpeed

Definition at line 124 of file FFmpegKitConfig.m.

## _statisticsTime

int _statisticsTime

Definition at line 122 of file FFmpegKitConfig.m.

## asyncDispatchQueue

dispatch_queue_t asyncDispatchQueue

static

Definition at line 61 of file FFmpegKitConfig.m.

## callbackDataArray

NSMutableArray* callbackDataArray

static

Definition at line 78 of file FFmpegKitConfig.m.

## configuredLogLevel

int configuredLogLevel = LevelAVLogInfo

Holds the default log level

Definition at line 91 of file FFmpegKitConfig.m.

## executeCallback

ExecuteCallback executeCallback

static

Holds callback defined to redirect asynchronous execution results

Definition at line 70 of file FFmpegKitConfig.m.

## FFmpegKitNamedPipePrefix

NSString* const FFmpegKitNamedPipePrefix = @"fk_pipe_"

Prefix of named pipes created by ffmpeg-kit.

Definition at line 43 of file FFmpegKitConfig.m.

## FFmpegKitVersion

NSString* const FFmpegKitVersion = @"4.4"

Global library version

Definition at line 38 of file FFmpegKitConfig.m.

## globalLogRedirectionStrategy

LogRedirectionStrategy globalLogRedirectionStrategy

static

Definition at line 72 of file FFmpegKitConfig.m.

## handleSIGINT

volatile int handleSIGINT = 1

Definition at line 82 of file FFmpegKitConfig.m.

## handleSIGPIPE

volatile int handleSIGPIPE = 1

Definition at line 85 of file FFmpegKitConfig.m.

## handleSIGQUIT

volatile int handleSIGQUIT = 1

Fields that control the handling of SIGNALs

Definition at line 81 of file FFmpegKitConfig.m.

## handleSIGTERM

volatile int handleSIGTERM = 1

Definition at line 83 of file FFmpegKitConfig.m.

## handleSIGXCPU

volatile int handleSIGXCPU = 1

Definition at line 84 of file FFmpegKitConfig.m.

## lock

NSRecursiveLock* lock

static

Definition at line 76 of file FFmpegKitConfig.m.

## logCallback

LogCallback logCallback

static

Holds callback defined to redirect logs

Definition at line 64 of file FFmpegKitConfig.m.

## pipeIndexGenerator

AtomicLong* pipeIndexGenerator

static

Generates ids for named ffmpeg kit pipes.

Definition at line 48 of file FFmpegKitConfig.m.

## redirectionEnabled

int redirectionEnabled

static

Redirection control variables

Definition at line 75 of file FFmpegKitConfig.m.

## semaphore

dispatch_semaphore_t semaphore

static

Definition at line 77 of file FFmpegKitConfig.m.

## SESSION_MAP_SIZE

const int SESSION_MAP_SIZE = 1000

Session control variables

Definition at line 57 of file FFmpegKitConfig.m.

## sessionHistoryList

NSMutableArray* sessionHistoryList

static

Definition at line 53 of file FFmpegKitConfig.m.

## sessionHistoryLock

NSRecursiveLock* sessionHistoryLock

static

Definition at line 54 of file FFmpegKitConfig.m.

## sessionHistoryMap

volatile NSMutableDictionary* sessionHistoryMap

static

Definition at line 52 of file FFmpegKitConfig.m.

## sessionHistorySize

int sessionHistorySize

static

Definition at line 51 of file FFmpegKitConfig.m.

## sessionInTransitMessageCountMap

atomic_int sessionInTransitMessageCountMap[SESSION_MAP_SIZE]

static

Definition at line 59 of file FFmpegKitConfig.m.

## sessionMap

atomic_short sessionMap[SESSION_MAP_SIZE]

static

Definition at line 58 of file FFmpegKitConfig.m.

## statisticsCallback

StatisticsCallback statisticsCallback

static

Holds callback defined to redirect statistics

Definition at line 67 of file FFmpegKitConfig.m.