diff --git a/app/MainWindow.cpp b/app/MainWindow.cpp index a432994..f71087c 100644 --- a/app/MainWindow.cpp +++ b/app/MainWindow.cpp @@ -211,10 +211,19 @@ void MainWindow::loadFile( QString fileName, CalypFileInfo* pStreamInfo ) { bool opened = false; - if( !pStreamInfo ) + if( pStreamInfo != nullptr ) + { + try + { + opened = videoSubWindow->loadFile( pStreamInfo ); + } + catch( CalypFailure& e ) + { + } + } + + if( !opened ) opened = videoSubWindow->loadFile( fileName ); - else - opened = videoSubWindow->loadFile( pStreamInfo ); if( opened ) { diff --git a/app/ModulesHandle.cpp b/app/ModulesHandle.cpp index 4aea8f2..d86ee3a 100644 --- a/app/ModulesHandle.cpp +++ b/app/ModulesHandle.cpp @@ -497,9 +497,6 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf ) { if( !pcCurrModuleIf->m_pcModuleStream ) { - unsigned int Width = 0, Height = 0, FrameRate = 30; - int BitsPixel, InputFormat = -1; - QString supported = tr( "Supported Files (" ); QStringList formatsList; std::vector supportedFmts = CalypStream::supportedWriteFormats(); @@ -532,15 +529,15 @@ void ModulesHandle::applyAllModuleIf( CalypAppModuleIf* pcCurrModuleIf ) { return; } - Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth(); - Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight(); - InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat(); - BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel(); - FrameRate = 30; + auto Width = pcCurrModuleIf->m_pcProcessedFrame->getWidth(); + auto Height = pcCurrModuleIf->m_pcProcessedFrame->getHeight(); + auto InputFormat = pcCurrModuleIf->m_pcProcessedFrame->getPelFormat(); + auto BitsPixel = pcCurrModuleIf->m_pcProcessedFrame->getBitsPel(); + auto FrameRate = 30; pcCurrModuleIf->m_pcModuleStream = std::unique_ptr(); 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; return; diff --git a/app/VideoStreamSubWindow.cpp b/app/VideoStreamSubWindow.cpp index 13fabe2..ee47a4b 100644 --- a/app/VideoStreamSubWindow.cpp +++ b/app/VideoStreamSubWindow.cpp @@ -49,7 +49,7 @@ QDataStream& operator<<( QDataStream& out, const CalypFileInfoVector& array ) { d = array.at( i ); 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; } @@ -69,6 +69,7 @@ QDataStream& operator>>( QDataStream& in, CalypFileInfoVector& array ) in >> d.m_iEndianness; in >> d.m_uiFrameRate; in >> d.m_uiFileSize; + in >> d.m_bForceRaw; array.append( d ); } return in; @@ -200,7 +201,7 @@ bool VideoStreamSubWindow::loadFile( QString cFilename, bool bForceDialog ) } 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 ) { @@ -256,7 +257,7 @@ bool VideoStreamSubWindow::loadFile( CalypFileInfo* streamInfo ) 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_uiFrameRate, true ) ) + streamInfo->m_uiFrameRate, streamInfo->m_bForceRaw, CalypStream::Type::Input ) ) { return false; } @@ -323,7 +324,7 @@ bool VideoStreamSubWindow::guessFormat( QString filename, unsigned int& rWidth, } // 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 ); if( resolutionMatch.hasMatch() ) { @@ -454,7 +455,7 @@ void VideoStreamSubWindow::refreshFrame() if( m_pcDisplayModule ) { - //bool disableThreads = !m_bIsPlaying && hasAssociatedModule(); + // bool disableThreads = !m_bIsPlaying && hasAssociatedModule(); m_pcDisplayModule->apply( m_bIsPlaying, true ); bSetFrame = false; } diff --git a/app/VideoStreamSubWindow.h b/app/VideoStreamSubWindow.h index 8624c6c..a749229 100644 --- a/app/VideoStreamSubWindow.h +++ b/app/VideoStreamSubWindow.h @@ -54,6 +54,7 @@ typedef struct unsigned int m_iEndianness; unsigned int m_uiFrameRate; unsigned long long int m_uiFileSize; + bool m_bForceRaw{ false }; } CalypFileInfo; typedef QVector CalypFileInfoVector; diff --git a/tools/CalypTools.cpp b/tools/CalypTools.cpp index 31be1ea..d88a28e 100644 --- a/tools/CalypTools.cpp +++ b/tools/CalypTools.cpp @@ -68,7 +68,7 @@ int CalypTools::openInputs() std::string resolutionString( "" ); std::string fmtString( "yuv420p" ); unsigned int uiBitsPerPixel = 8; - unsigned int uiEndianness = 0; + int uiEndianness = 0; bool hasNegativeValues = false; CalypStream* pcStream; @@ -104,7 +104,7 @@ int CalypTools::openInputs() pcStream = new CalypStream; 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() ); return -1; @@ -242,7 +242,7 @@ int CalypTools::Open( int argc, char* argv[] ) { pcOutputStream->open( m_pcOutputFileNames[0], pcInputFrame->getWidth(), pcInputFrame->getHeight(), pcInputFrame->getPelFormat(), pcInputFrame->getBitsPel(), m_uiOutEndianness, 1, - false ); + CalypStream::Type::Output ); log( CLP_LOG_INFO, "Output stream from rate-reduction!\n" ); reportStreamInfo( pcOutputStream, "Output " ); } @@ -383,7 +383,7 @@ int CalypTools::Open( int argc, char* argv[] ) try { 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" ); reportStreamInfo( pcModStream, "Module Output " ); } @@ -570,11 +570,11 @@ int CalypTools::QualityOperation() return 0; } -//CalypFrame* CalypTools::applyFrameModule() +// CalypFrame* CalypTools::applyFrameModule() //{ -// CalypFrame* pcProcessedFrame = NULL; -// if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing ) -// { +// CalypFrame* pcProcessedFrame = NULL; +// if( m_pcCurrModuleIf->m_iModuleType == ClpModuleType::FrameProcessing ) +// { // } // return pcProcessedFrame;