Skip to content

Commit 1127853

Browse files
author
Clement Champetier
committed
util: getVideo/AudioCodecsNames: clean
1 parent ed6eaf0 commit 1127853

File tree

1 file changed

+10
-20
lines changed

1 file changed

+10
-20
lines changed

src/AvTranscoder/util.cpp

Lines changed: 10 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -144,18 +144,13 @@ NamesArray getVideoCodecsNames()
144144
AVCodec* c = NULL;
145145
while( ( c = av_codec_next( c ) ) != NULL )
146146
{
147-
switch( c->type )
147+
if( c->type == AVMEDIA_TYPE_VIDEO)
148148
{
149-
case AVMEDIA_TYPE_VIDEO:
150-
{
151-
if( ! c->name && ! c->long_name )
152-
continue;
149+
if( ! c->name && ! c->long_name )
150+
continue;
153151

154-
videoCodecsNames.push_back( std::make_pair( std::string( c->name ? c->name : "" ), std::string( c->long_name ? c->long_name : "" ) ) );
155-
break;
156-
}
157-
default:
158-
break;
152+
std::pair< std::string, std::string > codecNames( std::string( c->name ? c->name : "" ), std::string( c->long_name ? c->long_name : "" ) );
153+
videoCodecsNames.push_back( codecNames );
159154
}
160155
}
161156
return videoCodecsNames;
@@ -168,18 +163,13 @@ NamesArray getAudioCodecsNames()
168163
AVCodec* c = NULL;
169164
while( ( c = av_codec_next( c ) ) != NULL )
170165
{
171-
switch( c->type )
166+
if( c->type == AVMEDIA_TYPE_AUDIO )
172167
{
173-
case AVMEDIA_TYPE_AUDIO:
174-
{
175-
if( ! c->name && ! c->long_name )
176-
continue;
168+
if( ! c->name && ! c->long_name )
169+
continue;
177170

178-
audioCodecsNames.push_back( std::make_pair( std::string( c->name ? c->name : "" ), std::string( c->long_name ? c->long_name : "" ) ) );
179-
break;
180-
}
181-
default:
182-
break;
171+
std::pair< std::string, std::string > codecNames( std::string( c->name ? c->name : "" ), std::string( c->long_name ? c->long_name : "" ) );
172+
audioCodecsNames.push_back( codecNames );
183173
}
184174
}
185175
return audioCodecsNames;

0 commit comments

Comments
 (0)