Skip to content

Commit 4108338

Browse files
author
Clement Champetier
committed
OptionLoader: simplify call to loadOptions
* Parameter rej_flags was useless: * req_flags = 0 & (DECODING | ENCODING): get options of formatContext * req_flags = (VIDEO | AUDIO | SUBTITLE | METADATA) & (DECODING | ENCODING): get options of codecContext. * Update OptionChecker to correctly load options (AUDIO in the example).
1 parent 02b7839 commit 4108338

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

app/optionChecker/optionChecker.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
int optionChecker( const std::string& inputfilename )
99
{
1010
avtranscoder::OptionLoader optionLoader;
11-
optionLoader.loadOptions( 0, 0 );
11+
optionLoader.loadOptions( AV_OPT_FLAG_AUDIO_PARAM );
1212

1313
// display Options
1414
for( auto option : optionLoader.getOptions() )

src/AvTranscoder/OptionLoader.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ OptionLoader::OptionLoader()
3535
OptionLoader::~OptionLoader()
3636
{
3737
avformat_free_context( m_avFormatContext );
38-
avcodec_close( m_avCodecContext );
38+
av_free( m_avCodecContext );
3939
}
4040

41-
void OptionLoader::loadOptions( int req_flags, int rej_flags )
41+
void OptionLoader::loadOptions( int req_flags )
4242
{
4343
std::map<std::string, int> optionUnitToIndex;
4444
std::vector<Option> childOptions;
@@ -65,8 +65,7 @@ void OptionLoader::loadOptions( int req_flags, int rej_flags )
6565
{
6666
if( !avOption ||
6767
! avOption->name ||
68-
( avOption->flags & req_flags ) != req_flags ||
69-
( avOption->flags & rej_flags ) )
68+
( avOption->flags & req_flags ) != req_flags )
7069
{
7170
continue;
7271
}

src/AvTranscoder/OptionLoader.hpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,9 @@ class OptionLoader
3333

3434
/**
3535
* @brief: load array of Option depending on the flags.
36-
* @param req_flags
37-
* @param rej_flags
36+
* @param req_flags: AVOption flags we want to load.
3837
*/
39-
void loadOptions( int req_flags, int rej_flags );
38+
void loadOptions( int req_flags );
4039

4140
private:
4241
std::vector<Option> m_options;

0 commit comments

Comments
 (0)