Bugfix after introducing two frame buffer. Video has being displayed at

half of the rate
This commit is contained in:
jfmcarreira committed 2014-03-27 01:05:21 +00:00
1 parent 9df914fed3
commit 53de9ccc29
3 files changed
+13 -25

No files matched your search

+7 -8
View File
@@ -54,6 +54,7 @@ InputStream::InputStream()
m_cStreamInformationString = QString( "" );
m_pcCurrFrame = NULL;
m_pcNextFrame = NULL;
m_ppcFrameBuffer = NULL;
m_uiFrameBufferSize = 2;
}
@@ -163,8 +164,8 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
{
m_ppcFrameBuffer[i] = new PlaYUVerFrame( m_uiWidth, m_uiHeight, m_iPixelFormat );
}
m_pcCurrFrame = m_ppcFrameBuffer[0];
m_uiFrameBufferIndex = 1;
m_uiFrameBufferIndex = 0;
m_pcCurrFrame = m_pcNextFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
UInt64 frame_bytes_input = m_pcCurrFrame->getBytesPerFrame();
@@ -190,11 +191,8 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
}
m_cStreamInformationString.append( QString("/ "));
m_cStreamInformationString.append( PlaYUVerFrame::supportedPixelFormatList().at( m_iPixelFormat ) );
m_cStreamInformationString.append( "] " );
m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() );
m_iCurrFrameNum = -1;
@@ -250,7 +248,7 @@ Void InputStream::readNextFrame()
if( m_cLibAvContext.getStatus() )
{
m_cLibAvContext.decodeAvFormat();
m_ppcFrameBuffer[!m_uiFrameBufferIndex]->FrameFromBuffer( m_cLibAvContext.video_dst_data[0], m_iPixelFormat );
m_pcNextFrame->FrameFromBuffer( m_cLibAvContext.video_dst_data[0], m_iPixelFormat );
return;
}
#endif
@@ -263,8 +261,7 @@ Void InputStream::readNextFrame()
qDebug( ) << " Reading error !!!" << endl;
return;
}
m_ppcFrameBuffer[!m_uiFrameBufferIndex]->FrameFromBuffer( m_pInputBuffer, m_iPixelFormat );
m_uiFrameBufferIndex = !m_uiFrameBufferIndex;
m_pcNextFrame->FrameFromBuffer( m_pInputBuffer, m_iPixelFormat );
return;
}
@@ -277,6 +274,8 @@ Bool InputStream::writeFrame( const QString& filename )
Void InputStream::setNextFrame()
{
m_pcCurrFrame = m_ppcFrameBuffer[m_uiFrameBufferIndex];
m_pcNextFrame = m_ppcFrameBuffer[!m_uiFrameBufferIndex];
m_uiFrameBufferIndex = !m_uiFrameBufferIndex;
m_iCurrFrameNum++;
}
+1
View File
@@ -75,6 +75,7 @@ private:
UInt m_uiFrameBufferSize;
PlaYUVerFrame **m_ppcFrameBuffer;
PlaYUVerFrame *m_pcCurrFrame;
PlaYUVerFrame *m_pcNextFrame;
UInt m_uiFrameBufferIndex;
UInt m_uiWidth;
+5 -17
View File
@@ -141,31 +141,19 @@ Void SubWindowHandle::disableModule()
refreshFrame();
}
QImage* SubWindowHandle::FrameToQImage( PlaYUVerFrame* curr_frame )
{
curr_frame->FrametoRGB8();
// Pel*** bufferRGB = curr_frame->getPelBufferRGB();
// for( UInt y = 0; y < curr_frame->getHeight(); y++ )
// {
// for( UInt x = 0; x < curr_frame->getWidth(); x++ )
// {
// m_pCurrFrameQImage->setPixel( x, y, qRgb( bufferRGB[0][y][x], bufferRGB[1][y][x], bufferRGB[2][y][x] ) );
// }
// }
return m_pCurrFrameQImage;
}
Void SubWindowHandle::refreshFrame()
{
PlaYUVerFrame* CurrSubWindowFrame;
if( m_pcCurrentModule )
{
FrameToQImage( m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() ) );
CurrSubWindowFrame = m_pcCurrentModule->process( m_pCurrStream->getCurrFrame() );
}
else
{
FrameToQImage( m_pCurrStream->getCurrFrame() );
CurrSubWindowFrame = m_pCurrStream->getCurrFrame();
}
m_cViewArea->setImage( QPixmap::fromImage( *m_pCurrFrameQImage ) );
CurrSubWindowFrame->FrametoRGB8();
m_cViewArea->setImage( QPixmap::fromImage( QImage( CurrSubWindowFrame->getQImageBuffer(), CurrSubWindowFrame->getWidth(), CurrSubWindowFrame->getHeight(), QImage::Format_RGB888 ) ) );
}
Bool SubWindowHandle::save()