[Opalvoip-svn] SF.net SVN: opalvoip:[26491] opal/trunk/samples/openphone
Brought to you by:
csoutheren,
rjongbloed
From: <rjo...@us...> - 2011-09-28 04:48:58
|
Revision: 26491 http://opalvoip.svn.sourceforge.net/opalvoip/?rev=26491&view=rev Author: rjongbloed Date: 2011-09-28 04:48:52 +0000 (Wed, 28 Sep 2011) Log Message: ----------- Changed OpenPhone so if use *.yuv in the video grabber selection drop down box, it pops up a file selection dialog to select a specific file and sets the selection to that file. Modified Paths: -------------- opal/trunk/samples/openphone/main.cxx opal/trunk/samples/openphone/main.h opal/trunk/samples/openphone/openphone.wxg opal/trunk/samples/openphone/openphone.xrc Modified: opal/trunk/samples/openphone/main.cxx =================================================================== --- opal/trunk/samples/openphone/main.cxx 2011-09-27 11:19:41 UTC (rev 26490) +++ opal/trunk/samples/openphone/main.cxx 2011-09-28 04:48:52 UTC (rev 26491) @@ -173,7 +173,7 @@ DEF_FIELD(DisableDetectInBandDTMF); static const wxChar VideoGroup[] = wxT("/Video"); -DEF_FIELD(VideoGrabber); +DEF_FIELD(VideoGrabDevice); DEF_FIELD(VideoGrabFormat); DEF_FIELD(VideoGrabSource); DEF_FIELD(VideoGrabFrameRate); @@ -935,7 +935,7 @@ // Video fields config->SetPath(VideoGroup); PVideoDevice::OpenArgs videoArgs = GetVideoInputDevice(); - if (config->Read(VideoGrabberKey, &str)) + if (config->Read(VideoGrabDeviceKey, &str)) videoArgs.deviceName = str.p_str(); if (config->Read(VideoGrabFormatKey, &value1) && value1 >= 0 && value1 < PVideoDevice::NumVideoFormats) videoArgs.videoFormat = (PVideoDevice::VideoFormat)value1; @@ -3620,7 +3620,7 @@ //////////////////////////////////////// // Video fields - EVT_COMBOBOX(XRCID("VideoGrabber"), OptionsDialog::ChangeVideoGrabber) + EVT_COMBOBOX(XRCID("VideoGrabDevice"), OptionsDialog::ChangeVideoGrabDevice) EVT_BUTTON(XRCID("TestVideoCapture"), OptionsDialog::TestVideoCapture) //////////////////////////////////////// @@ -3873,7 +3873,7 @@ //////////////////////////////////////// // Video fields - INIT_FIELD(VideoGrabber, m_manager.GetVideoInputDevice().deviceName); + INIT_FIELD(VideoGrabDevice, m_manager.GetVideoInputDevice().deviceName); INIT_FIELD(VideoGrabFormat, m_manager.GetVideoInputDevice().videoFormat); m_videoSourceChoice = FindWindowByNameAs<wxChoice>(this, wxT("VideoGrabSource")); m_VideoGrabSource = m_manager.GetVideoInputDevice().channelNumber+1; @@ -3906,12 +3906,12 @@ for (i = 0; i < knownSizes.GetSize(); ++i) combo->Append(PwxString(knownSizes[i])); - m_videoGrabDevice = FindWindowByNameAs<wxComboBox>(this, wxT("VideoGrabber")); + m_videoGrabDeviceCombo = FindWindowByNameAs<wxComboBox>(this, wxT("VideoGrabDevice")); devices = PVideoInputDevice::GetDriversDeviceNames("*"); for (i = 0; i < devices.GetSize(); i++) - m_videoGrabDevice->Append(PwxString(devices[i])); + m_videoGrabDeviceCombo->Append(PwxString(devices[i])); - AdjustVideoControls(m_VideoGrabber); + AdjustVideoControls(m_VideoGrabDevice); //////////////////////////////////////// // Fax fields @@ -4321,7 +4321,7 @@ // Video fields config->SetPath(VideoGroup); PVideoDevice::OpenArgs grabber = m_manager.GetVideoInputDevice(); - SAVE_FIELD_STR(VideoGrabber, grabber.deviceName = ); + SAVE_FIELD_STR(VideoGrabDevice, grabber.deviceName = ); SAVE_FIELD(VideoGrabFormat, grabber.videoFormat = (PVideoDevice::VideoFormat)); --m_VideoGrabSource; SAVE_FIELD(VideoGrabSource, grabber.channelNumber = ); @@ -4792,8 +4792,23 @@ //////////////////////////////////////// // Video fields -void OptionsDialog::AdjustVideoControls(const PwxString & device) +void OptionsDialog::AdjustVideoControls(const PwxString & newDevice) { + PwxString device = newDevice; + if (newDevice[0] == '*') { + device = wxFileSelector(wxT("Select Video File"), + wxT(""), + wxT(""), + device.Mid(1), + device, + wxFD_OPEN|wxFD_FILE_MUST_EXIST); + if (device.empty()) + device = m_VideoGrabDevice; // Restore original text + + // For some bizarre reason SetValue() just does not work for Windows + m_videoGrabDeviceCombo->SetSelection(m_videoGrabDeviceCombo->Append(device)); + } + unsigned numChannels = 1; PVideoInputDevice * grabber = PVideoInputDevice::CreateDeviceByName(device); if (grabber != NULL) { @@ -4808,9 +4823,9 @@ } -void OptionsDialog::ChangeVideoGrabber(wxCommandEvent & /*event*/) +void OptionsDialog::ChangeVideoGrabDevice(wxCommandEvent & /*event*/) { - AdjustVideoControls(m_videoGrabDevice->GetValue()); + AdjustVideoControls(m_videoGrabDeviceCombo->GetValue()); } @@ -4820,7 +4835,7 @@ return; PVideoDevice::OpenArgs grabberArgs; - grabberArgs.deviceName = m_VideoGrabber.mb_str(wxConvUTF8); + grabberArgs.deviceName = m_VideoGrabDevice.mb_str(wxConvUTF8); grabberArgs.videoFormat = (PVideoDevice::VideoFormat)m_VideoGrabFormat; grabberArgs.channelNumber = m_VideoGrabSource-1; grabberArgs.rate = m_VideoGrabFrameRate; @@ -5665,7 +5680,7 @@ { wxXmlResource::Get()->LoadDialog(this, manager, wxT("StartVideoDialog")); - wxComboBox * combo = FindWindowByNameAs<wxComboBox>(this, wxT("VideoGrabber")); + wxComboBox * combo = FindWindowByNameAs<wxComboBox>(this, wxT("VideoGrabDevice")); PStringArray devices = PVideoInputDevice::GetDriversDeviceNames("*"); for (PINDEX i = 0; i < devices.GetSize(); i++) combo->Append(PwxString(devices[i])); Modified: opal/trunk/samples/openphone/main.h =================================================================== --- opal/trunk/samples/openphone/main.h 2011-09-27 11:19:41 UTC (rev 26490) +++ opal/trunk/samples/openphone/main.h 2011-09-28 04:48:52 UTC (rev 26491) @@ -637,7 +637,7 @@ //////////////////////////////////////// // Video fields - PwxString m_VideoGrabber; + PwxString m_VideoGrabDevice; int m_VideoGrabFormat; int m_VideoGrabSource; int m_VideoGrabFrameRate; @@ -652,11 +652,11 @@ int m_VideoGrabBitRate; int m_VideoMaxBitRate; - wxComboBox * m_videoGrabDevice; + wxComboBox * m_videoGrabDeviceCombo; wxChoice * m_videoSourceChoice; void AdjustVideoControls(const PwxString & device); - void ChangeVideoGrabber(wxCommandEvent & event); + void ChangeVideoGrabDevice(wxCommandEvent & event); void TestVideoCapture(wxCommandEvent & event); //////////////////////////////////////// Modified: opal/trunk/samples/openphone/openphone.wxg =================================================================== --- opal/trunk/samples/openphone/openphone.wxg 2011-09-27 11:19:41 UTC (rev 26490) +++ opal/trunk/samples/openphone/openphone.wxg 2011-09-28 04:48:52 UTC (rev 26491) @@ -1435,7 +1435,7 @@ <flag>wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL</flag> <border>12</border> <option>1</option> - <object class="wxComboBox" name="VideoGrabber" base="EditComboBox"> + <object class="wxComboBox" name="VideoGrabDevice" base="EditComboBox"> <style>wxCB_DROPDOWN</style> <selection>-1</selection> <choices> @@ -6107,7 +6107,7 @@ <flag>wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL</flag> <border>16</border> <option>0</option> - <object class="wxComboBox" name="VideoGrabber" base="EditComboBox"> + <object class="wxComboBox" name="VideoGrabDevice" base="EditComboBox"> <selection>-1</selection> <choices> </choices> Modified: opal/trunk/samples/openphone/openphone.xrc =================================================================== --- opal/trunk/samples/openphone/openphone.xrc 2011-09-27 11:19:41 UTC (rev 26490) +++ opal/trunk/samples/openphone/openphone.xrc 2011-09-28 04:48:52 UTC (rev 26491) @@ -3044,7 +3044,7 @@ <option>1</option> <flag>wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL</flag> <border>12</border> - <object class="wxComboBox" name="VideoGrabber"> + <object class="wxComboBox" name="VideoGrabDevice"> <style>wxCB_DROPDOWN</style> <selection>-1</selection> <content> @@ -4789,7 +4789,7 @@ <object class="sizeritem"> <flag>wxLEFT|wxRIGHT|wxTOP|wxEXPAND|wxALIGN_CENTER_VERTICAL</flag> <border>16</border> - <object class="wxComboBox" name="VideoGrabber"> + <object class="wxComboBox" name="VideoGrabDevice"> <selection>-1</selection> <content> </content> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |