AvTranscoder
0.9.4
C++APIforLibav/FFmpeg
|
#include <FileProperties.hpp>
Public Member Functions | |
FileProperties (const FormatContext &formatContext) | |
Analayse a file from its FormatContext. More... | |
void | extractStreamProperties (IProgress &progress, const EAnalyseLevel level) |
Relaunch streams analysis with a specific level. More... | |
std::string | getFilename () const |
std::string | getFormatName () const |
A comma separated list of short names for the format, or empty if unknown. More... | |
std::string | getFormatLongName () const |
Descriptive name for the format, meant to be more human-readable than name, or empty if unknown. More... | |
bool | isRawFormat () const |
Is there a container, or a raw bitstreams without access to timing information. More... | |
std::string | getFormatMimeType () const |
Comma-separated list of mime types, or empty if unknown. More... | |
size_t | getProgramsCount () const |
double | getStartTime () const |
float | getDuration () const |
in seconds More... | |
size_t | getBitRate () const |
total stream bitrate in bit/s, 0 if not available (result of a computation by ffmpeg) More... | |
size_t | getPacketSize () const |
const PropertyVector & | getMetadatas () const |
size_t | getNbStreams () const |
size_t | getNbVideoStreams () const |
size_t | getNbAudioStreams () const |
size_t | getNbDataStreams () const |
size_t | getNbSubtitleStreams () const |
size_t | getNbAttachementStreams () const |
size_t | getNbUnknownStreams () const |
const FormatContext & | getFormatContext () |
const AVFormatContext & | getAVFormatContext () |
std::string | allPropertiesAsJson () const |
Return all properties as a json format. More... | |
std::string | asJson () const |
Return all format properties as a json format. More... | |
PropertyMap | asMap () const |
Return format properties as a map (name of property, value) More... | |
PropertyVector | asVector () const |
Return format properties as a vector (name of property: value) More... | |
PropertyVector & | fillVector (PropertyVector &data) const |
To avoid copy of the vector. More... | |
const avtranscoder::StreamProperties & | getStreamPropertiesWithIndex (const size_t streamIndex) const |
const std::vector < avtranscoder::StreamProperties * > | getStreamProperties () const |
const std::vector < avtranscoder::VideoProperties > & | getVideoProperties () const |
const std::vector < avtranscoder::AudioProperties > & | getAudioProperties () const |
const std::vector < avtranscoder::DataProperties > & | getDataProperties () const |
const std::vector < avtranscoder::SubtitleProperties > & | getSubtitleProperties () const |
const std::vector < avtranscoder::AttachementProperties > & | getAttachementProperties () const |
const std::vector < avtranscoder::UnknownProperties > & | getUnknownProperties () const |
Private Member Functions | |
template<typename T > | |
void | addProperty (PropertyVector &data, const std::string &key, T(FileProperties::*getter)(void) const) const |
void | clearStreamProperties () |
Clear all array of stream properties. More... | |
Private Attributes | |
const FormatContext * | _formatContext |
Has link (no ownership) More... | |
const AVFormatContext * | _avFormatContext |
Has link (no ownership) More... | |
std::map< size_t, StreamProperties * > | _streams |
Map of properties per stream index (of all types) - only references to the following properties. More... | |
std::vector< VideoProperties > | _videoStreams |
Array of properties per video stream. More... | |
std::vector< AudioProperties > | _audioStreams |
Array of properties per audio stream. More... | |
std::vector< DataProperties > | _dataStreams |
Array of properties per data stream. More... | |
std::vector< SubtitleProperties > | _subtitleStreams |
Array of properties per subtitle stream. More... | |
std::vector < AttachementProperties > | _attachementStreams |
Array of properties per attachement stream. More... | |
std::vector< UnknownProperties > | _unknownStreams |
Array of properties per unknown stream. More... | |
PropertyVector | _metadatas |
Definition at line 24 of file FileProperties.hpp.
avtranscoder::FileProperties::FileProperties | ( | const FormatContext & | formatContext | ) |
Analayse a file from its FormatContext.
Definition at line 13 of file FileProperties.cpp.
References _avFormatContext, _metadatas, avtranscoder::eAnalyseLevelHeader, extractStreamProperties(), and avtranscoder::detail::fillMetadataDictionnary().
|
inlineprivate |
Definition at line 95 of file FileProperties.hpp.
References avtranscoder::detail::add(), and avtranscoder::detail::propertyValueIfError.
Referenced by fillVector().
std::string avtranscoder::FileProperties::allPropertiesAsJson | ( | ) | const |
Return all properties as a json format.
Definition at line 290 of file FileProperties.cpp.
References _attachementStreams, _audioStreams, _dataStreams, _subtitleStreams, _unknownStreams, _videoStreams, asJson(), and avtranscoder::json::JsonStreamWriter::build().
Referenced by main().
std::string avtranscoder::FileProperties::asJson | ( | ) | const |
Return all format properties as a json format.
Definition at line 281 of file FileProperties.cpp.
References asMap(), and avtranscoder::json::JsonStreamWriter::build().
Referenced by allPropertiesAsJson().
PropertyMap avtranscoder::FileProperties::asMap | ( | ) | const |
Return format properties as a map (name of property, value)
Definition at line 268 of file FileProperties.cpp.
References asVector().
Referenced by asJson().
PropertyVector avtranscoder::FileProperties::asVector | ( | ) | const |
Return format properties as a vector (name of property: value)
Definition at line 234 of file FileProperties.cpp.
References fillVector().
Referenced by asMap(), and avtranscoder::operator<<().
|
private |
Clear all array of stream properties.
Definition at line 362 of file FileProperties.cpp.
References _attachementStreams, _audioStreams, _dataStreams, _streams, _subtitleStreams, _unknownStreams, and _videoStreams.
Referenced by extractStreamProperties().
void avtranscoder::FileProperties::extractStreamProperties | ( | IProgress & | progress, |
const EAnalyseLevel | level | ||
) |
Relaunch streams analysis with a specific level.
progress | callback to get analysis progression |
level | of analysis |
Definition at line 30 of file FileProperties.cpp.
References _attachementStreams, _audioStreams, _dataStreams, _formatContext, _streams, _subtitleStreams, _unknownStreams, _videoStreams, clearStreamProperties(), avtranscoder::eAnalyseLevelHeader, avtranscoder::FormatContext::getAVStream(), avtranscoder::FormatContext::getNbStreams(), and isRawFormat().
Referenced by avtranscoder::InputFile::analyse(), and FileProperties().
PropertyVector & avtranscoder::FileProperties::fillVector | ( | PropertyVector & | data | ) | const |
To avoid copy of the vector.
Definition at line 240 of file FileProperties.cpp.
References _metadatas, avtranscoder::detail::add(), addProperty(), getBitRate(), getDuration(), getFilename(), getFormatLongName(), getFormatMimeType(), getFormatName(), getNbAttachementStreams(), getNbAudioStreams(), getNbDataStreams(), getNbStreams(), getNbSubtitleStreams(), getNbUnknownStreams(), getNbVideoStreams(), getProgramsCount(), and getStartTime().
Referenced by asVector().
|
inline |
Definition at line 78 of file FileProperties.hpp.
Referenced by avtranscoder::operator<<().
|
inline |
Definition at line 75 of file FileProperties.hpp.
Referenced by avtranscoder::operator<<().
|
inline |
Definition at line 83 of file FileProperties.hpp.
size_t avtranscoder::FileProperties::getBitRate | ( | ) | const |
total stream bitrate in bit/s, 0 if not available (result of a computation by ffmpeg)
Definition at line 192 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
|
inline |
Definition at line 76 of file FileProperties.hpp.
Referenced by avtranscoder::operator<<().
float avtranscoder::FileProperties::getDuration | ( | ) | const |
in seconds
Definition at line 185 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
std::string avtranscoder::FileProperties::getFilename | ( | ) | const |
Definition at line 129 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
|
inline |
Definition at line 63 of file FileProperties.hpp.
std::string avtranscoder::FileProperties::getFormatLongName | ( | ) | const |
Descriptive name for the format, meant to be more human-readable than name, or empty if unknown.
Definition at line 143 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
std::string avtranscoder::FileProperties::getFormatMimeType | ( | ) | const |
Comma-separated list of mime types, or empty if unknown.
Definition at line 160 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
std::string avtranscoder::FileProperties::getFormatName | ( | ) | const |
A comma separated list of short names for the format, or empty if unknown.
Definition at line 136 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector(), and isRawFormat().
|
inline |
Definition at line 53 of file FileProperties.hpp.
|
inline |
Definition at line 60 of file FileProperties.hpp.
Referenced by fillVector(), and avtranscoder::operator<<().
|
inline |
Definition at line 57 of file FileProperties.hpp.
Referenced by fillVector(), and avtranscoder::operator<<().
|
inline |
Definition at line 58 of file FileProperties.hpp.
Referenced by fillVector(), and avtranscoder::operator<<().
size_t avtranscoder::FileProperties::getNbStreams | ( | ) | const |
Definition at line 227 of file FileProperties.cpp.
References _avFormatContext.
Referenced by avtranscoder::Transcoder::addInputFile(), fillVector(), and isRawFormat().
|
inline |
Definition at line 59 of file FileProperties.hpp.
Referenced by fillVector(), and avtranscoder::operator<<().
|
inline |
Definition at line 61 of file FileProperties.hpp.
Referenced by fillVector(), and avtranscoder::operator<<().
|
inline |
Definition at line 56 of file FileProperties.hpp.
Referenced by fillVector(), avtranscoder::InputFile::getFps(), and avtranscoder::operator<<().
size_t avtranscoder::FileProperties::getPacketSize | ( | ) | const |
Definition at line 199 of file FileProperties.cpp.
References _avFormatContext.
size_t avtranscoder::FileProperties::getProgramsCount | ( | ) | const |
Definition at line 171 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
double avtranscoder::FileProperties::getStartTime | ( | ) | const |
Definition at line 178 of file FileProperties.cpp.
References _avFormatContext.
Referenced by fillVector().
const std::vector< avtranscoder::StreamProperties * > avtranscoder::FileProperties::getStreamProperties | ( | ) | const |
Definition at line 217 of file FileProperties.cpp.
References _streams.
Referenced by avtranscoder::Transcoder::add(), and isRawFormat().
const avtranscoder::StreamProperties & avtranscoder::FileProperties::getStreamPropertiesWithIndex | ( | const size_t | streamIndex | ) | const |
Definition at line 206 of file FileProperties.cpp.
References _streams.
Referenced by avtranscoder::Transcoder::add(), avtranscoder::Transcoder::getProfileFromFile(), avtranscoder::InputStream::getProperties(), avtranscoder::AudioReader::init(), and avtranscoder::VideoReader::init().
|
inline |
Definition at line 77 of file FileProperties.hpp.
Referenced by avtranscoder::operator<<().
|
inline |
Definition at line 79 of file FileProperties.hpp.
Referenced by avtranscoder::operator<<().
|
inline |
Definition at line 74 of file FileProperties.hpp.
Referenced by avtranscoder::InputFile::getFps(), and avtranscoder::operator<<().
bool avtranscoder::FileProperties::isRawFormat | ( | ) | const |
Is there a container, or a raw bitstreams without access to timing information.
Definition at line 150 of file FileProperties.cpp.
References getFormatName(), getNbStreams(), and getStreamProperties().
Referenced by extractStreamProperties().
|
private |
Array of properties per attachement stream.
Definition at line 121 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().
|
private |
Array of properties per audio stream.
Definition at line 118 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().
|
private |
Has link (no ownership)
Definition at line 112 of file FileProperties.hpp.
Referenced by FileProperties(), getBitRate(), getDuration(), getFilename(), getFormatLongName(), getFormatMimeType(), getFormatName(), getNbStreams(), getPacketSize(), getProgramsCount(), and getStartTime().
|
private |
Array of properties per data stream.
Definition at line 119 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().
|
private |
Has link (no ownership)
Definition at line 111 of file FileProperties.hpp.
Referenced by extractStreamProperties().
|
private |
Definition at line 124 of file FileProperties.hpp.
Referenced by FileProperties(), and fillVector().
|
private |
Map of properties per stream index (of all types) - only references to the following properties.
Definition at line 115 of file FileProperties.hpp.
Referenced by clearStreamProperties(), extractStreamProperties(), getStreamProperties(), and getStreamPropertiesWithIndex().
|
private |
Array of properties per subtitle stream.
Definition at line 120 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().
|
private |
Array of properties per unknown stream.
Definition at line 122 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().
|
private |
Array of properties per video stream.
Definition at line 117 of file FileProperties.hpp.
Referenced by allPropertiesAsJson(), clearStreamProperties(), and extractStreamProperties().