From b3a4f913b91fc515af26181f44c68f4b0adc51a5 Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 6 Jan 2015 18:28:23 +0000 Subject: [PATCH 1/2] fix copyrights --- app/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/main.cpp b/app/main.cpp index 887aa5b..07ecb34 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -1,6 +1,6 @@ /* This file is a part of plaYUVer project - * Copyright (C) 2014 by Luis Lucas (luisfrlucas@gmail.com) - * Joao Carreira (jfmcarreira@gmail.com) + * Copyright (C) 2014-2015 by Luis Lucas (luisfrlucas@gmail.com) + * Joao Carreira (jfmcarreira@gmail.com) * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by From f346e5e7fe60e86e43cd0706c736c99603f7f38d Mon Sep 17 00:00:00 2001 From: Joao Carreira Date: Tue, 6 Jan 2015 18:58:39 +0000 Subject: [PATCH 2/2] fix opening files --- app/VideoSubWindow.cpp | 25 +++++++++++++------------ lib/PlaYUVerStream.cpp | 10 ++++++---- 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/app/VideoSubWindow.cpp b/app/VideoSubWindow.cpp index 0ab3eaa..b87a50a 100644 --- a/app/VideoSubWindow.cpp +++ b/app/VideoSubWindow.cpp @@ -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; diff --git a/lib/PlaYUVerStream.cpp b/lib/PlaYUVerStream.cpp index d1713e7..ee743ff 100644 --- a/lib/PlaYUVerStream.cpp +++ b/lib/PlaYUVerStream.cpp @@ -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()