Add guessing for endianness

This commit is contained in:
jfmcarreira committed 2016-12-15 16:53:15 +00:00
1 parent af6ec494a2
commit 26cd949d9a
3 files changed
+43 -15

No files matched your search

+30 -14
View File
@@ -428,7 +428,7 @@ Void VideoSubWindow::updateVideoWindowInfo()
}
}
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel )
Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel, Int& rEndianness )
{
std::vector<PlaYUVerStdResolution> stdResList = PlaYUVerStream::stdResolutionSizes();
Bool bGuessed = true;
@@ -488,19 +488,6 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
}
}
}
// Guess bits per pixel - match %dbpp
QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() )
{
QString matchString = BppMatch.captured( 0 );
matchString.remove( "_" );
matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt();
if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) )
{
rBitsPerPixel = -1;
}
}
#endif
}
@@ -534,6 +521,35 @@ Bool VideoSubWindow::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
}
}
// Guess bits per pixel - match %dbpp
#if( QT_VERSION_PLAYUVER == 5 )
QRegularExpressionMatch BppMatch = QRegularExpression( "_\\d*bpp" ).match( FilenameShort );
if( BppMatch.hasMatch() )
{
QString matchString = BppMatch.captured( 0 );
matchString.remove( "_" );
matchString.remove( "bpp" );
rBitsPerPixel = matchString.toUInt();
if( !( rBitsPerPixel > 0 && rBitsPerPixel < 16 ) )
{
rBitsPerPixel = -1;
}
}
#endif
// Guess Endianness
if( rEndianness == -1 )
{
if( FilenameShort.contains( QStringLiteral( "be" ), Qt::CaseInsensitive ) )
{
rEndianness = PLAYUVER_BIG_ENDIAN;
}
if( FilenameShort.contains( QStringLiteral( "le" ), Qt::CaseInsensitive ) )
{
rEndianness = PLAYUVER_LITTLE_ENDIAN;
}
}
if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )
bGuessed = true && !bGuessedByFilesize;
}