X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e8482f24cfc00645607f8526fde38d39e0dcaa63..ec75509f94fb11322c1c69056d1ec2af8f041fe2:/contrib/src/mmedia/vidwin.cpp?ds=sidebyside diff --git a/contrib/src/mmedia/vidwin.cpp b/contrib/src/mmedia/vidwin.cpp index 2f0c28f1a9..ddfe966bf8 100644 --- a/contrib/src/mmedia/vidwin.cpp +++ b/contrib/src/mmedia/vidwin.cpp @@ -18,7 +18,9 @@ #include "wx/wx.h" #endif -#ifdef __WINDOWS__ +#if defined(__WINDOWS__) && !defined(__MINGW32__) && !defined(__WATCOMC__) +// versions of Open Watcom and MinGW tested against this source does not +// deliver "digitalv.h" required in this feature #ifdef __BORLANDC__ #pragma hdrstop @@ -47,10 +49,10 @@ wxVideoWindows::wxVideoWindows(wxInputStream& str) : wxVideoBaseDriver(str) { m_internal = new wxVIDWinternal; - m_remove_file = TRUE; - m_filename = wxGetTempFileName("wxvid"); - m_paused = FALSE; - m_stopped = TRUE; + m_remove_file = true; + m_filename = wxGetTempFileName(_T("wxvid")); + m_paused = false; + m_stopped = true; m_frameRate = 1.0; wxFileOutputStream temp_file(m_filename); @@ -63,10 +65,10 @@ wxVideoWindows::wxVideoWindows(const wxString& filename) : wxVideoBaseDriver(filename) { m_internal = new wxVIDWinternal; - m_remove_file = FALSE; + m_remove_file = false; m_filename = filename; - m_paused = FALSE; - m_stopped = TRUE; + m_paused = false; + m_stopped = true; m_frameRate = 1.0; OpenFile(); } @@ -84,14 +86,13 @@ void wxVideoWindows::OpenFile() MCI_DGV_OPEN_PARMS openStruct; MCI_DGV_SET_PARMS setStruct; MCI_STATUS_PARMS statusStruct; - DWORD ret; - openStruct.lpstrDeviceType = "avivideo"; - openStruct.lpstrElementName = (LPSTR)(m_filename.mb_str()); + openStruct.lpstrDeviceType = _T("avivideo"); + openStruct.lpstrElementName = (wxChar *)m_filename.c_str(); openStruct.hWndParent = 0; - ret = mciSendCommand(0, MCI_OPEN, - MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_OPEN_TYPE|MCI_DGV_OPEN_32BIT, + mciSendCommand(0, MCI_OPEN, + MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_OPEN_TYPE|MCI_DGV_OPEN_32BIT, (DWORD)(LPVOID)&openStruct); m_internal->m_dev_id = openStruct.wDeviceID; @@ -99,20 +100,20 @@ void wxVideoWindows::OpenFile() setStruct.dwCallback = 0; setStruct.dwTimeFormat = MCI_FORMAT_FRAMES; - ret = mciSendCommand(m_internal->m_dev_id, MCI_SET, MCI_SET_TIME_FORMAT, + mciSendCommand(m_internal->m_dev_id, MCI_SET, MCI_SET_TIME_FORMAT, (DWORD)(LPVOID)&setStruct); statusStruct.dwCallback = 0; statusStruct.dwItem = MCI_DGV_STATUS_FRAME_RATE; - ret = mciSendCommand(m_internal->m_dev_id, MCI_STATUS, + mciSendCommand(m_internal->m_dev_id, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPVOID)&statusStruct); m_frameRate = ((double)statusStruct.dwReturn) / 1000; statusStruct.dwItem = MCI_DGV_STATUS_BITSPERSAMPLE; - ret = mciSendCommand(m_internal->m_dev_id, MCI_STATUS, MCI_STATUS_ITEM, + mciSendCommand(m_internal->m_dev_id, MCI_STATUS, MCI_STATUS_ITEM, (DWORD)(LPVOID)&statusStruct); m_bps = statusStruct.dwReturn; @@ -121,16 +122,16 @@ void wxVideoWindows::OpenFile() bool wxVideoWindows::Pause() { if (m_paused || m_stopped) - return TRUE; - m_paused = TRUE; + return true; + m_paused = true; return (mciSendCommand(m_internal->m_dev_id, MCI_PAUSE, MCI_WAIT, 0) == 0); } bool wxVideoWindows::Resume() { if (!m_paused || m_stopped) - return TRUE; - m_paused = FALSE; + return true; + m_paused = false; return (mciSendCommand(m_internal->m_dev_id, MCI_RESUME, 0, 0) == 0); } @@ -148,15 +149,15 @@ bool wxVideoWindows::GetSize(wxSize& size) const { size.SetWidth(200); size.SetHeight(200); - return TRUE; + return true; } -bool wxVideoWindows::SetSize(wxSize size) +bool wxVideoWindows::SetSize(wxSize WXUNUSED(size)) { - return TRUE; + return true; } -bool wxVideoWindows::IsCapable(wxVideoType v_type) +bool wxVideoWindows::IsCapable(wxVideoType v_type) const { return (v_type == wxVIDEO_MSAVI); } @@ -166,12 +167,12 @@ bool wxVideoWindows::AttachOutput(wxWindow& output) MCI_DGV_WINDOW_PARMS win_struct; if (!wxVideoBaseDriver::AttachOutput(output)) - return FALSE; + return false; win_struct.hWnd = (HWND)output.GetHWND(); mciSendCommand(m_internal->m_dev_id, MCI_WINDOW, - MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct); - return TRUE; + MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct); + return true; } void wxVideoWindows::DetachOutput() @@ -182,14 +183,14 @@ void wxVideoWindows::DetachOutput() win_struct.hWnd = 0; mciSendCommand(m_internal->m_dev_id, MCI_WINDOW, - MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct); + MCI_DGV_WINDOW_HWND, (DWORD)(LPVOID)&win_struct); } bool wxVideoWindows::Play() { if (!m_stopped) - return FALSE; - m_stopped = FALSE; + return false; + m_stopped = false; return (mciSendCommand(m_internal->m_dev_id, MCI_PLAY, 0, NULL) == 0); } @@ -198,10 +199,10 @@ bool wxVideoWindows::Stop() MCI_SEEK_PARMS seekStruct; if (m_stopped) - return FALSE; - m_stopped = TRUE; + return false; + m_stopped = true; if (::mciSendCommand(m_internal->m_dev_id, MCI_STOP, MCI_WAIT, NULL) != 0) - return FALSE; + return false; seekStruct.dwCallback = 0; seekStruct.dwTo = 0;