Skip to content

Commit b8cb14c

Browse files
catch exception on incorrect profile, and display at the end
1 parent fff6b87 commit b8cb14c

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

app/cpp/presetChecker/presetChecker.cpp

Lines changed: 29 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ int main( int argc, char** argv )
1414

1515
std::cout << p.getProfiles().size() << std::endl;
1616

17+
size_t presetInError = 0;
18+
1719
std::cout << std::left;
1820

1921
for( auto profile : p.getProfiles() )
@@ -22,18 +24,35 @@ int main( int argc, char** argv )
2224
for( auto key : profile )
2325
std::cout << std::setw(35) << key.first << key.second << std::endl;
2426

25-
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo )
26-
{
27-
avtranscoder::OutputVideo outputVideo;
28-
outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() );
27+
try{
28+
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeVideo )
29+
{
30+
avtranscoder::OutputVideo outputVideo;
31+
outputVideo.setProfile( profile, outputVideo.getVideoDesc().getVideoFrameDesc() );
32+
}
33+
34+
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio )
35+
{
36+
avtranscoder::OutputAudio outputAudio;
37+
outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() );
38+
}
2939
}
30-
31-
if( profile.find( avtranscoder::Profile::avProfileType )->second == avtranscoder::Profile::avProfileTypeAudio )
40+
catch( ... )
3241
{
33-
avtranscoder::OutputAudio outputAudio;
34-
outputAudio.setProfile( profile, outputAudio.getAudioDesc().getFrameDesc() );
42+
std::cout << "ERROR on preset ! " << std::endl;
43+
presetInError ++;
3544
}
36-
3745
}
3846

39-
}
47+
std::cout << "********************" << std::endl;
48+
std::cout << " Result: " << std::endl;
49+
if( presetInError )
50+
{
51+
std::cout << presetInError << " / " << p.getProfiles().size() << " are incorrects" << std::endl;
52+
}
53+
else
54+
{
55+
std::cout << "every presets are corrects" << std::endl;
56+
}
57+
std::cout << "********************" << std::endl;
58+
}

0 commit comments

Comments
 (0)