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(); std::vector<PlaYUVerStdResolution> stdResList = PlaYUVerStream::stdResolutionSizes();
Bool bGuessed = true; 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 #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 ) if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )
bGuessed = true && !bGuessedByFilesize; bGuessed = true && !bGuessedByFilesize;
} }
+6 -1
View File
@@ -103,7 +103,7 @@ private:
Void refreshFrameOperation(); 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 * Private zoom function to handle
@@ -164,6 +164,11 @@ public:
return m_pCurrStream; return m_pCurrStream;
} }
PlaYUVerStream* getCurrStream()
{
return m_pCurrStream;
}
PlaYUVerFrame* getCurrFrame() PlaYUVerFrame* getCurrFrame()
{ {
return m_pcCurrFrame; return m_pcCurrFrame;
+7
View File
@@ -115,6 +115,13 @@ enum RGBcomponent
COLOR_A, COLOR_A,
}; };
enum Endianness
{
PLAYUVER_BIG_ENDIAN = 0,
PLAYUVER_LITTLE_ENDIAN = 1,
};
inline String lowercase( const String& in ) inline String lowercase( const String& in )
{ {
String out; String out;