diff --git a/app/avInfo/avInfo.cpp b/app/avInfo/avInfo.cpp index 94e279f5..f63f8b59 100644 --- a/app/avInfo/avInfo.cpp +++ b/app/avInfo/avInfo.cpp @@ -13,7 +13,7 @@ int main( int argc, char** argv ) std::cout << std::left; std::cout << std::setw( 15 ) << (*library).getName(); std::cout << std::setw( 10 ) << (*library).getStringVersion(); - std::cout << std::setw( 30 ) << (*library).getLicence(); + std::cout << std::setw( 30 ) << (*library).getLicense(); std::cout << std::endl; } diff --git a/app/avMeta/avMeta.cpp b/app/avMeta/avMeta.cpp index 28736169..58492337 100644 --- a/app/avMeta/avMeta.cpp +++ b/app/avMeta/avMeta.cpp @@ -17,5 +17,5 @@ int main( int argc, char** argv ) input.analyse( p, avtranscoder::InputFile::eAnalyseLevelFull ); // a simply metadata display - std::cout << input << std::endl; + std::cout << input; } diff --git a/src/AvTranscoder/Description.cpp b/src/AvTranscoder/Description.cpp index 6361ec44..f955f375 100644 --- a/src/AvTranscoder/Description.cpp +++ b/src/AvTranscoder/Description.cpp @@ -22,9 +22,9 @@ extern "C" { namespace avtranscoder { -Library::Library( const std::string& name, const std::string& licence, const size_t major, const size_t minor, const size_t release ) +Library::Library( const std::string& name, const std::string& license, const size_t major, const size_t minor, const size_t release ) : _name( name ) - , _licence( licence ) + , _licence( license ) , _major( major ) , _minor( minor ) , _release( release ) @@ -69,7 +69,7 @@ size_t Library::getReleaseVersion() return _release; } -std::string Library::getLicence() +std::string Library::getLicense() { return _licence; } diff --git a/src/AvTranscoder/Description.hpp b/src/AvTranscoder/Description.hpp index f2764eab..cd943d98 100644 --- a/src/AvTranscoder/Description.hpp +++ b/src/AvTranscoder/Description.hpp @@ -12,7 +12,7 @@ namespace avtranscoder class Library { public: - Library( const std::string& name, const std::string& licence, const size_t major, const size_t minor, const size_t release ); + Library( const std::string& name, const std::string& license, const size_t major, const size_t minor, const size_t release ); std::string getName(); @@ -22,7 +22,7 @@ class Library size_t getMinorVersion(); size_t getReleaseVersion(); - std::string getLicence(); + std::string getLicense(); private: std::string _name; std::string _licence; diff --git a/src/AvTranscoder/File/InputFile.cpp b/src/AvTranscoder/File/InputFile.cpp index 8b26e019..a8bbcd7d 100644 --- a/src/AvTranscoder/File/InputFile.cpp +++ b/src/AvTranscoder/File/InputFile.cpp @@ -80,11 +80,7 @@ InputFile& InputFile::analyse( ProgressListener& progress, const EAnalyseLevel l _properties.bitRate = _formatContext->bit_rate; _properties.packetSize = _formatContext->packet_size; - AVDictionaryEntry *tag = NULL; - while( ( tag = av_dict_get( _formatContext->metadata, "", tag, AV_DICT_IGNORE_SUFFIX ) ) ) - { - _properties.metadatas.push_back( std::pair( tag->key, tag->value ) ); - } + detail::fillMetadataDictionnary( _formatContext->metadata, _properties.metadatas ); for( size_t streamId = 0; streamId < _formatContext->nb_streams; streamId++ ) { @@ -93,31 +89,37 @@ InputFile& InputFile::analyse( ProgressListener& progress, const EAnalyseLevel l case AVMEDIA_TYPE_VIDEO: { _properties.videoStreams.push_back( videoStreamInfo( _formatContext, streamId, progress, level ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.videoStreams.back().metadatas ); break; } case AVMEDIA_TYPE_AUDIO: { _properties.audioStreams.push_back( audioStreamInfo( _formatContext, streamId ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.audioStreams.back().metadatas ); break; } case AVMEDIA_TYPE_DATA: { _properties.dataStreams.push_back( dataStreamInfo( _formatContext, streamId ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.dataStreams.back().metadatas ); break; } case AVMEDIA_TYPE_SUBTITLE: { _properties.subtitleStreams.push_back( subtitleStreamInfo( _formatContext, streamId ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.subtitleStreams.back().metadatas ); break; } case AVMEDIA_TYPE_ATTACHMENT: { _properties.attachementStreams.push_back( attachementStreamInfo( _formatContext, streamId ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.attachementStreams.back().metadatas ); break; } case AVMEDIA_TYPE_UNKNOWN: { _properties.unknownStreams.push_back( unknownStreamInfo( _formatContext, streamId ) ); + detail::fillMetadataDictionnary( _formatContext->streams[streamId]->metadata, _properties.unknownStreams.back().metadatas ); break; } case AVMEDIA_TYPE_NB: diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp new file mode 100644 index 00000000..225ce2c7 --- /dev/null +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -0,0 +1,220 @@ +#include "MediaMetadatasStructures.hpp" + +extern "C" { +#ifndef __STDC_CONSTANT_MACROS + #define __STDC_CONSTANT_MACROS +#endif +#include +} + +#include +#include + +namespace avtranscoder +{ + +namespace detail +{ + +template +void add( MetadatasMap& dataMap, const std::string& key, const T& value ) +{ + std::stringstream ss; + ss << value; + add( dataMap, key, ss.str() ); +} + +template<> +void add( MetadatasMap& dataMap, const std::string& key, const std::string& value ) +{ + dataMap.push_back( std::pair( key, value ) ); +} + +template<> +void add( MetadatasMap& dataMap, const std::string& key, const bool& value ) +{ + add( dataMap, key, value ? "True" : "False" ); +} + +void fillMetadataDictionnary( AVDictionary* avdictionnary, MetadatasMap& metadata ) +{ + AVDictionaryEntry* tag = NULL; + while( ( tag = av_dict_get( avdictionnary, "", tag, AV_DICT_IGNORE_SUFFIX ) ) ) + { + metadata.push_back( std::pair( tag->key, tag->value ) ); + } +} + +} + +MetadatasMap VideoProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "stream id", streamId ); + detail::add( dataMap, "codec id", codecId ); + detail::add( dataMap, "codec name", codecName ); + detail::add( dataMap, "codec long name", codecLongName ); + detail::add( dataMap, "profile", profile ); + detail::add( dataMap, "profile name", profileName ); + detail::add( dataMap, "level", level ); + detail::add( dataMap, "start timecode", startTimecode ); + detail::add( dataMap, "width", width ); + detail::add( dataMap, "height", height ); + detail::add( dataMap, "pixel aspect ratio", sar.num / sar.den ); + detail::add( dataMap, "display aspect ratio", dar.num / dar.den ); + detail::add( dataMap, "dtgActiveFormat", dtgActiveFormat ); + detail::add( dataMap, "components count", componentsCount ); + detail::add( dataMap, "pixel type", pixelName ); + detail::add( dataMap, "bit wise acked", bitWisePacked ); + detail::add( dataMap, "rgb pixel", rgbPixelData ); + detail::add( dataMap, "as alpha", asAlpha ); + detail::add( dataMap, "chroma width", chromaWidth ); + detail::add( dataMap, "chroma height", chromaHeight ); + detail::add( dataMap, "endianess", endianess ); + detail::add( dataMap, "color transfert", colorTransfert ); + detail::add( dataMap, "colorspace", colorspace ); + detail::add( dataMap, "color range", colorRange ); + detail::add( dataMap, "color primaries", colorPrimaries ); + detail::add( dataMap, "indexed colors", indexedColors ); + detail::add( dataMap, "pseudo paletted", pseudoPaletted ); + detail::add( dataMap, "chroma sample location", chromaSampleLocation); + detail::add( dataMap, "interlaced ", isInterlaced ); + detail::add( dataMap, "top field first", topFieldFirst ); + detail::add( dataMap, "field order", fieldOrder); + detail::add( dataMap, "timeBase", timeBase.num / timeBase.den ); + detail::add( dataMap, "fps", fps ); + detail::add( dataMap, "ticksPerFrame", ticksPerFrame ); + detail::add( dataMap, "bit rate", bitRate ); + detail::add( dataMap, "max bit rate", maxBitRate ); + detail::add( dataMap, "min bit rate", minBitRate ); + detail::add( dataMap, "gop size", gopSize ); + + std::string gop; + for( size_t frameIndex = 0; frameIndex < gopStructure.size(); ++frameIndex ) + { + gop += gopStructure.at( frameIndex ).first; + gop += ( gopStructure.at( frameIndex ).second ? "*" : " " ); + } + detail::add( dataMap, "gop", gop ); + + detail::add( dataMap, "has B frames", hasBFrames ); + detail::add( dataMap, "references frames", referencesFrames ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap AudioProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "stream id", streamId ); + detail::add( dataMap, "codec id", codecId ); + detail::add( dataMap, "codec name", codecName ); + detail::add( dataMap, "codec long name", codecLongName ); + detail::add( dataMap, "sample format", sampleFormat ); + detail::add( dataMap, "sample rate", sampleRate ); + detail::add( dataMap, "bit rate", bit_rate ); + detail::add( dataMap, "channels", channels ); + detail::add( dataMap, "channel layout", channelLayout ); + detail::add( dataMap, "channel name", channelName ); + detail::add( dataMap, "channel description", channelDescription ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap DataProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap SubtitleProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap AttachementProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap UnknownProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +MetadatasMap Properties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "filename", filename ); + detail::add( dataMap, "format name", formatName ); + detail::add( dataMap, "format long name", formatLongName ); + + detail::add( dataMap, "start time", startTime ); + detail::add( dataMap, "duration", duration ); + detail::add( dataMap, "bitrate", bitRate ); + detail::add( dataMap, "number of streams", streamsCount ); + detail::add( dataMap, "number of programs", programsCount ); + detail::add( dataMap, "number of video streams", videoStreams.size() ); + detail::add( dataMap, "number of audio streams", audioStreams.size() ); + detail::add( dataMap, "number of data streams", dataStreams.size() ); + detail::add( dataMap, "number of subtitle streams", subtitleStreams.size() ); + detail::add( dataMap, "number of attachement streams", attachementStreams.size() ); + detail::add( dataMap, "number of unknown streams", unknownStreams.size() ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + detail::add( dataMap, metadatas.at( metadataIndex ).first, metadatas.at( metadataIndex ).second ); + } + + return dataMap; +} + +} diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index 95c22fa8..cedb7209 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -1,20 +1,37 @@ #ifndef _AV_TRANSCODER_MEDIA_HPP_ #define _AV_TRANSCODER_MEDIA_HPP_ +#include + #include #include - +#include namespace avtranscoder { -struct Channel { +/** + * @brief Can get all data of Properties structures by getDataMap(), which return a MetadatasMap. + */ +typedef std::vector< std::pair > MetadatasMap; + +namespace detail +{ + /** + * @brief Fill metadata parameter with the given AVDictionary. + */ + void fillMetadataDictionnary( AVDictionary* avdictionnary, MetadatasMap& metadata ); +} + +struct Channel +{ size_t id; size_t chromaHeight; size_t bitStep; }; -struct VideoProperties { +struct VideoProperties +{ std::string codecName; std::string codecLongName; std::string profileName; @@ -67,9 +84,15 @@ struct VideoProperties { // ( frame type / is key frame ) std::vector< std::pair< char, bool > > gopStructure; std::vector channels; + + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct AudioProperties { +struct AudioProperties +{ std::string codecName; std::string codecLongName; std::string sampleFormat; @@ -81,25 +104,51 @@ struct AudioProperties { size_t sampleRate; size_t channels; size_t bit_rate; + + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct DataProperties { +struct DataProperties +{ size_t streamId; + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct SubtitleProperties { +struct SubtitleProperties +{ size_t streamId; + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct AttachementProperties { +struct AttachementProperties +{ size_t streamId; + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct UnknownProperties { +struct UnknownProperties +{ size_t streamId; + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; -struct Properties { +struct Properties +{ std::string filename; std::string formatName; std::string formatLongName; @@ -117,7 +166,10 @@ struct Properties { std::vector< AttachementProperties > attachementStreams; std::vector< UnknownProperties > unknownStreams; - std::vector< std::pair< std::string, std::string > > metadatas; // ( key, value ) + MetadatasMap metadatas; + +public: + MetadatasMap getDataMap() const; }; } diff --git a/src/AvTranscoder/Metadatas/Print.hpp b/src/AvTranscoder/Metadatas/Print.hpp index 2dbaa8f6..94b7a696 100644 --- a/src/AvTranscoder/Metadatas/Print.hpp +++ b/src/AvTranscoder/Metadatas/Print.hpp @@ -6,6 +6,7 @@ #include #include #include +#include namespace avtranscoder { @@ -17,27 +18,13 @@ std::ostream& operator<<( std::ostream& flux, const Properties& properties ) { flux << std::left; flux << separator << " Wrapper " << separator << std::endl; - flux << std::setw( keyWidth ) << "filename" << ": " << properties.filename << std::endl; - flux << std::setw( keyWidth ) << "format name" << ": " << properties.formatName << std::endl; - flux << std::setw( keyWidth ) << "format long name" << ": " << properties.formatLongName << std::endl; - flux << std::setw( keyWidth ) << "start time" << ": " << properties.startTime << std::endl; - flux << std::setw( keyWidth ) << "duration" << ": " << properties.duration << std::endl; - flux << std::setw( keyWidth ) << "bitrate" << ": " << properties.bitRate << std::endl; - flux << std::setw( keyWidth ) << "number of streams" << ": " << properties.streamsCount << std::endl; - flux << std::setw( keyWidth ) << "number of programs" << ": " << properties.programsCount << std::endl; - flux << std::setw( keyWidth ) << "number of video streams" << ": " << properties.videoStreams.size() << std::endl; - flux << std::setw( keyWidth ) << "number of audio streams" << ": " << properties.audioStreams.size() << std::endl; - flux << std::setw( keyWidth ) << "number of data streams" << ": " << properties.dataStreams.size() << std::endl; - flux << std::setw( keyWidth ) << "number of subtitle streams" << ": " << properties.subtitleStreams.size() << std::endl; - flux << std::setw( keyWidth ) << "number of attachement streams" << ": " << properties.attachementStreams.size() << std::endl; - flux << std::setw( keyWidth ) << "number of unknown streams" << ": " << properties.unknownStreams.size() << std::endl; - - flux << separator << " Metadatas " << separator << std::endl; - for( size_t metadataIndex = 0; metadataIndex < properties.metadatas.size(); ++metadataIndex ) + + MetadatasMap dataMap = properties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { - flux << std::setw( keyWidth ) << properties.metadatas.at( metadataIndex ).first << ": " << properties.metadatas.at( metadataIndex ).second << std::endl; + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } - + return flux; } @@ -45,63 +32,13 @@ std::ostream& operator<<( std::ostream& flux, const VideoProperties& videoProper { flux << std::left; flux << separator << " Video stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "codec name" << ": " << videoProperties.codecName << std::endl; - flux << std::setw( keyWidth ) << "codec long name" << ": " << videoProperties.codecLongName << std::endl; - flux << std::setw( keyWidth ) << "codec id" << ": " << videoProperties.codecId << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << videoProperties.streamId << std::endl; - flux << std::setw( keyWidth ) << "profile name" << ": " << videoProperties.profileName << std::endl; - flux << std::setw( keyWidth ) << "profile" << ": " << videoProperties.profile << std::endl; - flux << std::setw( keyWidth ) << "level" << ": " << videoProperties.level << std::endl; - flux << std::setw( keyWidth ) << "width" << ": " << videoProperties.width << std::endl; - flux << std::setw( keyWidth ) << "height" << ": " << videoProperties.height << std::endl; - flux << std::setw( keyWidth ) << "dtgActiveFormat" << ": " << videoProperties.dtgActiveFormat << std::endl; - - - flux << std::setw( keyWidth ) << "start timecode" << ": " << videoProperties.startTimecode << std::endl; - flux << std::setw( keyWidth ) << "timeBase" << ": " << videoProperties.timeBase.num << "/" << - videoProperties.timeBase.den << std::endl; - flux << std::setw( keyWidth ) << "fps" << ": " << videoProperties.fps << std::endl; - flux << std::setw( keyWidth ) << "ticksPerFrame" << ": " << videoProperties.ticksPerFrame << std::endl; - - flux << std::setw( keyWidth ) << "pixel aspect ratio" << ": " << videoProperties.sar.num << "/" << - videoProperties.sar.den << std::endl; - flux << std::setw( keyWidth ) << "display aspect ratio" << ": " << videoProperties.dar.num << "/" << - videoProperties.dar.den << std::endl; - flux << std::setw( keyWidth ) << "pixel type" << ": " << videoProperties.pixelName << std::endl; - flux << std::setw( keyWidth ) << "bit wise acked" << ": " << ( videoProperties.bitWisePacked ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "rgb pixel" << ": " << ( videoProperties.rgbPixelData ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "as alpha" << ": " << ( videoProperties.asAlpha ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "endianess" << ": " << videoProperties.endianess << std::endl; - - flux << std::setw( keyWidth ) << "bit rate" << ": " << videoProperties.bitRate << std::endl; - flux << std::setw( keyWidth ) << "max bit rate" << ": " << videoProperties.maxBitRate << std::endl; - flux << std::setw( keyWidth ) << "min bit rate" << ": " << videoProperties.minBitRate << std::endl; - - flux << std::setw( keyWidth ) << "color transfert" << ": " << videoProperties.colorTransfert << std::endl; - flux << std::setw( keyWidth ) << "colorspace" << ": " << videoProperties.colorspace << std::endl; - flux << std::setw( keyWidth ) << "color range" << ": " << videoProperties.colorRange << std::endl; - flux << std::setw( keyWidth ) << "color primaries" << ": " << videoProperties.colorPrimaries << std::endl; - flux << std::setw( keyWidth ) << "indexed colors" << ": " << ( videoProperties.indexedColors ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "pseudo paletted" << ": " << ( videoProperties.pseudoPaletted ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "components count" << ": " << videoProperties.componentsCount << std::endl; - flux << std::setw( keyWidth ) << "chroma width" << ": " << videoProperties.chromaWidth << std::endl; - flux << std::setw( keyWidth ) << "chroma height" << ": " << videoProperties.chromaHeight << std::endl; - flux << std::setw( keyWidth ) << "chroma sample location" << ": " << videoProperties.chromaSampleLocation << std::endl; - flux << std::setw( keyWidth ) << "interlaced " << ": " << ( videoProperties.isInterlaced ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "top field first" << ": " << ( videoProperties.topFieldFirst ? "True" : "False" ) << std::endl; - flux << std::setw( keyWidth ) << "field order" << ": " << videoProperties.fieldOrder << std::endl; - flux << std::setw( keyWidth ) << "gop size" << ": " << videoProperties.gopSize << std::endl; - flux << std::setw( keyWidth ) << "has B frames" << ": " << ( videoProperties.hasBFrames ? "True" : "False" ) << std::endl; - - flux << std::setw( keyWidth ) << "gop" << ": "; - for( size_t frameIndex = 0; frameIndex < videoProperties.gopStructure.size(); ++frameIndex ) + + MetadatasMap dataMap = videoProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { - flux << videoProperties.gopStructure.at( frameIndex ).first; - flux << ( videoProperties.gopStructure.at( frameIndex ).second ? "*" : " " ); + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } - flux << std::endl; - flux << std::setw( keyWidth ) << "references frames" << ": " << videoProperties.referencesFrames << std::endl; - + return flux; } @@ -109,17 +46,12 @@ std::ostream& operator<<( std::ostream& flux, const AudioProperties& audioProper { flux << std::left; flux << separator << " Audio stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "codec name" << ": " << audioProperties.codecName << std::endl; - flux << std::setw( keyWidth ) << "codec long name" << ": " << audioProperties.codecLongName << std::endl; - flux << std::setw( keyWidth ) << "sample format" << ": " << audioProperties.sampleFormat << std::endl; - flux << std::setw( keyWidth ) << "codec id" << ": " << audioProperties.codecId << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << audioProperties.streamId << std::endl; - flux << std::setw( keyWidth ) << "sample rate" << ": " << audioProperties.sampleRate << std::endl; - flux << std::setw( keyWidth ) << "channels" << ": " << audioProperties.channels << std::endl; - flux << std::setw( keyWidth ) << "channel layout" << ": " << audioProperties.channelLayout << std::endl; - flux << std::setw( keyWidth ) << "channel name" << ": " << audioProperties.channelName << std::endl; - flux << std::setw( keyWidth ) << "channel description" << ": " << audioProperties.channelDescription << std::endl; - flux << std::setw( keyWidth ) << "bit rate" << ": " << audioProperties.bit_rate << std::endl; + + MetadatasMap dataMap = audioProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -127,7 +59,12 @@ std::ostream& operator<<( std::ostream& flux, const AudioProperties& audioProper std::ostream& operator<<( std::ostream& flux, const DataProperties& dataProperties ) { flux << separator << " Data stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << dataProperties.streamId << std::endl; + + MetadatasMap dataMap = dataProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -135,7 +72,12 @@ std::ostream& operator<<( std::ostream& flux, const DataProperties& dataProperti std::ostream& operator<<( std::ostream& flux, const SubtitleProperties& subtitleProperties ) { flux << separator << " Subtitle stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << subtitleProperties.streamId << std::endl; + + MetadatasMap dataMap = subtitleProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -143,7 +85,12 @@ std::ostream& operator<<( std::ostream& flux, const SubtitleProperties& subtitle std::ostream& operator<<( std::ostream& flux, const AttachementProperties& attachementProperties ) { flux << separator << " Attachement stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << attachementProperties.streamId << std::endl; + + MetadatasMap dataMap = attachementProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -151,7 +98,12 @@ std::ostream& operator<<( std::ostream& flux, const AttachementProperties& attac std::ostream& operator<<( std::ostream& flux, const UnknownProperties& unknownProperties ) { flux << separator << " Unknown stream " << separator << std::endl; - flux << std::setw( keyWidth ) << "stream id" << ": " << unknownProperties.streamId << std::endl; + + MetadatasMap dataMap = unknownProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -159,42 +111,42 @@ std::ostream& operator<<( std::ostream& flux, const UnknownProperties& unknownPr std::ostream& operator<<( std::ostream& flux, const InputFile& input ) { // wrapper - flux << input.getProperties() << std::endl; + flux << input.getProperties(); // video streams for( size_t videoStreamIndex = 0; videoStreamIndex < input.getProperties().videoStreams.size(); ++videoStreamIndex ) { - flux << input.getProperties().videoStreams.at( videoStreamIndex ) << std::endl; + flux << input.getProperties().videoStreams.at( videoStreamIndex ); } - + // audio streams for( size_t audioStreamIndex = 0; audioStreamIndex < input.getProperties().audioStreams.size(); ++audioStreamIndex ) { - flux << input.getProperties().audioStreams.at( audioStreamIndex ) << std::endl; + flux << input.getProperties().audioStreams.at( audioStreamIndex ); } - + // data streams for( size_t dataStreamIndex = 0; dataStreamIndex < input.getProperties().dataStreams.size(); ++dataStreamIndex ) { - flux << input.getProperties().dataStreams.at( dataStreamIndex ) << std::endl; + flux << input.getProperties().dataStreams.at( dataStreamIndex ); } // subtitle streams for( size_t subtitleStreamIndex = 0; subtitleStreamIndex < input.getProperties().subtitleStreams.size(); ++subtitleStreamIndex ) { - flux << input.getProperties().subtitleStreams.at( subtitleStreamIndex ) << std::endl; + flux << input.getProperties().subtitleStreams.at( subtitleStreamIndex ); } // attachement streams for( size_t attachementStreamIndex = 0; attachementStreamIndex < input.getProperties().attachementStreams.size(); ++attachementStreamIndex ) { - flux << input.getProperties().attachementStreams.at( attachementStreamIndex ) << std::endl; + flux << input.getProperties().attachementStreams.at( attachementStreamIndex ); } // unknown streams for( size_t unknownStreamIndex = 0; unknownStreamIndex < input.getProperties().unknownStreams.size(); ++unknownStreamIndex ) { - flux << input.getProperties().unknownStreams.at( unknownStreamIndex ) << std::endl; + flux << input.getProperties().unknownStreams.at( unknownStreamIndex ); } return flux;