Skip to content

dev OptionLoader #25

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 18, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions src/AvTranscoder/EssenceStream/OutputVideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 );
Expand All @@ -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;

Expand All @@ -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;

Expand Down
10 changes: 10 additions & 0 deletions src/AvTranscoder/OptionLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -353,4 +353,14 @@ std::vector<std::string> 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() );
}

}
16 changes: 14 additions & 2 deletions src/AvTranscoder/OptionLoader.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> 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<std::string> 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.
Expand Down
2 changes: 0 additions & 2 deletions src/AvTranscoder/Profile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
{
Expand Down
3 changes: 0 additions & 3 deletions src/AvTranscoder/Profile.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down