Fixed the capture video functionality of GSDX. Let's hope I'll make bositman happy with this. :D

It was a series of very old bug. 
1) After the passage to the WX system the CoInitialize was not anymore called on the GS thread causing the Filter enumeration on DirectShow to fail.
2) After the "MFC Free" commit of Gabest, if you selected the Uncompressed functionality a nullpointer exception trigger (as there is no filter for that)
3) Strangely there was no code path to connect the source with the mux when Uncompressed was selected (without an encoder in the middle). I added it.
Test it and report problem. I already know there is a problem with the closing of the sound recording, but that's a PCSX2 problem, not a GSDX one.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2657 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
feal87 2010-03-02 12:55:26 +00:00
parent e0b9f75a3c
commit ea385c4da8
2 changed files with 29 additions and 11 deletions

View File

@ -434,16 +434,26 @@ bool GSCapture::BeginCapture(int fps)
m_src = new GSSource(m_size.x, m_size.y, fps, NULL, hr);
if(FAILED(hr = m_graph->AddFilter(m_src, L"Source"))
|| FAILED(hr = m_graph->AddFilter(dlg.m_enc, L"Encoder")))
if (dlg.m_enc==0)
{
return false;
if (FAILED(hr = m_graph->AddFilter(m_src, L"Source")))
return false;
if (FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
return false;
}
if(FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(dlg.m_enc, PINDIR_INPUT), NULL))
|| FAILED(hr = m_graph->ConnectDirect(GetFirstPin(dlg.m_enc, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
else
{
return false;
if(FAILED(hr = m_graph->AddFilter(m_src, L"Source"))
|| FAILED(hr = m_graph->AddFilter(dlg.m_enc, L"Encoder")))
{
return false;
}
if(FAILED(hr = m_graph->ConnectDirect(GetFirstPin(m_src, PINDIR_OUTPUT), GetFirstPin(dlg.m_enc, PINDIR_INPUT), NULL))
|| FAILED(hr = m_graph->ConnectDirect(GetFirstPin(dlg.m_enc, PINDIR_OUTPUT), GetFirstPin(mux, PINDIR_INPUT), NULL)))
{
return false;
}
}
BeginEnumFilters(m_graph, pEF, pBF)

View File

@ -68,6 +68,7 @@ void GSCaptureDlg::OnInit()
ComboBoxAppend(IDC_CODECS, "Uncompressed", 0, true);
CoInitialize(0);
BeginEnumSysDev(CLSID_VideoCompressorCategory, moniker)
{
Codec c;
@ -179,7 +180,8 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
Codec c;
if(GetSelCodec(c) == 0)
int ris = GetSelCodec(c);
if(ris == 0)
{
return false;
}
@ -190,9 +192,15 @@ bool GSCaptureDlg::OnCommand(HWND hWnd, UINT id, UINT code)
theApp.SetConfig("CaptureHeight", m_height);
theApp.SetConfig("CaptureFileName", m_filename.c_str());
wstring s = wstring(c.DisplayName.m_str);
theApp.SetConfig("CaptureVideoCodecDisplayName", string(s.begin(), s.end()).c_str());
if (ris != 2)
{
wstring s = wstring(c.DisplayName.m_str);
theApp.SetConfig("CaptureVideoCodecDisplayName", string(s.begin(), s.end()).c_str());
}
else
{
theApp.SetConfig("CaptureVideoCodecDisplayName", "");
}
}
return __super::OnCommand(hWnd, id, code);