Skip to content

Commit 2b817e6

Browse files
committed
Merge pull request #110 from cchampet/fix_FileProperties
Fix media properties
2 parents f67d4c9 + b231cce commit 2b817e6

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

src/AvTranscoder/mediaProperty/AudioProperties.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ std::string AudioProperties::getCodecName() const
4040
{
4141
if( _codec && _codec->name )
4242
return std::string( _codec->name );
43-
else
44-
return "unknown codec";
43+
return "unknown codec";
4544
}
4645

4746
std::string AudioProperties::getCodecLongName() const

src/AvTranscoder/mediaProperty/FileProperties.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,22 +20,22 @@ FileProperties::FileProperties( const FormatContext& formatContext )
2020

2121
std::string FileProperties::getFilename() const
2222
{
23-
if( ! _formatContext )
24-
throw std::runtime_error( "unknown format context" );
23+
if( ! _formatContext || ! _formatContext->filename )
24+
return "unknown file name";
2525
return _formatContext->filename;
2626
}
2727

2828
std::string FileProperties::getFormatName() const
2929
{
30-
if( ! _formatContext || ! _formatContext->iformat )
31-
throw std::runtime_error( "unknown format context" );
30+
if( ! _formatContext || ! _formatContext->iformat || ! _formatContext->iformat->name )
31+
return "unknown format name";
3232
return _formatContext->iformat->name;
3333
}
3434

3535
std::string FileProperties::getFormatLongName() const
3636
{
37-
if( ! _formatContext || ! _formatContext->iformat )
38-
throw std::runtime_error( "unknown format context" );
37+
if( ! _formatContext || ! _formatContext->iformat || ! _formatContext->iformat->long_name )
38+
return "unknown format long name";
3939
return _formatContext->iformat->long_name;
4040
}
4141

src/AvTranscoder/mediaProperty/VideoProperties.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ std::string VideoProperties::getProfileName() const
8484

8585
if( _codecContext->profile != -99 )
8686
{
87-
const char* profile;
87+
const char* profile = NULL;
8888
if( ( profile = av_get_profile_name( _codec, _codecContext->profile ) ) != NULL )
8989
return std::string( profile );
9090
}

0 commit comments

Comments
 (0)