]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/mediactrl.cpp
Fixed typo
[wxWidgets.git] / src / msw / mediactrl.cpp
index 96c8361634ef4e49763b2bf7f3428d69549b0058..34a0a3351064555a9b293a2bae6196d4b79218f3 100644 (file)
@@ -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"