| FFmpegKit Linux API 6.0

Loading...
Searching...
No Matches
AbstractSession.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2022 Taner Sener
3 *
4 * This file is part of FFmpegKit.
5 *
6 * FFmpegKit is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Lesser General License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * FFmpegKit is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Lesser General License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General License
17 * along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#ifndef FFMPEG_KIT_ABSTRACT_SESSION_H
21#define FFMPEG_KIT_ABSTRACT_SESSION_H
22
23#include "Session.h"
24
25 namespace ffmpegkit {
26
31 class AbstractSession : public Session, std::enable_shared_from_this<AbstractSession> {
32 public:
33
37 static constexpr int DefaultTimeoutForAsynchronousMessagesInTransmit = 5000;
38
46 AbstractSession(const std::list<std::string>& arguments, const ffmpegkit::LogCallback logCallback, const LogRedirectionStrategy logRedirectionStrategy);
47
53 void waitForAsynchronousMessagesInTransmit(const int timeout) const;
54
60 ffmpegkit::LogCallback getLogCallback() const override;
61
67 long getSessionId() const override;
68
74 std::chrono::time_point<std::chrono::system_clock> getCreateTime() const override;
75
81 std::chrono::time_point<std::chrono::system_clock> getStartTime() const override;
82
88 std::chrono::time_point<std::chrono::system_clock> getEndTime() const override;
89
96 long getDuration() const override;
97
103 std::shared_ptr<std::list<std::string>> getArguments() const override;
104
110 std::string getCommand() const override;
111
119 std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogsWithTimeout(const int waitTimeout) const override;
120
127 std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogs() const override;
128
136 std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getLogs() const override;
137
146 std::string getAllLogsAsStringWithTimeout(const int waitTimeout) const override;
147
154 std::string getAllLogsAsString() const override;
155
163 std::string getLogsAsString() const override;
164
170 std::string getOutput() const override;
171
177 ffmpegkit::SessionState getState() const override;
178
187 std::shared_ptr<ffmpegkit::ReturnCode> getReturnCode() const override;
188
198 std::string getFailStackTrace() const override;
199
205 ffmpegkit::LogRedirectionStrategy getLogRedirectionStrategy() const override;
206
214 bool thereAreAsynchronousMessagesInTransmit() const override;
215
224 void addLog(const std::shared_ptr<ffmpegkit::Log> log) override;
225
229 void startRunning() override;
230
236 void complete(const std::shared_ptr<ffmpegkit::ReturnCode> returnCode) override;
237
243 void fail(const char* error) override;
244
250 virtual bool isFFmpeg() const override;
251
257 virtual bool isFFprobe() const override;
258
264 virtual bool isMediaInformation() const override;
265
269 void cancel() override;
270
271 private:
272 const long _sessionId;
273 ffmpegkit::LogCallback _logCallback;
274 std::chrono::time_point<std::chrono::system_clock> _createTime;
275 std::chrono::time_point<std::chrono::system_clock> _startTime;
276 std::chrono::time_point<std::chrono::system_clock> _endTime;
277 std::shared_ptr<std::list<std::string>> _arguments;
278 std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> _logs;
279 SessionState _state;
280 std::shared_ptr<ffmpegkit::ReturnCode> _returnCode;
281 std::string _failStackTrace;
282 LogRedirectionStrategy _logRedirectionStrategy;
283 };
284
285}
286
287#endif // FFMPEG_KIT_ABSTRACT_SESSION_H
logCallback
static ffmpegkit::LogCallback logCallback
Definition FFmpegKitConfig.cpp:69
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::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