From 73bf2a4a8163788a55a2b9531650b19eba8d0746 Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Fri, 18 Jul 2014 12:05:49 +0200 Subject: [PATCH 1/3] OptionLoader: add getAVPixelFormat and getAVSampleFormat * getAVPixelFormat: get the enum value from the pixel format name. * getAVSampleFormat: get the enum value from the sample format name. --- src/AvTranscoder/OptionLoader.cpp | 10 ++++++++++ src/AvTranscoder/OptionLoader.hpp | 12 ++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/AvTranscoder/OptionLoader.cpp b/src/AvTranscoder/OptionLoader.cpp index 064670d6..8393f250 100644 --- a/src/AvTranscoder/OptionLoader.cpp +++ b/src/AvTranscoder/OptionLoader.cpp @@ -352,4 +352,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 c9b9ce9d..d95937f7 100644 --- a/src/AvTranscoder/OptionLoader.hpp +++ b/src/AvTranscoder/OptionLoader.hpp @@ -74,6 +74,18 @@ class OptionLoader */ 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. From 0a2ef1aaa6f9bceea5acc2338d4caf07bd2f7a7a Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Fri, 18 Jul 2014 12:06:04 +0200 Subject: [PATCH 2/3] OptionLoader: update doc --- src/AvTranscoder/OptionLoader.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/AvTranscoder/OptionLoader.hpp b/src/AvTranscoder/OptionLoader.hpp index d95937f7..7c1b0803 100644 --- a/src/AvTranscoder/OptionLoader.hpp +++ b/src/AvTranscoder/OptionLoader.hpp @@ -63,13 +63,13 @@ class OptionLoader public: /** - * Get array of pixel format supported by 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 = "" ); From 82f7af1734f833ec98eb0fd8cf04819c90827d4a Mon Sep 17 00:00:00 2001 From: Clement Champetier Date: Fri, 18 Jul 2014 13:33:58 +0200 Subject: [PATCH 3/3] Profile: remove width and height OuputVideo: width and height are set from the imageDesc. These informations are not in the profile. --- src/AvTranscoder/EssenceStream/OutputVideo.cpp | 10 ---------- src/AvTranscoder/Profile.cpp | 2 -- src/AvTranscoder/Profile.hpp | 3 --- 3 files changed, 15 deletions(-) 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/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; 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