Add EOF support to stream handler
This commit is contained in:
4 files changed
+18
-4
No files matched your search
@@ -32,6 +32,8 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
#define QT_NO_CONCURRENT
|
||||
|
||||
/**
|
||||
* \brief Functions to control data stream from stream information
|
||||
*/
|
||||
|
||||
+2
-2
@@ -155,10 +155,10 @@ struct CalypStreamPrivate
|
||||
|
||||
CalypStreamPrivate()
|
||||
{
|
||||
isInit = false;
|
||||
pfctCreateHandler = NULL;
|
||||
handler = NULL;
|
||||
pfctCreateHandler = NULL;
|
||||
isInput = true;
|
||||
isInit = false;
|
||||
bLoadAll = false;
|
||||
iCurrFrameNum = -1;
|
||||
cFilename = "";
|
||||
|
||||
@@ -80,6 +80,7 @@ public:
|
||||
, m_uiTotalNumberFrames( 0 )
|
||||
, m_pStreamBuffer( NULL )
|
||||
, m_uiNBytesPerFrame( 0 )
|
||||
, m_isEOF( false )
|
||||
{
|
||||
}
|
||||
virtual ~CalypStreamHandlerIf() {}
|
||||
@@ -115,6 +116,7 @@ protected:
|
||||
unsigned long m_uiTotalNumberFrames;
|
||||
ClpByte* m_pStreamBuffer;
|
||||
unsigned long m_uiNBytesPerFrame;
|
||||
bool m_isEOF;
|
||||
};
|
||||
|
||||
#endif // __CALYPSTREAMHANDLERIF_H__
|
||||
@@ -336,11 +336,12 @@ bool StreamHandlerLibav::configureBuffer( CalypFrame* pcFrame )
|
||||
void StreamHandlerLibav::calculateFrameNumber()
|
||||
{
|
||||
unsigned long long int num_frames;
|
||||
if( m_cStream->nb_frames )
|
||||
/*if( m_cStream->nb_frames )
|
||||
{
|
||||
num_frames = m_cStream->nb_frames;
|
||||
}
|
||||
else if( m_cFmtCtx->duration != AV_NOPTS_VALUE )
|
||||
else */
|
||||
if( m_cFmtCtx->duration != AV_NOPTS_VALUE )
|
||||
{
|
||||
long long int duration = m_cFmtCtx->duration + 5000;
|
||||
m_uiSecs = duration / AV_TIME_BASE;
|
||||
@@ -371,6 +372,8 @@ bool StreamHandlerLibav::read( CalypFrame* pcFrame )
|
||||
bReadPkt = true;
|
||||
else
|
||||
return false;
|
||||
//if( iRet == AVERROR_EOF )
|
||||
// m_isEOF = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -397,7 +400,14 @@ bool StreamHandlerLibav::read( CalypFrame* pcFrame )
|
||||
bReadPkt = false;
|
||||
av_packet_unref( &m_cOrgPacket );
|
||||
if( ( iRet = av_read_frame( m_cFmtCtx, &m_cPacket ) ) < 0 )
|
||||
{
|
||||
if( iRet == AVERROR_EOF )
|
||||
{
|
||||
m_isEOF = true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
m_cOrgPacket = m_cPacket;
|
||||
#ifdef FF_SEND_RECEIVE_API
|
||||
if( m_cPacket.stream_index == m_iStreamIdx )
|
||||
|
||||
Reference in new issue
Block a user