Inserted "stdio catch" in wxExecute. The activation is controlled by wxProcess.
Completed some TODO in wxMMedia (wxSoundUlaw, ...) Reworked the PCM converted: it should be simpler to add converters now and it is cleaner. Implemented status information in wxVideoWindows but it doesn't work on my Win98SE (UNSUPPORTED_FUNCTION) Changed *ERR into *ERROR Added a TODO: we must detect the best format in wxSoundWindows git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@6311 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// -----------------------------------------------------------------------------
|
||||
// Name: vidwin.h
|
||||
// Purpose: wxMMedia
|
||||
// Author: Guilhem Lavaux
|
||||
@@ -6,7 +6,7 @@
|
||||
// Updated:
|
||||
// Copyright: (C) 1998, 1999, 2000 Guilhem Lavaux
|
||||
// License: wxWindows license
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation "vidwin.h"
|
||||
@@ -45,6 +45,7 @@ wxVideoWindows::wxVideoWindows(wxInputStream& str)
|
||||
m_filename = wxGetTempFileName("wxvid");
|
||||
m_paused = FALSE;
|
||||
m_stopped = TRUE;
|
||||
m_frameRate = 1.0;
|
||||
|
||||
wxFileOutputStream temp_file(m_filename);
|
||||
temp_file << str;
|
||||
@@ -60,6 +61,7 @@ wxVideoWindows::wxVideoWindows(const wxString& filename)
|
||||
m_filename = filename;
|
||||
m_paused = FALSE;
|
||||
m_stopped = TRUE;
|
||||
m_frameRate = 1.0;
|
||||
OpenFile();
|
||||
}
|
||||
|
||||
@@ -73,17 +75,41 @@ wxVideoWindows::~wxVideoWindows(void)
|
||||
|
||||
void wxVideoWindows::OpenFile()
|
||||
{
|
||||
MCI_DGV_OPEN_PARMS open_struct;
|
||||
MCI_DGV_OPEN_PARMS openStruct;
|
||||
MCI_DGV_SET_PARMS setStruct;
|
||||
MCI_STATUS_PARMS statusStruct;
|
||||
DWORD ret;
|
||||
|
||||
open_struct.lpstrDeviceType = "avivideo";
|
||||
open_struct.lpstrElementName = (LPSTR)(m_filename.mb_str());
|
||||
open_struct.hWndParent = 0;
|
||||
openStruct.lpstrDeviceType = "avivideo";
|
||||
openStruct.lpstrElementName = (LPSTR)(m_filename.mb_str());
|
||||
openStruct.hWndParent = 0;
|
||||
|
||||
ret = mciSendCommand(0, MCI_OPEN,
|
||||
MCI_OPEN_ELEMENT|MCI_DGV_OPEN_PARENT|MCI_OPEN_TYPE|MCI_DGV_OPEN_32BIT,
|
||||
(DWORD)(LPVOID)&open_struct);
|
||||
m_internal->m_dev_id = open_struct.wDeviceID;
|
||||
(DWORD)(LPVOID)&openStruct);
|
||||
m_internal->m_dev_id = openStruct.wDeviceID;
|
||||
|
||||
|
||||
setStruct.dwCallback = 0;
|
||||
setStruct.dwTimeFormat = MCI_FORMAT_FRAMES;
|
||||
|
||||
ret = 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,
|
||||
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,
|
||||
(DWORD)(LPVOID)&statusStruct);
|
||||
m_bps = statusStruct.dwReturn;
|
||||
|
||||
}
|
||||
|
||||
bool wxVideoWindows::Pause()
|
||||
@@ -91,7 +117,7 @@ bool wxVideoWindows::Pause()
|
||||
if (m_paused || m_stopped)
|
||||
return TRUE;
|
||||
m_paused = TRUE;
|
||||
return (mciSendCommand(m_internal->m_dev_id, MCI_PAUSE, 0, 0) == 0);
|
||||
return (mciSendCommand(m_internal->m_dev_id, MCI_PAUSE, MCI_WAIT, 0) == 0);
|
||||
}
|
||||
|
||||
bool wxVideoWindows::Resume()
|
||||
@@ -114,7 +140,6 @@ bool wxVideoWindows::IsStopped() const
|
||||
|
||||
bool wxVideoWindows::GetSize(wxSize& size) const
|
||||
{
|
||||
// Two random numbers.
|
||||
size.SetWidth(200);
|
||||
size.SetHeight(200);
|
||||
return TRUE;
|
||||
@@ -169,16 +194,17 @@ bool wxVideoWindows::Stop()
|
||||
if (m_stopped)
|
||||
return FALSE;
|
||||
m_stopped = TRUE;
|
||||
if (::mciSendCommand(m_internal->m_dev_id, MCI_STOP, 0, NULL) != 0)
|
||||
if (::mciSendCommand(m_internal->m_dev_id, MCI_STOP, MCI_WAIT, NULL) != 0)
|
||||
return FALSE;
|
||||
|
||||
seekStruct.dwCallback = 0;
|
||||
seekStruct.dwTo = 0;
|
||||
return (::mciSendCommand(m_internal->m_dev_id, MCI_SEEK, 0, (DWORD)(LPVOID)&seekStruct) == 0);
|
||||
return (::mciSendCommand(m_internal->m_dev_id, MCI_SEEK, MCI_SEEK_TO_START|MCI_WAIT, (DWORD)(LPVOID)&seekStruct) == 0);
|
||||
}
|
||||
|
||||
|
||||
// TODO TODO
|
||||
// I hate windows :-(. The doc says MCI_STATUS should return all info I want but when I call it
|
||||
// it returns to me with an UNSUPPORTED_FUNCTION error. I will have to do all by myself. Grrrr !
|
||||
|
||||
wxString wxVideoWindows::GetMovieCodec() const
|
||||
{
|
||||
@@ -202,12 +228,12 @@ wxUint8 wxVideoWindows::GetChannels() const
|
||||
|
||||
wxUint8 wxVideoWindows::GetBPS() const
|
||||
{
|
||||
return 8;
|
||||
return m_bps;
|
||||
}
|
||||
|
||||
double wxVideoWindows::GetFrameRate() const
|
||||
{
|
||||
return 1.0;
|
||||
return m_frameRate;
|
||||
}
|
||||
|
||||
wxUint32 wxVideoWindows::GetNbFrames() const
|
||||
|
||||
Reference in New Issue
Block a user