Change InputStream class name and minor fix in open function

This commit is contained in:
jfmcarreira committed 2014-06-17 17:28:59 +01:00
1 parent cf9edc1b59
commit aaaeb9da14
10 files changed
+52 -52

No files matched your search

+1 -1
View File
@@ -123,7 +123,7 @@ QSize StreamPropertiesSideBar::sizeHint() const
return bestSize( size() ); return bestSize( size() );
} }
Void StreamPropertiesSideBar::setData( InputStream* pcStream ) Void StreamPropertiesSideBar::setData( PlaYUVerStream* pcStream )
{ {
// Clear information. // Clear information.
labelFormatValue->clear(); labelFormatValue->clear();
+2 -2
View File
@@ -49,10 +49,10 @@ public:
QSize sizeHint() const; QSize sizeHint() const;
Void setData( InputStream* m_pcStream ); Void setData( PlaYUVerStream* m_pcStream );
private: private:
InputStream* m_pcStream; PlaYUVerStream* m_pcStream;
Bool m_bIsVisible; Bool m_bIsVisible;
QLabel* labelFormatValue; QLabel* labelFormatValue;
+10 -10
View File
@@ -55,7 +55,7 @@ SubWindowHandle::SubWindowHandle( QWidget * parent, Bool isModule ) :
m_cScrollArea->setWidgetResizable( true ); m_cScrollArea->setWidgetResizable( true );
m_pCurrStream = NULL; m_pCurrStream = NULL;
//m_pCurrStream = new InputStream; //m_pCurrStream = new PlaYUVerStream;
m_pcCurrFrame = NULL; m_pcCurrFrame = NULL;
m_pcCurrentModule = NULL; m_pcCurrentModule = NULL;
@@ -80,19 +80,19 @@ Void SubWindowHandle::reloadFile()
seekAbsoluteEvent( currFrameNum ); seekAbsoluteEvent( currFrameNum );
} }
Bool SubWindowHandle::loadFile( const QString &rcFilename, Bool bForceDialog ) Bool SubWindowHandle::loadFile( QString cFilename, Bool bForceDialog )
{ {
UInt Width = 0, Height = 0, FrameRate = 30; UInt Width = 0, Height = 0, FrameRate = 30;
Int InputFormat = -1; Int InputFormat = -1;
if( !m_pCurrStream ) if( !m_pCurrStream )
{ {
m_pCurrStream = new InputStream; m_pCurrStream = new PlaYUVerStream;
} }
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate ); m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
if( m_pCurrStream->guessFormat( rcFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog ) if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
{ {
ConfigureFormatDialog formatDialog( this ); ConfigureFormatDialog formatDialog( this );
if( formatDialog.runConfigureFormatDialog( Width, Height, InputFormat, FrameRate ) == QDialog::Rejected ) if( formatDialog.runConfigureFormatDialog( Width, Height, InputFormat, FrameRate ) == QDialog::Rejected )
@@ -102,7 +102,7 @@ Bool SubWindowHandle::loadFile( const QString &rcFilename, Bool bForceDialog )
} }
QApplication::setOverrideCursor( Qt::WaitCursor ); QApplication::setOverrideCursor( Qt::WaitCursor );
QApplication::restoreOverrideCursor(); QApplication::restoreOverrideCursor();
if( !m_pCurrStream->open( rcFilename, Width, Height, InputFormat, FrameRate ) ) if( !m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate ) )
{ {
return false; return false;
} }
@@ -113,7 +113,7 @@ Bool SubWindowHandle::loadFile( const QString &rcFilename, Bool bForceDialog )
refreshFrame(); refreshFrame();
m_cCurrFileName = rcFilename; m_cCurrFileName = cFilename;
m_cWindowName = m_pCurrStream->getStreamInformationString(); m_cWindowName = m_pCurrStream->getStreamInformationString();
setWindowTitle( m_cWindowName ); setWindowTitle( m_cWindowName );
return true; return true;
@@ -194,13 +194,13 @@ Void SubWindowHandle::refreshFrame()
Bool SubWindowHandle::save() Bool SubWindowHandle::save()
{ {
QString supported = tr( "Supported Files" ); QString supported = tr( "Supported Files" );
QString formats = InputStream::supportedWriteFormats(); QString formats = PlaYUVerStream::supportedWriteFormats();
formats.prepend( " (" ); formats.prepend( " (" );
formats.append( ")" ); formats.append( ")" );
supported.append( formats ); // supported=="Supported Files (*.pbm *.jpg...)" supported.append( formats ); // supported=="Supported Files (*.pbm *.jpg...)"
QStringList filter; QStringList filter;
filter << supported filter << supported
<< InputStream::supportedWriteFormatsList() << PlaYUVerStream::supportedWriteFormatsList()
<< tr( "All Files (*)" ); << tr( "All Files (*)" );
QString fileName = QFileDialog::getSaveFileName( this, tr( "Save As" ), m_cCurrFileName, filter.join( ";;" ) ); QString fileName = QFileDialog::getSaveFileName( this, tr( "Save As" ), m_cCurrFileName, filter.join( ";;" ) );
if( fileName.isEmpty() ) if( fileName.isEmpty() )
@@ -231,12 +231,12 @@ Int SubWindowHandle::playEvent()
{ {
m_pCurrStream->setNextFrame(); m_pCurrStream->setNextFrame();
refreshFrame(); refreshFrame();
if( m_pCurrStream->checkErrors( InputStream::END_OF_SEQ ) ) if( m_pCurrStream->checkErrors( PlaYUVerStream::END_OF_SEQ ) )
{ {
return -2; return -2;
} }
m_pCurrStream->readNextFrame(); m_pCurrStream->readNextFrame();
if( m_pCurrStream->checkErrors( InputStream::READING ) ) if( m_pCurrStream->checkErrors( PlaYUVerStream::READING ) )
{ {
QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cCurrFileName ) ); QMessageBox::warning( this, tr( "plaYUVer" ), tr( "Cannot read %1." ).arg( m_cCurrFileName ) );
return -3; return -3;
+3 -3
View File
@@ -50,7 +50,7 @@ private:
PlaYUVerModuleIf* m_pcCurrentModule; PlaYUVerModuleIf* m_pcCurrentModule;
InputStream* m_pCurrStream; PlaYUVerStream* m_pCurrStream;
PlaYUVerFrame* m_pcCurrFrame; PlaYUVerFrame* m_pcCurrFrame;
QString m_cWindowName; QString m_cWindowName;
@@ -66,7 +66,7 @@ public:
~SubWindowHandle(); ~SubWindowHandle();
Bool mayClose(); Bool mayClose();
Bool loadFile( const QString &rcFilename, Bool bForceDialog = false ); Bool loadFile( QString cFilename, Bool bForceDialog = false );
Void reloadFile(); Void reloadFile();
Bool save(); Bool save();
@@ -88,7 +88,7 @@ public:
Void refreshFrame(); Void refreshFrame();
Void setCurrFrame( PlaYUVerFrame* pcCurrFrame ); Void setCurrFrame( PlaYUVerFrame* pcCurrFrame );
InputStream* getInputStream() PlaYUVerStream* getInputStream()
{ {
return m_pCurrStream; return m_pCurrStream;
} }
+2 -2
View File
@@ -875,12 +875,12 @@ void ViewArea::updateMask( const QRect &rect )
} }
void ViewArea::setInputStream( InputStream *stream ) void ViewArea::setInputStream( PlaYUVerStream *stream )
{ {
m_pStream = stream; m_pStream = stream;
} }
InputStream* ViewArea::getInputStream() PlaYUVerStream* ViewArea::getInputStream()
{ {
return m_pStream; return m_pStream;
} }
+4 -4
View File
@@ -38,7 +38,7 @@
namespace plaYUVer namespace plaYUVer
{ {
class InputStream; class PlaYUVerStream;
/** /**
* *
@@ -99,8 +99,8 @@ public:
return m_maskColor; return m_maskColor;
} }
void setInputStream( InputStream *stream ); void setInputStream( PlaYUVerStream *stream );
InputStream* getInputStream(); PlaYUVerStream* getInputStream();
Void zoomChangeEvent(Double factor, QPoint center); Void zoomChangeEvent(Double factor, QPoint center);
Double getZoomFactor(); Double getZoomFactor();
@@ -167,7 +167,7 @@ private:
bool m_snapToGrid; bool m_snapToGrid;
bool m_cursorInGrid; bool m_cursorInGrid;
InputStream *m_pStream; PlaYUVerStream *m_pStream;
}; };
+2 -2
View File
@@ -189,14 +189,14 @@ Void plaYUVerApp::loadFile( QString fileName )
Void plaYUVerApp::open() Void plaYUVerApp::open()
{ {
QString supported = tr( "Supported Files" ); QString supported = tr( "Supported Files" );
QString formats = InputStream::supportedReadFormats(); QString formats = PlaYUVerStream::supportedReadFormats();
formats.prepend( " (" ); formats.prepend( " (" );
formats.append( ")" ); formats.append( ")" );
supported.append( formats ); // supported=="Supported Files (*.pbm *.jpg...)" supported.append( formats ); // supported=="Supported Files (*.pbm *.jpg...)"
QStringList filter; QStringList filter;
filter << supported filter << supported
<< InputStream::supportedReadFormatsList() << PlaYUVerStream::supportedReadFormatsList()
<< tr( "All Files (*)" ); << tr( "All Files (*)" );
QString fileName = QFileDialog::getOpenFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) ); QString fileName = QFileDialog::getOpenFileName( this, tr( "Open File" ), m_cLastOpenPath, filter.join( ";;" ) );
+1 -1
View File
@@ -40,7 +40,7 @@ namespace plaYUVer
{ {
class SubWindowHandle; class SubWindowHandle;
class InputStream; class PlaYUVerStream;
class plaYUVerApp: public QMainWindow class plaYUVerApp: public QMainWindow
{ {
+19 -19
View File
@@ -32,7 +32,7 @@
namespace plaYUVer namespace plaYUVer
{ {
InputStream::InputStream() PlaYUVerStream::PlaYUVerStream()
{ {
m_bInit = false; m_bInit = false;
m_bLoadAll = false; m_bLoadAll = false;
@@ -57,12 +57,12 @@ InputStream::InputStream()
m_uiAveragePlayInterval = 0; m_uiAveragePlayInterval = 0;
} }
InputStream::~InputStream() PlaYUVerStream::~PlaYUVerStream()
{ {
close(); close();
} }
QString InputStream::supportedReadFormats() QString PlaYUVerStream::supportedReadFormats()
{ {
QString formats; QString formats;
formats = "*.yuv " // Raw video formats = "*.yuv " // Raw video
@@ -75,7 +75,7 @@ QString InputStream::supportedReadFormats()
return formats; return formats;
} }
QString InputStream::supportedWriteFormats() QString PlaYUVerStream::supportedWriteFormats()
{ {
QString formats; QString formats;
formats = "*.bmp " // Windows Bitmap formats = "*.bmp " // Windows Bitmap
@@ -86,7 +86,7 @@ QString InputStream::supportedWriteFormats()
return formats; return formats;
} }
QStringList InputStream::supportedReadFormatsList() QStringList PlaYUVerStream::supportedReadFormatsList()
{ {
QStringList formats; QStringList formats;
formats << "Raw video (*.yuv)" formats << "Raw video (*.yuv)"
@@ -99,7 +99,7 @@ QStringList InputStream::supportedReadFormatsList()
return formats; return formats;
} }
QStringList InputStream::supportedWriteFormatsList() QStringList PlaYUVerStream::supportedWriteFormatsList()
{ {
QStringList formats; QStringList formats;
formats << "Windows Bitmap (*.bmp)" formats << "Windows Bitmap (*.bmp)"
@@ -108,7 +108,7 @@ QStringList InputStream::supportedWriteFormatsList()
return formats; return formats;
} }
Bool InputStream::open( QString filename, UInt width, UInt height, Int input_format, UInt frame_rate ) Bool PlaYUVerStream::open( QString filename, UInt width, UInt height, Int input_format, UInt frame_rate )
{ {
Bool avStatus = false; Bool avStatus = false;
@@ -199,7 +199,7 @@ Bool InputStream::open( QString filename, UInt width, UInt height, Int input_for
return m_bInit; return m_bInit;
} }
Void InputStream::close() Void PlaYUVerStream::close()
{ {
if( m_pFile ) if( m_pFile )
fclose( m_pFile ); fclose( m_pFile );
@@ -231,7 +231,7 @@ Void InputStream::close()
m_bInit = false; m_bInit = false;
} }
Void InputStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
{ {
if( m_bInit ) if( m_bInit )
{ {
@@ -249,7 +249,7 @@ Void InputStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat, UIn
} }
} }
Bool InputStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate ) Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
{ {
Bool bRet = false; Bool bRet = false;
QString fileExtension = QFileInfo( filename ).suffix(); QString fileExtension = QFileInfo( filename ).suffix();
@@ -292,7 +292,7 @@ Bool InputStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, In
return bRet; return bRet;
} }
Void InputStream::loadAll() Void PlaYUVerStream::loadAll()
{ {
if( m_bLoadAll ) if( m_bLoadAll )
return; return;
@@ -331,7 +331,7 @@ Void InputStream::loadAll()
seekInput( 0 ); seekInput( 0 );
} }
Void InputStream::getDuration( Int* duration_array ) Void PlaYUVerStream::getDuration( Int* duration_array )
{ {
Int hours, mins, secs; Int hours, mins, secs;
#ifdef USE_FFMPEG #ifdef USE_FFMPEG
@@ -353,7 +353,7 @@ Void InputStream::getDuration( Int* duration_array )
*duration_array++ = secs; *duration_array++ = secs;
} }
Void InputStream::readNextFrame() Void PlaYUVerStream::readNextFrame()
{ {
UInt64 bytes_read = 0; UInt64 bytes_read = 0;
//m_cTimer.restart(); //m_cTimer.restart();
@@ -396,13 +396,13 @@ Void InputStream::readNextFrame()
return; return;
} }
Bool InputStream::writeFrame( const QString& filename ) Bool PlaYUVerStream::writeFrame( const QString& filename )
{ {
//m_pcCurrFrame->getQimage().save( filename ); //m_pcCurrFrame->getQimage().save( filename );
return true; return true;
} }
Void InputStream::setNextFrame() Void PlaYUVerStream::setNextFrame()
{ {
if( m_pcNextFrame ) if( m_pcNextFrame )
{ {
@@ -422,7 +422,7 @@ Void InputStream::setNextFrame()
} }
} }
PlaYUVerFrame* InputStream::getCurrFrame( PlaYUVerFrame *pyuv_image ) PlaYUVerFrame* PlaYUVerStream::getCurrFrame( PlaYUVerFrame *pyuv_image )
{ {
if( pyuv_image == NULL ) if( pyuv_image == NULL )
pyuv_image = new PlaYUVerFrame( m_pcCurrFrame ); pyuv_image = new PlaYUVerFrame( m_pcCurrFrame );
@@ -431,12 +431,12 @@ PlaYUVerFrame* InputStream::getCurrFrame( PlaYUVerFrame *pyuv_image )
return pyuv_image; return pyuv_image;
} }
PlaYUVerFrame* InputStream::getCurrFrame() PlaYUVerFrame* PlaYUVerStream::getCurrFrame()
{ {
return m_pcCurrFrame; return m_pcCurrFrame;
} }
Void InputStream::seekInput( UInt64 new_frame_num ) Void PlaYUVerStream::seekInput( UInt64 new_frame_num )
{ {
if( !m_pFile || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || (Int64)new_frame_num == m_iCurrFrameNum ) if( !m_pFile || new_frame_num < 0 || new_frame_num >= m_uiTotalFrameNum || (Int64)new_frame_num == m_iCurrFrameNum )
return; return;
@@ -471,7 +471,7 @@ Void InputStream::seekInput( UInt64 new_frame_num )
readNextFrame(); readNextFrame();
} }
Bool InputStream::checkErrors( Int error_type ) Bool PlaYUVerStream::checkErrors( Int error_type )
{ {
if( m_iErrorStatus == error_type ) if( m_iErrorStatus == error_type )
{ {
+8 -8
View File
@@ -22,8 +22,8 @@
* \brief Input stream handling * \brief Input stream handling
*/ */
#ifndef __INPUTSTREAM_H__ #ifndef __PLAYUVERSTREAM_H__
#define __INPUTSTREAM_H__ #define __PLAYUVERSTREAM_H__
#ifdef PLAYUVER #ifdef PLAYUVER
#include "config.h" #include "config.h"
@@ -44,7 +44,7 @@
namespace plaYUVer namespace plaYUVer
{ {
class InputStream class PlaYUVerStream
{ {
private: private:
@@ -83,21 +83,21 @@ private:
Int64 m_iCurrFrameNum; Int64 m_iCurrFrameNum;
public: public:
InputStream(); PlaYUVerStream();
~InputStream(); ~PlaYUVerStream();
static QString supportedReadFormats(); static QString supportedReadFormats();
static QString supportedWriteFormats(); static QString supportedWriteFormats();
static QStringList supportedReadFormatsList(); static QStringList supportedReadFormatsList();
static QStringList supportedWriteFormatsList(); static QStringList supportedWriteFormatsList();
enum InputStreamFormats enum PlaYUVerStreamFormats
{ {
INVALID = -1, INVALID = -1,
YUVFormat = 0, // Use color space. YUVFormat = 0, // Use color space.
}; };
enum InputStreamErrors enum PlaYUVerStreamErrors
{ {
NO_STREAM_ERROR = 0, NO_STREAM_ERROR = 0,
READING, READING,
@@ -185,4 +185,4 @@ public:
} // NAMESPACE } // NAMESPACE
#endif // __INPUTSTREAM_H__ #endif // __PLAYUVERSTREAM_H__