Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/mpc-hc.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCasimir666 <casimir666@users.sourceforge.net>2009-12-05 11:27:07 +0300
committerCasimir666 <casimir666@users.sourceforge.net>2009-12-05 11:27:07 +0300
commit124f69849a8a917deea6543eeae21f6464d15a7f (patch)
tree6182d0571cf19fa0719244cf0eedf37963993478 /src/apps/mplayerc/FGManagerBDA.h
parent7ee261016254b880b83f50488392d07cf3739f17 (diff)
Added : BDA capture card support (experimental)
git-svn-id: https://mpc-hc.svn.sourceforge.net/svnroot/mpc-hc/trunk@1383 10f7b99b-c216-0410-bff0-8a66a9350fd8
Diffstat (limited to 'src/apps/mplayerc/FGManagerBDA.h')
-rw-r--r--src/apps/mplayerc/FGManagerBDA.h179
1 files changed, 179 insertions, 0 deletions
diff --git a/src/apps/mplayerc/FGManagerBDA.h b/src/apps/mplayerc/FGManagerBDA.h
new file mode 100644
index 000000000..3d28c7891
--- /dev/null
+++ b/src/apps/mplayerc/FGManagerBDA.h
@@ -0,0 +1,179 @@
+/*
+ * $Id$
+ *
+ * (C) 2006-2007 see AUTHORS
+ *
+ * This file is part of mplayerc.
+ *
+ * Mplayerc is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * Mplayerc is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+
+#pragma once
+
+#include <bdatypes.h>
+#include <bdamedia.h>
+#include <bdaiface.h>
+
+#include "FGManager.h"
+
+
+class CDVBStream
+{
+public :
+ CDVBStream() :
+ m_ulMappedPID(0)
+ {
+ }
+
+ CDVBStream(LPWSTR strName, const AM_MEDIA_TYPE * pmt, bool bFindExisting = false, MEDIA_SAMPLE_CONTENT nMsc=MEDIA_ELEMENTARY_STREAM) :
+ m_Name(strName),
+ m_bFindExisting(bFindExisting),
+ m_pmt(pmt),
+ m_nMsc(nMsc),
+ m_ulMappedPID(0)
+ {}
+
+ LPWSTR GetName() { return m_Name; };
+ const AM_MEDIA_TYPE* GetMediaType() { return m_pmt; };
+ bool GetFindExisting() { return m_bFindExisting; };
+ IBaseFilter* GetFilter() { return m_pFilter; };
+
+ void SetPin(IPin* pPin)
+ {
+ CComPtr<IPin> pPinOut;
+ PIN_INFO PinInfo;
+
+ m_pMap = pPin;
+ if (m_pMap &&
+ SUCCEEDED (pPin->ConnectedTo (&pPinOut)) &&
+ SUCCEEDED (pPinOut->QueryPinInfo (&PinInfo)))
+ {
+ m_pFilter.Attach (PinInfo.pFilter);
+ }
+ }
+
+ HRESULT Map (ULONG ulPID)
+ {
+ CheckPointer (m_pMap, E_UNEXPECTED);
+ ClearMaps();
+ m_ulMappedPID = ulPID;
+ return m_pMap->MapPID (1, &ulPID, m_nMsc);
+ }
+
+ HRESULT Unmap (ULONG ulPID)
+ {
+ CheckPointer (m_pMap, E_UNEXPECTED);
+ m_ulMappedPID = 0;
+ return m_pMap->UnmapPID (1, &ulPID);
+ }
+
+ ULONG GetMappedPID()
+ {
+ return m_ulMappedPID;
+ }
+
+private :
+ CComQIPtr<IMPEG2PIDMap> m_pMap;
+ CComPtr<IBaseFilter> m_pFilter;
+ const AM_MEDIA_TYPE* m_pmt;
+ bool m_bFindExisting;
+ LPWSTR m_Name;
+ MEDIA_SAMPLE_CONTENT m_nMsc;
+ ULONG m_ulMappedPID;
+
+ void ClearMaps()
+ {
+ HRESULT hr;
+ CComPtr<IEnumPIDMap> pEnumMap;
+
+ if (SUCCEEDED(hr = m_pMap->EnumPIDMap(&pEnumMap)))
+ {
+ PID_MAP maps[8];
+ ULONG nbPids = 0;
+
+ if (pEnumMap->Next(_countof(maps), maps, &nbPids)==S_OK)
+ {
+ for (ULONG i=0; i<nbPids; i++)
+ {
+ ULONG pid = maps[i].ulPID;
+
+ m_pMap->UnmapPID(1, &pid);
+ }
+ }
+ }
+ }
+};
+
+
+class CFGManagerBDA : public CFGManagerPlayer, IBDATuner, IAMStreamSelect
+{
+public:
+ CFGManagerBDA(LPCTSTR pName, LPUNKNOWN pUnk, HWND hWnd);
+ ~CFGManagerBDA();
+
+ // IGraphBuilder
+ STDMETHODIMP RenderFile(LPCWSTR lpcwstrFile, LPCWSTR lpcwstrPlayList);
+
+ // IFilterGraph
+ STDMETHODIMP ConnectDirect(IPin* pPinOut, IPin* pPinIn, const AM_MEDIA_TYPE* pmt);
+
+ // IBDATuner
+ STDMETHODIMP SetChannel (int nChannelPrefNumber);
+ STDMETHODIMP SetAudio (int nAudioIndex);
+ STDMETHODIMP SetFrequency(ULONG freq);
+ STDMETHODIMP Scan(ULONG ulFrequency, HWND hWnd);
+ STDMETHODIMP GetStats (BOOLEAN& bPresent, BOOLEAN& bLocked, LONG& lStrength, LONG& lQuality);
+
+ // IAMStreamSelect
+ STDMETHODIMP Count(DWORD* pcStreams);
+ STDMETHODIMP Enable(long lIndex, DWORD dwFlags);
+ STDMETHODIMP Info(long lIndex, AM_MEDIA_TYPE** ppmt, DWORD* pdwFlags, LCID* plcid, DWORD* pdwGroup, WCHAR** ppszName, IUnknown** ppObject, IUnknown** ppUnk);
+
+ DECLARE_IUNKNOWN;
+ STDMETHODIMP NonDelegatingQueryInterface(REFIID riid, void** ppv);
+
+private :
+
+ CComQIPtr<IBDA_DeviceControl> m_pBDAControl;
+ CComPtr<IBDA_FrequencyFilter> m_pBDAFreq;
+ CComPtr<IBDA_SignalStatistics> m_pBDAStats;
+ CAtlMap<DVB_STREAM_TYPE, CDVBStream> m_DVBStreams;
+
+ DVB_STREAM_TYPE m_nCurVideoType;
+ DVB_STREAM_TYPE m_nCurAudioType;
+
+ HRESULT CreateKSFilter(IBaseFilter** ppBF, CLSID KSCategory, CStringW& DisplayName);
+ HRESULT ConnectFilters(IBaseFilter* pOutFiter, IBaseFilter* pInFilter);
+ HRESULT CreateMicrosoftDemux(IBaseFilter* pReceiver, CComPtr<IBaseFilter>& pMpeg2Demux);
+ HRESULT SetChannelInternal (CDVBChannel* pChannel);
+ HRESULT SwitchStream (DVB_STREAM_TYPE& nOldType, DVB_STREAM_TYPE nNewType);
+ HRESULT ChangeState(FILTER_STATE nRequested);
+ FILTER_STATE GetState();
+
+ template <class ITF>
+ HRESULT SearchIBDATopology(const CComPtr<IBaseFilter> & pTuner, CComPtr<ITF> & pItf)
+ {
+ CComPtr<IUnknown> pUnk;
+ HRESULT hr = SearchIBDATopology(pTuner, __uuidof(ITF), pUnk);
+
+ if (SUCCEEDED(hr)) {
+ hr = pUnk.QueryInterface(&pItf);
+ }
+ return !pItf ? E_NOINTERFACE : hr;
+ }
+
+ HRESULT SearchIBDATopology(const CComPtr<IBaseFilter>& pTuner, REFIID iid, CComPtr<IUnknown>& pUnk);
+};