Skip to content

Commit 73bf2a4

Browse files
author
Clement Champetier
committed
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.
1 parent 323cb0c commit 73bf2a4

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

src/AvTranscoder/OptionLoader.cpp

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

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

src/AvTranscoder/OptionLoader.hpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,18 @@ class OptionLoader
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.

0 commit comments

Comments
 (0)