diff --git a/source/app/SubWindowHandle.cpp b/source/app/SubWindowHandle.cpp index 14055ad..6125d6d 100644 --- a/source/app/SubWindowHandle.cpp +++ b/source/app/SubWindowHandle.cpp @@ -29,39 +29,6 @@ namespace plaYUVer { -QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array ) -{ - PlaYUVerStreamInfo d; - out << array.size(); - for( Int i = 0; i < array.size(); i++ ) - { - d = array.at( i ); - out << d.m_cFilename << d.m_uiWidth - << d.m_uiHeight - << d.m_iPelFormat - << d.m_uiFrameRate; - - } - return out; -} - -QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array ) -{ - PlaYUVerStreamInfo d; - Int array_size; - in >> array_size; - for( Int i = 0; i < array_size; i++ ) - { - in >> d.m_cFilename; - in >> d.m_uiWidth; - in >> d.m_uiHeight; - in >> d.m_iPelFormat; - in >> d.m_uiFrameRate; - array.append( d ); - } - return in; -} - SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) : QMdiSubWindow( parent ), m_pCurrStream( NULL ), @@ -108,7 +75,7 @@ SubWindowHandle::~SubWindowHandle() Void SubWindowHandle::reloadFile() { Int currFrameNum = m_pCurrStream->getCurrFrameNum(); - loadFile( m_sStreamInfo.m_cFilename, false ); + loadFile( m_cFilename, false ); seekAbsoluteEvent( currFrameNum ); } @@ -145,12 +112,7 @@ Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog ) refreshFrame(); - m_sStreamInfo.m_cFilename = cFilename; - m_sStreamInfo.m_uiWidth = Width; - m_sStreamInfo.m_uiHeight = Height; - m_sStreamInfo.m_iPelFormat = InputFormat; - m_sStreamInfo.m_uiFrameRate = FrameRate; - + m_cFilename = cFilename; m_cWindowName = m_pCurrStream->getStreamInformationString(); m_cWindowShortName = QFileInfo( cFilename ).fileName(); setWindowTitle( m_cWindowName ); @@ -163,10 +125,9 @@ Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo ) { m_pCurrStream = new PlaYUVerStream; } - m_sStreamInfo = *streamInfo; - if( !m_pCurrStream->open( m_sStreamInfo.m_cFilename, m_sStreamInfo.m_uiWidth, m_sStreamInfo.m_uiHeight, m_sStreamInfo.m_iPelFormat, - m_sStreamInfo.m_uiFrameRate ) ) + if( !m_pCurrStream->open( streamInfo->m_cFilename, streamInfo->m_uiWidth, streamInfo->m_uiHeight, streamInfo->m_iPelFormat, + streamInfo->m_uiFrameRate ) ) { return false; } @@ -177,8 +138,9 @@ Bool SubWindowHandle::loadFile( PlaYUVerStreamInfo* streamInfo ) refreshFrame(); + m_cFilename = streamInfo->m_cFilename; m_cWindowName = m_pCurrStream->getStreamInformationString(); - m_cWindowShortName = QFileInfo( m_sStreamInfo.m_cFilename ).fileName(); + m_cWindowShortName = QFileInfo( streamInfo->m_cFilename ).fileName(); setWindowTitle( m_cWindowName ); return true; } @@ -323,7 +285,7 @@ Int SubWindowHandle::playEvent() m_pCurrStream->readFrame(); if( m_pCurrStream->checkErrors( PlaYUVerStream::READING ) ) { - QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_sStreamInfo.m_cFilename ) ); + QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cFilename ) ); return -3; } return 0; diff --git a/source/app/SubWindowHandle.h b/source/app/SubWindowHandle.h index 6f375c9..34c2f5d 100644 --- a/source/app/SubWindowHandle.h +++ b/source/app/SubWindowHandle.h @@ -41,20 +41,6 @@ namespace plaYUVer class SubWindowHandle; -typedef struct -{ - QString m_cFilename; - UInt m_uiWidth; - UInt m_uiHeight; - Int m_iPelFormat; - UInt m_uiFrameRate; -}PlaYUVerStreamInfo; -typedef QVector PlaYUVerStreamInfoVector; - -QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); -QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); - - class SubWindowHandle: public QMdiSubWindow { Q_OBJECT @@ -64,11 +50,10 @@ private: QScrollArea* m_cScrollArea; ViewArea* m_cViewArea; - PlaYUVerStreamInfo m_sStreamInfo; - PlaYUVerStream* m_pCurrStream; PlaYUVerFrame* m_pcCurrFrame; + QString m_cFilename; PlaYUVerModuleIf* m_pcCurrentModule; SubWindowHandle* m_pcReferenceSubWindow; @@ -113,7 +98,10 @@ public: PlaYUVerStreamInfo getStreamInfo() { - return m_sStreamInfo; + PlaYUVerStreamInfo info; + if( m_pCurrStream ) + info = m_pCurrStream->getStreamInfo(); + return info; } PlaYUVerStream* getInputStream() @@ -214,7 +202,7 @@ public: } QString getCurrentFileName() { - return m_sStreamInfo.m_cFilename; + return m_cFilename; } Bool getIsModule() @@ -233,8 +221,5 @@ public Q_SLOTS: } // NAMESPACE -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo); -Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector); - #endif // __SUBWINDOWHANDLE_H__ diff --git a/source/app/main.cpp b/source/app/main.cpp index 551ed6e..739cf8f 100644 --- a/source/app/main.cpp +++ b/source/app/main.cpp @@ -25,7 +25,7 @@ #include #include "config.h" #include "plaYUVerApp.h" -#include "SubWindowHandle.h" +#include "PlaYUVerStream.h" #ifdef USE_FERVOR #include "fvupdater.h" #endif diff --git a/source/lib/PlaYUVerStream.cpp b/source/lib/PlaYUVerStream.cpp index 3f283c5..62e6387 100644 --- a/source/lib/PlaYUVerStream.cpp +++ b/source/lib/PlaYUVerStream.cpp @@ -34,6 +34,40 @@ namespace plaYUVer { +QDataStream& operator<<( QDataStream& out, const PlaYUVerStreamInfoVector& array ) +{ + PlaYUVerStreamInfo d; + out << array.size(); + for( Int i = 0; i < array.size(); i++ ) + { + d = array.at( i ); + out << d.m_cFilename << d.m_uiWidth + << d.m_uiHeight + << d.m_iPelFormat + << d.m_uiFrameRate; + + } + return out; +} + +QDataStream& operator>>( QDataStream& in, PlaYUVerStreamInfoVector& array ) +{ + PlaYUVerStreamInfo d; + Int array_size; + in >> array_size; + for( Int i = 0; i < array_size; i++ ) + { + in >> d.m_cFilename; + in >> d.m_uiWidth; + in >> d.m_uiHeight; + in >> d.m_iPelFormat; + in >> d.m_uiFrameRate; + array.append( d ); + } + return in; +} + + PlaYUVerStream::PlaYUVerStream() { m_bInit = false; diff --git a/source/lib/PlaYUVerStream.h b/source/lib/PlaYUVerStream.h index c420779..d7c559e 100644 --- a/source/lib/PlaYUVerStream.h +++ b/source/lib/PlaYUVerStream.h @@ -36,6 +36,20 @@ namespace plaYUVer class LibAvContextHandle; +typedef struct +{ + QString m_cFilename; + UInt m_uiWidth; + UInt m_uiHeight; + Int m_iPelFormat; + UInt m_uiFrameRate; +}PlaYUVerStreamInfo; +typedef QVector PlaYUVerStreamInfoVector; + +QDataStream& operator<<(QDataStream& out, const PlaYUVerStreamInfoVector& d); +QDataStream& operator>>(QDataStream& in, PlaYUVerStreamInfoVector& d); + + class PlaYUVerStream { private: @@ -47,6 +61,8 @@ private: Bool m_bLoadAll; Int m_iErrorStatus; + PlaYUVerStreamInfo m_sStreamInfo; + LibAvContextHandle* m_cLibAvContext; QString m_cFilename; @@ -297,8 +313,15 @@ public: m_uiHeight = new_height; } } + PlaYUVerStreamInfo getStreamInfo() + { + return m_sStreamInfo; + } }; } // NAMESPACE +Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfo); +Q_DECLARE_METATYPE(plaYUVer::PlaYUVerStreamInfoVector); + #endif // __PLAYUVERSTREAM_H__