# FFmpegKit Linux API: FFmpegKit.cpp Source File

FFmpegKit.cpp
Go to the documentation of this file.
/*
* Copyright (c) 2022 Taner Sener
*
* This file is part of FFmpegKit.
*
* FFmpegKit is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* FFmpegKit is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/
extern "C" {
#include "fftools_ffmpeg.h"
}
#include "ArchDetect.h"
#include "FFmpegKit.h"
#include "FFmpegKitConfig.h"
#include "Packages.h"
extern void* ffmpegKitInitialize();
const void* _ffmpegKitInitializeri{ffmpegKitInitialize()};
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::executeWithArguments(const std::list<std::string>& arguments) {
auto session = ffmpegkit::FFmpegSession::create(arguments);
ffmpegkit::FFmpegKitConfig::ffmpegExecute(session);
return session;
}
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFmpegSessionCompleteCallback completeCallback) {
auto session = ffmpegkit::FFmpegSession::create(arguments, completeCallback);
ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute(session);
return session;
}
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::executeWithArgumentsAsync(const std::list<std::string>& arguments, FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback) {
auto session = ffmpegkit::FFmpegSession::create(arguments, completeCallback, logCallback, statisticsCallback);
ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute(session);
return session;
}
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::execute(const std::string command) {
auto session = ffmpegkit::FFmpegSession::create(FFmpegKitConfig::parseArguments(command.c_str()));
ffmpegkit::FFmpegKitConfig::ffmpegExecute(session);
return session;
}
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::executeAsync(const std::string command, FFmpegSessionCompleteCallback completeCallback) {
auto session = ffmpegkit::FFmpegSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback);
ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute(session);
return session;
}
std::shared_ptr<ffmpegkit::FFmpegSession> ffmpegkit::FFmpegKit::executeAsync(const std::string command, FFmpegSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback, ffmpegkit::StatisticsCallback statisticsCallback) {
auto session = ffmpegkit::FFmpegSession::create(FFmpegKitConfig::parseArguments(command.c_str()), completeCallback, logCallback, statisticsCallback);
ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute(session);
return session;
}
void ffmpegkit::FFmpegKit::cancel() {
/*
* ZERO (0) IS A SPECIAL SESSION ID
* WHEN IT IS PASSED TO THIS METHOD, A SIGINT IS GENERATED WHICH CANCELS ALL ONGOING SESSIONS
*/
cancel_operation(0);
}
void ffmpegkit::FFmpegKit::cancel(const long sessionId) {
cancel_operation(sessionId);
}
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::FFmpegSession>>> ffmpegkit::FFmpegKit::listSessions() {
return ffmpegkit::FFmpegKitConfig::getFFmpegSessions();
}
ArchDetect.h
_ffmpegKitInitializeri
const void * _ffmpegKitInitializeri
Definition: FFmpegKit.cpp:30
ffmpegKitInitialize
void * ffmpegKitInitialize()
Definition: FFmpegKitConfig.cpp:766
FFmpegKit.h
logCallback
static ffmpegkit::LogCallback logCallback
Definition: FFmpegKitConfig.cpp:64
statisticsCallback
static ffmpegkit::StatisticsCallback statisticsCallback
Definition: FFmpegKitConfig.cpp:67
FFmpegKitConfig.h
Packages.h
ffmpegkit::FFmpegKitConfig::parseArguments
static std::list< std::string > parseArguments(const std::string &command)
Definition: FFmpegKitConfig.cpp:1361
ffmpegkit::FFmpegKitConfig::asyncFFmpegExecute
static void asyncFFmpegExecute(const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
Definition: FFmpegKitConfig.cpp:1055
ffmpegkit::FFmpegKitConfig::getFFmpegSessions
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > getFFmpegSessions()
Definition: FFmpegKitConfig.cpp:1267
ffmpegkit::FFmpegKitConfig::ffmpegExecute
static void ffmpegExecute(const std::shared_ptr< ffmpegkit::FFmpegSession > ffmpegSession)
Definition: FFmpegKitConfig.cpp:1007
ffmpegkit::FFmpegKit::listSessions
static std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::FFmpegSession > > > listSessions()
Definition: FFmpegKit.cpp:81
ffmpegkit::FFmpegKit::executeWithArgumentsAsync
static std::shared_ptr< ffmpegkit::FFmpegSession > executeWithArgumentsAsync(const std::list< std::string > &arguments, FFmpegSessionCompleteCallback completeCallback)
Definition: FFmpegKit.cpp:38
ffmpegkit::FFmpegKit::executeWithArguments
static std::shared_ptr< ffmpegkit::FFmpegSession > executeWithArguments(const std::list< std::string > &arguments)
Definition: FFmpegKit.cpp:32
ffmpegkit::FFmpegKit::executeAsync
static std::shared_ptr< ffmpegkit::FFmpegSession > executeAsync(const std::string command, FFmpegSessionCompleteCallback completeCallback)
Definition: FFmpegKit.cpp:56
ffmpegkit::FFmpegKit::cancel
static void cancel()
Definition: FFmpegKit.cpp:68
ffmpegkit::FFmpegKit::execute
static std::shared_ptr< ffmpegkit::FFmpegSession > execute(const std::string command)
Definition: FFmpegKit.cpp:50
ffmpegkit::FFmpegSession::create
static std::shared_ptr< ffmpegkit::FFmpegSession > create(const std::list< std::string > &arguments)
Definition: FFmpegSession.cpp:27
cancel_operation
void cancel_operation(long id)
Definition: fftools_ffmpeg.c:4764
fftools_ffmpeg.h
ffmpegkit::StatisticsCallback
std::function< void(const std::shared_ptr< ffmpegkit::Statistics > statistics)> StatisticsCallback
Definition: StatisticsCallback.h:35
ffmpegkit::LogCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
Definition: LogCallback.h:35
ffmpegkit::FFmpegSessionCompleteCallback
std::function< void(const std::shared_ptr< ffmpegkit::FFmpegSession > session)> FFmpegSessionCompleteCallback
Definition: FFmpegSessionCompleteCallback.h:52