# FFmpegKit Linux API: StreamInformation.cpp Source File

Loading...
Searching...
No Matches
StreamInformation.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 Public 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 Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with FFmpegKit. If not, see <http://www.gnu.org/licenses/>.
*/
#include "StreamInformation.h"
ffmpegkit::StreamInformation::StreamInformation(std::shared_ptr<rapidjson::Value> streamInformationValue) : _streamInformationValue{streamInformationValue} {
}
std::shared_ptr<int64_t> ffmpegkit::StreamInformation::getIndex() {
return getNumberProperty(KeyIndex);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getType() {
return getStringProperty(KeyType);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getCodec() {
return getStringProperty(KeyCodec);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getCodecLong() {
return getStringProperty(KeyCodecLong);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getFormat() {
return getStringProperty(KeyFormat);
}
std::shared_ptr<int64_t> ffmpegkit::StreamInformation::getWidth() {
return getNumberProperty(KeyWidth);
}
std::shared_ptr<int64_t> ffmpegkit::StreamInformation::getHeight() {
return getNumberProperty(KeyHeight);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getBitrate() {
return getStringProperty(KeyBitRate);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getSampleRate() {
return getStringProperty(KeySampleRate);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getSampleFormat() {
return getStringProperty(KeySampleFormat);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getChannelLayout() {
return getStringProperty(KeyChannelLayout);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getSampleAspectRatio() {
return getStringProperty(KeySampleAspectRatio);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getDisplayAspectRatio() {
return getStringProperty(KeyDisplayAspectRatio);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getAverageFrameRate() {
return getStringProperty(KeyAverageFrameRate);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getRealFrameRate() {
return getStringProperty(KeyRealFrameRate);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getTimeBase() {
return getStringProperty(KeyTimeBase);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getCodecTimeBase() {
return getStringProperty(KeyCodecTimeBase);
}
std::shared_ptr<rapidjson::Value> ffmpegkit::StreamInformation::getTags() {
return getProperty(KeyTags);
}
std::shared_ptr<std::string> ffmpegkit::StreamInformation::getStringProperty(const char* key) {
if (_streamInformationValue->HasMember(key)) {
return std::make_shared<std::string>((*_streamInformationValue)[key].GetString());
} else {
return nullptr;
}
}
std::shared_ptr<int64_t> ffmpegkit::StreamInformation::getNumberProperty(const char* key) {
if (_streamInformationValue->HasMember(key)) {
return std::make_shared<int64_t>((*_streamInformationValue)[key].GetInt64());
} else {
return nullptr;
}
}
std::shared_ptr<rapidjson::Value> ffmpegkit::StreamInformation::getProperty(const char* key) {
if (_streamInformationValue->HasMember(key)) {
auto value = std::make_shared<rapidjson::Value>();
*value = (*_streamInformationValue)[key];
return value;
} else {
return nullptr;
}
}
std::shared_ptr<rapidjson::Value> ffmpegkit::StreamInformation::getAllProperties() {
if (_streamInformationValue != nullptr) {
auto all = std::make_shared<rapidjson::Value>();
*all = (*_streamInformationValue);
return all;
} else {
return nullptr;
}
}
StreamInformation.h
ffmpegkit::StreamInformation::getType
std::shared_ptr< std::string > getType()
Definition StreamInformation.cpp:29
ffmpegkit::StreamInformation::getProperty
std::shared_ptr< rapidjson::Value > getProperty(const char *key)
Definition StreamInformation.cpp:113
ffmpegkit::StreamInformation::getIndex
std::shared_ptr< int64_t > getIndex()
Definition StreamInformation.cpp:25
ffmpegkit::StreamInformation::getNumberProperty
std::shared_ptr< int64_t > getNumberProperty(const char *key)
Definition StreamInformation.cpp:105
ffmpegkit::StreamInformation::getSampleFormat
std::shared_ptr< std::string > getSampleFormat()
Definition StreamInformation.cpp:61
ffmpegkit::StreamInformation::getHeight
std::shared_ptr< int64_t > getHeight()
Definition StreamInformation.cpp:49
ffmpegkit::StreamInformation::getSampleAspectRatio
std::shared_ptr< std::string > getSampleAspectRatio()
Definition StreamInformation.cpp:69
ffmpegkit::StreamInformation::getTags
std::shared_ptr< rapidjson::Value > getTags()
Definition StreamInformation.cpp:93
ffmpegkit::StreamInformation::getSampleRate
std::shared_ptr< std::string > getSampleRate()
Definition StreamInformation.cpp:57
ffmpegkit::StreamInformation::getStringProperty
std::shared_ptr< std::string > getStringProperty(const char *key)
Definition StreamInformation.cpp:97
ffmpegkit::StreamInformation::getCodecLong
std::shared_ptr< std::string > getCodecLong()
Definition StreamInformation.cpp:37
ffmpegkit::StreamInformation::getDisplayAspectRatio
std::shared_ptr< std::string > getDisplayAspectRatio()
Definition StreamInformation.cpp:73
ffmpegkit::StreamInformation::getRealFrameRate
std::shared_ptr< std::string > getRealFrameRate()
Definition StreamInformation.cpp:81
ffmpegkit::StreamInformation::getWidth
std::shared_ptr< int64_t > getWidth()
Definition StreamInformation.cpp:45
ffmpegkit::StreamInformation::getFormat
std::shared_ptr< std::string > getFormat()
Definition StreamInformation.cpp:41
ffmpegkit::StreamInformation::getTimeBase
std::shared_ptr< std::string > getTimeBase()
Definition StreamInformation.cpp:85
ffmpegkit::StreamInformation::getAllProperties
std::shared_ptr< rapidjson::Value > getAllProperties()
Definition StreamInformation.cpp:123
ffmpegkit::StreamInformation::getAverageFrameRate
std::shared_ptr< std::string > getAverageFrameRate()
Definition StreamInformation.cpp:77
ffmpegkit::StreamInformation::StreamInformation
StreamInformation(std::shared_ptr< rapidjson::Value > streamInformationValue)
Definition StreamInformation.cpp:22
ffmpegkit::StreamInformation::getCodecTimeBase
std::shared_ptr< std::string > getCodecTimeBase()
Definition StreamInformation.cpp:89
ffmpegkit::StreamInformation::getBitrate
std::shared_ptr< std::string > getBitrate()
Definition StreamInformation.cpp:53
ffmpegkit::StreamInformation::getChannelLayout
std::shared_ptr< std::string > getChannelLayout()
Definition StreamInformation.cpp:65
ffmpegkit::StreamInformation::getCodec
std::shared_ptr< std::string > getCodec()
Definition StreamInformation.cpp:33