// TimeBolt: the ffmpeg command-line tool as a library. // // tb_ffmpeg_run() runs one ffmpeg command, given its arguments exactly as they would appear on the // command line (without the leading "ffmpeg"), on the calling thread, and returns ffmpeg's exit code // (0 on success, 255 when cancelled, otherwise what ffmpeg would have exited with). Only one command runs // at a time per process: the tool keeps its state in globals, so a second caller waits on a lock. // tb_ffmpeg_cancel() stops the running command the way Ctrl-C would; the run then returns 255. // // Logging goes through libavutil's av_log, so install a callback with av_log_set_callback(). Progress is // best read with "-progress pipe: -nostats" and a pipe created by the caller. #ifndef TB_FFMPEG_MAIN_H #define TB_FFMPEG_MAIN_H #ifdef __cplusplus extern "C" { #endif int tb_ffmpeg_run(int argc, const char *const *argv); void tb_ffmpeg_cancel(void); int tb_ffmpeg_is_running(void); const char *tb_ffmpeg_version(void); /* Flattened av_log lines (level is an AV_LOG_* value). NULL restores ffmpeg's stderr logging. */ void tb_ffmpeg_set_log_handler(void (*handler)(int level, const char *line)); #ifdef __cplusplus } #endif #endif