diff --git a/src/AvTranscoder/EssenceStream/OutputVideo.cpp b/src/AvTranscoder/EssenceStream/OutputVideo.cpp index cdff0a06..2c6b8397 100644 --- a/src/AvTranscoder/EssenceStream/OutputVideo.cpp +++ b/src/AvTranscoder/EssenceStream/OutputVideo.cpp @@ -195,12 +195,6 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im throw std::runtime_error( "The profile " + desc[ Profile::avProfileIdentificatorHuman ] + " is invalid." ); } - if( ( desc.count( Profile::avProfileWidth ) && std::strtoul( desc[ Profile::avProfileWidth ].c_str(), NULL, 0 ) != imageDesc.getWidth() ) || - ( desc.count( Profile::avProfileHeight ) && std::strtoul( desc[ Profile::avProfileHeight ].c_str(), NULL, 0 ) != imageDesc.getHeight() ) ) - { - throw std::runtime_error( "Invalid imageDesc with the profile " + desc[ Profile::avProfileIdentificatorHuman ] + "." ); - } - _videoDesc.setVideoCodec( desc[ Profile::avProfileCodec ] ); const size_t frameRate = std::strtoul( desc[ Profile::avProfileFrameRate ].c_str(), NULL, 0 ); @@ -215,8 +209,6 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im (*it).first == Profile::avProfileType || (*it).first == Profile::avProfileCodec || (*it).first == Profile::avProfilePixelFormat || - (*it).first == Profile::avProfileWidth || - (*it).first == Profile::avProfileHeight || (*it).first == Profile::avProfileFrameRate ) continue; @@ -239,8 +231,6 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im (*it).first == Profile::avProfileType || (*it).first == Profile::avProfileCodec || (*it).first == Profile::avProfilePixelFormat || - (*it).first == Profile::avProfileWidth || - (*it).first == Profile::avProfileHeight || (*it).first == Profile::avProfileFrameRate ) continue; diff --git a/src/AvTranscoder/OptionLoader.cpp b/src/AvTranscoder/OptionLoader.cpp index 2f6389a3..0f8d2337 100644 --- a/src/AvTranscoder/OptionLoader.cpp +++ b/src/AvTranscoder/OptionLoader.cpp @@ -353,4 +353,14 @@ std::vector OptionLoader::getSampleFormats( const std::string& audi return sampleFormats; } +AVPixelFormat OptionLoader::getAVPixelFormat( const std::string& pixelFormat ) +{ + return av_get_pix_fmt( pixelFormat.c_str() ); +} + +AVSampleFormat OptionLoader::getAVSampleFormat( const std::string& sampleFormat ) +{ + return av_get_sample_fmt( sampleFormat.c_str() ); +} + } diff --git a/src/AvTranscoder/OptionLoader.hpp b/src/AvTranscoder/OptionLoader.hpp index 1f77b30d..7c1b0803 100644 --- a/src/AvTranscoder/OptionLoader.hpp +++ b/src/AvTranscoder/OptionLoader.hpp @@ -63,17 +63,29 @@ class OptionLoader public: /** - * Get array of pixel format supported by a video codec. + * @brief Get array of pixel format supported by video codec. * @param videoCodecName: the video codec name (empty if not indicated, and so get all pixel formats supported by all video codecs). */ static std::vector getPixelFormats( const std::string& videoCodecName = "" ); /** - * Get array of sample format supported by an audio codec. + * @brief Get array of sample format supported by an audio codec. * @param audioCodecName: the audio codec name (empty if not indicated, and so get all sample formats supported by all audio codecs). */ static std::vector getSampleFormats( const std::string& audioCodecName = "" ); + /** + * @brief Get the corresponding AVPixelFormat from the pixel format name + * @param pixelFormat the name of the pixel format + */ + static AVPixelFormat getAVPixelFormat( const std::string& pixelFormat ); + + /** + * @brief Get the corresponding AVSampleFormat from the sample format name + * @param sampleFormat the name of the sample format + */ + static AVSampleFormat getAVSampleFormat( const std::string& sampleFormat ); + private: /** * @brief: load array of Option depending on the flags. diff --git a/src/AvTranscoder/Profile.cpp b/src/AvTranscoder/Profile.cpp index c9097948..feef878d 100644 --- a/src/AvTranscoder/Profile.cpp +++ b/src/AvTranscoder/Profile.cpp @@ -25,8 +25,6 @@ const std::string Profile::avProfileSampleFormat( "sample_fmt" ); const std::string Profile::avProfileFrameRate( "r" ); const std::string Profile::avProfileSampleRate( "ar" ); const std::string Profile::avProfileChannel( "ac" ); -const std::string Profile::avProfileWidth( "width" ); -const std::string Profile::avProfileHeight( "height" ); Profile::Profile( bool autoload ) { diff --git a/src/AvTranscoder/Profile.hpp b/src/AvTranscoder/Profile.hpp index eca96a4f..434b52b1 100644 --- a/src/AvTranscoder/Profile.hpp +++ b/src/AvTranscoder/Profile.hpp @@ -25,9 +25,6 @@ class Profile static const std::string avProfileFrameRate; static const std::string avProfileSampleRate; static const std::string avProfileChannel; - - static const std::string avProfileWidth; - static const std::string avProfileHeight; public: // typedef std::pair< std::string, std::string > KeyDesc;