Skip to content

Commit 1f7805c

Browse files
author
Clement Champetier
committed
Merge branch 'dev_OptionLoader' into dev_Dummy
2 parents 672eea8 + 233b088 commit 1f7805c

File tree

5 files changed

+24
-17
lines changed

5 files changed

+24
-17
lines changed

src/AvTranscoder/EssenceStream/OutputVideo.cpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -195,12 +195,6 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im
195195
throw std::runtime_error( "The profile " + desc[ Profile::avProfileIdentificatorHuman ] + " is invalid." );
196196
}
197197

198-
if( ( desc.count( Profile::avProfileWidth ) && std::strtoul( desc[ Profile::avProfileWidth ].c_str(), NULL, 0 ) != imageDesc.getWidth() ) ||
199-
( desc.count( Profile::avProfileHeight ) && std::strtoul( desc[ Profile::avProfileHeight ].c_str(), NULL, 0 ) != imageDesc.getHeight() ) )
200-
{
201-
throw std::runtime_error( "Invalid imageDesc with the profile " + desc[ Profile::avProfileIdentificatorHuman ] + "." );
202-
}
203-
204198
_videoDesc.setVideoCodec( desc[ Profile::avProfileCodec ] );
205199

206200
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
215209
(*it).first == Profile::avProfileType ||
216210
(*it).first == Profile::avProfileCodec ||
217211
(*it).first == Profile::avProfilePixelFormat ||
218-
(*it).first == Profile::avProfileWidth ||
219-
(*it).first == Profile::avProfileHeight ||
220212
(*it).first == Profile::avProfileFrameRate )
221213
continue;
222214

@@ -239,8 +231,6 @@ void OutputVideo::setProfile( Profile::ProfileDesc& desc, const avtranscoder::Im
239231
(*it).first == Profile::avProfileType ||
240232
(*it).first == Profile::avProfileCodec ||
241233
(*it).first == Profile::avProfilePixelFormat ||
242-
(*it).first == Profile::avProfileWidth ||
243-
(*it).first == Profile::avProfileHeight ||
244234
(*it).first == Profile::avProfileFrameRate )
245235
continue;
246236

src/AvTranscoder/OptionLoader.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,4 +353,14 @@ std::vector<std::string> OptionLoader::getSampleFormats( const std::string& audi
353353
return sampleFormats;
354354
}
355355

356+
AVPixelFormat OptionLoader::getAVPixelFormat( const std::string& pixelFormat )
357+
{
358+
return av_get_pix_fmt( pixelFormat.c_str() );
359+
}
360+
361+
AVSampleFormat OptionLoader::getAVSampleFormat( const std::string& sampleFormat )
362+
{
363+
return av_get_sample_fmt( sampleFormat.c_str() );
364+
}
365+
356366
}

src/AvTranscoder/OptionLoader.hpp

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,29 @@ class OptionLoader
6363

6464
public:
6565
/**
66-
* Get array of pixel format supported by a video codec.
66+
* @brief Get array of pixel format supported by video codec.
6767
* @param videoCodecName: the video codec name (empty if not indicated, and so get all pixel formats supported by all video codecs).
6868
*/
6969
static std::vector<std::string> getPixelFormats( const std::string& videoCodecName = "" );
7070

7171
/**
72-
* Get array of sample format supported by an audio codec.
72+
* @brief Get array of sample format supported by an audio codec.
7373
* @param audioCodecName: the audio codec name (empty if not indicated, and so get all sample formats supported by all audio codecs).
7474
*/
7575
static std::vector<std::string> getSampleFormats( const std::string& audioCodecName = "" );
7676

77+
/**
78+
* @brief Get the corresponding AVPixelFormat from the pixel format name
79+
* @param pixelFormat the name of the pixel format
80+
*/
81+
static AVPixelFormat getAVPixelFormat( const std::string& pixelFormat );
82+
83+
/**
84+
* @brief Get the corresponding AVSampleFormat from the sample format name
85+
* @param sampleFormat the name of the sample format
86+
*/
87+
static AVSampleFormat getAVSampleFormat( const std::string& sampleFormat );
88+
7789
private:
7890
/**
7991
* @brief: load array of Option depending on the flags.

src/AvTranscoder/Profile.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ const std::string Profile::avProfileSampleFormat( "sample_fmt" );
2525
const std::string Profile::avProfileFrameRate( "r" );
2626
const std::string Profile::avProfileSampleRate( "ar" );
2727
const std::string Profile::avProfileChannel( "ac" );
28-
const std::string Profile::avProfileWidth( "width" );
29-
const std::string Profile::avProfileHeight( "height" );
3028

3129
Profile::Profile( bool autoload )
3230
{

src/AvTranscoder/Profile.hpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ class Profile
2525
static const std::string avProfileFrameRate;
2626
static const std::string avProfileSampleRate;
2727
static const std::string avProfileChannel;
28-
29-
static const std::string avProfileWidth;
30-
static const std::string avProfileHeight;
3128

3229
public:
3330
// typedef std::pair< std::string, std::string > KeyDesc;

0 commit comments

Comments
 (0)