From 852e8e59a6fb5a8856bc570b09721a7fa9014e1c Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 14 Apr 2015 23:07:40 +0100 Subject: [PATCH] Add support for bits per pixel in playuverTools --- tools/CommandLineHandle.cpp | 1 + tools/CommandLineHandle.h | 1 + tools/PlaYUVerTools.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/tools/CommandLineHandle.cpp b/tools/CommandLineHandle.cpp index 70fad11..33055ce 100644 --- a/tools/CommandLineHandle.cpp +++ b/tools/CommandLineHandle.cpp @@ -70,6 +70,7 @@ Int CommandLineHandle::parseToolsArgs( Int argc, Char *argv[] ) ( "output,o", m_strOutput, "output file" ) /**/ ( "size,s", m_strResolution, "size (WxH)" ) /**/ ( "pel_fmt", m_strPelFmt, "pixel format" ) /**/ + ( "bits_pel", m_uiBitsPerPixel, "bits per pixel" ) /**/ ( "frames,f", m_iFrames, "number of frames to parse" ); Opts().addOptions()/**/ diff --git a/tools/CommandLineHandle.h b/tools/CommandLineHandle.h index df25f05..afc9871 100644 --- a/tools/CommandLineHandle.h +++ b/tools/CommandLineHandle.h @@ -78,6 +78,7 @@ private: std::string m_strOutput; std::string m_strResolution; std::string m_strPelFmt; + UInt m_uiBitsPerPixel; Bool m_bListPelFmts; Int m_iFrames; diff --git a/tools/PlaYUVerTools.cpp b/tools/PlaYUVerTools.cpp index 0f37c51..a28aa5e 100644 --- a/tools/PlaYUVerTools.cpp +++ b/tools/PlaYUVerTools.cpp @@ -70,6 +70,11 @@ Int PlaYUVerTools::openInputs() { fmtString = m_cCmdLineHandler.m_strPelFmt; } + UInt uiBitPerPixel = 8; + if( m_cCmdLineHandler.Opts()["bits_pel"]->count() ) + { + uiBitPerPixel = m_cCmdLineHandler.m_uiBitsPerPixel; + } std::vector inputFileNames = m_cCmdLineHandler.m_apcInputs; @@ -79,7 +84,7 @@ Int PlaYUVerTools::openInputs() pcStream = new PlaYUVerStream; try { - if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, 8, 1 ) ) + if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitPerPixel, 1 ) ) { m_cCmdLineHandler.log( LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() ); return 2;