diff options
author | Armada <jules.blok@gmail.com> | 2013-08-30 15:59:29 +0400 |
---|---|---|
committer | Armada <jules.blok@gmail.com> | 2013-08-31 19:04:02 +0400 |
commit | 15f062e7b1798b12fe6469a1d83a311a50aed02b (patch) | |
tree | 2978a7cf46e9833ddcd411f2c461808ddaf10d10 /src | |
parent | 88030038e60b485543c03b885134cc4408ed90cd (diff) |
MainFrm: Get the source filter from the graph immediately after opening the main file.
Changed all code that depends on the source filter to take advantage of it.
Fixes issues with the wrong source filter being used when multiple source filters are on the graph.
Diffstat (limited to 'src')
-rw-r--r-- | src/mpc-hc/ISDb.cpp | 15 | ||||
-rw-r--r-- | src/mpc-hc/ISDb.h | 2 | ||||
-rw-r--r-- | src/mpc-hc/MainFrm.cpp | 24 | ||||
-rw-r--r-- | src/mpc-hc/MainFrm.h | 1 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoClip.cpp | 18 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoClip.h | 3 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoDetails.cpp | 43 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoDetails.h | 3 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoRes.cpp | 18 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoRes.h | 3 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileInfoSheet.cpp | 8 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileMediaInfo.cpp | 20 | ||||
-rw-r--r-- | src/mpc-hc/PPageFileMediaInfo.h | 3 | ||||
-rw-r--r-- | src/mpc-hc/WebClientSocket.cpp | 37 |
14 files changed, 90 insertions, 108 deletions
diff --git a/src/mpc-hc/ISDb.cpp b/src/mpc-hc/ISDb.cpp index b84b13355..8766a843f 100644 --- a/src/mpc-hc/ISDb.cpp +++ b/src/mpc-hc/ISDb.cpp @@ -28,21 +28,16 @@ namespace ISDb
{
- bool mpc_filehash(IFilterGraph* pFG, filehash& fh)
+ bool mpc_filehash(IFileSourceFilter* pFSF, filehash& fh)
{
- CComQIPtr<IFileSourceFilter> pFSF;
CComQIPtr<IAsyncReader> pAR;
- BeginEnumFilters(pFG, pEF, pBF) {
- if (pFSF = pBF) {
- BeginEnumPins(pBF, pEP, pPin)
- if (pAR = pPin) {
- break;
- }
- EndEnumPins;
+ if (CComQIPtr<IBaseFilter> pBF = pFSF) {
+ BeginEnumPins(pBF, pEP, pPin)
+ if (pAR = pPin) {
break;
}
+ EndEnumPins;
}
- EndEnumFilters;
if (!pAR || !pFSF) {
return false;
diff --git a/src/mpc-hc/ISDb.h b/src/mpc-hc/ISDb.h index b273100fd..4c31566a7 100644 --- a/src/mpc-hc/ISDb.h +++ b/src/mpc-hc/ISDb.h @@ -65,7 +65,7 @@ namespace ISDb UINT64 size, mpc_filehash;
};
- extern bool mpc_filehash(IFilterGraph* pFG, filehash& fh);
+ extern bool mpc_filehash(IFileSourceFilter* pFSF, filehash& fh);
extern bool mpc_filehash(LPCTSTR fn, filehash& fh);
extern void mpc_filehash(CPlaylist& pl, CList<filehash>& fhs);
extern CStringA makeargs(CPlaylist& pl);
diff --git a/src/mpc-hc/MainFrm.cpp b/src/mpc-hc/MainFrm.cpp index 35e4281db..d02b76485 100644 --- a/src/mpc-hc/MainFrm.cpp +++ b/src/mpc-hc/MainFrm.cpp @@ -5408,7 +5408,7 @@ void CMainFrame::OnFileISDBDownload() {
const CAppSettings& s = AfxGetAppSettings();
ISDb::filehash fh;
- if (!ISDb::mpc_filehash(m_pGB, fh)) {
+ if (!ISDb::mpc_filehash(m_pFSF, fh)) {
if (!ISDb::mpc_filehash((CString)m_wndPlaylistBar.GetCurFileName(), fh)) {
MessageBeep((UINT) - 1);
return;
@@ -10594,6 +10594,13 @@ void CMainFrame::OpenFile(OpenFileData* pOFD) if (bMainFile) {
pOFD->title = fn;
+ if (!(m_pFSF = m_pGB)) {
+ BeginEnumFilters(m_pGB, pEF, pBF);
+ if (m_pFSF = pBF) {
+ break;
+ }
+ EndEnumFilters;
+ }
}
bMainFile = false;
@@ -12090,6 +12097,7 @@ void CMainFrame::CloseMediaPrivate() m_pVW.Release();
m_pME.Release();
m_pMC.Release();
+ m_pFSF.Release();
if (m_pGB) {
m_pGB->RemoveFromROT();
@@ -16326,17 +16334,13 @@ CString CMainFrame::GetFileName() {
CPath path(m_wndPlaylistBar.GetCurFileName());
- BeginEnumFilters(m_pGB, pEF, pBF) {
- if (CComQIPtr<IFileSourceFilter> pFSF = pBF) {
- LPOLESTR pFN;
- if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) {
- path = pFN;
- CoTaskMemFree(pFN);
- }
- break;
+ if (m_pFSF) {
+ LPOLESTR pFN;
+ if (SUCCEEDED(m_pFSF->GetCurFile(&pFN, nullptr))) {
+ path = pFN;
+ CoTaskMemFree(pFN);
}
}
- EndEnumFilters;
path.StripPath();
return path;
diff --git a/src/mpc-hc/MainFrm.h b/src/mpc-hc/MainFrm.h index 8ad7c36db..388e23adc 100644 --- a/src/mpc-hc/MainFrm.h +++ b/src/mpc-hc/MainFrm.h @@ -177,6 +177,7 @@ class CMainFrame : public CFrameWnd, public CDropTarget CComQIPtr<IBasicAudio> m_pBA;
CComQIPtr<IMediaSeeking> m_pMS;
CComQIPtr<IVideoFrameStep> m_pFS;
+ CComQIPtr<IFileSourceFilter> m_pFSF;
CComQIPtr<IQualProp, &IID_IQualProp> m_pQP;
CComQIPtr<IBufferInfo> m_pBI;
CComQIPtr<IAMOpenProgress> m_pAMOP;
diff --git a/src/mpc-hc/PPageFileInfoClip.cpp b/src/mpc-hc/PPageFileInfoClip.cpp index 2831f2375..f148c8f0a 100644 --- a/src/mpc-hc/PPageFileInfoClip.cpp +++ b/src/mpc-hc/PPageFileInfoClip.cpp @@ -31,11 +31,12 @@ // CPPageFileInfoClip dialog
IMPLEMENT_DYNAMIC(CPPageFileInfoClip, CPropertyPage)
-CPPageFileInfoClip::CPPageFileInfoClip(CString path, IFilterGraph* pFG)
+CPPageFileInfoClip::CPPageFileInfoClip(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF)
: CPropertyPage(CPPageFileInfoClip::IDD, CPPageFileInfoClip::IDD)
, m_fn(path)
, m_path(path)
, m_pFG(pFG)
+ , m_pFSF(pFSF)
, m_clip(ResStr(IDS_AG_NONE))
, m_author(ResStr(IDS_AG_NONE))
, m_copyright(ResStr(IDS_AG_NONE))
@@ -98,18 +99,13 @@ BOOL CPPageFileInfoClip::OnInitDialog() {
__super::OnInitDialog();
- BeginEnumFilters(m_pFG, pEF, pBF) {
- CComQIPtr<IFileSourceFilter> pFSF = pBF;
- if (pFSF) {
- LPOLESTR pFN;
- if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) {
- m_fn = pFN;
- CoTaskMemFree(pFN);
- }
- break;
+ if (m_pFSF) {
+ LPOLESTR pFN;
+ if (SUCCEEDED(m_pFSF->GetCurFile(&pFN, nullptr))) {
+ m_fn = pFN;
+ CoTaskMemFree(pFN);
}
}
- EndEnumFilters;
if (m_path.IsEmpty()) {
m_path = m_fn;
diff --git a/src/mpc-hc/PPageFileInfoClip.h b/src/mpc-hc/PPageFileInfoClip.h index aa3da4203..6e94e7023 100644 --- a/src/mpc-hc/PPageFileInfoClip.h +++ b/src/mpc-hc/PPageFileInfoClip.h @@ -32,12 +32,13 @@ class CPPageFileInfoClip : public CPropertyPage private:
CComPtr<IFilterGraph> m_pFG;
+ CComPtr<IFileSourceFilter> m_pFSF;
HICON m_hIcon;
CToolTipCtrl m_tooltip;
public:
- CPPageFileInfoClip(CString path, IFilterGraph* pFG);
+ CPPageFileInfoClip(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF);
virtual ~CPPageFileInfoClip();
// Dialog Data
diff --git a/src/mpc-hc/PPageFileInfoDetails.cpp b/src/mpc-hc/PPageFileInfoDetails.cpp index 19a8a2123..7761f71d0 100644 --- a/src/mpc-hc/PPageFileInfoDetails.cpp +++ b/src/mpc-hc/PPageFileInfoDetails.cpp @@ -33,12 +33,13 @@ // CPPageFileInfoDetails dialog
IMPLEMENT_DYNAMIC(CPPageFileInfoDetails, CPropertyPage)
-CPPageFileInfoDetails::CPPageFileInfoDetails(CString path, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP)
+CPPageFileInfoDetails::CPPageFileInfoDetails(CString path, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP, IFileSourceFilter* pFSF)
: CPropertyPage(CPPageFileInfoDetails::IDD, CPPageFileInfoDetails::IDD)
, m_fn(path)
, m_path(path)
, m_pFG(pFG)
, m_pCAP(pCAP)
+ , m_pFSF(pFSF)
, m_hIcon(nullptr)
, m_type(ResStr(IDS_AG_NOT_KNOWN))
, m_size(ResStr(IDS_AG_NOT_KNOWN))
@@ -106,29 +107,13 @@ BOOL CPPageFileInfoDetails::OnInitDialog() {
__super::OnInitDialog();
- __int64 size = 0;
- CComQIPtr<IFileSourceFilter> pFSF;
- BeginEnumFilters(m_pFG, pEF, pBF) {
- if (pFSF = pBF) {
- LPOLESTR pFN;
- if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) {
- m_fn = pFN;
- CoTaskMemFree(pFN);
- }
- BeginEnumPins(pBF, pEP, pPin) {
- if (CComQIPtr<IAsyncReader> pAR = pPin) {
- LONGLONG total, available;
- if (SUCCEEDED(pAR->Length(&total, &available))) {
- size = total;
- }
- break;
- }
- }
- EndEnumPins;
- break;
+ if (m_pFSF) {
+ LPOLESTR pFN;
+ if (SUCCEEDED(m_pFSF->GetCurFile(&pFN, nullptr))) {
+ m_fn = pFN;
+ CoTaskMemFree(pFN);
}
}
- EndEnumFilters;
if (m_path.IsEmpty()) {
m_path = m_fn;
@@ -167,6 +152,20 @@ BOOL CPPageFileInfoDetails::OnInitDialog() }
}
+ __int64 size = 0;
+ if (CComQIPtr<IBaseFilter> pBF = m_pFSF) {
+ BeginEnumPins(pBF, pEP, pPin) {
+ if (CComQIPtr<IAsyncReader> pAR = pPin) {
+ LONGLONG total, available;
+ if (SUCCEEDED(pAR->Length(&total, &available))) {
+ size = total;
+ }
+ break;
+ }
+ }
+ EndEnumPins;
+ }
+
WIN32_FIND_DATA wfd;
HANDLE hFind = FindFirstFile(m_path, &wfd);
if (hFind != INVALID_HANDLE_VALUE) {
diff --git a/src/mpc-hc/PPageFileInfoDetails.h b/src/mpc-hc/PPageFileInfoDetails.h index 4509b0621..3d8890939 100644 --- a/src/mpc-hc/PPageFileInfoDetails.h +++ b/src/mpc-hc/PPageFileInfoDetails.h @@ -33,6 +33,7 @@ class CPPageFileInfoDetails : public CPropertyPage private:
CComPtr<IFilterGraph> m_pFG;
+ CComPtr<IFileSourceFilter> m_pFSF;
CComPtr<ISubPicAllocatorPresenter> m_pCAP;
HICON m_hIcon;
@@ -40,7 +41,7 @@ private: void InitEncoding();
public:
- CPPageFileInfoDetails(CString path, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP);
+ CPPageFileInfoDetails(CString path, IFilterGraph* pFG, ISubPicAllocatorPresenter* pCAP, IFileSourceFilter* pFSF);
virtual ~CPPageFileInfoDetails();
// Dialog Data
diff --git a/src/mpc-hc/PPageFileInfoRes.cpp b/src/mpc-hc/PPageFileInfoRes.cpp index 38f8ebc41..e20f7c3a1 100644 --- a/src/mpc-hc/PPageFileInfoRes.cpp +++ b/src/mpc-hc/PPageFileInfoRes.cpp @@ -27,11 +27,12 @@ // CPPageFileInfoRes dialog IMPLEMENT_DYNAMIC(CPPageFileInfoRes, CPPageBase) -CPPageFileInfoRes::CPPageFileInfoRes(CString path, IFilterGraph* pFG) +CPPageFileInfoRes::CPPageFileInfoRes(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF) : CPPageBase(CPPageFileInfoRes::IDD, CPPageFileInfoRes::IDD) , m_fn(path) , m_hIcon(nullptr) , m_pFG(pFG) + , m_pFSF(pFSF) { } @@ -62,18 +63,13 @@ BOOL CPPageFileInfoRes::OnInitDialog() { __super::OnInitDialog(); - CComQIPtr<IFileSourceFilter> pFSF; - BeginEnumFilters(m_pFG, pEF, pBF) { - if (pFSF = pBF) { - LPOLESTR pFN = nullptr; - if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) { - m_fn = pFN; - CoTaskMemFree(pFN); - } - break; + if (m_pFSF) { + LPOLESTR pFN = nullptr; + if (SUCCEEDED(m_pFSF->GetCurFile(&pFN, nullptr))) { + m_fn = pFN; + CoTaskMemFree(pFN); } } - EndEnumFilters; m_hIcon = LoadIcon(m_fn, false); if (m_hIcon) { diff --git a/src/mpc-hc/PPageFileInfoRes.h b/src/mpc-hc/PPageFileInfoRes.h index d496d1eba..f1c08d2b2 100644 --- a/src/mpc-hc/PPageFileInfoRes.h +++ b/src/mpc-hc/PPageFileInfoRes.h @@ -35,11 +35,12 @@ class CPPageFileInfoRes : public CPPageBase private: CComPtr<IFilterGraph> m_pFG; + CComPtr<IFileSourceFilter> m_pFSF; HICON m_hIcon; CAtlList<CDSMResource> m_res; public: - CPPageFileInfoRes(CString path, IFilterGraph* pFG); // standard constructor + CPPageFileInfoRes(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF); // standard constructor virtual ~CPPageFileInfoRes(); // Dialog Data diff --git a/src/mpc-hc/PPageFileInfoSheet.cpp b/src/mpc-hc/PPageFileInfoSheet.cpp index 658618216..a3b5cddf4 100644 --- a/src/mpc-hc/PPageFileInfoSheet.cpp +++ b/src/mpc-hc/PPageFileInfoSheet.cpp @@ -31,10 +31,10 @@ IMPLEMENT_DYNAMIC(CPPageFileInfoSheet, CPropertySheet)
CPPageFileInfoSheet::CPPageFileInfoSheet(CString path, CMainFrame* pMainFrame, CWnd* pParentWnd)
: CPropertySheet(ResStr(IDS_PROPSHEET_PROPERTIES), pParentWnd, 0)
- , m_clip(path, pMainFrame->m_pGB)
- , m_details(path, pMainFrame->m_pGB, pMainFrame->m_pCAP)
- , m_res(path, pMainFrame->m_pGB)
- , m_mi(path, pMainFrame->m_pGB)
+ , m_clip(path, pMainFrame->m_pGB, pMainFrame->m_pFSF)
+ , m_details(path, pMainFrame->m_pGB, pMainFrame->m_pCAP, pMainFrame->m_pFSF)
+ , m_res(path, pMainFrame->m_pGB, pMainFrame->m_pFSF)
+ , m_mi(path, pMainFrame->m_pGB, pMainFrame->m_pFSF)
, m_path(path)
{
AddPage(&m_details);
diff --git a/src/mpc-hc/PPageFileMediaInfo.cpp b/src/mpc-hc/PPageFileMediaInfo.cpp index 23ebf35c1..2afcd2fa2 100644 --- a/src/mpc-hc/PPageFileMediaInfo.cpp +++ b/src/mpc-hc/PPageFileMediaInfo.cpp @@ -40,11 +40,12 @@ using namespace MediaInfoDLL; // CPPageFileMediaInfo dialog
IMPLEMENT_DYNAMIC(CPPageFileMediaInfo, CPropertyPage)
-CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFilterGraph* pFG)
+CPPageFileMediaInfo::CPPageFileMediaInfo(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF)
: CPropertyPage(CPPageFileMediaInfo::IDD, CPPageFileMediaInfo::IDD)
, m_fn(path)
, m_path(path)
, m_pFG(pFG)
+ , m_pFSF(pFSF)
, m_pCFont(nullptr)
{
}
@@ -95,23 +96,22 @@ BOOL CPPageFileMediaInfo::OnInitDialog() }
CComQIPtr<IAsyncReader> pAR;
- BeginEnumFilters(m_pFG, pEF, pBF) {
- if (CComQIPtr<IFileSourceFilter> pFSF = pBF) {
- LPOLESTR pFN;
- if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) {
- m_fn = pFN;
- CoTaskMemFree(pFN);
- }
+ if (m_pFSF) {
+ LPOLESTR pFN;
+ if (SUCCEEDED(m_pFSF->GetCurFile(&pFN, nullptr))) {
+ m_fn = pFN;
+ CoTaskMemFree(pFN);
+ }
+
+ if (CComQIPtr<IBaseFilter> pBF = m_pFSF) {
BeginEnumPins(pBF, pEP, pPin) {
if (pAR = pPin) {
break;
}
}
EndEnumPins;
- break;
}
}
- EndEnumFilters;
if (m_path.IsEmpty()) {
m_path = m_fn;
diff --git a/src/mpc-hc/PPageFileMediaInfo.h b/src/mpc-hc/PPageFileMediaInfo.h index 5c3739d90..abaac6c71 100644 --- a/src/mpc-hc/PPageFileMediaInfo.h +++ b/src/mpc-hc/PPageFileMediaInfo.h @@ -28,9 +28,10 @@ class CPPageFileMediaInfo : public CPropertyPage private:
CComPtr<IFilterGraph> m_pFG;
+ CComPtr<IFileSourceFilter> m_pFSF;
public:
- CPPageFileMediaInfo(CString path, IFilterGraph* pFG);
+ CPPageFileMediaInfo(CString path, IFilterGraph* pFG, IFileSourceFilter* pFSF);
virtual ~CPPageFileMediaInfo();
// Dialog Data
diff --git a/src/mpc-hc/WebClientSocket.cpp b/src/mpc-hc/WebClientSocket.cpp index d4f1bf2bb..cc9ff4279 100644 --- a/src/mpc-hc/WebClientSocket.cpp +++ b/src/mpc-hc/WebClientSocket.cpp @@ -444,43 +444,30 @@ bool CWebClientSocket::OnInfo(CStringA& hdr, CStringA& body, CStringA& mime) int pos = (int)(m_pMainFrame->GetPos() / 10000);
int dur = (int)(m_pMainFrame->GetDur() / 10000);
- CString positionstring, durationstring, versionstring, sizestring;
+ CString positionstring, durationstring, versionstring, sizestring, file;
versionstring.Format(L"%s", AfxGetMyApp()->m_strVersion);
positionstring.Format(_T("%02d:%02d:%02d"), (pos / 3600000), (pos / 60000) % 60, (pos / 1000) % 60);
durationstring.Format(_T("%02d:%02d:%02d"), (dur / 3600000), (dur / 60000) % 60, (dur / 1000) % 60);
+ file = m_pMainFrame->GetFileName();
+
__int64 size = 0;
- CPath path(m_pMainFrame->m_wndPlaylistBar.GetCurFileName());
- CPath file(path);
- CComQIPtr<IFileSourceFilter> pFSF;
- BeginEnumFilters(m_pMainFrame->m_pGB, pEF, pBF) {
- if (pFSF = pBF) {
- LPOLESTR pFN;
- if (SUCCEEDED(pFSF->GetCurFile(&pFN, nullptr))) {
- file = pFN;
- CoTaskMemFree(pFN);
- }
- BeginEnumPins(pBF, pEP, pPin) {
- if (CComQIPtr<IAsyncReader> pAR = pPin) {
- LONGLONG total, available;
- pAR->Length(&total, &available);
- size = total;
- break;
- }
+ if (CComQIPtr<IBaseFilter> pBF = m_pMainFrame->m_pFSF) {
+ BeginEnumPins(pBF, pEP, pPin) {
+ if (CComQIPtr<IAsyncReader> pAR = pPin) {
+ LONGLONG total, available;
+ pAR->Length(&total, &available);
+ size = total;
+ break;
}
- EndEnumPins;
- break;
}
+ EndEnumPins;
}
- EndEnumFilters;
-
- file.StripPath();
- file.RemoveExtension();
if (size == 0) {
WIN32_FIND_DATA wfd;
- HANDLE hFind = FindFirstFile(path, &wfd);
+ HANDLE hFind = FindFirstFile(m_pMainFrame->m_wndPlaylistBar.GetCurFileName(), &wfd);
if (hFind != INVALID_HANDLE_VALUE) {
FindClose(hFind);
size = (__int64(wfd.nFileSizeHigh) << 32) | wfd.nFileSizeLow;
|