]> git.saurik.com Git - wxWidgets.git/commitdiff
Start xanim only when we are ready to play
authorGuilhem Lavaux <lavaux@easynet.fr>
Sun, 29 Aug 1999 14:40:11 +0000 (14:40 +0000)
committerGuilhem Lavaux <lavaux@easynet.fr>
Sun, 29 Aug 1999 14:40:11 +0000 (14:40 +0000)
Renamed StartPlay in Play
Added wxVideoBaseDriver::GetSize

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3521 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

utils/wxMMedia2/lib/sndwav.cpp
utils/wxMMedia2/lib/vidbase.cpp
utils/wxMMedia2/lib/vidbase.h
utils/wxMMedia2/lib/vidxanm.cpp
utils/wxMMedia2/lib/vidxanm.h

index b4fa4faaa01988e936b72db0c79fcfd1264300dd..a5f863e1e86b51b0d697357f5b1b3e3636c5a0a8 100644 (file)
@@ -233,8 +233,10 @@ FAIL_WITH(m_output->Write(&signature, 4).LastWrite() != 4, wxSOUND_INVSTRM);
     pcm->Signed(TRUE);
     pcm->SetOrder(wxLITTLE_ENDIAN);
     
     pcm->Signed(TRUE);
     pcm->SetOrder(wxLITTLE_ENDIAN);
     
-    if (!SetSoundFormat(*pcm))
+    if (!SetSoundFormat(*pcm)) {
+      delete pcm;
       return FALSE;
       return FALSE;
+    }
 
     delete pcm;
   }
 
     delete pcm;
   }
index 629389b52c74c81ea985be126cd0224f2e0fb0da..6e0b1d9de5c2b88a3b6e9abbde2eea6a0b241f67 100644 (file)
@@ -83,9 +83,9 @@ wxFrame *wxVideoCreateFrame(wxVideoBaseDriver *vid_drv)
   vid_out->DynamicSize(TRUE);
   frame->Layout();
   frame->Show(TRUE);
   vid_out->DynamicSize(TRUE);
   frame->Layout();
   frame->Show(TRUE);
-  wxYield();
 
   vid_drv->AttachOutput(*vid_out);
 
   vid_drv->AttachOutput(*vid_out);
+  vid_drv->Play();
 
   return frame;
 }
 
   return frame;
 }
index 2a3b69d259c7b4acefba244cbd361387e3b662eb..dc42450f61efc4ff004207f02ce798b3775bef6b 100644 (file)
@@ -67,32 +67,39 @@ protected:
 public:
   friend class wxVideoOutput;
  
 public:
   friend class wxVideoOutput;
  
-  ///
+  //
   wxVideoBaseDriver();
   wxVideoBaseDriver();
-  ///
+  //
   wxVideoBaseDriver(wxInputStream& str);
   wxVideoBaseDriver(wxInputStream& str);
-  ///
+  //
   virtual ~wxVideoBaseDriver();
 
   virtual ~wxVideoBaseDriver();
 
-  ///
+
+  //
+  virtual bool Play() = 0;
+  //
+  virtual bool Stop() = 0;
+  //
   virtual bool Pause() = 0;
   virtual bool Pause() = 0;
-  ///
+  //
   virtual bool Resume() = 0;
 
   virtual bool Resume() = 0;
 
-  ///
+  //
   virtual bool SetVolume(wxUint8 vol) = 0;
   virtual bool SetVolume(wxUint8 vol) = 0;
-  ///
+  //
   virtual bool Resize(wxUint16 w, wxUint16 h) = 0;
   virtual bool Resize(wxUint16 w, wxUint16 h) = 0;
+  //
+  virtual bool GetSize(wxSize& size) const = 0;
 
 
-  ///
+  //
   virtual bool IsCapable(wxVideoType WXUNUSED(v_type)) { return FALSE; }
 
   virtual bool IsCapable(wxVideoType WXUNUSED(v_type)) { return FALSE; }
 
-  ///
+  //
   virtual void OnFinished() {}
 
   virtual void OnFinished() {}
 
-  ///
+  //
   virtual bool AttachOutput(wxVideoOutput& output);
   virtual bool AttachOutput(wxVideoOutput& output);
-  ///
+  //
   virtual void DetachOutput();
 };
 
   virtual void DetachOutput();
 };
 
index 09eebc2d577b8a0b6996b3a7018d9de435314657..2dff4c3c68c1a21b6bf7b251b1e451d29931204a 100644 (file)
@@ -60,13 +60,13 @@ wxVideoXANIM::wxVideoXANIM(wxInputStream& str)
 wxVideoXANIM::~wxVideoXANIM()
 {
   if (m_xanim_started)
 wxVideoXANIM::~wxVideoXANIM()
 {
   if (m_xanim_started)
-    StopPlay();
+    Stop();
   delete m_internal;
 
   wxRemoveFile(m_filename);
 }
 
   delete m_internal;
 
   wxRemoveFile(m_filename);
 }
 
-bool wxVideoXANIM::StartPlay()
+bool wxVideoXANIM::Play()
 {
   if (!m_paused && m_xanim_started)
     return TRUE; 
 {
   if (!m_paused && m_xanim_started)
     return TRUE; 
@@ -75,7 +75,8 @@ bool wxVideoXANIM::StartPlay()
     return TRUE;
   }
 
     return TRUE;
   }
 
-  if (SendCommand(" ")) {
+  // The movie starts with xanim
+  if (RestartXANIM()) {
     m_paused = FALSE;
     return TRUE;
   }
     m_paused = FALSE;
     return TRUE;
   }
@@ -100,15 +101,17 @@ bool wxVideoXANIM::Resume()
   return FALSE;
 }
 
   return FALSE;
 }
 
-void wxVideoXANIM::StopPlay()
+bool wxVideoXANIM::Stop()
 {
   if (!m_xanim_started)
 {
   if (!m_xanim_started)
-    return;
+    return FALSE;
 
   SendCommand("q");
 
   m_xanim_started = FALSE;
   m_paused = FALSE;
 
   SendCommand("q");
 
   m_xanim_started = FALSE;
   m_paused = FALSE;
+
+  return TRUE;
 }
 
 bool wxVideoXANIM::SetVolume(wxUint8 vol)
 }
 
 bool wxVideoXANIM::SetVolume(wxUint8 vol)
@@ -127,6 +130,12 @@ bool wxVideoXANIM::Resize(wxUint16 WXUNUSED(w), wxUint16 WXUNUSED(h))
   return FALSE;
 }
 
   return FALSE;
 }
 
+bool wxVideoXANIM::GetSize(wxSize& size) const
+{
+  // Not implemented
+  return FALSE;
+}
+
 bool wxVideoXANIM::IsCapable(wxVideoType v_type)
 {
   if (v_type == wxVIDEO_MSAVI || v_type == wxVIDEO_MPEG ||
 bool wxVideoXANIM::IsCapable(wxVideoType v_type)
 {
   if (v_type == wxVIDEO_MSAVI || v_type == wxVIDEO_MPEG ||
@@ -142,7 +151,7 @@ bool wxVideoXANIM::AttachOutput(wxVideoOutput& out)
   if (!wxVideoBaseDriver::AttachOutput(out))
     return FALSE;
 
   if (!wxVideoBaseDriver::AttachOutput(out))
     return FALSE;
 
-  return RestartXANIM();
+  return TRUE;
 }
 
 void wxVideoXANIM::DetachOutput()
 }
 
 void wxVideoXANIM::DetachOutput()
@@ -229,7 +238,7 @@ bool wxVideoXANIM::RestartXANIM()
 //    wxYield();
   }
 
 //    wxYield();
   }
 
-//  m_paused = TRUE;
+  m_paused = FALSE;
   m_xanim_started = TRUE;
 
   return TRUE;
   m_xanim_started = TRUE;
 
   return TRUE;
index 86d6e1342475b665ac40169cc1faf8e04f6dad71..a224b8e354836420638f288ec482e19e8ed2ecab 100644 (file)
@@ -45,13 +45,14 @@ public:
   wxVideoXANIM(wxInputStream& str);
   ~wxVideoXANIM();
 
   wxVideoXANIM(wxInputStream& str);
   ~wxVideoXANIM();
 
-  bool StartPlay();
+  bool Play();
   bool Pause();
   bool Resume();
   bool Pause();
   bool Resume();
-  void StopPlay();
+  bool Stop();
 
   bool SetVolume(wxUint8 vol);
   bool Resize(wxUint16 w, wxUint16 h);
 
   bool SetVolume(wxUint8 vol);
   bool Resize(wxUint16 w, wxUint16 h);
+  bool GetSize(wxSize& size) const;
 
   bool IsCapable(wxVideoType v_type);
 
 
   bool IsCapable(wxVideoType v_type);