# FFmpegKit Linux API: AbstractSession.h Source File

AbstractSession.h
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 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 License for more details.
*
* You should have received a copy of the GNU Lesser General License
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef FFMPEG_KIT_ABSTRACT_SESSION_H
#define FFMPEG_KIT_ABSTRACT_SESSION_H
#include "Session.h"
namespace ffmpegkit {
class AbstractSession : public Session, std::enable_shared_from_this<AbstractSession> {
public:
static constexpr int DefaultTimeoutForAsynchronousMessagesInTransmit = 5000;
AbstractSession(const std::list<std::string>& arguments, const ffmpegkit::LogCallback logCallback, const LogRedirectionStrategy logRedirectionStrategy);
void waitForAsynchronousMessagesInTransmit(const int timeout) const;
ffmpegkit::LogCallback getLogCallback() const override;
long getSessionId() const override;
std::chrono::time_point<std::chrono::system_clock> getCreateTime() const override;
std::chrono::time_point<std::chrono::system_clock> getStartTime() const override;
std::chrono::time_point<std::chrono::system_clock> getEndTime() const override;
long getDuration() const override;
std::shared_ptr<std::list<std::string>> getArguments() const override;
std::string getCommand() const override;
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogsWithTimeout(const int waitTimeout) const override;
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogs() const override;
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getLogs() const override;
std::string getAllLogsAsStringWithTimeout(const int waitTimeout) const override;
std::string getAllLogsAsString() const override;
std::string getLogsAsString() const override;
std::string getOutput() const override;
ffmpegkit::SessionState getState() const override;
std::shared_ptr<ffmpegkit::ReturnCode> getReturnCode() const override;
std::string getFailStackTrace() const override;
ffmpegkit::LogRedirectionStrategy getLogRedirectionStrategy() const override;
bool thereAreAsynchronousMessagesInTransmit() const override;
void addLog(const std::shared_ptr<ffmpegkit::Log> log) override;
void startRunning() override;
void complete(const std::shared_ptr<ffmpegkit::ReturnCode> returnCode) override;
void fail(const char* error) override;
virtual bool isFFmpeg() const override;
virtual bool isFFprobe() const override;
virtual bool isMediaInformation() const override;
void cancel() override;
private:
const long _sessionId;
ffmpegkit::LogCallback _logCallback;
std::chrono::time_point<std::chrono::system_clock> _createTime;
std::chrono::time_point<std::chrono::system_clock> _startTime;
std::chrono::time_point<std::chrono::system_clock> _endTime;
std::shared_ptr<std::list<std::string>> _arguments;
std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> _logs;
SessionState _state;
std::shared_ptr<ffmpegkit::ReturnCode> _returnCode;
std::string _failStackTrace;
LogRedirectionStrategy _logRedirectionStrategy;
};
}
#endif // FFMPEG_KIT_ABSTRACT_SESSION_H
logCallback
static ffmpegkit::LogCallback logCallback
Definition: FFmpegKitConfig.cpp:64
Session.h
ffmpegkit::AbstractSession
Definition: AbstractSession.h:31
ffmpegkit::AbstractSession::fail
void fail(const char *error) override
Definition: AbstractSession.cpp:177
ffmpegkit::AbstractSession::_failStackTrace
std::string _failStackTrace
Definition: AbstractSession.h:281
ffmpegkit::AbstractSession::_sessionId
const long _sessionId
Definition: AbstractSession.h:272
ffmpegkit::AbstractSession::isFFmpeg
virtual bool isFFmpeg() const override
Definition: AbstractSession.cpp:183
ffmpegkit::AbstractSession::_logRedirectionStrategy
LogRedirectionStrategy _logRedirectionStrategy
Definition: AbstractSession.h:282
ffmpegkit::AbstractSession::addLog
void addLog(const std::shared_ptr< ffmpegkit::Log > log) override
Definition: AbstractSession.cpp:162
ffmpegkit::AbstractSession::getLogsAsString
std::string getLogsAsString() const override
Definition: AbstractSession.cpp:128
ffmpegkit::AbstractSession::getDuration
long getDuration() const override
Definition: AbstractSession.cpp:78
ffmpegkit::AbstractSession::getSessionId
long getSessionId() const override
Definition: AbstractSession.cpp:62
ffmpegkit::AbstractSession::getEndTime
std::chrono::time_point< std::chrono::system_clock > getEndTime() const override
Definition: AbstractSession.cpp:74
ffmpegkit::AbstractSession::_endTime
std::chrono::time_point< std::chrono::system_clock > _endTime
Definition: AbstractSession.h:276
ffmpegkit::AbstractSession::getAllLogsAsString
std::string getAllLogsAsString() const override
Definition: AbstractSession.cpp:124
ffmpegkit::AbstractSession::_arguments
std::shared_ptr< std::list< std::string > > _arguments
Definition: AbstractSession.h:277
ffmpegkit::AbstractSession::getOutput
std::string getOutput() const override
Definition: AbstractSession.cpp:138
ffmpegkit::AbstractSession::_createTime
std::chrono::time_point< std::chrono::system_clock > _createTime
Definition: AbstractSession.h:274
ffmpegkit::AbstractSession::_returnCode
std::shared_ptr< ffmpegkit::ReturnCode > _returnCode
Definition: AbstractSession.h:280
ffmpegkit::AbstractSession::getLogCallback
ffmpegkit::LogCallback getLogCallback() const override
Definition: AbstractSession.cpp:58
ffmpegkit::AbstractSession::getCreateTime
std::chrono::time_point< std::chrono::system_clock > getCreateTime() const override
Definition: AbstractSession.cpp:66
ffmpegkit::AbstractSession::AbstractSession
AbstractSession(const std::list< std::string > &arguments, const ffmpegkit::LogCallback logCallback, const LogRedirectionStrategy logRedirectionStrategy)
Definition: AbstractSession.cpp:36
ffmpegkit::AbstractSession::getReturnCode
std::shared_ptr< ffmpegkit::ReturnCode > getReturnCode() const override
Definition: AbstractSession.cpp:146
ffmpegkit::AbstractSession::waitForAsynchronousMessagesInTransmit
void waitForAsynchronousMessagesInTransmit(const int timeout) const
Definition: AbstractSession.cpp:47
ffmpegkit::AbstractSession::_state
SessionState _state
Definition: AbstractSession.h:279
ffmpegkit::AbstractSession::getAllLogsWithTimeout
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getAllLogsWithTimeout(const int waitTimeout) const override
Definition: AbstractSession.cpp:97
ffmpegkit::AbstractSession::startRunning
void startRunning() override
Definition: AbstractSession.cpp:166
ffmpegkit::AbstractSession::complete
void complete(const std::shared_ptr< ffmpegkit::ReturnCode > returnCode) override
Definition: AbstractSession.cpp:171
ffmpegkit::AbstractSession::getAllLogs
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getAllLogs() const override
Definition: AbstractSession.cpp:106
ffmpegkit::AbstractSession::getStartTime
std::chrono::time_point< std::chrono::system_clock > getStartTime() const override
Definition: AbstractSession.cpp:70
ffmpegkit::AbstractSession::getFailStackTrace
std::string getFailStackTrace() const override
Definition: AbstractSession.cpp:150
ffmpegkit::AbstractSession::_logCallback
ffmpegkit::LogCallback _logCallback
Definition: AbstractSession.h:273
ffmpegkit::AbstractSession::getCommand
std::string getCommand() const override
Definition: AbstractSession.cpp:93
ffmpegkit::AbstractSession::getState
ffmpegkit::SessionState getState() const override
Definition: AbstractSession.cpp:142
ffmpegkit::AbstractSession::thereAreAsynchronousMessagesInTransmit
bool thereAreAsynchronousMessagesInTransmit() const override
Definition: AbstractSession.cpp:158
ffmpegkit::AbstractSession::getArguments
std::shared_ptr< std::list< std::string > > getArguments() const override
Definition: AbstractSession.cpp:89
ffmpegkit::AbstractSession::getLogs
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getLogs() const override
Definition: AbstractSession.cpp:110
ffmpegkit::AbstractSession::getAllLogsAsStringWithTimeout
std::string getAllLogsAsStringWithTimeout(const int waitTimeout) const override
Definition: AbstractSession.cpp:114
ffmpegkit::AbstractSession::getLogRedirectionStrategy
ffmpegkit::LogRedirectionStrategy getLogRedirectionStrategy() const override
Definition: AbstractSession.cpp:154
ffmpegkit::AbstractSession::_startTime
std::chrono::time_point< std::chrono::system_clock > _startTime
Definition: AbstractSession.h:275
ffmpegkit::AbstractSession::isMediaInformation
virtual bool isMediaInformation() const override
Definition: AbstractSession.cpp:193
ffmpegkit::AbstractSession::DefaultTimeoutForAsynchronousMessagesInTransmit
static constexpr int DefaultTimeoutForAsynchronousMessagesInTransmit
Definition: AbstractSession.h:37
ffmpegkit::AbstractSession::cancel
void cancel() override
Definition: AbstractSession.cpp:198
ffmpegkit::AbstractSession::_logs
std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > _logs
Definition: AbstractSession.h:278
ffmpegkit::AbstractSession::isFFprobe
virtual bool isFFprobe() const override
Definition: AbstractSession.cpp:188
ffmpegkit::Session
Definition: Session.h:37
ffmpegkit
Definition: AbstractSession.h:25
ffmpegkit::LogRedirectionStrategy
LogRedirectionStrategy
Definition: LogRedirectionStrategy.h:25
ffmpegkit::SessionState
SessionState
Definition: SessionState.h:25
ffmpegkit::LogCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
Definition: LogCallback.h:35