Skip to content

Commit 3c11691

Browse files
author
Clement Champetier
committed
coder & format: clean exception message
Like log, start with an upper case.
1 parent 8c5d4d1 commit 3c11691

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/AvTranscoder/codec/ICodec.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ void ICodec::openCodec()
5959
const int ret = avcodec_open2( _avCodecContext, _avCodec, NULL );
6060
if( ret < 0 )
6161
{
62-
std::string msg = "unable open codec: ";
62+
std::string msg = "Unable open codec: ";
6363

6464
if( _avCodec && _avCodec->long_name )
6565
msg += _avCodec->long_name;
@@ -116,7 +116,7 @@ void ICodec::setCodec( const ECodecType type, const std::string& codecName )
116116
const AVCodecDescriptor* avCodecDescriptor = avcodec_descriptor_get_by_name( codecName.c_str() );
117117
if( ! avCodecDescriptor )
118118
{
119-
std::string msg( "unable to find codec " );
119+
std::string msg( "Unable to find codec " );
120120
msg += codecName;
121121
throw std::runtime_error( msg );
122122
}
@@ -146,7 +146,7 @@ void ICodec::allocateContext()
146146
_avCodecContext = avcodec_alloc_context3( _avCodec );
147147
if( ! _avCodecContext )
148148
{
149-
throw std::runtime_error( "unable to allocate the codecContext and set its fields to default values" );
149+
throw std::runtime_error( "Unable to allocate the codecContext and set its fields to default values" );
150150
}
151151
_avCodecContext->codec = _avCodec;
152152
}

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ FormatContext::FormatContext( const std::string& filename, int req_flags, AVDict
1515
int ret = avformat_open_input( &_avFormatContext, filename.c_str(), NULL, options );
1616
if( ret < 0 )
1717
{
18-
std::string msg = "unable to open file ";
18+
std::string msg = "Unable to open file ";
1919
msg += filename;
2020
msg += ": ";
2121
msg += getDescriptionFromErrorCode( ret );
@@ -56,7 +56,7 @@ void FormatContext::findStreamInfo( AVDictionary** options )
5656
int err = avformat_find_stream_info( _avFormatContext, options );
5757
if( err < 0 )
5858
{
59-
throw std::ios_base::failure( "unable to find stream informations: " + getDescriptionFromErrorCode( err ) );
59+
throw std::ios_base::failure( "Unable to find stream informations: " + getDescriptionFromErrorCode( err ) );
6060
}
6161
}
6262

@@ -68,7 +68,7 @@ void FormatContext::openRessource( const std::string& url, int flags )
6868
int err = avio_open2( &_avFormatContext->pb, url.c_str(), flags, NULL, NULL );
6969
if( err < 0 )
7070
{
71-
throw std::ios_base::failure( "error when opening output format: " + getDescriptionFromErrorCode( err ) );
71+
throw std::ios_base::failure( "Error when opening output format: " + getDescriptionFromErrorCode( err ) );
7272
}
7373
}
7474

@@ -80,7 +80,7 @@ void FormatContext::closeRessource()
8080
int err = avio_close( _avFormatContext->pb );
8181
if( err < 0 )
8282
{
83-
throw std::ios_base::failure( "error when close output format: " + getDescriptionFromErrorCode( err ) );
83+
throw std::ios_base::failure( "Error when close output format: " + getDescriptionFromErrorCode( err ) );
8484
}
8585
}
8686

@@ -89,7 +89,7 @@ void FormatContext::writeHeader( AVDictionary** options )
8989
int ret = avformat_write_header( _avFormatContext, options );
9090
if( ret != 0 )
9191
{
92-
throw std::runtime_error( "could not write header: " + getDescriptionFromErrorCode( ret ) );
92+
throw std::runtime_error( "Could not write header: " + getDescriptionFromErrorCode( ret ) );
9393
}
9494
// when muxing, priv_data of AVFormatContext is set by avformat_write_header()
9595
if( _avFormatContext->oformat->priv_class )
@@ -109,7 +109,7 @@ void FormatContext::writeFrame( AVPacket& packet, bool interleaved )
109109

110110
if( ret < 0 )
111111
{
112-
throw std::runtime_error( "error when writting packet in stream: " + getDescriptionFromErrorCode( ret ) );
112+
throw std::runtime_error( "Error when writting packet in stream: " + getDescriptionFromErrorCode( ret ) );
113113
}
114114
}
115115

@@ -118,7 +118,7 @@ void FormatContext::writeTrailer()
118118
int ret = av_write_trailer( _avFormatContext );
119119
if( ret != 0 )
120120
{
121-
throw std::runtime_error( "could not write trailer: " + getDescriptionFromErrorCode( ret ) );
121+
throw std::runtime_error( "Could not write trailer: " + getDescriptionFromErrorCode( ret ) );
122122
}
123123
}
124124

@@ -137,7 +137,7 @@ AVStream& FormatContext::addAVStream( const AVCodec& avCodec )
137137
AVStream* stream = avformat_new_stream( _avFormatContext, const_cast<AVCodec*>(&avCodec) );
138138
if( stream == NULL )
139139
{
140-
throw std::runtime_error( "unable to add new video stream" );
140+
throw std::runtime_error( "Unable to add new video stream" );
141141
}
142142
return *stream;
143143
}
@@ -189,7 +189,7 @@ void FormatContext::setOutputFormat( const std::string& filename, const std::str
189189
AVOutputFormat* oformat = av_guess_format( shortName.c_str(), filename.c_str(), mimeType.c_str() );
190190
if( ! oformat )
191191
{
192-
std::string msg( "unable to find format for " );
192+
std::string msg( "Unable to find format for " );
193193
msg += filename;
194194
if( ! shortName.empty() )
195195
{

0 commit comments

Comments
 (0)