fix opening files

This commit is contained in:
jfmcarreira committed 2015-01-06 18:58:39 +00:00
1 parent b3a4f913b9
commit f346e5e7fe
2 files changed
+19 -16

No files matched your search

+13 -12
View File
@@ -126,19 +126,10 @@ Void VideoSubWindow::reloadFile()
Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
{
UInt Width = 0, Height = 0, FrameRate = 30;
Int InputFormat = -1;
Int InputFormat = PlaYUVerFrame::YUV420p;
if( !m_pCurrStream )
{
m_pCurrStream = new PlaYUVerStream;
}
else
{
delete m_pCurrStream;
m_pCurrStream = new PlaYUVerStream;
}
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
if( m_pCurrStream )
m_pCurrStream->getFormat( Width, Height, InputFormat, FrameRate );
if( m_pCurrStream->guessFormat( cFilename, Width, Height, InputFormat, FrameRate ) || bForceDialog )
{
@@ -151,6 +142,16 @@ Bool VideoSubWindow::loadFile( QString cFilename, Bool bForceDialog )
QApplication::setOverrideCursor( Qt::WaitCursor );
QApplication::restoreOverrideCursor();
if( !m_pCurrStream )
{
m_pCurrStream = new PlaYUVerStream;
}
else
{
delete m_pCurrStream;
m_pCurrStream = new PlaYUVerStream;
}
m_pCurrStream->open( cFilename, Width, Height, InputFormat, FrameRate );
m_sStreamInfo.m_cFilename = cFilename;
+6 -4
View File
@@ -295,12 +295,13 @@ Void PlaYUVerStream::getFormat( UInt& rWidth, UInt& rHeight, Int& rInputFormat,
Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight, Int& rInputFormat, UInt& rFrameRate )
{
Bool bRet = false;
Bool bGuessed = true;
Bool bGuessedByFilesize = false;
QString FilenameShort = QFileInfo( filename ).fileName();
QString fileExtension = QFileInfo( filename ).suffix();
if( !fileExtension.compare( "yuv" ) )
{
bRet = true;
bGuessed = false;
// Guess pixel format
QStringList formats_list = PlaYUVerFrame::supportedPixelFormatListNames();
for( Int i = 0; i < formats_list.size(); i++ )
@@ -388,14 +389,15 @@ Bool PlaYUVerStream::guessFormat( QString filename, UInt& rWidth, UInt& rHeight,
{
rWidth = sizeResolution.at( match ).width();
rHeight = sizeResolution.at( match ).height();
bGuessedByFilesize = true;
}
}
}
if( rWidth > 0 && rHeight > 0 && rInputFormat >= 0 )
bRet = false;
bGuessed = true && !bGuessedByFilesize;
}
return bRet;
return !bGuessed;
}
Void PlaYUVerStream::loadAll()