# FFmpegKit Linux API: MediaInformationSession.cpp Source File

MediaInformationSession.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 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/>.
*/
#include "MediaInformationSession.h"
#include "LogCallback.h"
#include "MediaInformation.h"
extern void addSessionToSessionHistory(const std::shared_ptr<ffmpegkit::Session> session);
std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments) {
auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, nullptr, nullptr));
addSessionToSessionHistory(session);
return session;
}
std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback) {
auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, completeCallback, nullptr));
addSessionToSessionHistory(session);
return session;
}
std::shared_ptr<ffmpegkit::MediaInformationSession> ffmpegkit::MediaInformationSession::create(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) {
auto session = std::static_pointer_cast<ffmpegkit::MediaInformationSession>(std::make_shared<ffmpegkit::MediaInformationSession::PublicMediaInformationSession>(arguments, completeCallback, logCallback));
addSessionToSessionHistory(session);
return session;
}
struct ffmpegkit::MediaInformationSession::PublicMediaInformationSession : public ffmpegkit::MediaInformationSession {
PublicMediaInformationSession(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) :
MediaInformationSession(arguments, completeCallback, logCallback) {
}
};
ffmpegkit::MediaInformationSession::MediaInformationSession(const std::list<std::string>& arguments, ffmpegkit::MediaInformationSessionCompleteCallback completeCallback, ffmpegkit::LogCallback logCallback) :
ffmpegkit::AbstractSession(arguments, logCallback, ffmpegkit::LogRedirectionStrategyNeverPrintLogs), _completeCallback{completeCallback}, _mediaInformation{nullptr} {
}
std::shared_ptr<ffmpegkit::MediaInformation> ffmpegkit::MediaInformationSession::getMediaInformation() {
return _mediaInformation;
}
void ffmpegkit::MediaInformationSession::setMediaInformation(const std::shared_ptr<ffmpegkit::MediaInformation> mediaInformation) {
_mediaInformation = mediaInformation;
}
ffmpegkit::MediaInformationSessionCompleteCallback ffmpegkit::MediaInformationSession::getCompleteCallback() {
return _completeCallback;
}
bool ffmpegkit::MediaInformationSession::isFFmpeg() const {
return false;
}
bool ffmpegkit::MediaInformationSession::isFFprobe() const {
return false;
}
bool ffmpegkit::MediaInformationSession::isMediaInformation() const {
return true;
}
logCallback
static ffmpegkit::LogCallback logCallback
Definition: FFmpegKitConfig.cpp:64
LogCallback.h
MediaInformation.h
addSessionToSessionHistory
void addSessionToSessionHistory(const std::shared_ptr< ffmpegkit::Session > session)
Definition: FFmpegKitConfig.cpp:160
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