diff options
author | Underground78 <underground78@users.sourceforge.net> | 2013-10-05 22:42:41 +0400 |
---|---|---|
committer | Underground78 <underground78@users.sourceforge.net> | 2013-10-06 16:40:13 +0400 |
commit | c67a85e79b957ca91cb82d038efb62023488855a (patch) | |
tree | ed3f0e7c3890ad3971a893db1cbd195e11bbe706 /src | |
parent | 8d3eb94128764e5ebe5d9aaad8e1797dbd2817af (diff) |
Populate the capture bar only when opening Capture mode.
Buggy systems tend to crash when listing the available codecs for the capture bar. With this commit buggy systems will still be buggy but MPC-HC won't crash unless the user really starts capture mode.
This commit fixes #3523 #3533 #3551.
Diffstat (limited to 'src')
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 2 | ||||
-rw-r--r-- | src/mpc-hc/PlayerCaptureBar.cpp | 7 | ||||
-rw-r--r-- | src/mpc-hc/PlayerCaptureBar.h | 8 | ||||
-rw-r--r-- | src/mpc-hc/PlayerCaptureDialog.cpp | 84 | ||||
-rw-r--r-- | src/mpc-hc/PlayerCaptureDialog.h | 4 |
5 files changed, 63 insertions, 42 deletions
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 304c333e0..e0eedf3f7 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -10912,6 +10912,8 @@ HRESULT CMainFrame::OpenBDAGraph() void CMainFrame::OpenCapture(OpenDeviceData* pODD)
{
+ m_wndCaptureBar.InitControls();
+
CStringW vidfrname, audfrname;
CComPtr<IBaseFilter> pVidCapTmp, pAudCapTmp;
diff --git a/src/mpc-hc/PlayerCaptureBar.cpp b/src/mpc-hc/PlayerCaptureBar.cpp index 469564b51..4900c4872 100644 --- a/src/mpc-hc/PlayerCaptureBar.cpp +++ b/src/mpc-hc/PlayerCaptureBar.cpp @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -56,6 +56,11 @@ BOOL CPlayerCaptureBar::Create(CWnd* pParentWnd, UINT defDockBarID) return TRUE;
}
+void CPlayerCaptureBar::InitControls()
+{
+ m_capdlg.InitControls();
+}
+
BOOL CPlayerCaptureBar::PreTranslateMessage(MSG* pMsg)
{
if (IsWindow(pMsg->hwnd) && IsVisible() && pMsg->message >= WM_KEYFIRST && pMsg->message <= WM_KEYLAST) {
diff --git a/src/mpc-hc/PlayerCaptureBar.h b/src/mpc-hc/PlayerCaptureBar.h index f95caed5d..277154c74 100644 --- a/src/mpc-hc/PlayerCaptureBar.h +++ b/src/mpc-hc/PlayerCaptureBar.h @@ -1,6 +1,6 @@ /*
* (C) 2003-2006 Gabest
- * (C) 2006-2012 see Authors.txt
+ * (C) 2006-2013 see Authors.txt
*
* This file is part of MPC-HC.
*
@@ -31,13 +31,13 @@ class CPlayerCaptureBar : public CPlayerBar DECLARE_DYNAMIC(CPlayerCaptureBar)
public:
+ CPlayerCaptureDialog m_capdlg;
+
CPlayerCaptureBar();
virtual ~CPlayerCaptureBar();
BOOL Create(CWnd* pParentWnd, UINT defDockBarID);
-
-public:
- CPlayerCaptureDialog m_capdlg;
+ void InitControls();
protected:
virtual BOOL PreTranslateMessage(MSG* pMsg);
diff --git a/src/mpc-hc/PlayerCaptureDialog.cpp b/src/mpc-hc/PlayerCaptureDialog.cpp index b092d286a..b1aca1a8b 100644 --- a/src/mpc-hc/PlayerCaptureDialog.cpp +++ b/src/mpc-hc/PlayerCaptureDialog.cpp @@ -523,6 +523,7 @@ static int ShowPPage(CAtlArray<Codec>& codecs, const CComboBox& box, HWND hWnd = //IMPLEMENT_DYNAMIC(CPlayerCaptureDialog, CResizableDialog)
CPlayerCaptureDialog::CPlayerCaptureDialog()
: CResizableDialog(CPlayerCaptureDialog::IDD, nullptr)
+ , m_bInitialized(false)
, m_vidfps(0)
, m_file(_T(""))
, m_fVidOutput(TRUE)
@@ -609,6 +610,42 @@ BOOL CPlayerCaptureDialog::PreTranslateMessage(MSG* pMsg) return __super::PreTranslateMessage(pMsg);
}
+void CPlayerCaptureDialog::InitControls()
+{
+ if (!m_bInitialized) {
+ m_bInitialized = true;
+
+ InitCodecList(m_pVidEncArray, m_vidcodec, CLSID_VideoCompressorCategory);
+ UpdateVideoCodec();
+
+ InitCodecList(m_pAudEncArray, m_audcodec, CLSID_AudioCompressorCategory);
+ UpdateAudioCodec();
+
+ m_fEnableOgm = IsCLSIDRegistered(CLSID_OggMux);
+
+ m_nVidBuffers = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidBuffers"), 50);
+ m_nAudBuffers = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudBuffers"), 50);
+ m_fVidOutput = !!AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidOutput"), TRUE);
+ m_fAudOutput = !!AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudOutput"), TRUE);
+ m_fVidPreview = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidPreview"), TRUE);
+ m_fAudPreview = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudPreview"), TRUE);
+ m_muxtype = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("FileFormat"), 0);
+ m_file = AfxGetApp()->GetProfileString(IDS_R_CAPTURE, _T("FileName"), _T(""));
+ m_fSepAudio = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("SepAudio"), TRUE);
+
+ m_muxctrl.AddString(_T("AVI"));
+ m_muxctrl.AddString(_T("Ogg Media"));
+ m_muxctrl.AddString(_T("Matroska"));
+ m_muxctrl.AddString(_T("DirectShow Media"));
+
+ // UpdateMuxer();
+
+ UpdateData(FALSE);
+
+ OnCbnSelchangeCombo14();
+ }
+}
+
void CPlayerCaptureDialog::EmptyVideo()
{
// first save channel from previous session
@@ -1306,50 +1343,23 @@ BOOL CPlayerCaptureDialog::OnInitDialog() {
__super::OnInitDialog();
- InitCodecList(m_pVidEncArray, m_vidcodec, CLSID_VideoCompressorCategory);
- UpdateVideoCodec();
-
- InitCodecList(m_pAudEncArray, m_audcodec, CLSID_AudioCompressorCategory);
- UpdateAudioCodec();
-
- m_fEnableOgm = IsCLSIDRegistered(CLSID_OggMux);
-
- m_nVidBuffers = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidBuffers"), 50);
- m_nAudBuffers = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudBuffers"), 50);
- m_fVidOutput = !!AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidOutput"), TRUE);
- m_fAudOutput = !!AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudOutput"), TRUE);
- m_fVidPreview = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("VidPreview"), TRUE);
- m_fAudPreview = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("AudPreview"), TRUE);
- m_muxtype = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("FileFormat"), 0);
- m_file = AfxGetApp()->GetProfileString(IDS_R_CAPTURE, _T("FileName"), _T(""));
- m_fSepAudio = AfxGetApp()->GetProfileInt(IDS_R_CAPTURE, _T("SepAudio"), TRUE);
-
- m_muxctrl.AddString(_T("AVI"));
- m_muxctrl.AddString(_T("Ogg Media"));
- m_muxctrl.AddString(_T("Matroska"));
- m_muxctrl.AddString(_T("DirectShow Media"));
-
- // UpdateMuxer();
-
- UpdateData(FALSE);
-
- OnCbnSelchangeCombo14();
-
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CPlayerCaptureDialog::OnDestroy()
{
- UpdateData();
+ if (m_bInitialized) {
+ UpdateData();
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("VidOutput"), m_fVidOutput);
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("AudOutput"), m_fAudOutput);
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("VidPreview"), m_fVidPreview);
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("AudPreview"), m_fAudPreview);
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("FileFormat"), m_muxtype);
- AfxGetApp()->WriteProfileString(IDS_R_CAPTURE, _T("FileName"), m_file);
- AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("SepAudio"), m_fSepAudio);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("VidOutput"), m_fVidOutput);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("AudOutput"), m_fAudOutput);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("VidPreview"), m_fVidPreview);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("AudPreview"), m_fAudPreview);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("FileFormat"), m_muxtype);
+ AfxGetApp()->WriteProfileString(IDS_R_CAPTURE, _T("FileName"), m_file);
+ AfxGetApp()->WriteProfileInt(IDS_R_CAPTURE, _T("SepAudio"), m_fSepAudio);
+ }
__super::OnDestroy();
}
diff --git a/src/mpc-hc/PlayerCaptureDialog.h b/src/mpc-hc/PlayerCaptureDialog.h index 4f8e85e4f..27d820c1c 100644 --- a/src/mpc-hc/PlayerCaptureDialog.h +++ b/src/mpc-hc/PlayerCaptureDialog.h @@ -356,6 +356,8 @@ class CPlayerCaptureDialog : public CResizableDialog //CDialog {
//DECLARE_DYNAMIC(CPlayerCaptureDialog)
+ bool m_bInitialized;
+
// video input
CStringW m_VidDisplayName;
CComPtr<IAMStreamConfig> m_pAMVSC;
@@ -445,6 +447,8 @@ public: CComPtr<IBaseFilter> m_pVidBuffer, m_pAudBuffer;
public:
+ void InitControls();
+
void SetupVideoControls(CStringW DisplayName, IAMStreamConfig* pAMSC, IAMCrossbar* pAMXB, IAMTVTuner* pAMTuner);
void SetupVideoControls(CStringW DisplayName, IAMStreamConfig* pAMSC, IAMVfwCaptureDialogs* pAMVfwCD);
void SetupAudioControls(CStringW DisplayName, IAMStreamConfig* pAMSC, const CInterfaceArray<IAMAudioInputMixer>& pAMAIM);
|