FFmpegKit Linux API  4.5.1
Session.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_SESSION_H
21 #define FFMPEG_KIT_SESSION_H
22 
23 #include "Log.h"
24 #include "LogCallback.h"
25 #include "LogRedirectionStrategy.h"
26 #include "ReturnCode.h"
27 #include "SessionState.h"
28 #include <string>
29 #include <chrono>
30 #include <list>
31 
32 namespace ffmpegkit {
33 
37  class Session {
38  public:
39 
45  virtual ffmpegkit::LogCallback getLogCallback() const = 0;
46 
52  virtual long getSessionId() const = 0;
53 
59  virtual std::chrono::time_point<std::chrono::system_clock> getCreateTime() const = 0;
60 
66  virtual std::chrono::time_point<std::chrono::system_clock> getStartTime() const = 0;
67 
73  virtual std::chrono::time_point<std::chrono::system_clock> getEndTime() const = 0;
74 
81  virtual long getDuration() const = 0;
82 
88  virtual std::shared_ptr<std::list<std::string>> getArguments() const = 0;
89 
95  virtual std::string getCommand() const = 0;
96 
104  virtual std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogsWithTimeout(const int waitTimeout) const = 0;
105 
112  virtual std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getAllLogs() const = 0;
113 
121  virtual std::shared_ptr<std::list<std::shared_ptr<ffmpegkit::Log>>> getLogs() const = 0;
122 
131  virtual std::string getAllLogsAsStringWithTimeout(const int waitTimeout) const = 0;
132 
139  virtual std::string getAllLogsAsString() const = 0;
140 
148  virtual std::string getLogsAsString() const = 0;
149 
155  virtual std::string getOutput() const = 0;
156 
162  virtual ffmpegkit::SessionState getState() const = 0;
163 
172  virtual std::shared_ptr<ffmpegkit::ReturnCode> getReturnCode() const = 0;
173 
183  virtual std::string getFailStackTrace() const = 0;
184 
191 
199  virtual bool thereAreAsynchronousMessagesInTransmit() const = 0;
200 
209  virtual void addLog(const std::shared_ptr<ffmpegkit::Log> log) = 0;
210 
214  virtual void startRunning() = 0;
215 
221  virtual void complete(const std::shared_ptr<ffmpegkit::ReturnCode> returnCode) = 0;
222 
228  virtual void fail(const char* error) = 0;
229 
235  virtual bool isFFmpeg() const = 0;
236 
242  virtual bool isFFprobe() const = 0;
243 
249  virtual bool isMediaInformation() const = 0;
250 
254  virtual void cancel() = 0;
255 
256  };
257 
258 }
259 
260 #endif // FFMPEG_KIT_SESSION_H
ffmpegkit::Session::getState
virtual ffmpegkit::SessionState getState() const =0
ffmpegkit::Session::getAllLogsAsString
virtual std::string getAllLogsAsString() const =0
ffmpegkit::Session::getReturnCode
virtual std::shared_ptr< ffmpegkit::ReturnCode > getReturnCode() const =0
ffmpegkit::LogRedirectionStrategy
LogRedirectionStrategy
Definition: LogRedirectionStrategy.h:25
ffmpegkit::Session::thereAreAsynchronousMessagesInTransmit
virtual bool thereAreAsynchronousMessagesInTransmit() const =0
ffmpegkit::Session::getCommand
virtual std::string getCommand() const =0
ffmpegkit
Definition: AbstractSession.h:25
ffmpegkit::Session::isFFprobe
virtual bool isFFprobe() const =0
ffmpegkit::Session::getStartTime
virtual std::chrono::time_point< std::chrono::system_clock > getStartTime() const =0
ffmpegkit::Session::getLogsAsString
virtual std::string getLogsAsString() const =0
ffmpegkit::Session::getAllLogsAsStringWithTimeout
virtual std::string getAllLogsAsStringWithTimeout(const int waitTimeout) const =0
ffmpegkit::Session::getCreateTime
virtual std::chrono::time_point< std::chrono::system_clock > getCreateTime() const =0
ffmpegkit::Session::addLog
virtual void addLog(const std::shared_ptr< ffmpegkit::Log > log)=0
ffmpegkit::Session::getLogCallback
virtual ffmpegkit::LogCallback getLogCallback() const =0
LogRedirectionStrategy.h
ffmpegkit::LogCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
Definition: LogCallback.h:35
ffmpegkit::Session
Definition: Session.h:37
ffmpegkit::Session::getEndTime
virtual std::chrono::time_point< std::chrono::system_clock > getEndTime() const =0
ffmpegkit::Session::getArguments
virtual std::shared_ptr< std::list< std::string > > getArguments() const =0
ffmpegkit::Session::getSessionId
virtual long getSessionId() const =0
ffmpegkit::Session::getAllLogs
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getAllLogs() const =0
ffmpegkit::Session::fail
virtual void fail(const char *error)=0
ffmpegkit::Session::cancel
virtual void cancel()=0
ffmpegkit::Session::isFFmpeg
virtual bool isFFmpeg() const =0
ffmpegkit::Session::getOutput
virtual std::string getOutput() const =0
ffmpegkit::Session::getAllLogsWithTimeout
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getAllLogsWithTimeout(const int waitTimeout) const =0
SessionState.h
ffmpegkit::Session::isMediaInformation
virtual bool isMediaInformation() const =0
LogCallback.h
ffmpegkit::Session::complete
virtual void complete(const std::shared_ptr< ffmpegkit::ReturnCode > returnCode)=0
ffmpegkit::Session::startRunning
virtual void startRunning()=0
ffmpegkit::SessionState
SessionState
Definition: SessionState.h:25
ffmpegkit::Session::getDuration
virtual long getDuration() const =0
ffmpegkit::Session::getLogs
virtual std::shared_ptr< std::list< std::shared_ptr< ffmpegkit::Log > > > getLogs() const =0
ffmpegkit::Session::getLogRedirectionStrategy
virtual LogRedirectionStrategy getLogRedirectionStrategy() const =0
ReturnCode.h
Log.h
ffmpegkit::Session::getFailStackTrace
virtual std::string getFailStackTrace() const =0