From 6eb8a95b368353451f93a29f2f17938116f38182 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 11 Aug 2014 14:29:09 +0200 Subject: [PATCH 1/8] MediadataStructures: add getDataMap() * Can get all data of Properties structures by getDataMap(), which return a MetadatasMap. * Update Print file. This is the choice of the application which uses AvTranscoder of how to display the data. --- .../Metadatas/MediaMetadatasStructures.cpp | 175 ++++++++++++++++++ .../Metadatas/MediaMetadatasStructures.hpp | 30 ++- src/AvTranscoder/Metadatas/Print.hpp | 134 +++++--------- 3 files changed, 247 insertions(+), 92 deletions(-) create mode 100644 src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp new file mode 100644 index 00000000..059d1412 --- /dev/null +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -0,0 +1,175 @@ +#include "MediaMetadatasStructures.hpp" + +#include + +namespace avtranscoder +{ + +namespace detail +{ + +template +void add( MetadatasMap& dataMap, const std::string& key, const T& value ) +{ + std::stringstream ss; + ss << value; + dataMap[key]= ss.str(); +} + +template<> +void add( MetadatasMap& dataMap, const std::string& key, const std::string& value ) +{ + dataMap[key]= value; +} + +template<> +void add( MetadatasMap& dataMap, const std::string& key, const bool& value ) +{ + dataMap[key]= ( value ? "True" : "False" ); +} + +} + +MetadatasMap VideoProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "codec name", codecName ); + detail::add( dataMap, "codec long name", codecLongName ); + detail::add( dataMap, "profile name", profileName ); + detail::add( dataMap, "start timecode", startTimecode ); + 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, "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, "has B frames", hasBFrames ); + + 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, "codec id", codecId ); + detail::add( dataMap, "stream id", streamId ); + detail::add( dataMap, "profile", profile ); + detail::add( dataMap, "level", level ); + detail::add( dataMap, "width", width ); + detail::add( dataMap, "height", height ); + detail::add( dataMap, "dtgActiveFormat", dtgActiveFormat ); + detail::add( dataMap, "timeBase", timeBase.num / timeBase.den ); + detail::add( dataMap, "fps", fps ); + detail::add( dataMap, "ticksPerFrame", ticksPerFrame ); + detail::add( dataMap, "pixel aspect ratio", sar.num / sar.den ); + detail::add( dataMap, "display aspect ratio", dar.num / dar.den ); + detail::add( dataMap, "bit rate", bitRate ); + detail::add( dataMap, "max bit rate", maxBitRate ); + detail::add( dataMap, "min bit rate", minBitRate ); + detail::add( dataMap, "components count", componentsCount ); + detail::add( dataMap, "chroma width", chromaWidth ); + detail::add( dataMap, "chroma height", chromaHeight ); + detail::add( dataMap, "gop size", gopSize ); + detail::add( dataMap, "references frames", referencesFrames ); + + return dataMap; +} + +MetadatasMap AudioProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "codec name", codecName ); + detail::add( dataMap, "codec long name", codecLongName ); + detail::add( dataMap, "sample format", sampleFormat ); + detail::add( dataMap, "channel layout", channelLayout ); + detail::add( dataMap, "channel name", channelName ); + detail::add( dataMap, "channel description", channelDescription ); + + detail::add( dataMap, "codec id", codecId ); + detail::add( dataMap, "stream id", streamId ); + detail::add( dataMap, "sample rate", sampleRate ); + detail::add( dataMap, "channels", channels ); + detail::add( dataMap, "bit rate", bit_rate ); + + return dataMap; +} + +MetadatasMap DataProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + return dataMap; +} + +MetadatasMap SubtitleProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + return dataMap; +} + +MetadatasMap AttachementProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + return dataMap; +} + +MetadatasMap UnknownProperties::getDataMap() const +{ + MetadatasMap dataMap; + + detail::add( dataMap, "streamId", streamId ); + + 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 ); + + for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) + { + std::string key( "Metadatas " + metadatas.at( metadataIndex ).first ); + detail::add( dataMap, key, metadatas.at( metadataIndex ).second ); + } + + 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() ); + + return dataMap; +} + +} diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index 95c22fa8..380b31dd 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -1,13 +1,20 @@ #ifndef _AV_TRANSCODER_MEDIA_HPP_ #define _AV_TRANSCODER_MEDIA_HPP_ +#include + #include #include - +#include namespace avtranscoder { +/** + * @brief Can get all data of Properties structures by getDataMap(), which return a MetadatasMap. + */ +typedef std::map MetadatasMap; + struct Channel { size_t id; size_t chromaHeight; @@ -67,6 +74,9 @@ struct VideoProperties { // ( frame type / is key frame ) std::vector< std::pair< char, bool > > gopStructure; std::vector channels; + +public: + MetadatasMap getDataMap() const; }; struct AudioProperties { @@ -81,22 +91,37 @@ struct AudioProperties { size_t sampleRate; size_t channels; size_t bit_rate; + +public: + MetadatasMap getDataMap() const; }; struct DataProperties { size_t streamId; + +public: + MetadatasMap getDataMap() const; }; struct SubtitleProperties { size_t streamId; + +public: + MetadatasMap getDataMap() const; }; struct AttachementProperties { size_t streamId; + +public: + MetadatasMap getDataMap() const; }; struct UnknownProperties { size_t streamId; + +public: + MetadatasMap getDataMap() const; }; struct Properties { @@ -118,6 +143,9 @@ struct Properties { std::vector< UnknownProperties > unknownStreams; std::vector< std::pair< std::string, std::string > > metadatas; // ( key, value ) + +public: + MetadatasMap getDataMap() const; }; } diff --git a/src/AvTranscoder/Metadatas/Print.hpp b/src/AvTranscoder/Metadatas/Print.hpp index 2dbaa8f6..7286e5b8 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 ) + + std::map dataMap = properties.getDataMap(); + for( std::map::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 ) + + std::map dataMap = videoProperties.getDataMap(); + for( std::map::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; + + std::map dataMap = audioProperties.getDataMap(); + for( std::map::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; + + std::map dataMap = dataProperties.getDataMap(); + for( std::map::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; + + std::map dataMap = subtitleProperties.getDataMap(); + for( std::map::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; + + std::map dataMap = attachementProperties.getDataMap(); + for( std::map::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; + + std::map dataMap = unknownProperties.getDataMap(); + for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + { + flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; + } return flux; } @@ -166,13 +118,13 @@ std::ostream& operator<<( std::ostream& flux, const InputFile& input ) { flux << input.getProperties().videoStreams.at( videoStreamIndex ) << std::endl; } - + // audio streams for( size_t audioStreamIndex = 0; audioStreamIndex < input.getProperties().audioStreams.size(); ++audioStreamIndex ) { flux << input.getProperties().audioStreams.at( audioStreamIndex ) << std::endl; } - + // data streams for( size_t dataStreamIndex = 0; dataStreamIndex < input.getProperties().dataStreams.size(); ++dataStreamIndex ) { From fc1ff8254b8dde95b2bc2e92ebce4b29a6657cbb Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Mon, 11 Aug 2014 14:37:39 +0200 Subject: [PATCH 2/8] Description: correct Licence to License --- app/avInfo/avInfo.cpp | 2 +- src/AvTranscoder/Description.cpp | 6 +++--- src/AvTranscoder/Description.hpp | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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/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; From 112c7382ddc4b704a81b85951d2af81d534e4b62 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 10:42:23 +0200 Subject: [PATCH 3/8] Metadatas Print: clean newlines Easier to parse. --- app/avMeta/avMeta.cpp | 2 +- src/AvTranscoder/Metadatas/Print.hpp | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) 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/Metadatas/Print.hpp b/src/AvTranscoder/Metadatas/Print.hpp index 7286e5b8..246d2480 100644 --- a/src/AvTranscoder/Metadatas/Print.hpp +++ b/src/AvTranscoder/Metadatas/Print.hpp @@ -111,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; From 2d226d7f8edd530258a2fa960f72d90927a7efd9 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 10:44:16 +0200 Subject: [PATCH 4/8] MedaiMetadatasStructures: clean declaration formatting --- .../Metadatas/MediaMetadatasStructures.hpp | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index 380b31dd..d84dae38 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -15,13 +15,15 @@ namespace avtranscoder */ typedef std::map MetadatasMap; -struct Channel { +struct Channel +{ size_t id; size_t chromaHeight; size_t bitStep; }; -struct VideoProperties { +struct VideoProperties +{ std::string codecName; std::string codecLongName; std::string profileName; @@ -79,7 +81,8 @@ struct VideoProperties { MetadatasMap getDataMap() const; }; -struct AudioProperties { +struct AudioProperties +{ std::string codecName; std::string codecLongName; std::string sampleFormat; @@ -96,35 +99,40 @@ struct AudioProperties { MetadatasMap getDataMap() const; }; -struct DataProperties { +struct DataProperties +{ size_t streamId; public: MetadatasMap getDataMap() const; }; -struct SubtitleProperties { +struct SubtitleProperties +{ size_t streamId; public: MetadatasMap getDataMap() const; }; -struct AttachementProperties { +struct AttachementProperties +{ size_t streamId; public: MetadatasMap getDataMap() const; }; -struct UnknownProperties { +struct UnknownProperties +{ size_t streamId; public: MetadatasMap getDataMap() const; }; -struct Properties { +struct Properties +{ std::string filename; std::string formatName; std::string formatLongName; From 23b04466482062455c4d88ea677c5c1d7f3b6350 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 10:48:48 +0200 Subject: [PATCH 5/8] MediaMetadatasStructures: switch MetadatasMap from map to vector * Use the typedef as ofter as possible. * This structure will enable us to give the data with the order we want (which is not the alphabetic order). --- .../Metadatas/MediaMetadatasStructures.cpp | 8 ++++-- .../Metadatas/MediaMetadatasStructures.hpp | 4 +-- src/AvTranscoder/Metadatas/Print.hpp | 28 +++++++++---------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp index 059d1412..4751df54 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -1,6 +1,7 @@ #include "MediaMetadatasStructures.hpp" #include +#include namespace avtranscoder { @@ -13,19 +14,20 @@ void add( MetadatasMap& dataMap, const std::string& key, const T& value ) { std::stringstream ss; ss << value; - dataMap[key]= ss.str(); + add( dataMap, key, ss.str() ); } template<> void add( MetadatasMap& dataMap, const std::string& key, const std::string& value ) { - dataMap[key]= value; + dataMap.push_back( std::pair( key, value ) ); } template<> void add( MetadatasMap& dataMap, const std::string& key, const bool& value ) { - dataMap[key]= ( value ? "True" : "False" ); + add( dataMap, key, value ? "True" : "False" ); +} } } diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index d84dae38..eadaf8e0 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -13,7 +13,7 @@ namespace avtranscoder /** * @brief Can get all data of Properties structures by getDataMap(), which return a MetadatasMap. */ -typedef std::map MetadatasMap; +typedef std::vector< std::pair > MetadatasMap; struct Channel { @@ -150,7 +150,7 @@ 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 246d2480..94b7a696 100644 --- a/src/AvTranscoder/Metadatas/Print.hpp +++ b/src/AvTranscoder/Metadatas/Print.hpp @@ -19,8 +19,8 @@ std::ostream& operator<<( std::ostream& flux, const Properties& properties ) flux << std::left; flux << separator << " Wrapper " << separator << std::endl; - std::map dataMap = properties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = properties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -33,8 +33,8 @@ std::ostream& operator<<( std::ostream& flux, const VideoProperties& videoProper flux << std::left; flux << separator << " Video stream " << separator << std::endl; - std::map dataMap = videoProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = videoProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -47,8 +47,8 @@ std::ostream& operator<<( std::ostream& flux, const AudioProperties& audioProper flux << std::left; flux << separator << " Audio stream " << separator << std::endl; - std::map dataMap = audioProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = audioProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -60,8 +60,8 @@ std::ostream& operator<<( std::ostream& flux, const DataProperties& dataProperti { flux << separator << " Data stream " << separator << std::endl; - std::map dataMap = dataProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = dataProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -73,8 +73,8 @@ std::ostream& operator<<( std::ostream& flux, const SubtitleProperties& subtitle { flux << separator << " Subtitle stream " << separator << std::endl; - std::map dataMap = subtitleProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = subtitleProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -86,8 +86,8 @@ std::ostream& operator<<( std::ostream& flux, const AttachementProperties& attac { flux << separator << " Attachement stream " << separator << std::endl; - std::map dataMap = attachementProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = attachementProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } @@ -99,8 +99,8 @@ std::ostream& operator<<( std::ostream& flux, const UnknownProperties& unknownPr { flux << separator << " Unknown stream " << separator << std::endl; - std::map dataMap = unknownProperties.getDataMap(); - for( std::map::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) + MetadatasMap dataMap = unknownProperties.getDataMap(); + for( MetadatasMap::iterator it = dataMap.begin(); it != dataMap.end(); ++it ) { flux << std::setw( keyWidth ) << it->first << ": " << it->second << std::endl; } From 4bd847ce0d4d7a85089df44add08608a34e0b6c4 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 10:51:49 +0200 Subject: [PATCH 6/8] MediaMetadatasStructures: reorder data in getDataMap() Update order of data for: * VideoProperties. * AudioProperties. * Properties. --- .../Metadatas/MediaMetadatasStructures.cpp | 61 +++++++++---------- 1 file changed, 30 insertions(+), 31 deletions(-) diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp index 4751df54..24e576b0 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -36,14 +36,26 @@ 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 ); @@ -55,7 +67,13 @@ MetadatasMap VideoProperties::getDataMap() const detail::add( dataMap, "interlaced ", isInterlaced ); detail::add( dataMap, "top field first", topFieldFirst ); detail::add( dataMap, "field order", fieldOrder); - detail::add( dataMap, "has B frames", hasBFrames ); + 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 ) @@ -65,25 +83,7 @@ MetadatasMap VideoProperties::getDataMap() const } detail::add( dataMap, "gop", gop ); - detail::add( dataMap, "codec id", codecId ); - detail::add( dataMap, "stream id", streamId ); - detail::add( dataMap, "profile", profile ); - detail::add( dataMap, "level", level ); - detail::add( dataMap, "width", width ); - detail::add( dataMap, "height", height ); - detail::add( dataMap, "dtgActiveFormat", dtgActiveFormat ); - detail::add( dataMap, "timeBase", timeBase.num / timeBase.den ); - detail::add( dataMap, "fps", fps ); - detail::add( dataMap, "ticksPerFrame", ticksPerFrame ); - detail::add( dataMap, "pixel aspect ratio", sar.num / sar.den ); - detail::add( dataMap, "display aspect ratio", dar.num / dar.den ); - detail::add( dataMap, "bit rate", bitRate ); - detail::add( dataMap, "max bit rate", maxBitRate ); - detail::add( dataMap, "min bit rate", minBitRate ); - detail::add( dataMap, "components count", componentsCount ); - detail::add( dataMap, "chroma width", chromaWidth ); - detail::add( dataMap, "chroma height", chromaHeight ); - detail::add( dataMap, "gop size", gopSize ); + detail::add( dataMap, "has B frames", hasBFrames ); detail::add( dataMap, "references frames", referencesFrames ); return dataMap; @@ -93,18 +93,18 @@ 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 ); - detail::add( dataMap, "codec id", codecId ); - detail::add( dataMap, "stream id", streamId ); - detail::add( dataMap, "sample rate", sampleRate ); - detail::add( dataMap, "channels", channels ); - detail::add( dataMap, "bit rate", bit_rate ); return dataMap; } @@ -153,12 +153,6 @@ MetadatasMap Properties::getDataMap() const detail::add( dataMap, "format name", formatName ); detail::add( dataMap, "format long name", formatLongName ); - for( size_t metadataIndex = 0; metadataIndex < metadatas.size(); ++metadataIndex ) - { - std::string key( "Metadatas " + metadatas.at( metadataIndex ).first ); - detail::add( dataMap, key, metadatas.at( metadataIndex ).second ); - } - detail::add( dataMap, "start time", startTime ); detail::add( dataMap, "duration", duration ); detail::add( dataMap, "bitrate", bitRate ); @@ -171,6 +165,11 @@ MetadatasMap Properties::getDataMap() const 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; } From 3d99fa5b3bfd3538ff4aec116928e3912660f820 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 11:03:20 +0200 Subject: [PATCH 7/8] MediaMetadatasStructures: add fillMetadataDictionnary * This functions fills metadata parameter with the given AVDictionary. * Use it when add metadata of AVFormatContext in InputFile::analyse function. --- src/AvTranscoder/File/InputFile.cpp | 6 +----- .../Metadatas/MediaMetadatasStructures.cpp | 15 +++++++++++++++ .../Metadatas/MediaMetadatasStructures.hpp | 8 ++++++++ 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/src/AvTranscoder/File/InputFile.cpp b/src/AvTranscoder/File/InputFile.cpp index 8b26e019..a04dc922 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++ ) { diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp index 24e576b0..62fe33cb 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -1,5 +1,12 @@ #include "MediaMetadatasStructures.hpp" +extern "C" { +#ifndef __STDC_CONSTANT_MACROS + #define __STDC_CONSTANT_MACROS +#endif +#include +} + #include #include @@ -28,6 +35,14 @@ 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 ) ); + } } } diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index eadaf8e0..7582996e 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -15,6 +15,14 @@ namespace avtranscoder */ 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; From e3518165f35760f393d885ea65954d9b1f58ff45 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Tue, 12 Aug 2014 11:06:33 +0200 Subject: [PATCH 8/8] MediaMetadatasStructures: add metadata for each stream * All type of stream can have metadata! * Fill these data when add metadata of AVFormatContext of the stream in InputFile::analyse function. * Get these data with getDataMap function corresponding to the structure you want. --- src/AvTranscoder/File/InputFile.cpp | 6 ++++ .../Metadatas/MediaMetadatasStructures.cpp | 29 +++++++++++++++++++ .../Metadatas/MediaMetadatasStructures.hpp | 8 +++++ 3 files changed, 43 insertions(+) diff --git a/src/AvTranscoder/File/InputFile.cpp b/src/AvTranscoder/File/InputFile.cpp index a04dc922..a8bbcd7d 100644 --- a/src/AvTranscoder/File/InputFile.cpp +++ b/src/AvTranscoder/File/InputFile.cpp @@ -89,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 index 62fe33cb..225ce2c7 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.cpp @@ -101,6 +101,11 @@ MetadatasMap VideoProperties::getDataMap() const 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; } @@ -120,6 +125,10 @@ MetadatasMap AudioProperties::getDataMap() const 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; } @@ -130,6 +139,11 @@ MetadatasMap DataProperties::getDataMap() const 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; } @@ -139,6 +153,11 @@ MetadatasMap SubtitleProperties::getDataMap() const 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; } @@ -148,6 +167,11 @@ MetadatasMap AttachementProperties::getDataMap() const 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; } @@ -157,6 +181,11 @@ MetadatasMap UnknownProperties::getDataMap() const 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; } diff --git a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp index 7582996e..cedb7209 100644 --- a/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp +++ b/src/AvTranscoder/Metadatas/MediaMetadatasStructures.hpp @@ -85,6 +85,8 @@ struct VideoProperties std::vector< std::pair< char, bool > > gopStructure; std::vector channels; + MetadatasMap metadatas; + public: MetadatasMap getDataMap() const; }; @@ -103,6 +105,8 @@ struct AudioProperties size_t channels; size_t bit_rate; + MetadatasMap metadatas; + public: MetadatasMap getDataMap() const; }; @@ -110,6 +114,7 @@ struct AudioProperties struct DataProperties { size_t streamId; + MetadatasMap metadatas; public: MetadatasMap getDataMap() const; @@ -118,6 +123,7 @@ struct DataProperties struct SubtitleProperties { size_t streamId; + MetadatasMap metadatas; public: MetadatasMap getDataMap() const; @@ -126,6 +132,7 @@ struct SubtitleProperties struct AttachementProperties { size_t streamId; + MetadatasMap metadatas; public: MetadatasMap getDataMap() const; @@ -134,6 +141,7 @@ struct AttachementProperties struct UnknownProperties { size_t streamId; + MetadatasMap metadatas; public: MetadatasMap getDataMap() const; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy