Add guessing for endianness
This commit is contained in:
+30
-14
@@ -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;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ private:
|
||||
|
||||
Void refreshFrameOperation();
|
||||
|
||||
static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel );
|
||||
static Bool guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rBitsPerPixel, Int& rEndianness );
|
||||
|
||||
/**
|
||||
* Private zoom function to handle
|
||||
@@ -164,6 +164,11 @@ public:
|
||||
return m_pCurrStream;
|
||||
}
|
||||
|
||||
PlaYUVerStream* getCurrStream()
|
||||
{
|
||||
return m_pCurrStream;
|
||||
}
|
||||
|
||||
PlaYUVerFrame* getCurrFrame()
|
||||
{
|
||||
return m_pcCurrFrame;
|
||||
|
||||
@@ -115,6 +115,13 @@ enum RGBcomponent
|
||||
COLOR_A,
|
||||
};
|
||||
|
||||
enum Endianness
|
||||
{
|
||||
PLAYUVER_BIG_ENDIAN = 0,
|
||||
PLAYUVER_LITTLE_ENDIAN = 1,
|
||||
};
|
||||
|
||||
|
||||
inline String lowercase( const String& in )
|
||||
{
|
||||
String out;
|
||||
|
||||
Reference in New Issue
Block a user