TVPinvideo.cpp
资源名称:p2p_vod.rar [点击查看]
上传用户:liguizhu
上传日期:2015-11-01
资源大小:2422k
文件大小:2k
源码类别:
P2P编程
开发平台:
Visual C++
- #include "stdafx.h"
- // Video Pin
- CTVStreamSourceVideoPin::CTVStreamSourceVideoPin(HRESULT *phr, CSource *pFilter)
- : CTVStreamSourcePin(NAME("Chaos Filter Video Pin"), phr, pFilter, false)
- {
- }
- //
- CTVStreamSourceVideoPin::~CTVStreamSourceVideoPin()
- {
- }
- //
- HRESULT CTVStreamSourceVideoPin::ChangeStop()
- {
- return NOERROR;
- }
- //
- HRESULT CTVStreamSourceVideoPin::ChangeRate()
- {
- return NOERROR;
- }
- //
- HRESULT CTVStreamSourceVideoPin::SeekTime(REFERENCE_TIME rtPos)
- {
- SetSeekData(rtPos);
- //
- return S_FALSE;
- }
- //
- STDMETHODIMP CTVStreamSourceVideoPin::NonDelegatingQueryInterface(REFIID riid, void ** ppv)
- {
- CheckPointer(ppv, E_POINTER);
- return CTVStreamSourcePin::NonDelegatingQueryInterface(riid, ppv);
- }
- //
- HRESULT CTVStreamSourceVideoPin::ChangeStart()
- {
- if (m_pFilter && m_pFilter->m_pComm)
- return NOERROR;
- //
- if (ThreadExists())
- {
- DeliverBeginFlush();
- //
- Stop();
- // complete the flush
- DeliverEndFlush();
- // restart
- Run();
- }
- //
- return NOERROR;
- }
- //
- HRESULT CTVStreamSourceVideoPin::OnThreadStartPlay(void)
- {
- m_pFilter->SetBaseRef(_I64_MAX);
- //
- SetSeekData(m_rtStart + m_llBaseTime);
- //
- return CTVStreamSourcePin::OnThreadStartPlay();
- }
- HRESULT CTVStreamSourceVideoPin::OnThreadDestroy(void)
- {
- return CTVStreamSourcePin::OnThreadDestroy();
- }
- //
- HRESULT CTVStreamSourceVideoPin::Active(void)
- {
- return CSourceStream::Active();
- }
- void CTVStreamSourceVideoPin::RawSync(LONGLONG start)
- {
- LONGLONG m_audiotime = m_pFilter->GetRawAudioRef();
- //如果videopin太快,则拖延一下video的行为
- if(m_audiotime != _I64_MAX && (start > m_audiotime) && (start - m_audiotime > 50000000))
- {
- Sleep(1000);
- }
- }