Add support for little and big endian with an option
This commit is contained in:
1 parent
f596fda8dc
commit
b68bbded34
14 files changed
+104
-35
No files matched your search
+13
-1
@@ -76,6 +76,18 @@ Int PlaYUVerTools::openInputs()
|
||||
{
|
||||
uiBitPerPixel = m_cCmdLineHandler.m_uiBitsPerPixel;
|
||||
}
|
||||
UInt uiEndianness = 0;
|
||||
if( m_cCmdLineHandler.Opts()["endianness"]->count() )
|
||||
{
|
||||
if( m_cCmdLineHandler.m_strEndianness == "big" )
|
||||
{
|
||||
uiEndianness = 0;
|
||||
}
|
||||
if( m_cCmdLineHandler.m_strEndianness == "little" )
|
||||
{
|
||||
uiEndianness = 1;
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<std::string> inputFileNames = m_cCmdLineHandler.m_apcInputs;
|
||||
|
||||
@@ -85,7 +97,7 @@ Int PlaYUVerTools::openInputs()
|
||||
pcStream = new PlaYUVerStream;
|
||||
try
|
||||
{
|
||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel, 1 ) )
|
||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel, uiEndianness, 1 ) )
|
||||
{
|
||||
m_cCmdLineHandler.log( LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
|
||||
return 2;
|
||||
|
||||
@@ -71,6 +71,7 @@ Int PlaYUVerToolsCmdParser::parseToolsArgs( Int argc, Char *argv[] )
|
||||
( "size,s", m_strResolution, "size (WxH)" ) /**/
|
||||
( "pel_fmt", m_strPelFmt, "pixel format" ) /**/
|
||||
( "bits_pel", m_uiBitsPerPixel, "bits per pixel" ) /**/
|
||||
( "endianness", m_strEndianness, "File endianness (big, little)" ) /**/
|
||||
( "frames,f", m_iFrames, "number of frames to parse" );
|
||||
|
||||
Opts().addOptions()/**/
|
||||
|
||||
@@ -78,6 +78,8 @@ private:
|
||||
std::string m_strResolution;
|
||||
std::string m_strPelFmt;
|
||||
UInt m_uiBitsPerPixel;
|
||||
std::string m_strEndianness;
|
||||
UInt m_uiEndianness;
|
||||
Bool m_bListPelFmts;
|
||||
Int64 m_iFrames;
|
||||
|
||||
|
||||
Reference in new issue
Block a user