/////////////////////////////////////////////////////////////////////////////
// Name: wx/msw/mediactrl.h
-// Purpose: DirectX7+ wxMediaCtrl MSW
+// Purpose: DirectX7+ wxMediaCtrl MSW
// Author: Ryan Norton <wxprojects@comcast.net>
-// Modified by:
+// Modified by:
// Created: 11/07/04
// RCS-ID: $Id$
// Copyright: (c) Ryan Norton
wxMediaCtrl() : m_imp(NULL)
{ }
- wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxString& fileName,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_imp(NULL)
- { Create(parent, id, fileName, pos, size, style, driver, name); }
+ { Create(parent, id, fileName, pos, size, style, driver, name); }
wxMediaCtrl(wxWindow* parent, wxWindowID id, const wxURI& location,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, long driver = 0, const wxString& name = wxPanelNameStr) : m_imp(NULL)
- { Create(parent, id, location, pos, size, style, driver, name); }
+ { Create(parent, id, location, pos, size, style, driver, name); }
~wxMediaCtrl();
- bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ bool Create(wxWindow* parent, wxWindowID id, const wxString& fileName,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, long driver = 0, const wxString& name = wxPanelNameStr);
- bool Create(wxWindow* parent, wxWindowID id, const wxURI& location,
- const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
+ bool Create(wxWindow* parent, wxWindowID id, const wxURI& location,
+ const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize,
long style = 0, long driver = 0, const wxString& name = wxPanelNameStr);
bool Play();
class wxMediaCtrlImpl* m_imp;
bool m_bLoaded;
-
+
DECLARE_DYNAMIC_CLASS(wxMediaCtrl);
};
//Event stuff
-class WXDLLEXPORT wxMediaEvent : public wxNotifyEvent
-{
+class WXDLLEXPORT wxMediaEvent : public wxNotifyEvent
+{
public:
- wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
- : wxNotifyEvent(commandType, id)
+ wxMediaEvent(wxEventType commandType = wxEVT_NULL, int id = 0)
+ : wxNotifyEvent(commandType, id)
{ }
-
- wxMediaEvent(const wxMediaEvent &clone)
- : wxNotifyEvent(clone.GetEventType(), clone.GetId())
+
+ wxMediaEvent(const wxMediaEvent &clone)
+ : wxNotifyEvent(clone.GetEventType(), clone.GetId())
{ }
- wxEvent *Clone() { return new wxMediaEvent(*this); }
-
- DECLARE_DYNAMIC_CLASS(wxMediaEvent)
-};
+ wxEvent *Clone() { return new wxMediaEvent(*this); }
+
+ DECLARE_DYNAMIC_CLASS(wxMediaEvent)
+};
+
+#define wxMEDIA_FINISHED_ID 13000
+DECLARE_EVENT_TYPE(wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID)
+typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&);
+#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMediaEventFunction) & fn, (wxObject *) NULL ),
-#define wxMEDIA_FINISHED_ID 13000
-DECLARE_EVENT_TYPE(wxEVT_MEDIA_FINISHED, wxMEDIA_FINISHED_ID)
-typedef void (wxEvtHandler::*wxMediaEventFunction)(wxMediaEvent&);
-#define EVT_MEDIA_FINISHED(winid, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_MEDIA_FINISHED, winid, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) (wxMediaEventFunction) & fn, (wxObject *) NULL ),
+#endif // wxUSE_MEDIACTRL
-#endif // wxUSE_MEDIACTRL
\ No newline at end of file
// Name: msw/mediactrl.cpp
// Purpose: wxMediaCtrl MSW
// Author: Ryan Norton <wxprojects@comcast.net>
-// Modified by:
+// Modified by:
// Created: 11/07/04
// RCS-ID: $Id$
// Copyright: (c) Ryan Norton
//###########################################################################
IMPLEMENT_CLASS(wxMediaCtrl, wxControl);
-IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent);
-DEFINE_EVENT_TYPE(wxEVT_MEDIA_FINISHED);
+IMPLEMENT_DYNAMIC_CLASS(wxMediaEvent, wxEvent);
+DEFINE_EVENT_TYPE(wxEVT_MEDIA_FINISHED);
//---------------------------------------------------------------------------
// wxMediaCtrlImpl
wxMediaCtrlImpl() : m_bLoaded(false)
{ }
- virtual ~wxMediaCtrlImpl()
+ virtual ~wxMediaCtrlImpl()
{ }
- virtual bool Create(wxMediaCtrl* WXUNUSED(ctrl))
+ virtual bool Create(wxMediaCtrl* WXUNUSED(ctrl))
{ return false; }
virtual bool Play() { return false; }
virtual double GetPlaybackRate() { return 0; }
virtual bool SetPlaybackRate(double) { return false; }
-
+
virtual bool MSWWindowProc(WXUINT, WXWPARAM, WXLPARAM) { return false; }
bool IsLoaded()
//
//---------------------------------------------------------------------------
-bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxString& fileName,
- const wxPoint& pos, const wxSize& size,
+bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxString& fileName,
+ const wxPoint& pos, const wxSize& size,
long style, long WXUNUSED(driver), const wxString& name)
{
//base create
- if ( !wxControl::Create(parent, id, pos, size, (style | wxNO_BORDER) | wxCLIP_CHILDREN,
+ if ( !wxControl::Create(parent, id, pos, size, (style | wxNO_BORDER) | wxCLIP_CHILDREN,
wxDefaultValidator, name) )
return false;
return true;
}
-bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxURI& location,
- const wxPoint& pos, const wxSize& size,
+bool wxMediaCtrl::Create(wxWindow* parent, wxWindowID id, const wxURI& location,
+ const wxPoint& pos, const wxSize& size,
long style, long WXUNUSED(driver), const wxString& name)
{
//base create
- if ( !wxControl::Create(parent, id, pos, size, (style | wxNO_BORDER) | wxCLIP_CHILDREN,
+ if ( !wxControl::Create(parent, id, pos, size, (style | wxNO_BORDER) | wxCLIP_CHILDREN,
wxDefaultValidator, name) )
return false;
//
//---------------------------------------------------------------------------
-#if wxUSE_DIRECTSHOW
+#if wxUSE_DIRECTSHOW
wxDXMediaCtrlImpl::wxDXMediaCtrlImpl() : m_pGB(NULL)
{
bool wxDXMediaCtrlImpl::Load(const wxString& fileName)
{
if(m_bLoaded)
- Cleanup();
-
+ Cleanup();
+
SAFE_RELEASE(m_pGB);
CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,
IID_IGraphBuilder, (void**)&m_pGB);
- //load the graph & render
+ //load the graph & render
if( FAILED(m_pGB->RenderFile(fileName.wc_str(wxConvLocal), NULL)) )
return false;
nSX = nSY = 0;
}
- else
+ else
{
m_bVideo = true;
}
LONGLONG pos = ((LONGLONG)where) * 10000;
return SUCCEEDED( m_pMS->SetPositions(
- &pos,
+ &pos,
AM_SEEKING_AbsolutePositioning,
- NULL,
+ NULL,
AM_SEEKING_NoPositioning
) );
}
HRESULT hr;
OAFilterState theState;
hr = m_pMC->GetState(INFINITE, &theState);
-
+
wxASSERT( SUCCEEDED(hr) );
//MSW state is the same as ours
// Process all queued events
while(SUCCEEDED(m_pME->GetEvent(&evCode, (LONG_PTR *) &evParam1,
- (LONG_PTR *) &evParam2, 0)
- )
+ (LONG_PTR *) &evParam2, 0)
+ )
)
{
// Free memory associated with callback, since we're not using it
wxMediaEvent theEvent(wxEVT_MEDIA_FINISHED, m_ctrl->GetId());
m_ctrl->GetParent()->ProcessEvent(theEvent);
}
- }
+ }
return true;
}
return false;
/* TCHAR sz[5000];
mciGetErrorString(nError, sz, 5000);
wxMessageBox(wxString::Format(_T("Error:%s"), sz));
- */
+ */
}
wxWMMEMediaCtrlImpl::~wxWMMEMediaCtrlImpl()
}
bool wxWMMEMediaCtrlImpl::Create(wxMediaCtrl* ctrl)
-{
+{
m_ctrl = ctrl;
return true;
}
//then it actually automagically finds the device for you!
if ( mciSendCommand(0, MCI_OPEN,
MCI_OPEN_ELEMENT,
- (DWORD)(LPVOID)&openParms) != 0)
+ (DWORD)(LPVOID)&openParms) != 0)
return false;
m_hDev = openParms.wDeviceID;
windowParms.hWnd = (HWND)m_ctrl->GetHandle();
m_bVideo = (mciSendCommand(m_hDev, MCI_WINDOW,
0x00010000L //MCI_DGV_WINDOW_HWND
- ,
+ ,
(DWORD)(LPVOID)&windowParms) == 0);
m_bLoaded = true;
m_ctrl->GetParent()->Layout();
m_ctrl->GetParent()->Refresh();
m_ctrl->GetParent()->Update();
-
+
return true;
}
long wxWMMEMediaCtrlImpl::GetPosition()
{
MCI_STATUS_PARMS statusParms;
-
- statusParms.dwItem = MCI_STATUS_POSITION;
- if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
+
+ statusParms.dwItem = MCI_STATUS_POSITION;
+ if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
(DWORD)(LPSTR)&statusParms) != 0)
return 0;
long wxWMMEMediaCtrlImpl::GetDuration()
{
MCI_STATUS_PARMS statusParms;
-
- statusParms.dwItem = MCI_STATUS_LENGTH;
- if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
+
+ statusParms.dwItem = MCI_STATUS_LENGTH;
+ if (mciSendCommand(m_hDev, MCI_STATUS, MCI_STATUS_ITEM,
(DWORD)(LPSTR)&statusParms) != 0)
return 0;
{
if(m_bVideo)
{
- MCI_DGV_RECT_PARMS rect;
+ MCI_DGV_RECT_PARMS rect;
mciSendCommand(m_hDev, MCI_WHERE, 0x00020000L//MCI_DGV_WHERE_SOURCE
- ,
+ ,
(DWORD)(LPSTR)&rect);
return wxSize(rect.rc.right, rect.rc.bottom);
}
return false;
}
-#endif //wxUSE_MEDIACTRL
\ No newline at end of file
+#endif //wxUSE_MEDIACTRL
+