Init LibAvContextHandle flags. fix current frame number variable. Add disconnect function when stop is clicked
This commit is contained in:
1 parent
3ee9a4b277
commit
fcef6e09c4
3 files changed
+20
-18
No files matched your search
+13
-13
@@ -39,7 +39,7 @@ InputStream::InputStream()
|
|||||||
m_uiWidth = 0;
|
m_uiWidth = 0;
|
||||||
m_uiHeight = 0;
|
m_uiHeight = 0;
|
||||||
m_uiTotalFrameNum = 0;
|
m_uiTotalFrameNum = 0;
|
||||||
m_uiCurrFrameNum = 0;
|
m_iCurrFrameNum = -1;
|
||||||
m_iErrorStatus = 0;
|
m_iErrorStatus = 0;
|
||||||
m_iPixelFormat = -1;
|
m_iPixelFormat = -1;
|
||||||
|
|
||||||
@@ -137,9 +137,12 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
|
|||||||
m_cStreamInformationString = QString( "[" );
|
m_cStreamInformationString = QString( "[" );
|
||||||
|
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
if( QFileInfo( filename ).completeSuffix().compare( QString( "yuv" ) ) )
|
||||||
m_cStreamInformationString.append( QString::fromUtf8( m_cLibAvContext.getStreamInformation() ) );
|
{
|
||||||
m_uiTotalFrameNum = 100;
|
avStatus = m_cLibAvContext.initAvFormat( m_cFilename.toLocal8Bit().data(), m_uiWidth, m_uiHeight, m_iPixelFormat, m_uiFrameRate );
|
||||||
|
m_cStreamInformationString.append( QString::fromUtf8( m_cLibAvContext.getStreamInformation() ) );
|
||||||
|
m_uiTotalFrameNum = 100;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if( m_uiWidth <= 0 || m_uiHeight <= 0 )
|
if( m_uiWidth <= 0 || m_uiHeight <= 0 )
|
||||||
@@ -181,7 +184,7 @@ Void InputStream::init( QString filename, UInt width, UInt height, Int input_for
|
|||||||
|
|
||||||
m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() );
|
m_cStreamInformationString.append( QFileInfo( m_cFilename ).fileName() );
|
||||||
|
|
||||||
m_uiCurrFrameNum = 0;
|
m_iCurrFrameNum = -1;
|
||||||
m_iStatus = 1;
|
m_iStatus = 1;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@@ -208,15 +211,12 @@ Void InputStream::readFrame()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_uiCurrFrameNum < m_uiTotalFrameNum )
|
m_iCurrFrameNum++;
|
||||||
{
|
if( m_iCurrFrameNum >= m_uiTotalFrameNum )
|
||||||
m_uiCurrFrameNum++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
m_iErrorStatus = END_OF_SEQ;
|
m_iErrorStatus = END_OF_SEQ;
|
||||||
m_uiCurrFrameNum = 0;
|
m_iCurrFrameNum = 0;
|
||||||
seekInput( m_uiCurrFrameNum );
|
seekInput( m_iCurrFrameNum );
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_FFMPEG
|
#ifdef USE_FFMPEG
|
||||||
@@ -292,7 +292,7 @@ Void InputStream::seekInput( Int new_frame_num )
|
|||||||
UInt64 frame_bytes_input = m_uiWidth * m_uiHeight * 1.5;
|
UInt64 frame_bytes_input = m_uiWidth * m_uiHeight * 1.5;
|
||||||
UInt64 nbytes_seek = frame_bytes_input * new_frame_num;
|
UInt64 nbytes_seek = frame_bytes_input * new_frame_num;
|
||||||
fseek( m_pFile, nbytes_seek, SEEK_SET );
|
fseek( m_pFile, nbytes_seek, SEEK_SET );
|
||||||
m_uiCurrFrameNum = new_frame_num;
|
m_iCurrFrameNum = new_frame_num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ private:
|
|||||||
UInt m_uiHeight;
|
UInt m_uiHeight;
|
||||||
UInt m_uiFrameRate;
|
UInt m_uiFrameRate;
|
||||||
UInt m_uiTotalFrameNum;
|
UInt m_uiTotalFrameNum;
|
||||||
UInt m_uiCurrFrameNum;
|
Int m_iCurrFrameNum;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InputStream();
|
InputStream();
|
||||||
@@ -136,9 +136,9 @@ public:
|
|||||||
{
|
{
|
||||||
return m_uiHeight;
|
return m_uiHeight;
|
||||||
}
|
}
|
||||||
UInt getCurrFrameNum()
|
Int getCurrFrameNum()
|
||||||
{
|
{
|
||||||
return m_uiCurrFrameNum;
|
return m_iCurrFrameNum;
|
||||||
}
|
}
|
||||||
UInt getFrameRate()
|
UInt getFrameRate()
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -43,8 +43,6 @@ extern "C"
|
|||||||
#include <libavformat/avformat.h>
|
#include <libavformat/avformat.h>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#include "TypeDef.h"
|
#include "TypeDef.h"
|
||||||
|
|
||||||
namespace plaYUVer
|
namespace plaYUVer
|
||||||
@@ -53,6 +51,10 @@ namespace plaYUVer
|
|||||||
class LibAvContextHandle
|
class LibAvContextHandle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
LibAvContextHandle() :
|
||||||
|
m_bHasStream( false )
|
||||||
|
{
|
||||||
|
}
|
||||||
Bool initAvFormat( char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate );
|
Bool initAvFormat( char* filename, UInt& width, UInt& height, Int& pixel_format, UInt& frame_rate );
|
||||||
Void closeAvFormat();
|
Void closeAvFormat();
|
||||||
Bool decodeAvFormat();
|
Bool decodeAvFormat();
|
||||||
|
|||||||
Reference in new issue
Block a user