X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/3f9a3bf9df67fff13df7cdb70066f479c249f2e5..bc37bfe2ee241f9c8d5da57011c8f5ba5d8bc29e:/src/msw/mediactrl.cpp diff --git a/src/msw/mediactrl.cpp b/src/msw/mediactrl.cpp index 96c8361634..34a0a33510 100644 --- a/src/msw/mediactrl.cpp +++ b/src/msw/mediactrl.cpp @@ -256,10 +256,10 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxString& fileNa { delete m_imp; #endif - m_imp = new wxWMMEMediaCtrlImpl; - if(!m_imp->Create(this)) +// m_imp = new wxWMMEMediaCtrlImpl; +// if(!m_imp->Create(this)) { - delete m_imp; +// delete m_imp; m_imp = NULL; return false; } @@ -294,10 +294,10 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxURI& location, { delete m_imp; #endif - m_imp = new wxWMMEMediaCtrlImpl; - if(!m_imp->Create(this)) +// m_imp = new wxWMMEMediaCtrlImpl; +// if(!m_imp->Create(this)) { - delete m_imp; +// delete m_imp; m_imp = NULL; return false; } @@ -531,7 +531,13 @@ bool wxDXMediaCtrlImpl::Pause() bool wxDXMediaCtrlImpl::Stop() { - return SUCCEEDED( m_pMC->Stop() ) && SetPosition(0); + bool bOK = SUCCEEDED( m_pMC->Stop() ); + + //We don't care if it can't get to the beginning in directshow - + //it could be a non-seeking filter (wince midi) in which case playing + //starts all over again + SetPosition(0); + return bOK; } bool wxDXMediaCtrlImpl::SetPosition(long where) @@ -613,11 +619,14 @@ bool wxDXMediaCtrlImpl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPa // If this is the end of the clip, notify handler if(EC_COMPLETE == evCode) { + //Interestingly enough, DirectShow does not actually stop + //the filters - even when it reaches the end! #ifdef __WXDEBUG__ wxASSERT( Stop() ); #else Stop(); #endif + wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED, m_ctrl->GetId()); m_ctrl->GetParent()->ProcessEvent(theEvent); } @@ -703,7 +712,8 @@ bool wxWMMEMediaCtrlImpl::Pause() bool wxWMMEMediaCtrlImpl::Stop() { - return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0); + return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0) && + SetPosition(GetDuration()); } #include "wx/log.h"