Skip to content

Commit ab3b7f2

Browse files
author
Clement Champetier
committed
FormatContext: improve exception message when setOutputFormat
1 parent b261d00 commit ab3b7f2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/AvTranscoder/file/FormatContext.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,21 @@ void FormatContext::setOutputFormat( const std::string& filename, const std::str
165165
{
166166
AVOutputFormat* oformat = av_guess_format( shortName.c_str(), filename.c_str(), mimeType.c_str() );
167167
if( ! oformat )
168-
throw std::ios_base::failure( "unable to find format" );
168+
{
169+
std::string msg( "unable to find format for " );
170+
msg += filename;
171+
if( ! shortName.empty() )
172+
{
173+
msg += ", ";
174+
msg += shortName;
175+
}
176+
if( ! mimeType.empty() )
177+
{
178+
msg += ", ";
179+
msg += mimeType;
180+
}
181+
throw std::ios_base::failure( msg );
182+
}
169183

170184
_avFormatContext->oformat = oformat;
171185
}

0 commit comments

Comments
 (0)