diff options
author | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-02 22:17:39 +0400 |
---|---|---|
committer | kinddragon <kinddragon@users.sourceforge.net> | 2010-05-02 22:17:39 +0400 |
commit | 0d32d6282bf68fd38a4b377b72fb1b20c80bba46 (patch) | |
tree | f0e7d7901a56d9217687fab5852fd1331862312c | |
parent | dfc02adc80812cea6d460dd58ca90a051a141d88 (diff) |
Minor fixes
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1833 10f7b99b-c216-0410-bff0-8a66a9350fd8
-rw-r--r-- | src/apps/mplayerc/EVRAllocatorPresenter.cpp | 7 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.cpp | 35 | ||||
-rw-r--r-- | src/apps/mplayerc/MainFrm.h | 3 |
3 files changed, 27 insertions, 18 deletions
diff --git a/src/apps/mplayerc/EVRAllocatorPresenter.cpp b/src/apps/mplayerc/EVRAllocatorPresenter.cpp index 8df90f23f..371b3ba73 100644 --- a/src/apps/mplayerc/EVRAllocatorPresenter.cpp +++ b/src/apps/mplayerc/EVRAllocatorPresenter.cpp @@ -1927,15 +1927,16 @@ void CEVRAllocatorPresenter::OnVBlankFinished(bool fAll, LONGLONG PerformanceCou {
llClockTime = m_StarvationClock;
}
- m_pCurrentDisplaydSample->GetSampleDuration(&SampleDuration);
+ if (FAILED(m_pCurrentDisplaydSample->GetSampleDuration(&SampleDuration)))
+ SampleDuration = 0;
- m_pCurrentDisplaydSample->GetSampleTime(&nsSampleTime);
+ if (FAILED(m_pCurrentDisplaydSample->GetSampleTime(&nsSampleTime)))
+ nsSampleTime = llClockTime;
LONGLONG TimePerFrame = m_rtTimePerFrame;
if (!TimePerFrame)
return;
if (SampleDuration > 1)
TimePerFrame = SampleDuration;
-
{
m_nNextSyncOffset = (m_nNextSyncOffset+1) % NB_JITTER;
LONGLONG SyncOffset = nsSampleTime - llClockTime;
diff --git a/src/apps/mplayerc/MainFrm.cpp b/src/apps/mplayerc/MainFrm.cpp index 3f23d612c..d29cfe712 100644 --- a/src/apps/mplayerc/MainFrm.cpp +++ b/src/apps/mplayerc/MainFrm.cpp @@ -598,7 +598,8 @@ CMainFrame::CMainFrame() : m_bToggleShaderScreenSpace(false),
m_bInOptions(false),
m_pTaskbarList(NULL),
- m_pGraphThread(NULL)
+ m_pGraphThread(NULL),
+ m_bOpenedThruThread(false)
{
m_Lcd.SetVolumeRange(1, 100);
}
@@ -2565,13 +2566,21 @@ LRESULT CMainFrame::OnGraphNotify(WPARAM wParam, LPARAM lParam) LRESULT CMainFrame::OnResetDevice( WPARAM wParam, LPARAM lParam )
{
- PostMessage(WM_COMMAND, ID_PLAY_PAUSE);
- CAMEvent e;
+ OAFilterState fs = State_Stopped;
+ pMC->GetState(0, &fs);
+ if(fs == State_Running) pMC->Pause();
+
BOOL bResult = false;
- m_pGraphThread->PostThreadMessage(CGraphThread::TM_RESET, (WPARAM)&bResult, (LPARAM)&e);
- e.Wait();
- if (bResult)
- PostMessage(WM_COMMAND, ID_PLAY_PLAY); // fix problems with VMR7
+ if (m_bOpenedThruThread)
+ {
+ CAMEvent e;
+ m_pGraphThread->PostThreadMessage(CGraphThread::TM_RESET, (WPARAM)&bResult, (LPARAM)&e);
+ e.Wait();
+ }
+ else
+ ResetDevice();
+
+ if(fs == State_Running) pMC->Run();
return S_OK;
}
@@ -13127,8 +13136,6 @@ void CMainFrame::AddCurDevToPlaylist() }
}
-static int s_fOpenedThruThread = false;
-
void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD)
{
// shortcut
@@ -13160,7 +13167,7 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD) if(p->fns.GetCount() > 0)
{
engine_t e = s.Formats.GetEngine(p->fns.GetHead());
- fUseThread = e == DirectShow /*|| e == RealMedia || e == QuickTime*/;
+ fUseThread = e == DirectShow; //|| e == RealMedia || e == QuickTime;
}
}
else if(OpenDeviceData* p = dynamic_cast<OpenDeviceData*>(pOMD.m_p))
@@ -13172,12 +13179,12 @@ void CMainFrame::OpenMedia(CAutoPtr<OpenMediaData> pOMD) && AfxGetAppSettings().fEnableWorkerThreadForOpening)
{
m_pGraphThread->PostThreadMessage(CGraphThread::TM_OPEN, 0, (LPARAM)pOMD.Detach());
- s_fOpenedThruThread = true;
+ m_bOpenedThruThread = true;
}
else
{
OpenMediaPrivate(pOMD);
- s_fOpenedThruThread = false;
+ m_bOpenedThruThread = false;
}
}
@@ -13210,7 +13217,7 @@ void CMainFrame::CloseMedia() TRACE(_T("CRITICAL ERROR: !!! Must kill opener thread !!!"));
TerminateThread(m_pGraphThread->m_hThread, -1);
m_pGraphThread = (CGraphThread*)AfxBeginThread(RUNTIME_CLASS(CGraphThread));
- s_fOpenedThruThread = false;
+ m_bOpenedThruThread = false;
break;
}
@@ -13227,7 +13234,7 @@ void CMainFrame::CloseMedia() OnFilePostClosemedia();
- if(m_pGraphThread && s_fOpenedThruThread)
+ if(m_pGraphThread && m_bOpenedThruThread)
{
CAMEvent e;
m_pGraphThread->PostThreadMessage(CGraphThread::TM_CLOSE, 0, (LPARAM)&e);
diff --git a/src/apps/mplayerc/MainFrm.h b/src/apps/mplayerc/MainFrm.h index ff660ecbd..57418312c 100644 --- a/src/apps/mplayerc/MainFrm.h +++ b/src/apps/mplayerc/MainFrm.h @@ -434,7 +434,8 @@ protected: bool GraphEventComplete();
friend class CGraphThread;
- CGraphThread* m_pGraphThread;
+ CGraphThread* m_pGraphThread;
+ bool m_bOpenedThruThread;
CAtlArray<REFERENCE_TIME> m_kfs;
|