cleanup - more reformatting
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37140 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
f36b056bd0
commit
6591df24b6
@ -1563,24 +1563,19 @@ public:
|
|||||||
void Notify()
|
void Notify()
|
||||||
{
|
{
|
||||||
LONG evCode;
|
LONG evCode;
|
||||||
LONG_PTR evParam1,
|
LONG_PTR evParam1, evParam2;
|
||||||
evParam2;
|
|
||||||
|
|
||||||
//
|
|
||||||
// DirectShow keeps a list of queued events, and we need
|
// DirectShow keeps a list of queued events, and we need
|
||||||
// to go through them one by one, stopping at (Hopefully only one)
|
// to go through them one by one, stopping at (hopefully only one)
|
||||||
// EC_COMPLETE message
|
// EC_COMPLETE message
|
||||||
//
|
while ( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 )
|
||||||
while( m_pME->GetEvent(&evCode, &evParam1, &evParam2, 0) == 0 )
|
|
||||||
{
|
{
|
||||||
// Cleanup memory that GetEvent allocated
|
// Cleanup memory that GetEvent allocated
|
||||||
HRESULT hr = m_pME->FreeEventParams(evCode,
|
HRESULT hr = m_pME->FreeEventParams(evCode, evParam1, evParam2);
|
||||||
evParam1, evParam2);
|
|
||||||
if (hr != 0)
|
if (hr != 0)
|
||||||
{
|
{
|
||||||
// Even though this makes a messagebox this
|
// Even though this makes a messagebox, this is Windows,
|
||||||
// is windows where we can do gui stuff in seperate
|
// where we can do GUI stuff in separate threads :)
|
||||||
// threads :)
|
|
||||||
wxFAIL_MSG(m_pBE->GetErrorString(hr));
|
wxFAIL_MSG(m_pBE->GetErrorString(hr));
|
||||||
}
|
}
|
||||||
// If this is the end of the clip, notify handler
|
// If this is the end of the clip, notify handler
|
||||||
@ -1589,7 +1584,6 @@ public:
|
|||||||
if ( m_pBE->SendStopEvent() )
|
if ( m_pBE->SendStopEvent() )
|
||||||
{
|
{
|
||||||
Stop();
|
Stop();
|
||||||
|
|
||||||
m_pBE->QueueFinishEvent();
|
m_pBE->QueueFinishEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1618,7 +1612,8 @@ wxAMMediaBackend::wxAMMediaBackend()
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
wxAMMediaBackend::~wxAMMediaBackend()
|
wxAMMediaBackend::~wxAMMediaBackend()
|
||||||
{
|
{
|
||||||
Clear(); //Free memory from Load()
|
// Free memory from Load()
|
||||||
|
Clear();
|
||||||
|
|
||||||
if (m_pAX)
|
if (m_pAX)
|
||||||
{
|
{
|
||||||
@ -1666,8 +1661,8 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Now determine which (if any) media player interface is
|
// determine which (if any) media player interface
|
||||||
// available - IMediaPlayer or IActiveMovie
|
// is available - IMediaPlayer or IActiveMovie
|
||||||
if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL,
|
if ( ::CoCreateInstance(CLSID_MediaPlayer, NULL,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
IID_IMediaPlayer, (void**)&m_pMP) != 0 )
|
IID_IMediaPlayer, (void**)&m_pMP) != 0 )
|
||||||
@ -1675,7 +1670,10 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL,
|
if ( ::CoCreateInstance(CLSID_ActiveMovie, NULL,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
IID_IActiveMovie, (void**)&m_pAM) != 0 )
|
IID_IActiveMovie, (void**)&m_pAM) != 0 )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP);
|
m_pAM->QueryInterface(IID_IMediaPlayer, (void**)&m_pMP);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1683,30 +1681,28 @@ bool wxAMMediaBackend::CreateControl(wxControl* ctrl, wxWindow* parent,
|
|||||||
m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM);
|
m_pMP->QueryInterface(IID_IActiveMovie, (void**)&m_pAM);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Create window
|
// Create window
|
||||||
// By default wxWindow(s) is created with a border -
|
// By default wxWindow(s) is created with a border -
|
||||||
// so we need to get rid of those
|
// so we need to get rid of those
|
||||||
//
|
//
|
||||||
// Since we don't have a child window like most other
|
// Since we don't have a child window like most other
|
||||||
// backends, we don't need wxCLIP_CHILDREN
|
// backends, we don't need wxCLIP_CHILDREN
|
||||||
//
|
|
||||||
if ( !ctrl->wxControl::Create(parent, id, pos, size,
|
if ( !ctrl->wxControl::Create(parent, id, pos, size,
|
||||||
(style & ~wxBORDER_MASK) | wxBORDER_NONE,
|
(style & ~wxBORDER_MASK) | wxBORDER_NONE,
|
||||||
validator, name) )
|
validator, name) )
|
||||||
|
{
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Now create the ActiveX container along with the media player
|
// Create the ActiveX container along with the media player
|
||||||
// interface and query them
|
// interface and query them
|
||||||
//
|
|
||||||
m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);
|
m_ctrl = wxStaticCast(ctrl, wxMediaCtrl);
|
||||||
m_pAX = new wxActiveXContainer(ctrl,
|
m_pAX = new wxActiveXContainer(ctrl,
|
||||||
m_pMP ? IID_IMediaPlayer : IID_IActiveMovie,
|
m_pMP ? IID_IMediaPlayer : IID_IActiveMovie,
|
||||||
m_pAM);
|
m_pAM);
|
||||||
|
|
||||||
// Here we set up wx-specific stuff for the default
|
// Set up wx-specific stuff for the default
|
||||||
// settings wxMediaCtrl says it will stay to
|
// settings wxMediaCtrl says it will conform to (???)
|
||||||
//
|
|
||||||
if (m_pMP)
|
if (m_pMP)
|
||||||
{
|
{
|
||||||
m_pMP->put_DisplaySize(mpFitToSize);
|
m_pMP->put_DisplaySize(mpFitToSize);
|
||||||
@ -1747,8 +1743,7 @@ bool wxAMMediaBackend::Load(const wxString& fileName)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::Load(const wxURI& location)
|
bool wxAMMediaBackend::Load(const wxURI& location)
|
||||||
{
|
{
|
||||||
// Turn off loading from a proxy as user
|
// Turn off loading from a proxy, as user may have set it previously
|
||||||
// may have set it previously
|
|
||||||
INSPlay* pPlay = NULL;
|
INSPlay* pPlay = NULL;
|
||||||
m_pAM->QueryInterface(IID_INSPlay, (void**) &pPlay);
|
m_pAM->QueryInterface(IID_INSPlay, (void**) &pPlay);
|
||||||
if (pPlay)
|
if (pPlay)
|
||||||
@ -1788,14 +1783,15 @@ bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy)
|
|||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
bool wxAMMediaBackend::DoLoad(const wxString& location)
|
bool wxAMMediaBackend::DoLoad(const wxString& location)
|
||||||
{
|
{
|
||||||
Clear(); //Clear up previously allocated memory
|
//Clear up previously allocated memory
|
||||||
|
Clear();
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
// Play the movie the normal way through the embedded
|
// Play the movie the normal way through the embedded WMP.
|
||||||
// WMP. Supposively Open is better in theory because
|
// Supposedly, Open is better in theory because
|
||||||
// the docs say its async and put_FileName is not -
|
// the docs say its async and put_FileName is not -
|
||||||
// but in practice they both seem to be async anyway
|
// but in practice they both appear to be async anyway
|
||||||
if (m_pMP)
|
if (m_pMP)
|
||||||
hr = m_pMP->Open( wxBasicString(location).Get() );
|
hr = m_pMP->Open( wxBasicString(location).Get() );
|
||||||
else
|
else
|
||||||
@ -1830,10 +1826,8 @@ void wxAMMediaBackend::FinishLoad()
|
|||||||
m_pAM->get_ImageSourceWidth((long*)&m_bestSize.x);
|
m_pAM->get_ImageSourceWidth((long*)&m_bestSize.x);
|
||||||
m_pAM->get_ImageSourceHeight((long*)&m_bestSize.y);
|
m_pAM->get_ImageSourceHeight((long*)&m_bestSize.y);
|
||||||
|
|
||||||
//
|
// Start the play timer to catch stop events
|
||||||
//Start the play timer to catch stop events
|
// Previous load timer cleans up itself
|
||||||
//Previous load timer cleans up itself
|
|
||||||
//
|
|
||||||
m_pTimer = new wxAMPlayTimer(this);
|
m_pTimer = new wxAMPlayTimer(this);
|
||||||
|
|
||||||
NotifyMovieLoaded();
|
NotifyMovieLoaded();
|
||||||
|
Loading…
Reference in New Issue
Block a user