| FFmpegKit Linux API 6.0

Loading...
Searching...
No Matches
MediaInformationSession.cpp
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#include "MediaInformationSession.h"
21#include "LogCallback.h"
22#include "MediaInformation.h"
23
24 extern void addSessionToSessionHistory(const std::shared_ptr<ffmpegkit::Session> session);
25
26std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments) {
27 auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, nullptr, nullptr));
28 addSessionToSessionHistory(session);
29 return session;
30}
31
32std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback) {
33 auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, completeCallback, nullptr));
34 addSessionToSessionHistory(session);
35 return session;
36}
37
38std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) {
39 auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, completeCallback, logCallback));
40 addSessionToSessionHistory(session);
41 return session;
42}
43
44 struct ffmpegkit::MediaInformationSession::PublicMediaInformationSession : public ffmpegkit::MediaInformationSession {
45 PublicMediaInformationSession(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) :
46 MediaInformationSession(arguments, completeCallback, logCallback) {
47 }
48};
49
50 ffmpegkit::MediaInformationSession::MediaInformationSession(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) :
51 ffmpegkit::AbstractSession(arguments, logCallback, ffmpegkit::LogRedirectionStrategyNeverPrintLogs), _completeCallback{completeCallback}, _mediaInformation{nullptr} {
52}
53
54std::shared_ptr<ffmpegkit::MediaInformation> ffmpegkit::MediaInformationSession::getMediaInformation() {
55 return _mediaInformation;
56}
57
58 void ffmpegkit::MediaInformationSession::setMediaInformation(const std::shared_ptr<ffmpegkit::MediaInformation> mediaInformation) {
59 _mediaInformation = mediaInformation;
60}
61
62 ffmpegkit::MediaInformationSessionCompleteCallback ffmpegkit::MediaInformationSession::getCompleteCallback() {
63 return _completeCallback;
64}
65
66 bool ffmpegkit::MediaInformationSession::isFFmpeg() const {
67 return false;
68}
69
70 bool ffmpegkit::MediaInformationSession::isFFprobe() const {
71 return false;
72}
73
74 bool ffmpegkit::MediaInformationSession::isMediaInformation() const {
75 return true;
76}
addSessionToSessionHistory
void addSessionToSessionHistory(const std::shared_ptr< ffmpegkit::Session > session)
Definition FFmpegKitConfig.cpp:165
logCallback
static ffmpegkit::LogCallback logCallback
Definition FFmpegKitConfig.cpp:69
LogCallback.h
MediaInformation.h
addSessionToSessionHistory
void addSessionToSessionHistory(const std::shared_ptr< ffmpegkit::Session > session)
Definition FFmpegKitConfig.cpp:165
MediaInformationSession.h
ffmpegkit::AbstractSession
Definition AbstractSession.h:31
ffmpegkit::MediaInformationSession
Definition MediaInformationSession.h:33
ffmpegkit::MediaInformationSession::MediaInformationSession
MediaInformationSession(const std::list< std::string > &arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback)
Definition MediaInformationSession.cpp:50
ffmpegkit::MediaInformationSession::isFFmpeg
bool isFFmpeg() const override
Definition MediaInformationSession.cpp:66
ffmpegkit::MediaInformationSession::getMediaInformation
std::shared_ptr< ffmpegkit::MediaInformation > getMediaInformation()
Definition MediaInformationSession.cpp:54
ffmpegkit::MediaInformationSession::getCompleteCallback
ffmpegkit::MediaInformationSessionCompleteCallback getCompleteCallback()
Definition MediaInformationSession.cpp:62
ffmpegkit::MediaInformationSession::setMediaInformation
void setMediaInformation(const std::shared_ptr< ffmpegkit::MediaInformation > mediaInformation)
Definition MediaInformationSession.cpp:58
ffmpegkit::MediaInformationSession::isFFprobe
bool isFFprobe() const override
Definition MediaInformationSession.cpp:70
ffmpegkit::MediaInformationSession::create
static std::shared_ptr< ffmpegkit::MediaInformationSession > create(const std::list< std::string > &arguments)
Definition MediaInformationSession.cpp:26
ffmpegkit::MediaInformationSession::isMediaInformation
bool isMediaInformation() const override
Definition MediaInformationSession.cpp:74
ffmpegkit
Definition AbstractSession.h:25
ffmpegkit::LogRedirectionStrategyNeverPrintLogs
@ LogRedirectionStrategyNeverPrintLogs
Definition LogRedirectionStrategy.h:30
ffmpegkit::MediaInformationSessionCompleteCallback
std::function< void(const std::shared_ptr< ffmpegkit::MediaInformationSession > session)> MediaInformationSessionCompleteCallback
Definition MediaInformationSessionCompleteCallback.h:53
ffmpegkit::LogCallback
std::function< void(const std::shared_ptr< ffmpegkit::Log > log)> LogCallback
Definition LogCallback.h:35