diff options
author | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-10-21 14:45:51 +0400 |
---|---|---|
committer | Hendrik Leppkes <h.leppkes@gmail.com> | 2012-10-21 14:45:51 +0400 |
commit | 2dd5d56765d75346a7864462a05bd0fe4d99f7fe (patch) | |
tree | e3ba2d8433bf7a376d097fb5ab113c273116611a /decoder/LAVAudio | |
parent | e07e32aee550187e6635e5b757163581c05840e2 (diff) |
Factor decoder flushing into its own function
Diffstat (limited to 'decoder/LAVAudio')
-rw-r--r-- | decoder/LAVAudio/LAVAudio.cpp | 28 | ||||
-rw-r--r-- | decoder/LAVAudio/LAVAudio.h | 1 |
2 files changed, 19 insertions, 10 deletions
diff --git a/decoder/LAVAudio/LAVAudio.cpp b/decoder/LAVAudio/LAVAudio.cpp index 4fdb8885..f6088fc1 100644 --- a/decoder/LAVAudio/LAVAudio.cpp +++ b/decoder/LAVAudio/LAVAudio.cpp @@ -1410,17 +1410,8 @@ HRESULT CLAVAudio::EndFlush() m_buff.SetSize(0); FlushOutput(FALSE); - if(m_pParser) { - av_parser_close(m_pParser); - m_pParser = av_parser_init(m_nCodecId); - m_bUpdateTimeCache = TRUE; - } + FlushDecoder(); - if (m_pAVCtx && m_pAVCtx->codec) { - avcodec_flush_buffers (m_pAVCtx); - } - - FlushDTSDecoder(); m_bsOutput.SetSize(0); m_bQueueResync = TRUE; @@ -1442,6 +1433,23 @@ HRESULT CLAVAudio::NewSegment(REFERENCE_TIME tStart, REFERENCE_TIME tStop, doubl return __super::NewSegment(tStart, tStop, dRate); } +HRESULT CLAVAudio::FlushDecoder() +{ + if(m_pParser) { + av_parser_close(m_pParser); + m_pParser = av_parser_init(m_nCodecId); + m_bUpdateTimeCache = TRUE; + } + + if (m_pAVCtx && m_pAVCtx->codec) { + avcodec_flush_buffers (m_pAVCtx); + } + + FlushDTSDecoder(); + + return S_OK; +} + HRESULT CLAVAudio::Receive(IMediaSample *pIn) { CAutoLock cAutoLock(&m_csReceive); diff --git a/decoder/LAVAudio/LAVAudio.h b/decoder/LAVAudio/LAVAudio.h index e2a4da4f..0ccf79ae 100644 --- a/decoder/LAVAudio/LAVAudio.h +++ b/decoder/LAVAudio/LAVAudio.h @@ -194,6 +194,7 @@ private: HRESULT QueueOutput(BufferDetails &buffer); HRESULT FlushOutput(BOOL bDeliver = TRUE); + HRESULT FlushDecoder(); HRESULT Deliver(BufferDetails &buffer); |