Define wxMediaEvent before it is used. Make OnMediaFinish compatible to wxObjectEventFunction. Warning fix.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30568 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
// Name: wx/mediactrl.h
|
// Name: wx/mediactrl.h
|
||||||
// Purpose: wxMediaCtrl class
|
// Purpose: wxMediaCtrl class
|
||||||
// Author: Ryan Norton <wxprojects@comcast.net>
|
// Author: Ryan Norton <wxprojects@comcast.net>
|
||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 11/07/04
|
// Created: 11/07/04
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Ryan Norton
|
// Copyright: (c) Ryan Norton
|
||||||
@@ -64,166 +64,6 @@ enum wxMediaTimeFormat
|
|||||||
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
|
#define wxMEDIABACKEND_MCI wxT("wxMCIMediaBackend")
|
||||||
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
|
#define wxMEDIABACKEND_QUICKTIME wxT("wxQTMediaBackend")
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// wxMediaCtrl
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxMediaCtrl : public wxControl
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxMediaCtrl() : m_imp(NULL), m_bLoaded(false), m_bLoop(false)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
wxMediaCtrl(wxWindow* parent, wxWindowID id,
|
|
||||||
const wxString& fileName = wxT(""),
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxString& szBackend = wxT(""),
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxT("mediaCtrl"))
|
|
||||||
: m_imp(NULL), m_bLoaded(false), m_bLoop(false)
|
|
||||||
{ Create(parent, id, fileName, pos, size, style,
|
|
||||||
szBackend, validator, name); }
|
|
||||||
|
|
||||||
wxMediaCtrl(wxWindow* parent, wxWindowID id,
|
|
||||||
const wxURI& location,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxString& szBackend = wxT(""),
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxT("mediaCtrl"))
|
|
||||||
: m_imp(NULL), m_bLoop(false)
|
|
||||||
{ Create(parent, id, location, pos, size, style,
|
|
||||||
szBackend, validator, name); }
|
|
||||||
|
|
||||||
~wxMediaCtrl();
|
|
||||||
|
|
||||||
bool Create(wxWindow* parent, wxWindowID id,
|
|
||||||
const wxString& fileName = wxT(""),
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxString& szBackend = wxT(""),
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxT("mediaCtrl"));
|
|
||||||
|
|
||||||
bool Create(wxWindow* parent, wxWindowID id,
|
|
||||||
const wxURI& location,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxString& szBackend = wxT(""),
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxT("mediaCtrl"));
|
|
||||||
|
|
||||||
bool DoCreate(wxClassInfo* instance,
|
|
||||||
wxWindow* parent, wxWindowID id,
|
|
||||||
const wxPoint& pos = wxDefaultPosition,
|
|
||||||
const wxSize& size = wxDefaultSize,
|
|
||||||
long style = 0,
|
|
||||||
const wxValidator& validator = wxDefaultValidator,
|
|
||||||
const wxString& name = wxT("mediaCtrl"));
|
|
||||||
|
|
||||||
static wxClassInfo* NextBackend();
|
|
||||||
|
|
||||||
|
|
||||||
bool Play();
|
|
||||||
bool Pause();
|
|
||||||
bool Stop();
|
|
||||||
|
|
||||||
bool Load(const wxString& fileName);
|
|
||||||
bool Load(const wxURI& location);
|
|
||||||
|
|
||||||
void Loop(bool bLoop = true);
|
|
||||||
bool IsLooped();
|
|
||||||
|
|
||||||
wxMediaState GetState();
|
|
||||||
|
|
||||||
double GetPlaybackRate();
|
|
||||||
bool SetPlaybackRate(double dRate);
|
|
||||||
|
|
||||||
bool SetPosition(wxLongLong where);
|
|
||||||
wxLongLong GetPosition();
|
|
||||||
wxLongLong GetDuration();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void OnMediaFinished(const class wxMediaEvent& evt);
|
|
||||||
virtual void DoMoveWindow(int x, int y, int w, int h);
|
|
||||||
wxSize DoGetBestSize() const;
|
|
||||||
|
|
||||||
class wxMediaBackend* m_imp;
|
|
||||||
bool m_bLoaded;
|
|
||||||
bool m_bLoop;
|
|
||||||
|
|
||||||
DECLARE_DYNAMIC_CLASS(wxMediaCtrl);
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
//
|
|
||||||
// wxMediaBackend
|
|
||||||
//
|
|
||||||
// Currently an internal class - API stability not gauranteed.
|
|
||||||
//
|
|
||||||
// ----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class wxMediaBackend : public wxObject
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
wxMediaBackend()
|
|
||||||
{ }
|
|
||||||
|
|
||||||
virtual ~wxMediaBackend();
|
|
||||||
|
|
||||||
virtual bool CreateControl(wxControl* WXUNUSED(ctrl),
|
|
||||||
wxWindow* WXUNUSED(parent),
|
|
||||||
wxWindowID WXUNUSED(id),
|
|
||||||
const wxPoint& WXUNUSED(pos),
|
|
||||||
const wxSize& WXUNUSED(size),
|
|
||||||
long WXUNUSED(style),
|
|
||||||
const wxValidator& WXUNUSED(validator),
|
|
||||||
const wxString& WXUNUSED(name))
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
virtual bool Play()
|
|
||||||
{ return false; }
|
|
||||||
virtual bool Pause()
|
|
||||||
{ return false; }
|
|
||||||
virtual bool Stop()
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
virtual bool Load(const wxString& WXUNUSED(fileName))
|
|
||||||
{ return false; }
|
|
||||||
virtual bool Load(const wxURI& WXUNUSED(location))
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
virtual bool SetPosition(wxLongLong WXUNUSED(where))
|
|
||||||
{ return 0; }
|
|
||||||
virtual wxLongLong GetPosition()
|
|
||||||
{ return 0; }
|
|
||||||
virtual wxLongLong GetDuration()
|
|
||||||
{ return 0; }
|
|
||||||
|
|
||||||
virtual void Move(int WXUNUSED(x), int WXUNUSED(y),
|
|
||||||
int WXUNUSED(w), int WXUNUSED(h))
|
|
||||||
{ }
|
|
||||||
virtual wxSize GetVideoSize() const
|
|
||||||
{ return wxSize(0,0); }
|
|
||||||
|
|
||||||
virtual double GetPlaybackRate()
|
|
||||||
{ return 0.0; }
|
|
||||||
virtual bool SetPlaybackRate(double WXUNUSED(dRate))
|
|
||||||
{ return false; }
|
|
||||||
|
|
||||||
virtual wxMediaState GetState()
|
|
||||||
{ return wxMEDIASTATE_STOPPED; }
|
|
||||||
|
|
||||||
DECLARE_CLASS(wxMediaBackend)
|
|
||||||
};
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
// wxMediaEvent
|
// wxMediaEvent
|
||||||
@@ -257,7 +97,7 @@ public:
|
|||||||
// Allocates a copy of this object.
|
// Allocates a copy of this object.
|
||||||
// Required for wxEvtHandler::AddPendingEvent
|
// Required for wxEvtHandler::AddPendingEvent
|
||||||
// ------------------------------------------------------------------------
|
// ------------------------------------------------------------------------
|
||||||
virtual wxEvent *Clone() const
|
virtual wxEvent *Clone() const
|
||||||
{ return new wxMediaEvent(*this); }
|
{ return new wxMediaEvent(*this); }
|
||||||
|
|
||||||
|
|
||||||
@@ -265,6 +105,166 @@ public:
|
|||||||
DECLARE_DYNAMIC_CLASS(wxMediaEvent)
|
DECLARE_DYNAMIC_CLASS(wxMediaEvent)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// wxMediaCtrl
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxMediaCtrl : public wxControl
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxMediaCtrl() : m_imp(NULL), m_bLoaded(false), m_bLoop(false)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
wxMediaCtrl(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& fileName = wxT(""),
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& szBackend = wxT(""),
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxT("mediaCtrl"))
|
||||||
|
: m_imp(NULL), m_bLoaded(false), m_bLoop(false)
|
||||||
|
{ Create(parent, id, fileName, pos, size, style,
|
||||||
|
szBackend, validator, name); }
|
||||||
|
|
||||||
|
wxMediaCtrl(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxURI& location,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& szBackend = wxT(""),
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxT("mediaCtrl"))
|
||||||
|
: m_imp(NULL), m_bLoop(false)
|
||||||
|
{ Create(parent, id, location, pos, size, style,
|
||||||
|
szBackend, validator, name); }
|
||||||
|
|
||||||
|
~wxMediaCtrl();
|
||||||
|
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxString& fileName = wxT(""),
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& szBackend = wxT(""),
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxT("mediaCtrl"));
|
||||||
|
|
||||||
|
bool Create(wxWindow* parent, wxWindowID id,
|
||||||
|
const wxURI& location,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxString& szBackend = wxT(""),
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxT("mediaCtrl"));
|
||||||
|
|
||||||
|
bool DoCreate(wxClassInfo* instance,
|
||||||
|
wxWindow* parent, wxWindowID id,
|
||||||
|
const wxPoint& pos = wxDefaultPosition,
|
||||||
|
const wxSize& size = wxDefaultSize,
|
||||||
|
long style = 0,
|
||||||
|
const wxValidator& validator = wxDefaultValidator,
|
||||||
|
const wxString& name = wxT("mediaCtrl"));
|
||||||
|
|
||||||
|
static wxClassInfo* NextBackend();
|
||||||
|
|
||||||
|
|
||||||
|
bool Play();
|
||||||
|
bool Pause();
|
||||||
|
bool Stop();
|
||||||
|
|
||||||
|
bool Load(const wxString& fileName);
|
||||||
|
bool Load(const wxURI& location);
|
||||||
|
|
||||||
|
void Loop(bool bLoop = true);
|
||||||
|
bool IsLooped();
|
||||||
|
|
||||||
|
wxMediaState GetState();
|
||||||
|
|
||||||
|
double GetPlaybackRate();
|
||||||
|
bool SetPlaybackRate(double dRate);
|
||||||
|
|
||||||
|
bool SetPosition(wxLongLong where);
|
||||||
|
wxLongLong GetPosition();
|
||||||
|
wxLongLong GetDuration();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void OnMediaFinished(wxMediaEvent& evt);
|
||||||
|
virtual void DoMoveWindow(int x, int y, int w, int h);
|
||||||
|
wxSize DoGetBestSize() const;
|
||||||
|
|
||||||
|
class wxMediaBackend* m_imp;
|
||||||
|
bool m_bLoaded;
|
||||||
|
bool m_bLoop;
|
||||||
|
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxMediaCtrl);
|
||||||
|
};
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
//
|
||||||
|
// wxMediaBackend
|
||||||
|
//
|
||||||
|
// Currently an internal class - API stability not gauranteed.
|
||||||
|
//
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxMediaBackend : public wxObject
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
wxMediaBackend()
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual ~wxMediaBackend();
|
||||||
|
|
||||||
|
virtual bool CreateControl(wxControl* WXUNUSED(ctrl),
|
||||||
|
wxWindow* WXUNUSED(parent),
|
||||||
|
wxWindowID WXUNUSED(id),
|
||||||
|
const wxPoint& WXUNUSED(pos),
|
||||||
|
const wxSize& WXUNUSED(size),
|
||||||
|
long WXUNUSED(style),
|
||||||
|
const wxValidator& WXUNUSED(validator),
|
||||||
|
const wxString& WXUNUSED(name))
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
virtual bool Play()
|
||||||
|
{ return false; }
|
||||||
|
virtual bool Pause()
|
||||||
|
{ return false; }
|
||||||
|
virtual bool Stop()
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
virtual bool Load(const wxString& WXUNUSED(fileName))
|
||||||
|
{ return false; }
|
||||||
|
virtual bool Load(const wxURI& WXUNUSED(location))
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
virtual bool SetPosition(wxLongLong WXUNUSED(where))
|
||||||
|
{ return 0; }
|
||||||
|
virtual wxLongLong GetPosition()
|
||||||
|
{ return 0; }
|
||||||
|
virtual wxLongLong GetDuration()
|
||||||
|
{ return 0; }
|
||||||
|
|
||||||
|
virtual void Move(int WXUNUSED(x), int WXUNUSED(y),
|
||||||
|
int WXUNUSED(w), int WXUNUSED(h))
|
||||||
|
{ }
|
||||||
|
virtual wxSize GetVideoSize() const
|
||||||
|
{ return wxSize(0,0); }
|
||||||
|
|
||||||
|
virtual double GetPlaybackRate()
|
||||||
|
{ return 0.0; }
|
||||||
|
virtual bool SetPlaybackRate(double WXUNUSED(dRate))
|
||||||
|
{ return false; }
|
||||||
|
|
||||||
|
virtual wxMediaState GetState()
|
||||||
|
{ return wxMEDIASTATE_STOPPED; }
|
||||||
|
|
||||||
|
DECLARE_CLASS(wxMediaBackend)
|
||||||
|
};
|
||||||
|
|
||||||
//Event ID to give to our events
|
//Event ID to give to our events
|
||||||
#define wxMEDIA_FINISHED_ID 13000
|
#define wxMEDIA_FINISHED_ID 13000
|
||||||
#define wxMEDIA_STOP_ID 13001
|
#define wxMEDIA_STOP_ID 13001
|
||||||
|
@@ -12,7 +12,7 @@
|
|||||||
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
// %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
||||||
// MediaPlayer
|
// MediaPlayer
|
||||||
//
|
//
|
||||||
// This is a simple example of how to use all the funtionality of
|
// This is a simple example of how to use all the funtionality of
|
||||||
// the wxMediaCtrl class in wxWidgets.
|
// the wxMediaCtrl class in wxWidgets.
|
||||||
//
|
//
|
||||||
// To use this sample, simply select Open File from the file menu,
|
// To use this sample, simply select Open File from the file menu,
|
||||||
@@ -53,7 +53,7 @@
|
|||||||
#include "wx/textdlg.h" //for getting user text from OpenURL
|
#include "wx/textdlg.h" //for getting user text from OpenURL
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// Bail out if the user doesn't want one of the
|
// Bail out if the user doesn't want one of the
|
||||||
// things we need
|
// things we need
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -207,7 +207,7 @@ const wxChar* wxGetMediaStateText(int nState)
|
|||||||
// the wxApp exists, and thus will crash the application if you try it.
|
// the wxApp exists, and thus will crash the application if you try it.
|
||||||
//
|
//
|
||||||
// IMPLEMENT_APP does this, and also implements the platform-specific entry
|
// IMPLEMENT_APP does this, and also implements the platform-specific entry
|
||||||
// routine, such as main or WinMain(). Use IMPLEMENT_APP_NO_MAIN if you do
|
// routine, such as main or WinMain(). Use IMPLEMENT_APP_NO_MAIN if you do
|
||||||
// not desire this behavior.
|
// not desire this behavior.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
IMPLEMENT_APP(MyApp)
|
IMPLEMENT_APP(MyApp)
|
||||||
@@ -253,8 +253,8 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
wxMenu *menuFile = new wxMenu;
|
wxMenu *menuFile = new wxMenu;
|
||||||
|
|
||||||
wxMenu *helpMenu = new wxMenu;
|
wxMenu *helpMenu = new wxMenu;
|
||||||
helpMenu->Append(wxID_ABOUT,
|
helpMenu->Append(wxID_ABOUT,
|
||||||
_T("&About...\tF1"),
|
_T("&About...\tF1"),
|
||||||
_T("Show about dialog"));
|
_T("Show about dialog"));
|
||||||
|
|
||||||
menuFile->Append(wxID_OPENFILE, _T("&Open File"), _T("Open a File"));
|
menuFile->Append(wxID_OPENFILE, _T("&Open File"), _T("Open a File"));
|
||||||
@@ -263,12 +263,12 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
menuFile->Append(wxID_PAUSE, _T("P&ause"), _T("Pause playback"));
|
menuFile->Append(wxID_PAUSE, _T("P&ause"), _T("Pause playback"));
|
||||||
menuFile->Append(wxID_STOP, _T("&Stop"), _T("Stop playback"));
|
menuFile->Append(wxID_STOP, _T("&Stop"), _T("Stop playback"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->AppendCheckItem(wxID_LOOP,
|
menuFile->AppendCheckItem(wxID_LOOP,
|
||||||
_T("&Loop"),
|
_T("&Loop"),
|
||||||
_T("Loop Selected Media"));
|
_T("Loop Selected Media"));
|
||||||
menuFile->AppendSeparator();
|
menuFile->AppendSeparator();
|
||||||
menuFile->Append(wxID_EXIT,
|
menuFile->Append(wxID_EXIT,
|
||||||
_T("E&xit\tAlt-X"),
|
_T("E&xit\tAlt-X"),
|
||||||
_T("Quit this program"));
|
_T("Quit this program"));
|
||||||
|
|
||||||
wxMenuBar *menuBar = new wxMenuBar();
|
wxMenuBar *menuBar = new wxMenuBar();
|
||||||
@@ -322,10 +322,10 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
ResetStatus();
|
ResetStatus();
|
||||||
SetStatusText(m_basestatus);
|
SetStatusText(m_basestatus);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
|
|
||||||
//
|
//
|
||||||
// Connect events.
|
// Connect events.
|
||||||
//
|
//
|
||||||
// There are two ways in wxWidgets to use events -
|
// There are two ways in wxWidgets to use events -
|
||||||
// Message Maps and Connections.
|
// Message Maps and Connections.
|
||||||
//
|
//
|
||||||
@@ -339,7 +339,7 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
// END_EVENT_TABLE()
|
// END_EVENT_TABLE()
|
||||||
//
|
//
|
||||||
// Where MyFrame is the class with the DECLARE_MESSAGE_MAP
|
// Where MyFrame is the class with the DECLARE_MESSAGE_MAP
|
||||||
// in it. EVT_XXX(XXX) are each of your handlers, such
|
// in it. EVT_XXX(XXX) are each of your handlers, such
|
||||||
// as EVT_MENU for menu events and the XXX inside
|
// as EVT_MENU for menu events and the XXX inside
|
||||||
// is the parameters to the event macro - in the case
|
// is the parameters to the event macro - in the case
|
||||||
// of EVT_MENU the menu id and then the function to call.
|
// of EVT_MENU the menu id and then the function to call.
|
||||||
@@ -366,19 +366,19 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
//
|
//
|
||||||
// The third is the function handler for the event -
|
// The third is the function handler for the event -
|
||||||
// You need to cast it to the specific event handler
|
// You need to cast it to the specific event handler
|
||||||
// type, then to a wxEventFunction, then to a
|
// type, then to a wxEventFunction, then to a
|
||||||
// wxObjectEventFunction - I.E.
|
// wxObjectEventFunction - I.E.
|
||||||
// (wxObjectEventFunction)(wxEventFunction)
|
// (wxObjectEventFunction)(wxEventFunction)
|
||||||
// (wxCommandEventFunction) &MyFrame::MyHandler
|
// (wxCommandEventFunction) &MyFrame::MyHandler
|
||||||
//
|
//
|
||||||
// The fourth is an optional userdata param -
|
// The fourth is an optional userdata param -
|
||||||
// this is of historical relevance only and is
|
// this is of historical relevance only and is
|
||||||
// there only for backwards compatability.
|
// there only for backwards compatability.
|
||||||
//
|
//
|
||||||
// The fifth is the context in which to call the
|
// The fifth is the context in which to call the
|
||||||
// handler - by default (this param is optional)
|
// handler - by default (this param is optional)
|
||||||
// this. For example in your event handler
|
// this. For example in your event handler
|
||||||
// if you were to call "this->MyFunc()"
|
// if you were to call "this->MyFunc()"
|
||||||
// it would literally do this->MyFunc. However,
|
// it would literally do this->MyFunc. However,
|
||||||
// if you were to pass myHandler as the fifth
|
// if you were to pass myHandler as the fifth
|
||||||
// parameter, for instance, you would _really_
|
// parameter, for instance, you would _really_
|
||||||
@@ -389,48 +389,48 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
//
|
//
|
||||||
// Menu events
|
// Menu events
|
||||||
//
|
//
|
||||||
this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_EXIT, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnQuit);
|
(wxCommandEventFunction) &MyFrame::OnQuit);
|
||||||
|
|
||||||
this->Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_ABOUT, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnAbout);
|
(wxCommandEventFunction) &MyFrame::OnAbout);
|
||||||
|
|
||||||
this->Connect(wxID_LOOP, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_LOOP, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnLoop);
|
(wxCommandEventFunction) &MyFrame::OnLoop);
|
||||||
|
|
||||||
this->Connect(wxID_OPENFILE, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_OPENFILE, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnOpenFile);
|
(wxCommandEventFunction) &MyFrame::OnOpenFile);
|
||||||
|
|
||||||
this->Connect(wxID_PLAY, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_PLAY, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnPlay);
|
(wxCommandEventFunction) &MyFrame::OnPlay);
|
||||||
|
|
||||||
this->Connect(wxID_PAUSE, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_PAUSE, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnPause);
|
(wxCommandEventFunction) &MyFrame::OnPause);
|
||||||
|
|
||||||
this->Connect(wxID_STOP, wxEVT_COMMAND_MENU_SELECTED,
|
this->Connect(wxID_STOP, wxEVT_COMMAND_MENU_SELECTED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnStop);
|
(wxCommandEventFunction) &MyFrame::OnStop);
|
||||||
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Slider events
|
// Slider events
|
||||||
//
|
//
|
||||||
this->Connect(wxID_SLIDER, wxEVT_COMMAND_SLIDER_UPDATED,
|
this->Connect(wxID_SLIDER, wxEVT_COMMAND_SLIDER_UPDATED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnSeek);
|
(wxCommandEventFunction) &MyFrame::OnSeek);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Media Control events
|
// Media Control events
|
||||||
//
|
//
|
||||||
this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_STOP,
|
this->Connect(wxID_MEDIACTRL, wxEVT_MEDIA_STOP,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxCommandEventFunction) &MyFrame::OnMediaStop);
|
(wxMediaEventFunction) &MyFrame::OnMediaStop);
|
||||||
|
|
||||||
//
|
//
|
||||||
// End of Events
|
// End of Events
|
||||||
@@ -451,7 +451,7 @@ MyFrame::MyFrame(const wxString& title)
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame Destructor
|
// MyFrame Destructor
|
||||||
//
|
//
|
||||||
// 1) Deletes child objects implicitly
|
// 1) Deletes child objects implicitly
|
||||||
// 2) Delete our timer explicitly
|
// 2) Delete our timer explicitly
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
MyFrame::~MyFrame()
|
MyFrame::~MyFrame()
|
||||||
@@ -462,16 +462,16 @@ MyFrame::~MyFrame()
|
|||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::ResetStatus
|
// MyFrame::ResetStatus
|
||||||
//
|
//
|
||||||
// Here we just make a simple status string with some useful info about
|
// Here we just make a simple status string with some useful info about
|
||||||
// the media that we won't change later - such as the length of the media.
|
// the media that we won't change later - such as the length of the media.
|
||||||
//
|
//
|
||||||
// We then append some other info that changes in MyTimer::Notify, then
|
// We then append some other info that changes in MyTimer::Notify, then
|
||||||
// set the status bar to this text.
|
// set the status bar to this text.
|
||||||
//
|
//
|
||||||
// In real applications, you'd want to find a better way to do this,
|
// In real applications, you'd want to find a better way to do this,
|
||||||
// such as static text controls (wxStaticText).
|
// such as static text controls (wxStaticText).
|
||||||
//
|
//
|
||||||
// We display info here in seconds (wxMediaCtrl uses milliseconds - that's why
|
// We display info here in seconds (wxMediaCtrl uses milliseconds - that's why
|
||||||
// we divide by 1000).
|
// we divide by 1000).
|
||||||
//
|
//
|
||||||
// We also reset our loop counter here.
|
// We also reset our loop counter here.
|
||||||
@@ -505,7 +505,7 @@ void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnAbout
|
// MyFrame::OnAbout
|
||||||
//
|
//
|
||||||
// Called from help->about.
|
// Called from help->about.
|
||||||
// Gets some info about this application.
|
// Gets some info about this application.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -553,7 +553,7 @@ void MyFrame::OnOpenFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnPlay
|
// MyFrame::OnPlay
|
||||||
//
|
//
|
||||||
// Called from file->play.
|
// Called from file->play.
|
||||||
// Resumes the media if it is paused or stopped.
|
// Resumes the media if it is paused or stopped.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -565,7 +565,7 @@ void MyFrame::OnPlay(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnPause
|
// MyFrame::OnPause
|
||||||
//
|
//
|
||||||
// Called from file->pause.
|
// Called from file->pause.
|
||||||
// Pauses the media in-place.
|
// Pauses the media in-place.
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -577,7 +577,7 @@ void MyFrame::OnPause(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnStop
|
// MyFrame::OnStop
|
||||||
//
|
//
|
||||||
// Called from file->stop.
|
// Called from file->stop.
|
||||||
// Where it stops depends on whether you can seek in the
|
// Where it stops depends on whether you can seek in the
|
||||||
// media control or not - if you can it stops and seeks to the beginning,
|
// media control or not - if you can it stops and seeks to the beginning,
|
||||||
@@ -592,7 +592,7 @@ void MyFrame::OnStop(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnSeek
|
// MyFrame::OnSeek
|
||||||
//
|
//
|
||||||
// Called from file->seek.
|
// Called from file->seek.
|
||||||
// Called when the user moves the slider -
|
// Called when the user moves the slider -
|
||||||
// seeks to a position within the media
|
// seeks to a position within the media
|
||||||
@@ -605,7 +605,7 @@ void MyFrame::OnSeek(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// MyFrame::OnMediaStop
|
// MyFrame::OnMediaStop
|
||||||
//
|
//
|
||||||
// Called when the media is about to stop playing.
|
// Called when the media is about to stop playing.
|
||||||
// Here we just increase our loop counter
|
// Here we just increase our loop counter
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -625,7 +625,7 @@ void MyFrame::OnMediaStop(wxMediaEvent& WXUNUSED(event))
|
|||||||
//
|
//
|
||||||
// 1) Update our slider with the position were are in in the media
|
// 1) Update our slider with the position were are in in the media
|
||||||
// 2) Update our status bar with the base text from MyFrame::ResetStatus,
|
// 2) Update our status bar with the base text from MyFrame::ResetStatus,
|
||||||
// append some non-static (changing) info to it, then set the
|
// append some non-static (changing) info to it, then set the
|
||||||
// status bar text to that result
|
// status bar text to that result
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
void MyTimer::Notify()
|
void MyTimer::Notify()
|
||||||
|
@@ -41,7 +41,7 @@
|
|||||||
//===========================================================================
|
//===========================================================================
|
||||||
//
|
//
|
||||||
// Implementation
|
// Implementation
|
||||||
//
|
//
|
||||||
//===========================================================================
|
//===========================================================================
|
||||||
|
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -67,7 +67,7 @@ DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP);
|
|||||||
// Searches for a backend that is installed on the system (backends
|
// Searches for a backend that is installed on the system (backends
|
||||||
// starting with lower characters in the alphabet are given priority),
|
// starting with lower characters in the alphabet are given priority),
|
||||||
// and creates the control from it
|
// and creates the control from it
|
||||||
//
|
//
|
||||||
// This searches by searching the global RTTI hashtable, class by class,
|
// This searches by searching the global RTTI hashtable, class by class,
|
||||||
// attempting to call CreateControl on each one found that is a derivative
|
// attempting to call CreateControl on each one found that is a derivative
|
||||||
// of wxMediaBackend - if it succeededs Create returns true, otherwise
|
// of wxMediaBackend - if it succeededs Create returns true, otherwise
|
||||||
@@ -75,9 +75,9 @@ DEFINE_EVENT_TYPE(wxEVT_MEDIA_STOP);
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
||||||
const wxString& fileName,
|
const wxString& fileName,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& szBackend,
|
const wxString& szBackend,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
@@ -113,7 +113,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
if(!DoCreate(classInfo, parent, id,
|
if(!DoCreate(classInfo, parent, id,
|
||||||
pos, size, style, validator, name))
|
pos, size, style, validator, name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!fileName.empty())
|
if (!fileName.empty())
|
||||||
{
|
{
|
||||||
@@ -135,9 +135,9 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
|||||||
|
|
||||||
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
||||||
const wxURI& location,
|
const wxURI& location,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxString& szBackend,
|
const wxString& szBackend,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
@@ -170,7 +170,7 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
|||||||
{
|
{
|
||||||
if(!DoCreate(classInfo, parent, id,
|
if(!DoCreate(classInfo, parent, id,
|
||||||
pos, size, style, validator, name))
|
pos, size, style, validator, name))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (m_imp->Load(location))
|
if (m_imp->Load(location))
|
||||||
return true;
|
return true;
|
||||||
@@ -192,24 +192,24 @@ bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id,
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMediaCtrl::DoCreate(wxClassInfo* classInfo,
|
bool wxMediaCtrl::DoCreate(wxClassInfo* classInfo,
|
||||||
wxWindow* parent, wxWindowID id,
|
wxWindow* parent, wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
m_imp = (wxMediaBackend*)classInfo->CreateObject();
|
m_imp = (wxMediaBackend*)classInfo->CreateObject();
|
||||||
|
|
||||||
if( m_imp->CreateControl(this, parent, id, pos, size,
|
if( m_imp->CreateControl(this, parent, id, pos, size,
|
||||||
style, validator, name) )
|
style, validator, name) )
|
||||||
{
|
{
|
||||||
this->Connect(GetId(), wxEVT_MEDIA_FINISHED,
|
this->Connect(GetId(), wxEVT_MEDIA_FINISHED,
|
||||||
(wxObjectEventFunction) (wxEventFunction)
|
(wxObjectEventFunction) (wxEventFunction)
|
||||||
(wxMediaEventFunction)
|
(wxMediaEventFunction)
|
||||||
&wxMediaCtrl::OnMediaFinished);
|
&wxMediaCtrl::OnMediaFinished);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
delete m_imp;
|
delete m_imp;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -221,7 +221,7 @@ bool wxMediaCtrl::DoCreate(wxClassInfo* classInfo,
|
|||||||
// Search through the RTTI hashmap one at a
|
// Search through the RTTI hashmap one at a
|
||||||
// time, attempting to create each derivative
|
// time, attempting to create each derivative
|
||||||
// of wxMediaBackend
|
// of wxMediaBackend
|
||||||
//
|
//
|
||||||
//
|
//
|
||||||
// STL isn't compatable with and will have a compilation error
|
// STL isn't compatable with and will have a compilation error
|
||||||
// on a wxNode, however, wxHashTable::compatibility_iterator is
|
// on a wxNode, however, wxHashTable::compatibility_iterator is
|
||||||
@@ -295,7 +295,7 @@ bool wxMediaCtrl::Load(const wxURI& location)
|
|||||||
// wxMediaCtrl::GetDuration
|
// wxMediaCtrl::GetDuration
|
||||||
// wxMediaCtrl::GetState
|
// wxMediaCtrl::GetState
|
||||||
// wxMediaCtrl::DoGetBestSize
|
// wxMediaCtrl::DoGetBestSize
|
||||||
//
|
//
|
||||||
// 1) Check to see whether the backend exists and is loading
|
// 1) Check to see whether the backend exists and is loading
|
||||||
// 2) Call the backend's version of the method, returning success
|
// 2) Call the backend's version of the method, returning success
|
||||||
// if the backend's version succeeds
|
// if the backend's version succeeds
|
||||||
@@ -372,7 +372,7 @@ wxSize wxMediaCtrl::DoGetBestSize() const
|
|||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxMediaCtrl::DoMoveWindow
|
// wxMediaCtrl::DoMoveWindow
|
||||||
//
|
//
|
||||||
// 1) Call parent's version so that our control's window moves where
|
// 1) Call parent's version so that our control's window moves where
|
||||||
// it's supposed to
|
// it's supposed to
|
||||||
// 2) If the backend exists and is loaded, move the video
|
// 2) If the backend exists and is loaded, move the video
|
||||||
@@ -396,7 +396,7 @@ bool wxMediaCtrl::IsLooped()
|
|||||||
return m_bLoop;
|
return m_bLoop;
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxMediaCtrl::OnMediaFinished(const wxMediaEvent& WXUNUSED(evt))
|
void wxMediaCtrl::OnMediaFinished(wxMediaEvent& WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
if(m_bLoop)
|
if(m_bLoop)
|
||||||
{
|
{
|
||||||
|
@@ -75,11 +75,11 @@ public:
|
|||||||
|
|
||||||
virtual ~wxAMMediaBackend();
|
virtual ~wxAMMediaBackend();
|
||||||
|
|
||||||
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name);
|
const wxString& name);
|
||||||
|
|
||||||
@@ -106,15 +106,15 @@ public:
|
|||||||
|
|
||||||
bool m_bVideo;
|
bool m_bVideo;
|
||||||
|
|
||||||
static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg,
|
static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
wxControl* m_ctrl;
|
wxControl* m_ctrl;
|
||||||
|
|
||||||
IGraphBuilder* m_pGB;
|
IGraphBuilder* m_pGB;
|
||||||
IMediaControl* m_pMC;
|
IMediaControl* m_pMC;
|
||||||
IMediaEventEx* m_pME;
|
IMediaEventEx* m_pME;
|
||||||
IVideoWindow* m_pVW;
|
IVideoWindow* m_pVW;
|
||||||
@@ -148,11 +148,11 @@ public:
|
|||||||
wxMCIMediaBackend();
|
wxMCIMediaBackend();
|
||||||
~wxMCIMediaBackend();
|
~wxMCIMediaBackend();
|
||||||
|
|
||||||
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name);
|
const wxString& name);
|
||||||
|
|
||||||
@@ -175,10 +175,10 @@ public:
|
|||||||
virtual double GetPlaybackRate();
|
virtual double GetPlaybackRate();
|
||||||
virtual bool SetPlaybackRate(double dRate);
|
virtual bool SetPlaybackRate(double dRate);
|
||||||
|
|
||||||
static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg,
|
static LRESULT CALLBACK NotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam, LPARAM lParam);
|
WPARAM wParam, LPARAM lParam);
|
||||||
|
|
||||||
MCIDEVICEID m_hDev; //Our MCI Device ID/Handler
|
MCIDEVICEID m_hDev; //Our MCI Device ID/Handler
|
||||||
@@ -213,11 +213,11 @@ public:
|
|||||||
wxQTMediaBackend();
|
wxQTMediaBackend();
|
||||||
~wxQTMediaBackend();
|
~wxQTMediaBackend();
|
||||||
|
|
||||||
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
virtual bool CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name);
|
const wxString& name);
|
||||||
|
|
||||||
@@ -316,7 +316,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxAMMediaBackend, wxMediaBackend);
|
|||||||
// wxAMMediaBackend Constructor
|
// wxAMMediaBackend Constructor
|
||||||
//
|
//
|
||||||
// Sets m_hNotifyWnd to NULL to signify that we haven't loaded anything yet
|
// Sets m_hNotifyWnd to NULL to signify that we haven't loaded anything yet
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxAMMediaBackend::wxAMMediaBackend() : m_hNotifyWnd(NULL)
|
wxAMMediaBackend::wxAMMediaBackend() : m_hNotifyWnd(NULL)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
@@ -324,8 +324,8 @@ wxAMMediaBackend::wxAMMediaBackend() : m_hNotifyWnd(NULL)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxAMMediaBackend Destructor
|
// wxAMMediaBackend Destructor
|
||||||
//
|
//
|
||||||
// Cleans up everything
|
// Cleans up everything
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxAMMediaBackend::~wxAMMediaBackend()
|
wxAMMediaBackend::~wxAMMediaBackend()
|
||||||
{
|
{
|
||||||
if (m_hNotifyWnd)
|
if (m_hNotifyWnd)
|
||||||
@@ -339,15 +339,15 @@ wxAMMediaBackend::~wxAMMediaBackend()
|
|||||||
// so we just create a normal control with a black background.
|
// so we just create a normal control with a black background.
|
||||||
//
|
//
|
||||||
// We also check to see if ActiveMovie is installed
|
// We also check to see if ActiveMovie is installed
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
//create our filter graph
|
//create our filter graph
|
||||||
HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
|
HRESULT hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_IGraphBuilder, (void**)&m_pGB);
|
IID_IGraphBuilder, (void**)&m_pGB);
|
||||||
@@ -376,7 +376,7 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
//Set our background color to black by default
|
//Set our background color to black by default
|
||||||
//
|
//
|
||||||
ctrl->SetBackgroundColour(*wxBLACK);
|
ctrl->SetBackgroundColour(*wxBLACK);
|
||||||
|
|
||||||
m_ctrl = ctrl;
|
m_ctrl = ctrl;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -386,7 +386,7 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
// wxAMMediaBackend::Load (file version)
|
// wxAMMediaBackend::Load (file version)
|
||||||
//
|
//
|
||||||
// Creates an Active Movie filter graph from a file or url
|
// Creates an Active Movie filter graph from a file or url
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Load(const wxString& fileName)
|
bool wxAMMediaBackend::Load(const wxString& fileName)
|
||||||
{
|
{
|
||||||
if(m_hNotifyWnd)
|
if(m_hNotifyWnd)
|
||||||
@@ -407,7 +407,7 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
wxAMVERIFY( m_pGB->QueryInterface(IID_IBasicAudio, (void**)&m_pBA) );
|
wxAMVERIFY( m_pGB->QueryInterface(IID_IBasicAudio, (void**)&m_pBA) );
|
||||||
wxAMVERIFY( m_pGB->QueryInterface(IID_IBasicVideo, (void**)&m_pBV) );
|
wxAMVERIFY( m_pGB->QueryInterface(IID_IBasicVideo, (void**)&m_pBV) );
|
||||||
|
|
||||||
//We could tell if the media has audio or not by
|
//We could tell if the media has audio or not by
|
||||||
//something like
|
//something like
|
||||||
//-----
|
//-----
|
||||||
//long lVolume;
|
//long lVolume;
|
||||||
@@ -418,12 +418,12 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
//
|
//
|
||||||
//Obtain the _actual_ size of the movie & remember it
|
//Obtain the _actual_ size of the movie & remember it
|
||||||
//
|
//
|
||||||
long nX,
|
long nX,
|
||||||
nY;
|
nY;
|
||||||
|
|
||||||
m_bestSize.x = m_bestSize.y = 0;
|
m_bestSize.x = m_bestSize.y = 0;
|
||||||
|
|
||||||
m_bVideo = SUCCEEDED( m_pVW->GetWindowPosition( &nX,
|
m_bVideo = SUCCEEDED( m_pVW->GetWindowPosition( &nX,
|
||||||
&nY,
|
&nY,
|
||||||
(long*)&m_bestSize.x,
|
(long*)&m_bestSize.x,
|
||||||
(long*)&m_bestSize.y) );
|
(long*)&m_bestSize.y) );
|
||||||
@@ -443,9 +443,9 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
//
|
//
|
||||||
// Create a hidden window and register to handle
|
// Create a hidden window and register to handle
|
||||||
// directshow events for this graph
|
// directshow events for this graph
|
||||||
// Note that wxCanvasClassName is already registered
|
// Note that wxCanvasClassName is already registered
|
||||||
// and used by all wxWindows and normal wxControls
|
// and used by all wxWindows and normal wxControls
|
||||||
//
|
//
|
||||||
m_hNotifyWnd = ::CreateWindow
|
m_hNotifyWnd = ::CreateWindow
|
||||||
(
|
(
|
||||||
wxCanvasClassName,
|
wxCanvasClassName,
|
||||||
@@ -465,14 +465,14 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
::SetWindowLongPtr(m_hNotifyWnd, GWLP_WNDPROC,
|
::SetWindowLongPtr(m_hNotifyWnd, GWLP_WNDPROC,
|
||||||
(LONG_PTR)wxAMMediaBackend::NotifyWndProc);
|
(LONG_PTR)wxAMMediaBackend::NotifyWndProc);
|
||||||
|
|
||||||
::SetWindowLong(m_hNotifyWnd, GWL_USERDATA,
|
::SetWindowLong(m_hNotifyWnd, GWL_USERDATA,
|
||||||
(LONG) this);
|
(LONG) this);
|
||||||
|
|
||||||
wxAMVERIFY( m_pME->SetNotifyWindow((OAHWND)m_hNotifyWnd,
|
wxAMVERIFY( m_pME->SetNotifyWindow((OAHWND)m_hNotifyWnd,
|
||||||
WM_GRAPHNOTIFY, 0) );
|
WM_GRAPHNOTIFY, 0) );
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -499,7 +499,7 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
// Loads media from a URL. Interestingly enough DirectShow
|
// Loads media from a URL. Interestingly enough DirectShow
|
||||||
// appears (?) to escape the URL for us, at least on normal
|
// appears (?) to escape the URL for us, at least on normal
|
||||||
// files
|
// files
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Load(const wxURI& location)
|
bool wxAMMediaBackend::Load(const wxURI& location)
|
||||||
{
|
{
|
||||||
return Load(location.BuildUnescapedURI());
|
return Load(location.BuildUnescapedURI());
|
||||||
@@ -509,7 +509,7 @@ bool wxAMMediaBackend::Load(const wxURI& location)
|
|||||||
// wxAMMediaBackend::Play
|
// wxAMMediaBackend::Play
|
||||||
//
|
//
|
||||||
// Plays the stream. If it is non-seekable, it will restart it.
|
// Plays the stream. If it is non-seekable, it will restart it.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Play()
|
bool wxAMMediaBackend::Play()
|
||||||
{
|
{
|
||||||
return SUCCEEDED( m_pMC->Run() );
|
return SUCCEEDED( m_pMC->Run() );
|
||||||
@@ -519,7 +519,7 @@ bool wxAMMediaBackend::Play()
|
|||||||
// wxAMMediaBackend::Pause
|
// wxAMMediaBackend::Pause
|
||||||
//
|
//
|
||||||
// Pauses the stream.
|
// Pauses the stream.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Pause()
|
bool wxAMMediaBackend::Pause()
|
||||||
{
|
{
|
||||||
return SUCCEEDED( m_pMC->Pause() );
|
return SUCCEEDED( m_pMC->Pause() );
|
||||||
@@ -529,7 +529,7 @@ bool wxAMMediaBackend::Pause()
|
|||||||
// wxAMMediaBackend::Stop
|
// wxAMMediaBackend::Stop
|
||||||
//
|
//
|
||||||
// Stops the stream.
|
// Stops the stream.
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Stop()
|
bool wxAMMediaBackend::Stop()
|
||||||
{
|
{
|
||||||
bool bOK = SUCCEEDED( m_pMC->Stop() );
|
bool bOK = SUCCEEDED( m_pMC->Stop() );
|
||||||
@@ -544,12 +544,12 @@ bool wxAMMediaBackend::Stop()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxAMMediaBackend::SetPosition
|
// wxAMMediaBackend::SetPosition
|
||||||
//
|
//
|
||||||
// 1) Translates the current position's time to directshow time,
|
// 1) Translates the current position's time to directshow time,
|
||||||
// which is in a scale of 100 nanoseconds
|
// which is in a scale of 100 nanoseconds
|
||||||
// 2) Sets the play position of the IMediaSeeking interface -
|
// 2) Sets the play position of the IMediaSeeking interface -
|
||||||
// passing NULL as the stop position means to keep the old
|
// passing NULL as the stop position means to keep the old
|
||||||
// stop position
|
// stop position
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::SetPosition(wxLongLong where)
|
bool wxAMMediaBackend::SetPosition(wxLongLong where)
|
||||||
{
|
{
|
||||||
LONGLONG pos = ((LONGLONG)where.GetValue()) * 10000;
|
LONGLONG pos = ((LONGLONG)where.GetValue()) * 10000;
|
||||||
@@ -567,7 +567,7 @@ bool wxAMMediaBackend::SetPosition(wxLongLong where)
|
|||||||
//
|
//
|
||||||
// 1) Obtains the current play and stop positions from IMediaSeeking
|
// 1) Obtains the current play and stop positions from IMediaSeeking
|
||||||
// 2) Returns the play position translated to our time base
|
// 2) Returns the play position translated to our time base
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxLongLong wxAMMediaBackend::GetPosition()
|
wxLongLong wxAMMediaBackend::GetPosition()
|
||||||
{
|
{
|
||||||
LONGLONG outCur, outStop;
|
LONGLONG outCur, outStop;
|
||||||
@@ -582,7 +582,7 @@ wxLongLong wxAMMediaBackend::GetPosition()
|
|||||||
//
|
//
|
||||||
// 1) Obtains the duration of the media from the IMediaSeeking interface
|
// 1) Obtains the duration of the media from the IMediaSeeking interface
|
||||||
// 2) Converts that value to our time base, and returns it
|
// 2) Converts that value to our time base, and returns it
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxLongLong wxAMMediaBackend::GetDuration()
|
wxLongLong wxAMMediaBackend::GetDuration()
|
||||||
{
|
{
|
||||||
LONGLONG outDuration;
|
LONGLONG outDuration;
|
||||||
@@ -598,9 +598,9 @@ wxLongLong wxAMMediaBackend::GetDuration()
|
|||||||
// Obtains the state from the IMediaControl interface.
|
// Obtains the state from the IMediaControl interface.
|
||||||
// Note that it's enumeration values for stopping/playing
|
// Note that it's enumeration values for stopping/playing
|
||||||
// etc. are the same as ours, so we just do a straight cast.
|
// etc. are the same as ours, so we just do a straight cast.
|
||||||
// TODO: MS recommends against INFINITE here for
|
// TODO: MS recommends against INFINITE here for
|
||||||
// IMediaControl::GetState- do it in stages
|
// IMediaControl::GetState- do it in stages
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxMediaState wxAMMediaBackend::GetState()
|
wxMediaState wxAMMediaBackend::GetState()
|
||||||
{
|
{
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
@@ -622,7 +622,7 @@ wxMediaState wxAMMediaBackend::GetState()
|
|||||||
//
|
//
|
||||||
// Pretty simple way of obtaining the playback rate from
|
// Pretty simple way of obtaining the playback rate from
|
||||||
// the IMediaSeeking interface
|
// the IMediaSeeking interface
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
double wxAMMediaBackend::GetPlaybackRate()
|
double wxAMMediaBackend::GetPlaybackRate()
|
||||||
{
|
{
|
||||||
double dRate;
|
double dRate;
|
||||||
@@ -635,7 +635,7 @@ double wxAMMediaBackend::GetPlaybackRate()
|
|||||||
//
|
//
|
||||||
// Sets the playback rate of the media - DirectShow is pretty good
|
// Sets the playback rate of the media - DirectShow is pretty good
|
||||||
// about this, actually
|
// about this, actually
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::SetPlaybackRate(double dRate)
|
bool wxAMMediaBackend::SetPlaybackRate(double dRate)
|
||||||
{
|
{
|
||||||
return SUCCEEDED( m_pMS->SetRate(dRate) );
|
return SUCCEEDED( m_pMS->SetRate(dRate) );
|
||||||
@@ -644,12 +644,12 @@ bool wxAMMediaBackend::SetPlaybackRate(double dRate)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxAMMediaBackend::NotifyWndProc
|
// wxAMMediaBackend::NotifyWndProc
|
||||||
//
|
//
|
||||||
// Here we check to see if DirectShow tells us we've reached the stop
|
// Here we check to see if DirectShow tells us we've reached the stop
|
||||||
// position in our stream - if it has, it may not actually stop
|
// position in our stream - if it has, it may not actually stop
|
||||||
// the stream - which we need to do...
|
// the stream - which we need to do...
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
LRESULT CALLBACK wxAMMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK wxAMMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
wxAMMediaBackend* backend = (wxAMMediaBackend*)
|
wxAMMediaBackend* backend = (wxAMMediaBackend*)
|
||||||
@@ -658,14 +658,14 @@ LRESULT CALLBACK wxAMMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam);
|
return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK wxAMMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK wxAMMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
if (nMsg == WM_GRAPHNOTIFY)
|
if (nMsg == WM_GRAPHNOTIFY)
|
||||||
{
|
{
|
||||||
LONG evCode,
|
LONG evCode,
|
||||||
evParam1,
|
evParam1,
|
||||||
evParam2;
|
evParam2;
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -694,9 +694,9 @@ LRESULT CALLBACK wxAMMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
//Interestingly enough, DirectShow does not actually stop
|
//Interestingly enough, DirectShow does not actually stop
|
||||||
//the filters - even when it reaches the end!
|
//the filters - even when it reaches the end!
|
||||||
wxVERIFY( Stop() );
|
wxVERIFY( Stop() );
|
||||||
|
|
||||||
//send the event to our child
|
//send the event to our child
|
||||||
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
||||||
m_ctrl->GetId());
|
m_ctrl->GetId());
|
||||||
m_ctrl->ProcessEvent(theEvent);
|
m_ctrl->ProcessEvent(theEvent);
|
||||||
}
|
}
|
||||||
@@ -709,13 +709,13 @@ LRESULT CALLBACK wxAMMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxAMMediaBackend::Cleanup
|
// wxAMMediaBackend::Cleanup
|
||||||
//
|
//
|
||||||
// 1) Hide/disowns the video window (MS says bad things will happen if
|
// 1) Hide/disowns the video window (MS says bad things will happen if
|
||||||
// you don't)
|
// you don't)
|
||||||
// 2) Releases all the directshow interfaces we use
|
// 2) Releases all the directshow interfaces we use
|
||||||
// TODO: Maybe there's a way to redirect the IGraphBuilder each time
|
// TODO: Maybe there's a way to redirect the IGraphBuilder each time
|
||||||
// we load, rather then creating and destroying the interfaces
|
// we load, rather then creating and destroying the interfaces
|
||||||
// each time?
|
// each time?
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void wxAMMediaBackend::Cleanup()
|
void wxAMMediaBackend::Cleanup()
|
||||||
{
|
{
|
||||||
// Hide then disown the window
|
// Hide then disown the window
|
||||||
@@ -733,7 +733,7 @@ void wxAMMediaBackend::Cleanup()
|
|||||||
SAFE_RELEASE(m_pBV);
|
SAFE_RELEASE(m_pBV);
|
||||||
SAFE_RELEASE(m_pVW);
|
SAFE_RELEASE(m_pVW);
|
||||||
SAFE_RELEASE(m_pGB);
|
SAFE_RELEASE(m_pGB);
|
||||||
|
|
||||||
// Get rid of our hidden Window
|
// Get rid of our hidden Window
|
||||||
DestroyWindow(m_hNotifyWnd);
|
DestroyWindow(m_hNotifyWnd);
|
||||||
m_hNotifyWnd = NULL;
|
m_hNotifyWnd = NULL;
|
||||||
@@ -744,7 +744,7 @@ void wxAMMediaBackend::Cleanup()
|
|||||||
// wxAMMediaBackend::GetVideoSize
|
// wxAMMediaBackend::GetVideoSize
|
||||||
//
|
//
|
||||||
// Obtains the cached original video size
|
// Obtains the cached original video size
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxSize wxAMMediaBackend::GetVideoSize() const
|
wxSize wxAMMediaBackend::GetVideoSize() const
|
||||||
{
|
{
|
||||||
return m_bestSize;
|
return m_bestSize;
|
||||||
@@ -754,7 +754,7 @@ wxSize wxAMMediaBackend::GetVideoSize() const
|
|||||||
// wxAMMediaBackend::Move
|
// wxAMMediaBackend::Move
|
||||||
//
|
//
|
||||||
// Resizes the IVideoWindow to the size of the control window
|
// Resizes the IVideoWindow to the size of the control window
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void wxAMMediaBackend::Move(int x, int y, int w, int h)
|
void wxAMMediaBackend::Move(int x, int y, int w, int h)
|
||||||
{
|
{
|
||||||
if(m_hNotifyWnd && m_bVideo)
|
if(m_hNotifyWnd && m_bVideo)
|
||||||
@@ -771,7 +771,7 @@ void wxAMMediaBackend::Move(int x, int y, int w, int h)
|
|||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
//
|
//
|
||||||
// wxMCIMediaBackend
|
// wxMCIMediaBackend
|
||||||
//
|
//
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
|
|
||||||
|
|
||||||
@@ -800,7 +800,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxMCIMediaBackend, wxMediaBackend);
|
|||||||
// Simulation for <digitalv.h>
|
// Simulation for <digitalv.h>
|
||||||
//
|
//
|
||||||
// Mingw and possibly other compilers don't have the digitalv.h header
|
// Mingw and possibly other compilers don't have the digitalv.h header
|
||||||
// that is needed to have some essential features of mci work with
|
// that is needed to have some essential features of mci work with
|
||||||
// windows - so we provide the declarations for the types we use here
|
// windows - so we provide the declarations for the types we use here
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
@@ -809,7 +809,7 @@ typedef struct {
|
|||||||
#ifdef MCI_USE_OFFEXT
|
#ifdef MCI_USE_OFFEXT
|
||||||
POINT ptOffset;
|
POINT ptOffset;
|
||||||
POINT ptExtent;
|
POINT ptExtent;
|
||||||
#else
|
#else
|
||||||
RECT rc;
|
RECT rc;
|
||||||
#endif
|
#endif
|
||||||
} MCI_DGV_RECT_PARMS;
|
} MCI_DGV_RECT_PARMS;
|
||||||
@@ -828,12 +828,12 @@ typedef struct {
|
|||||||
} MCI_DGV_WINDOW_PARMS;
|
} MCI_DGV_WINDOW_PARMS;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
DWORD_PTR dwCallback;
|
DWORD_PTR dwCallback;
|
||||||
DWORD dwTimeFormat;
|
DWORD dwTimeFormat;
|
||||||
DWORD dwAudio;
|
DWORD dwAudio;
|
||||||
DWORD dwFileFormat;
|
DWORD dwFileFormat;
|
||||||
DWORD dwSpeed;
|
DWORD dwSpeed;
|
||||||
} MCI_DGV_SET_PARMS;
|
} MCI_DGV_SET_PARMS;
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// wxMCIMediaBackend Constructor
|
// wxMCIMediaBackend Constructor
|
||||||
@@ -866,11 +866,11 @@ wxMCIMediaBackend::~wxMCIMediaBackend()
|
|||||||
// Here we just tell wxMediaCtrl that mci does exist (which it does, on all
|
// Here we just tell wxMediaCtrl that mci does exist (which it does, on all
|
||||||
// msw systems, at least in some form dating back to win16 days)
|
// msw systems, at least in some form dating back to win16 days)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
bool wxMCIMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -916,14 +916,14 @@ bool wxMCIMediaBackend::Load(const wxString& fileName)
|
|||||||
//
|
//
|
||||||
//Opens a file and has MCI select a device. Normally you'd put
|
//Opens a file and has MCI select a device. Normally you'd put
|
||||||
//MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you
|
//MCI_OPEN_TYPE in addition to MCI_OPEN_ELEMENT - however if you
|
||||||
//omit this it tells MCI to select the device instead. This is
|
//omit this it tells MCI to select the device instead. This is
|
||||||
//good because we have no reliable way of "enumerating" the devices
|
//good because we have no reliable way of "enumerating" the devices
|
||||||
//in MCI
|
//in MCI
|
||||||
//
|
//
|
||||||
MCI_OPEN_PARMS openParms;
|
MCI_OPEN_PARMS openParms;
|
||||||
openParms.lpstrElementName = (wxChar*) fileName.c_str();
|
openParms.lpstrElementName = (wxChar*) fileName.c_str();
|
||||||
|
|
||||||
if ( mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT,
|
if ( mciSendCommand(0, MCI_OPEN, MCI_OPEN_ELEMENT,
|
||||||
(DWORD)(LPVOID)&openParms) != 0)
|
(DWORD)(LPVOID)&openParms) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -946,16 +946,16 @@ bool wxMCIMediaBackend::Load(const wxString& fileName)
|
|||||||
MCI_DGV_WINDOW_PARMS windowParms;
|
MCI_DGV_WINDOW_PARMS windowParms;
|
||||||
windowParms.hWnd = (HWND)m_ctrl->GetHandle();
|
windowParms.hWnd = (HWND)m_ctrl->GetHandle();
|
||||||
|
|
||||||
m_bVideo = (mciSendCommand(m_hDev, MCI_WINDOW,
|
m_bVideo = (mciSendCommand(m_hDev, MCI_WINDOW,
|
||||||
0x00010000L, //MCI_DGV_WINDOW_HWND
|
0x00010000L, //MCI_DGV_WINDOW_HWND
|
||||||
(DWORD)(LPVOID)&windowParms) == 0);
|
(DWORD)(LPVOID)&windowParms) == 0);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Create a hidden window and register to handle
|
// Create a hidden window and register to handle
|
||||||
// MCI events
|
// MCI events
|
||||||
// Note that wxCanvasClassName is already registered
|
// Note that wxCanvasClassName is already registered
|
||||||
// and used by all wxWindows and normal wxControls
|
// and used by all wxWindows and normal wxControls
|
||||||
//
|
//
|
||||||
m_hNotifyWnd = ::CreateWindow
|
m_hNotifyWnd = ::CreateWindow
|
||||||
(
|
(
|
||||||
wxCanvasClassName,
|
wxCanvasClassName,
|
||||||
@@ -975,8 +975,8 @@ bool wxMCIMediaBackend::Load(const wxString& fileName)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
::SetWindowLong(m_hNotifyWnd, GWL_WNDPROC,
|
::SetWindowLong(m_hNotifyWnd, GWL_WNDPROC,
|
||||||
(LONG)wxMCIMediaBackend::NotifyWndProc);
|
(LONG)wxMCIMediaBackend::NotifyWndProc);
|
||||||
|
|
||||||
::SetWindowLong(m_hNotifyWnd, GWL_USERDATA,
|
::SetWindowLong(m_hNotifyWnd, GWL_USERDATA,
|
||||||
@@ -1014,7 +1014,7 @@ bool wxMCIMediaBackend::Load(const wxURI& WXUNUSED(location))
|
|||||||
// 1) Certain drivers will crash and burn if we don't pass them an
|
// 1) Certain drivers will crash and burn if we don't pass them an
|
||||||
// MCI_PLAY_PARMS, despite the documentation that says otherwise...
|
// MCI_PLAY_PARMS, despite the documentation that says otherwise...
|
||||||
// 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing
|
// 2) There is a MCI_RESUME command, but MCI_PLAY does the same thing
|
||||||
// and will resume from a stopped state also, so there's no need to
|
// and will resume from a stopped state also, so there's no need to
|
||||||
// call both, for example
|
// call both, for example
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::Play()
|
bool wxMCIMediaBackend::Play()
|
||||||
@@ -1022,7 +1022,7 @@ bool wxMCIMediaBackend::Play()
|
|||||||
MCI_PLAY_PARMS playParms;
|
MCI_PLAY_PARMS playParms;
|
||||||
playParms.dwCallback = (DWORD)m_hNotifyWnd;
|
playParms.dwCallback = (DWORD)m_hNotifyWnd;
|
||||||
|
|
||||||
return ( mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY,
|
return ( mciSendCommand(m_hDev, MCI_PLAY, MCI_NOTIFY,
|
||||||
(DWORD)(LPVOID)&playParms) == 0 );
|
(DWORD)(LPVOID)&playParms) == 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1030,7 +1030,7 @@ bool wxMCIMediaBackend::Play()
|
|||||||
// wxMCIMediaBackend::Pause
|
// wxMCIMediaBackend::Pause
|
||||||
//
|
//
|
||||||
// Pauses the MCI device - nothing special
|
// Pauses the MCI device - nothing special
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::Pause()
|
bool wxMCIMediaBackend::Pause()
|
||||||
{
|
{
|
||||||
return (mciSendCommand(m_hDev, MCI_PAUSE, MCI_WAIT, 0) == 0);
|
return (mciSendCommand(m_hDev, MCI_PAUSE, MCI_WAIT, 0) == 0);
|
||||||
@@ -1040,7 +1040,7 @@ bool wxMCIMediaBackend::Pause()
|
|||||||
// wxMCIMediaBackend::Stop
|
// wxMCIMediaBackend::Stop
|
||||||
//
|
//
|
||||||
// Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline
|
// Stops the MCI device & seeks to the beginning as wxMediaCtrl docs outline
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::Stop()
|
bool wxMCIMediaBackend::Stop()
|
||||||
{
|
{
|
||||||
return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0) &&
|
return (mciSendCommand(m_hDev, MCI_STOP, MCI_WAIT, 0) == 0) &&
|
||||||
@@ -1054,7 +1054,7 @@ bool wxMCIMediaBackend::Stop()
|
|||||||
// since we use direct comparisons with MCI_MODE_PLAY and
|
// since we use direct comparisons with MCI_MODE_PLAY and
|
||||||
// MCI_MODE_PAUSE, we don't care if the MCI_STATUS call
|
// MCI_MODE_PAUSE, we don't care if the MCI_STATUS call
|
||||||
// fails or not
|
// fails or not
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxMediaState wxMCIMediaBackend::GetState()
|
wxMediaState wxMCIMediaBackend::GetState()
|
||||||
{
|
{
|
||||||
MCI_STATUS_PARMS statusParms;
|
MCI_STATUS_PARMS statusParms;
|
||||||
@@ -1075,20 +1075,20 @@ wxMediaState wxMCIMediaBackend::GetState()
|
|||||||
// wxMCIMediaBackend::SetPosition
|
// wxMCIMediaBackend::SetPosition
|
||||||
//
|
//
|
||||||
// Here we set the position of the device in the stream.
|
// Here we set the position of the device in the stream.
|
||||||
// Note that MCI actually stops the device after you seek it if the
|
// Note that MCI actually stops the device after you seek it if the
|
||||||
// device is playing/paused, so we need to play the file after
|
// device is playing/paused, so we need to play the file after
|
||||||
// MCI seeks like normal APIs would
|
// MCI seeks like normal APIs would
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::SetPosition(wxLongLong where)
|
bool wxMCIMediaBackend::SetPosition(wxLongLong where)
|
||||||
{
|
{
|
||||||
MCI_SEEK_PARMS seekParms;
|
MCI_SEEK_PARMS seekParms;
|
||||||
seekParms.dwCallback = 0;
|
seekParms.dwCallback = 0;
|
||||||
seekParms.dwTo = where.GetValue();
|
seekParms.dwTo = (DWORD)where.GetValue();
|
||||||
|
|
||||||
//device was playing?
|
//device was playing?
|
||||||
bool bReplay = GetState() == wxMEDIASTATE_PLAYING;
|
bool bReplay = GetState() == wxMEDIASTATE_PLAYING;
|
||||||
|
|
||||||
if( mciSendCommand(m_hDev, MCI_SEEK, MCI_TO,
|
if( mciSendCommand(m_hDev, MCI_SEEK, MCI_TO,
|
||||||
(DWORD)(LPVOID)&seekParms) != 0)
|
(DWORD)(LPVOID)&seekParms) != 0)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1104,7 +1104,7 @@ bool wxMCIMediaBackend::SetPosition(wxLongLong where)
|
|||||||
//
|
//
|
||||||
// Gets the position of the device in the stream using the current
|
// Gets the position of the device in the stream using the current
|
||||||
// time format... nothing special here...
|
// time format... nothing special here...
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxLongLong wxMCIMediaBackend::GetPosition()
|
wxLongLong wxMCIMediaBackend::GetPosition()
|
||||||
{
|
{
|
||||||
MCI_STATUS_PARMS statusParms;
|
MCI_STATUS_PARMS statusParms;
|
||||||
@@ -1121,7 +1121,7 @@ wxLongLong wxMCIMediaBackend::GetPosition()
|
|||||||
// wxMCIMediaBackend::GetDuration
|
// wxMCIMediaBackend::GetDuration
|
||||||
//
|
//
|
||||||
// Gets the duration of the stream... nothing special
|
// Gets the duration of the stream... nothing special
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxLongLong wxMCIMediaBackend::GetDuration()
|
wxLongLong wxMCIMediaBackend::GetDuration()
|
||||||
{
|
{
|
||||||
MCI_STATUS_PARMS statusParms;
|
MCI_STATUS_PARMS statusParms;
|
||||||
@@ -1138,8 +1138,8 @@ wxLongLong wxMCIMediaBackend::GetDuration()
|
|||||||
// wxMCIMediaBackend::Move
|
// wxMCIMediaBackend::Move
|
||||||
//
|
//
|
||||||
// Moves the window to a location
|
// Moves the window to a location
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
||||||
int w, int h)
|
int w, int h)
|
||||||
{
|
{
|
||||||
if (m_hNotifyWnd && m_bVideo)
|
if (m_hNotifyWnd && m_bVideo)
|
||||||
@@ -1150,7 +1150,7 @@ void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
putParms.rc.right = w;
|
putParms.rc.right = w;
|
||||||
putParms.rc.bottom = h;
|
putParms.rc.bottom = h;
|
||||||
|
|
||||||
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT,
|
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_PUT,
|
||||||
0x00040000L, //MCI_DGV_PUT_DESTINATION
|
0x00040000L, //MCI_DGV_PUT_DESTINATION
|
||||||
(DWORD)(LPSTR)&putParms) );
|
(DWORD)(LPSTR)&putParms) );
|
||||||
}
|
}
|
||||||
@@ -1160,17 +1160,17 @@ void wxMCIMediaBackend::Move(int WXUNUSED(x), int WXUNUSED(y),
|
|||||||
// wxMCIMediaBackend::GetVideoSize
|
// wxMCIMediaBackend::GetVideoSize
|
||||||
//
|
//
|
||||||
// Gets the original size of the movie for sizers
|
// Gets the original size of the movie for sizers
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxSize wxMCIMediaBackend::GetVideoSize() const
|
wxSize wxMCIMediaBackend::GetVideoSize() const
|
||||||
{
|
{
|
||||||
if(m_bVideo)
|
if(m_bVideo)
|
||||||
{
|
{
|
||||||
MCI_DGV_RECT_PARMS whereParms; //ifdefed MCI_DGV_WHERE_PARMS
|
MCI_DGV_RECT_PARMS whereParms; //ifdefed MCI_DGV_WHERE_PARMS
|
||||||
|
|
||||||
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_WHERE,
|
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_WHERE,
|
||||||
0x00020000L, //MCI_DGV_WHERE_SOURCE
|
0x00020000L, //MCI_DGV_WHERE_SOURCE
|
||||||
(DWORD)(LPSTR)&whereParms) );
|
(DWORD)(LPSTR)&whereParms) );
|
||||||
|
|
||||||
return wxSize(whereParms.rc.right, whereParms.rc.bottom);
|
return wxSize(whereParms.rc.right, whereParms.rc.bottom);
|
||||||
}
|
}
|
||||||
return wxSize(0,0);
|
return wxSize(0,0);
|
||||||
@@ -1180,7 +1180,7 @@ wxSize wxMCIMediaBackend::GetVideoSize() const
|
|||||||
// wxMCIMediaBackend::GetPlaybackRate
|
// wxMCIMediaBackend::GetPlaybackRate
|
||||||
//
|
//
|
||||||
// TODO
|
// TODO
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
double wxMCIMediaBackend::GetPlaybackRate()
|
double wxMCIMediaBackend::GetPlaybackRate()
|
||||||
{
|
{
|
||||||
return 1.0;
|
return 1.0;
|
||||||
@@ -1190,7 +1190,7 @@ double wxMCIMediaBackend::GetPlaybackRate()
|
|||||||
// wxMCIMediaBackend::SetPlaybackRate
|
// wxMCIMediaBackend::SetPlaybackRate
|
||||||
//
|
//
|
||||||
// TODO
|
// TODO
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate))
|
bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate))
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@@ -1198,7 +1198,7 @@ bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate))
|
|||||||
MCI_DGV_SET_PARMS setParms;
|
MCI_DGV_SET_PARMS setParms;
|
||||||
setParms.dwSpeed = (DWORD) (dRate * 1000.0);
|
setParms.dwSpeed = (DWORD) (dRate * 1000.0);
|
||||||
|
|
||||||
return (mciSendCommand(m_hDev, MCI_SET,
|
return (mciSendCommand(m_hDev, MCI_SET,
|
||||||
0x00020000L, //MCI_DGV_SET_SPEED
|
0x00020000L, //MCI_DGV_SET_SPEED
|
||||||
(DWORD)(LPSTR)&setParms) == 0);
|
(DWORD)(LPSTR)&setParms) == 0);
|
||||||
*/
|
*/
|
||||||
@@ -1208,11 +1208,11 @@ bool wxMCIMediaBackend::SetPlaybackRate(double WXUNUSED(dRate))
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
// [static] wxMCIMediaBackend::MSWWindowProc
|
// [static] wxMCIMediaBackend::MSWWindowProc
|
||||||
//
|
//
|
||||||
// Here we process a message when MCI reaches the stopping point
|
// Here we process a message when MCI reaches the stopping point
|
||||||
// in the stream
|
// in the stream
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
wxMCIMediaBackend* backend = (wxMCIMediaBackend*)
|
wxMCIMediaBackend* backend = (wxMCIMediaBackend*)
|
||||||
@@ -1222,8 +1222,8 @@ LRESULT CALLBACK wxMCIMediaBackend::NotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam);
|
return backend->OnNotifyWndProc(hWnd, nMsg, wParam, lParam);
|
||||||
}
|
}
|
||||||
|
|
||||||
LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
if(nMsg == MM_MCINOTIFY)
|
if(nMsg == MM_MCINOTIFY)
|
||||||
@@ -1236,11 +1236,11 @@ LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
|
|
||||||
if(theEvent.IsAllowed())
|
if(theEvent.IsAllowed())
|
||||||
{
|
{
|
||||||
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_SEEK,
|
wxMCIVERIFY( mciSendCommand(m_hDev, MCI_SEEK,
|
||||||
MCI_SEEK_TO_START, 0) );
|
MCI_SEEK_TO_START, 0) );
|
||||||
|
|
||||||
//send the event to our child
|
//send the event to our child
|
||||||
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
||||||
m_ctrl->GetId());
|
m_ctrl->GetId());
|
||||||
m_ctrl->ProcessEvent(theEvent);
|
m_ctrl->ProcessEvent(theEvent);
|
||||||
}
|
}
|
||||||
@@ -1251,7 +1251,7 @@ LRESULT CALLBACK wxMCIMediaBackend::OnNotifyWndProc(HWND hWnd, UINT nMsg,
|
|||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
//
|
//
|
||||||
// wxQTMediaBackend
|
// wxQTMediaBackend
|
||||||
//
|
//
|
||||||
// TODO: Use a less cludgy way to pause/get state/set state
|
// TODO: Use a less cludgy way to pause/get state/set state
|
||||||
// TODO: Dynamically load from qtml.dll
|
// TODO: Dynamically load from qtml.dll
|
||||||
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||||
@@ -1296,10 +1296,10 @@ public:
|
|||||||
if (!m_bPaused)
|
if (!m_bPaused)
|
||||||
{
|
{
|
||||||
if(!IsMovieDone(m_movie))
|
if(!IsMovieDone(m_movie))
|
||||||
MoviesTask(m_movie, MOVIE_DELAY);
|
MoviesTask(m_movie, MOVIE_DELAY);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxMediaEvent theEvent(wxEVT_MEDIA_STOP,
|
wxMediaEvent theEvent(wxEVT_MEDIA_STOP,
|
||||||
m_parent->m_ctrl->GetId());
|
m_parent->m_ctrl->GetId());
|
||||||
m_parent->m_ctrl->ProcessEvent(theEvent);
|
m_parent->m_ctrl->ProcessEvent(theEvent);
|
||||||
|
|
||||||
@@ -1310,7 +1310,7 @@ public:
|
|||||||
wxASSERT(::GetMoviesError() == noErr);
|
wxASSERT(::GetMoviesError() == noErr);
|
||||||
|
|
||||||
//send the event to our child
|
//send the event to our child
|
||||||
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED,
|
||||||
m_parent->m_ctrl->GetId());
|
m_parent->m_ctrl->GetId());
|
||||||
m_parent->m_ctrl->ProcessEvent(theEvent);
|
m_parent->m_ctrl->ProcessEvent(theEvent);
|
||||||
}
|
}
|
||||||
@@ -1359,11 +1359,11 @@ wxQTMediaBackend::~wxQTMediaBackend()
|
|||||||
// 1) Intializes QuickTime
|
// 1) Intializes QuickTime
|
||||||
// 2) Creates the control window
|
// 2) Creates the control window
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
||||||
wxWindowID id,
|
wxWindowID id,
|
||||||
const wxPoint& pos,
|
const wxPoint& pos,
|
||||||
const wxSize& size,
|
const wxSize& size,
|
||||||
long style,
|
long style,
|
||||||
const wxValidator& validator,
|
const wxValidator& validator,
|
||||||
const wxString& name)
|
const wxString& name)
|
||||||
{
|
{
|
||||||
@@ -1403,7 +1403,7 @@ bool wxQTMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
// 1) Get an FSSpec from the Windows path name
|
// 1) Get an FSSpec from the Windows path name
|
||||||
// 2) Open the movie
|
// 2) Open the movie
|
||||||
// 3) Obtain the movie instance from the movie resource
|
// 3) Obtain the movie instance from the movie resource
|
||||||
// 4)
|
// 4)
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxQTMediaBackend::Load(const wxString& fileName)
|
bool wxQTMediaBackend::Load(const wxString& fileName)
|
||||||
{
|
{
|
||||||
@@ -1414,10 +1414,10 @@ bool wxQTMediaBackend::Load(const wxString& fileName)
|
|||||||
short movieResFile;
|
short movieResFile;
|
||||||
FSSpec sfFile;
|
FSSpec sfFile;
|
||||||
|
|
||||||
if (NativePathNameToFSSpec ((char*) (const char*) fileName.mb_str(),
|
if (NativePathNameToFSSpec ((char*) (const char*) fileName.mb_str(),
|
||||||
&sfFile, 0) != noErr)
|
&sfFile, 0) != noErr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (OpenMovieFile (&sfFile, &movieResFile, fsRdPerm) != noErr)
|
if (OpenMovieFile (&sfFile, &movieResFile, fsRdPerm) != noErr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -1462,8 +1462,8 @@ bool wxQTMediaBackend::Load(const wxURI& location)
|
|||||||
BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1);
|
BlockMove(theURI.mb_str(), *theHandle, theURI.length() + 1);
|
||||||
|
|
||||||
//create the movie from the handle that refers to the URI
|
//create the movie from the handle that refers to the URI
|
||||||
err = NewMovieFromDataRef(&m_movie, newMovieActive,
|
err = NewMovieFromDataRef(&m_movie, newMovieActive,
|
||||||
NULL, theHandle,
|
NULL, theHandle,
|
||||||
URLDataHandlerSubType);
|
URLDataHandlerSubType);
|
||||||
|
|
||||||
DisposeHandle(theHandle);
|
DisposeHandle(theHandle);
|
||||||
@@ -1503,17 +1503,17 @@ void wxQTMediaBackend::FinishLoad()
|
|||||||
|
|
||||||
m_bestSize.x = outRect.right - outRect.left;
|
m_bestSize.x = outRect.right - outRect.left;
|
||||||
m_bestSize.y = outRect.bottom - outRect.top;
|
m_bestSize.y = outRect.bottom - outRect.top;
|
||||||
|
|
||||||
//reparent movie/*AudioMediaCharacteristic*/
|
//reparent movie/*AudioMediaCharacteristic*/
|
||||||
if(GetMovieIndTrackType(m_movie, 1,
|
if(GetMovieIndTrackType(m_movie, 1,
|
||||||
VisualMediaCharacteristic,
|
VisualMediaCharacteristic,
|
||||||
movieTrackCharacteristic |
|
movieTrackCharacteristic |
|
||||||
movieTrackEnabledOnly) != NULL)
|
movieTrackEnabledOnly) != NULL)
|
||||||
{
|
{
|
||||||
CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L);
|
CreatePortAssociation(m_ctrl->GetHWND(), NULL, 0L);
|
||||||
|
|
||||||
SetMovieGWorld(m_movie,
|
SetMovieGWorld(m_movie,
|
||||||
(CGrafPtr) GetNativeWindowPort(m_ctrl->GetHWND()),
|
(CGrafPtr) GetNativeWindowPort(m_ctrl->GetHWND()),
|
||||||
nil);
|
nil);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1571,7 +1571,7 @@ bool wxQTMediaBackend::Stop()
|
|||||||
::StopMovie(m_movie);
|
::StopMovie(m_movie);
|
||||||
if(::GetMoviesError() != noErr)
|
if(::GetMoviesError() != noErr)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
::GoToBeginningOfMovie(m_movie);
|
::GoToBeginningOfMovie(m_movie);
|
||||||
return ::GetMoviesError() == noErr;
|
return ::GetMoviesError() == noErr;
|
||||||
}
|
}
|
||||||
@@ -1644,7 +1644,7 @@ wxLongLong wxQTMediaBackend::GetDuration()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxMediaState wxQTMediaBackend::GetState()
|
wxMediaState wxQTMediaBackend::GetState()
|
||||||
{
|
{
|
||||||
if ( !m_timer || (m_timer->IsRunning() == false &&
|
if ( !m_timer || (m_timer->IsRunning() == false &&
|
||||||
m_timer->GetPaused() == false) )
|
m_timer->GetPaused() == false) )
|
||||||
return wxMEDIASTATE_STOPPED;
|
return wxMEDIASTATE_STOPPED;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user