12 : _formatContext(&formatContext.getAVFormatContext())
25 ss <<
"Stream at index " <<
_streamIndex <<
" does not exist.";
26 throw std::runtime_error(ss.str());
42 throw std::runtime_error(
"unknown format context");
49 throw std::runtime_error(
"unknown format context");
62 throw std::runtime_error(
"unknown format context");
69 throw std::runtime_error(
"unknown codec context");
76 throw std::runtime_error(
"unknown codec");
78 if(
_codec->capabilities & CODEC_CAP_TRUNCATED)
82 throw std::runtime_error(
"unknown codec name");
84 return std::string(
_codec->name);
90 throw std::runtime_error(
"unknown codec");
92 if(
_codec->capabilities & CODEC_CAP_TRUNCATED)
96 throw std::runtime_error(
"unknown codec long name");
98 return std::string(
_codec->long_name);
117 for(
size_t metadataIndex = 0; metadataIndex <
_metadatas.size(); ++metadataIndex)
130 for(PropertyVector::const_iterator it = dataVector.begin(); it != dataVector.end(); ++it)
132 dataMap.insert(std::make_pair(it->first, it->second));
142 for(PropertyMap::iterator it = properties.begin(); it != properties.end(); ++it)
143 writer << std::make_pair(it->first.c_str(), it->second.c_str());
144 return writer.
build();
153 for(PropertyVector::iterator it = properties.begin(); it != properties.end(); ++it)
155 flux << std::setw(
detail::keyWidth) << it->first <<
": " << it->second << std::endl;
std::vector< std::pair< std::string, std::string > > PropertyVector
PropertyVector is a vector of pair, because the order of properties matters to us.
const AVFormatContext * _formatContext
Has link (no ownership)
AVMediaType getStreamType() const
std::string getCodecName() const
const std::string separator
Rational getTimeBase() const
void add(PropertyVector &propertyVector, const std::string &key, const size_t &value)
AVCodec * _codec
Has link (no ownership)
PropertyMap asMap() const
Return all properties as a map (name of property, value)
void fillMetadataDictionnary(AVDictionary *avdictionnary, PropertyVector &metadata)
Fill metadata parameter with the given AVDictionary.
virtual std::string build()
float getDuration() const
in seconds
std::map< std::string, std::string > PropertyMap
std::string asJson() const
Return all properties as a json format.
PropertyVector _metadatas
Wrapper of an AVFormatContext.
virtual PropertyVector & fillVector(PropertyVector &data) const
To avoid copy of the vector.
std::string getCodecLongName() const
AVCodecContext * _codecContext
Has link (no ownership)
size_t getStreamId() const
size_t getCodecId() const
Virtual based class of properties for all types of stream.
void addProperty(PropertyVector &dataVector, const std::string &key, T(StreamProperties::*getter)(void) const) const
StreamProperties(const FormatContext &formatContext, const size_t index)
Write an object to a stream.
std::ostream & operator<<(std::ostream &flux, const InputFile &input)
size_t getStreamIndex() const
virtual ~StreamProperties()=0
PropertyVector asVector() const
Same data with a specific order.