Refactor code based on lib changes
This commit is contained in:
+12
-3
@@ -211,10 +211,19 @@ void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo )
|
|||||||
{
|
{
|
||||||
bool opened = false;
|
bool opened = false;
|
||||||
|
|
||||||
if( !pStreamInfo )
|
if( pStreamInfo != nullptr )
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
opened = videoSubWindow->loadFile( pStreamInfo );
|
||||||
|
}
|
||||||
|
catch( CalypFailure& e )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !opened )
|
||||||
opened = videoSubWindow->loadFile( fileName );
|
opened = videoSubWindow->loadFile( fileName );
|
||||||
else
|
|
||||||
opened = videoSubWindow->loadFile( pStreamInfo );
|
|
||||||
|
|
||||||
if( opened )
|
if( opened )
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -497,9 +497,6 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
{
|
{
|
||||||
if( !pcCurrModuleIf->m_pcModuleStream )
|
if( !pcCurrModuleIf->m_pcModuleStream )
|
||||||
{
|
{
|
||||||
unsigned int Width = 0, Height = 0, FrameRate = 30;
|
|
||||||
int BitsPixel, InputFormat = -1;
|
|
||||||
|
|
||||||
QString supported = tr( "Supported Files (" );
|
QString supported = tr( "Supported Files (" );
|
||||||
QStringList formatsList;
|
QStringList formatsList;
|
||||||
std::vector<CalypStreamFormat> supportedFmts = CalypStream::supportedWriteFormats();
|
std::vector<CalypStreamFormat> supportedFmts = CalypStream::supportedWriteFormats();
|
||||||
@@ -532,15 +529,15 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf )
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth();
|
auto Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth();
|
||||||
Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
|
auto Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight();
|
||||||
InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat();
|
auto InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat();
|
||||||
BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel();
|
auto BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel();
|
||||||
FrameRate = 30;
|
auto FrameRate = 30;
|
||||||
|
|
||||||
pcCurrModuleIf->m_pcModuleStream = std::unique_ptr<CalypStream>();
|
pcCurrModuleIf->m_pcModuleStream = std::unique_ptr<CalypStream>();
|
||||||
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel,
|
if( !pcCurrModuleIf->m_pcModuleStream->open( fileName.toStdString(), Width, Height, InputFormat, BitsPixel,
|
||||||
CLP_LITTLE_ENDIAN, FrameRate, false ) )
|
CLP_LITTLE_ENDIAN, FrameRate, CalypStream::Type::Output ) )
|
||||||
{
|
{
|
||||||
pcCurrModuleIf->m_pcModuleStream = nullptr;
|
pcCurrModuleIf->m_pcModuleStream = nullptr;
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& array )
|
|||||||
{
|
{
|
||||||
d = array.at( i );
|
d = array.at( i );
|
||||||
out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness
|
out << d.m_cFilename << d.m_uiWidth << d.m_uiHeight << d.m_iPelFormat << d.m_uiBitsPelPixel << d.m_iEndianness
|
||||||
<< d.m_uiFrameRate << d.m_uiFileSize;
|
<< d.m_uiFrameRate << d.m_uiFileSize << d.m_bForceRaw;
|
||||||
}
|
}
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
@@ -69,6 +69,7 @@ QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array )
|
|||||||
in >> d.m_iEndianness;
|
in >> d.m_iEndianness;
|
||||||
in >> d.m_uiFrameRate;
|
in >> d.m_uiFrameRate;
|
||||||
in >> d.m_uiFileSize;
|
in >> d.m_uiFileSize;
|
||||||
|
in >> d.m_bForceRaw;
|
||||||
array.append( d );
|
array.append( d );
|
||||||
}
|
}
|
||||||
return in;
|
return in;
|
||||||
@@ -200,7 +201,7 @@ bool VideoStreamSubWindow::loadFile( QString cFilename, bool bForceDialog )
|
|||||||
}
|
}
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, true, iPass == 1 );
|
bRet = m_pCurrStream->open( cFilename.toStdString(), Width, Height, InputFormat, BitsPel, Endianness, FrameRate, iPass == 1, CalypStream::Type::Input );
|
||||||
}
|
}
|
||||||
catch( CalypFailure& e )
|
catch( CalypFailure& e )
|
||||||
{
|
{
|
||||||
@@ -256,7 +257,7 @@ bool VideoStreamSubWindow::loadFile( CalypFileInfo* streamInfo )
|
|||||||
|
|
||||||
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight,
|
if( !m_pCurrStream->open( streamInfo->m_cFilename.toStdString(), streamInfo->m_uiWidth, streamInfo->m_uiHeight,
|
||||||
streamInfo->m_iPelFormat, streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness,
|
streamInfo->m_iPelFormat, streamInfo->m_uiBitsPelPixel, streamInfo->m_iEndianness,
|
||||||
streamInfo->m_uiFrameRate, true ) )
|
streamInfo->m_uiFrameRate, streamInfo->m_bForceRaw, CalypStream::Type::Input ) )
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -323,7 +324,7 @@ bool VideoStreamSubWindow::guessFormat( QString filename, unsigned int& rWidth,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Guess resolution - match %dx%d
|
// Guess resolution - match %dx%d
|
||||||
//QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
|
// QRegularExpressionMatch resolutionMatch = QRegularExpression( "_\\d*x\\d*" ).match( FilenameShort );
|
||||||
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_[0-9]+x[0-9]+" ).match( FilenameShort );
|
QRegularExpressionMatch resolutionMatch = QRegularExpression( "_[0-9]+x[0-9]+" ).match( FilenameShort );
|
||||||
if( resolutionMatch.hasMatch() )
|
if( resolutionMatch.hasMatch() )
|
||||||
{
|
{
|
||||||
@@ -454,7 +455,7 @@ void VideoStreamSubWindow::refreshFrame()
|
|||||||
|
|
||||||
if( m_pcDisplayModule )
|
if( m_pcDisplayModule )
|
||||||
{
|
{
|
||||||
//bool disableThreads = !m_bIsPlaying && hasAssociatedModule();
|
// bool disableThreads = !m_bIsPlaying && hasAssociatedModule();
|
||||||
m_pcDisplayModule->apply( m_bIsPlaying, true );
|
m_pcDisplayModule->apply( m_bIsPlaying, true );
|
||||||
bSetFrame = false;
|
bSetFrame = false;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ typedef struct
|
|||||||
unsigned int m_iEndianness;
|
unsigned int m_iEndianness;
|
||||||
unsigned int m_uiFrameRate;
|
unsigned int m_uiFrameRate;
|
||||||
unsigned long long int m_uiFileSize;
|
unsigned long long int m_uiFileSize;
|
||||||
|
bool m_bForceRaw{ false };
|
||||||
} CalypFileInfo;
|
} CalypFileInfo;
|
||||||
typedef QVector<CalypFileInfo> CalypFileInfoVector;
|
typedef QVector<CalypFileInfo> CalypFileInfoVector;
|
||||||
|
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ int CalypTools::openInputs()
|
|||||||
std::string resolutionString( "" );
|
std::string resolutionString( "" );
|
||||||
std::string fmtString( "yuv420p" );
|
std::string fmtString( "yuv420p" );
|
||||||
unsigned int uiBitsPerPixel = 8;
|
unsigned int uiBitsPerPixel = 8;
|
||||||
unsigned int uiEndianness = 0;
|
int uiEndianness = 0;
|
||||||
bool hasNegativeValues = false;
|
bool hasNegativeValues = false;
|
||||||
|
|
||||||
CalypStream* pcStream;
|
CalypStream* pcStream;
|
||||||
@@ -104,7 +104,7 @@ int CalypTools::openInputs()
|
|||||||
pcStream = new CalypStream;
|
pcStream = new CalypStream;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitsPerPixel, uiEndianness, hasNegativeValues, 1, true ) )
|
if( !pcStream->open( inputFileNames[i], resolutionString, fmtString, uiBitsPerPixel, uiEndianness, hasNegativeValues, 1, CalypStream::Type::Input ) )
|
||||||
{
|
{
|
||||||
log( CLP_LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
|
log( CLP_LOG_ERROR, "Cannot open input stream %s! ", inputFileNames[i].c_str() );
|
||||||
return -1;
|
return -1;
|
||||||
@@ -242,7 +242,7 @@ int CalypTools::Open( int argc, char* argv[] )
|
|||||||
{
|
{
|
||||||
pcOutputStream->open( m_pcOutputFileNames[0], pcInputFrame->getWidth(), pcInputFrame->getHeight(),
|
pcOutputStream->open( m_pcOutputFileNames[0], pcInputFrame->getWidth(), pcInputFrame->getHeight(),
|
||||||
pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel(), m_uiOutEndianness, 1,
|
pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel(), m_uiOutEndianness, 1,
|
||||||
false );
|
CalypStream::Type::Output );
|
||||||
log( CLP_LOG_INFO, "Output stream from rate-reduction!\n" );
|
log( CLP_LOG_INFO, "Output stream from rate-reduction!\n" );
|
||||||
reportStreamInfo( pcOutputStream, "Output " );
|
reportStreamInfo( pcOutputStream, "Output " );
|
||||||
}
|
}
|
||||||
@@ -383,7 +383,7 @@ int CalypTools::Open( int argc, char* argv[] )
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
pcModStream->open( outputFileNames[0], pcModFrame->getWidth(), pcModFrame->getHeight(),
|
pcModStream->open( outputFileNames[0], pcModFrame->getWidth(), pcModFrame->getHeight(),
|
||||||
pcModFrame->getPelFormat(), pcModFrame->getBitsPel(), m_uiOutEndianness, 1, false );
|
pcModFrame->getPelFormat(), pcModFrame->getBitsPel(), m_uiOutEndianness, 1, CalypStream::Type::Output );
|
||||||
log( CLP_LOG_INFO, "Output stream from module!\n" );
|
log( CLP_LOG_INFO, "Output stream from module!\n" );
|
||||||
reportStreamInfo( pcModStream, "Module Output " );
|
reportStreamInfo( pcModStream, "Module Output " );
|
||||||
}
|
}
|
||||||
@@ -570,11 +570,11 @@ int CalypTools::QualityOperation()
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//CalypFrame* CalypTools::applyFrameModule()
|
// CalypFrame* CalypTools::applyFrameModule()
|
||||||
//{
|
//{
|
||||||
// CalypFrame* pcProcessedFrame = NULL;
|
// CalypFrame* pcProcessedFrame = NULL;
|
||||||
// if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
// if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing )
|
||||||
// {
|
// {
|
||||||
|
|
||||||
// }
|
// }
|
||||||
// return pcProcessedFrame;
|
// return pcProcessedFrame;
|
||||||
|
|||||||
Reference in New Issue
Block a user