Skip to content

Commit

Permalink
Merge branch 'master' into Releases
Browse files Browse the repository at this point in the history
  • Loading branch information
radi-sh committed Feb 2, 2019
2 parents 5ce0735 + 5c765d8 commit 72648d9
Show file tree
Hide file tree
Showing 15 changed files with 401 additions and 174 deletions.
10 changes: 5 additions & 5 deletions BdaSpecials/PlexPX/AsicenPropset.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
// Broadcast Driver Architecture で定義されている Property set / Method set
//
static const GUID KSPROPSETID_BdaAutodemodulate = { 0xddf15b12, 0xbd25, 0x11d2,{ 0x9c, 0xa0, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
static constexpr GUID KSPROPSETID_BdaAutodemodulate = { 0xddf15b12, 0xbd25, 0x11d2,{ 0x9c, 0xa0, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
enum KSPROPERTY_BDA_AUTODEMODULATE {
KSPROPERTY_BDA_AUTODEMODULATE_START = 0, // get only
KSPROPERTY_BDA_AUTODEMODULATE_STOP // get only
};
static const GUID KSPROPSETID_BdaFrequencyFilter = { 0x71985f47, 0x1ca1, 0x11d3,{ 0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
static constexpr GUID KSPROPSETID_BdaFrequencyFilter = { 0x71985f47, 0x1ca1, 0x11d3,{ 0x9c, 0xc8, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
enum KSPROPERTY_BDA_FREQUENCY_FILTER {
KSPROPERTY_BDA_RF_TUNER_FREQUENCY = 0, // get/set
Expand All @@ -27,7 +27,7 @@ enum KSPROPERTY_BDA_FREQUENCY_FILTER {
KSPROPERTY_BDA_RF_TUNER_STANDARD_MODE, // not supported
};
static const GUID KSPROPSETID_BdaSignalStats = { 0x1347d106, 0xcf3a, 0x428a,{ 0xa5, 0xcb, 0xac, 0xd, 0x9a, 0x2a, 0x43, 0x38 } };
static constexpr GUID KSPROPSETID_BdaSignalStats = { 0x1347d106, 0xcf3a, 0x428a,{ 0xa5, 0xcb, 0xac, 0xd, 0x9a, 0x2a, 0x43, 0x38 } };
enum KSPROPERTY_BDA_SIGNAL_STATS {
KSPROPERTY_BDA_SIGNAL_STRENGTH = 0, // get only
Expand All @@ -37,7 +37,7 @@ enum KSPROPERTY_BDA_SIGNAL_STATS {
KSPROPERTY_BDA_SAMPLE_TIME, // get only
};
static const GUID KSMETHODSETID_BdaChangeSync = { 0xfd0a5af3, 0xb41d, 0x11d2,{ 0x9c, 0x95, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
static constexpr GUID KSMETHODSETID_BdaChangeSync = { 0xfd0a5af3, 0xb41d, 0x11d2,{ 0x9c, 0x95, 0x0, 0xc0, 0x4f, 0x79, 0x71, 0xe0 } };
enum KSMETHOD_BDA_CHANGE_SYNC {
KSMETHOD_BDA_START_CHANGES = 0,
Expand All @@ -52,7 +52,7 @@ enum KSMETHOD_BDA_CHANGE_SYNC {
//

// ASICEN 拡張プロパティセット GUID
static const GUID KSPROPSETID_AsicenExtension = { 0x9e1781e1, 0x9cb1, 0x4407,{ 0xbb, 0xce, 0x54, 0x26, 0xc8, 0xd0, 0x0a, 0x4b } };
static constexpr GUID KSPROPSETID_AsicenExtension = { 0x9e1781e1, 0x9cb1, 0x4407,{ 0xbb, 0xce, 0x54, 0x26, 0xc8, 0xd0, 0x0a, 0x4b } };

// ASICEN 拡張プロパティID
enum KSPROPERTY_ASICEN_EXTENSION {
Expand Down
92 changes: 41 additions & 51 deletions BdaSpecials/PlexPX/PlexPX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
#pragma comment(lib, "aes.lib")

struct TunerAndCaptureGuid {
const std::wstring Tuner;
const std::wstring Capture;
const WCHAR * const Tuner;
const WCHAR * const Capture;
};

static const TunerAndCaptureGuid KNOWN_GUIDS_S[] = {
static constexpr TunerAndCaptureGuid KNOWN_GUIDS_S[] = {
// BS/CS110用TunerとCaptureのGUID組合せ
// PX-Q3PE Tuner 0/1/4/5がそれぞれ1個 計4個
// PX-W3PE V2 Tuner 0/4がそれぞれ1個 計2個
Expand All @@ -44,7 +44,7 @@ static const TunerAndCaptureGuid KNOWN_GUIDS_S[] = {
{ L"{ef4af615-7acd-45d2-b7b4-ded5c22a382e}", L"{d572e115-62c7-49ff-956c-84369aada823}", }, // PX-W3U3 V2 Tuner 2
};

static const TunerAndCaptureGuid KNOWN_GUIDS_T[] = {
static constexpr TunerAndCaptureGuid KNOWN_GUIDS_T[] = {
// UHF/CATV用TunerとCaptureのGUID組合せ
// PX-Q3PE Tuner 2/3/6/7がそれぞれ1個 計4個
// PX-W3PE V2 Tuner 2/6がそれぞれ1個 計2個
Expand All @@ -68,7 +68,7 @@ static const TunerAndCaptureGuid KNOWN_GUIDS_T[] = {
{ L"{6430d7ee-7dc7-4978-9481-d9657cbd583f}", L"{974860c1-a2a9-48e8-82d2-5e8c64a39878}", }, // PX-W3U3 V2 Tuner 3
};

static const TunerAndCaptureGuid KNOWN_GUIDS_3[] = {
static constexpr TunerAndCaptureGuid KNOWN_GUIDS_3[] = {
// UHF/CATV/BS/CS110用TunerとCaptureのGUID組合せ
// PX-S3U Tuner 0が1個 計1個
{ L"{58d97867-8a41-4f07-97e3-f2819af81a92}", L"{7e65574d-e061-4129-8998-51881804e4a4}", }, // PX-S3U Tuner 0
Expand All @@ -79,20 +79,20 @@ FILE *g_fpLog = NULL;

HMODULE hMySelf;

static const BYTE SeedInit[32] = {
static constexpr BYTE SeedInit[32] = {
0x61, 0xd8, 0x56, 0x3d, 0xc1, 0x15, 0x46, 0x68, 0xb2, 0xec, 0x6f, 0xa9, 0xed, 0x45, 0x33, 0x81,
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10,
};

static const BYTE SeedM2Dec[16] = {
static constexpr BYTE SeedM2Dec[16] = {
0xaa, 0xcb, 0x1e, 0x40, 0x5f, 0x43, 0x42, 0x50, 0x84, 0xfe, 0xa1, 0x1b, 0xc4, 0xb2, 0xb9, 0x1f,
};

static const BYTE SeedDecode[16] = {
static constexpr BYTE SeedDecode[16] = {
0x3c, 0x51, 0x93, 0x13, 0x9b, 0xa2, 0x41, 0xc9, 0xb3, 0xfe, 0xb5, 0xda, 0xfe, 0xa0, 0x05, 0xe2,
};

static const BYTE DecodeTable[32] = {
static constexpr BYTE DecodeTable[32] = {
0x40, 0x5b, 0x99, 0xcc, 0x69, 0x54, 0x42, 0xd6, 0xad, 0x0a, 0x95, 0x27, 0x46, 0x92, 0x6b, 0x73,
0x1c, 0x1a, 0x39, 0xfb, 0x21, 0xd7, 0x4f, 0xe5, 0x8b, 0xec, 0x1f, 0x5f, 0xd3, 0x79, 0x7a, 0x13,
};
Expand Down Expand Up @@ -154,15 +154,15 @@ __declspec(dllexport) HRESULT CheckAndInitTuner(IBaseFilter *pTunerDevice, const
IniFileAccess.SetSectionName(L"PLEXPX");

// DebugLogを記録するかどうか
if (IniFileAccess.ReadKeyB(L"DebugLog", 0)) {
if (IniFileAccess.ReadKeyB(L"DebugLog", FALSE)) {
// DebugLogのファイル名取得
SetDebugLog(common::GetModuleName(hMySelf) + L"log");
}

BOOL bM2_Dec = IniFileAccess.ReadKeyB(L"M2_Dec", 0);
BOOL bUseKnownGUID = IniFileAccess.ReadKeyB(L"UseKnownGUID", 0);
BOOL bISDBT = IniFileAccess.ReadKeyB(L"ISDB-T", 0);
BOOL bISDBS = IniFileAccess.ReadKeyB(L"ISDB-S", 0);
BOOL bM2_Dec = IniFileAccess.ReadKeyB(L"M2_Dec", FALSE);
BOOL bUseKnownGUID = IniFileAccess.ReadKeyB(L"UseKnownGUID", FALSE);
BOOL bISDBT = IniFileAccess.ReadKeyB(L"ISDB-T", FALSE);
BOOL bISDBS = IniFileAccess.ReadKeyB(L"ISDB-S", FALSE);
std::wstring displayName = szDisplayName;

// DisplayNameがGUID一覧と一致しているか比較
Expand Down Expand Up @@ -218,17 +218,14 @@ __declspec(dllexport) HRESULT CheckAndInitTuner(IBaseFilter *pTunerDevice, const
}
}

CComPtr<IKsPropertySet> pIKsPropertySet;

hr = pTunerDevice->QueryInterface(IID_IKsPropertySet, (LPVOID*)&pIKsPropertySet);
if (FAILED(hr)) {
return hr;
CComQIPtr<IKsPropertySet> pIKsPropertySet(pTunerDevice);
if (!pIKsPropertySet) {
return E_FAIL;
}

// Flag取得
DWORD dwFlag;
hr = asicen_GetFlags(pIKsPropertySet, &dwFlag);
if (FAILED(hr)) {
if (FAILED(hr = asicen_GetFlags(pIKsPropertySet, &dwFlag))) {
return hr;
}

Expand Down Expand Up @@ -269,9 +266,9 @@ __declspec(dllexport) HRESULT CheckCapture(const WCHAR *szTunerDisplayName, cons
CIniFileAccess IniFileAccess(szIniFilePath);
IniFileAccess.SetSectionName(L"PLEXPX");

BOOL bUseKnownGUID = IniFileAccess.ReadKeyB(L"UseKnownGUID", 0);
BOOL bISDBT = IniFileAccess.ReadKeyB(L"ISDB-T", 0);
BOOL bISDBS = IniFileAccess.ReadKeyB(L"ISDB-S", 0);
BOOL bUseKnownGUID = IniFileAccess.ReadKeyB(L"UseKnownGUID", FALSE);
BOOL bISDBT = IniFileAccess.ReadKeyB(L"ISDB-T", FALSE);
BOOL bISDBS = IniFileAccess.ReadKeyB(L"ISDB-S", FALSE);

if (!bUseKnownGUID) {
return S_OK;
Expand Down Expand Up @@ -310,15 +307,13 @@ __declspec(dllexport) HRESULT CheckCapture(const WCHAR *szTunerDisplayName, cons
CPlexPXSpecials::CPlexPXSpecials(HMODULE hMySelf, CComPtr<IBaseFilter> pTunerDevice)
: m_hMySelf(hMySelf),
m_pTunerDevice(pTunerDevice),
m_pIKsPropertySet(NULL),
m_pIKsPropertySet(m_pTunerDevice),
m_dwFlag(0)
{
::InitializeCriticalSection(&m_CriticalSection);

HRESULT hr;

hr = m_pTunerDevice->QueryInterface(IID_IKsPropertySet, (LPVOID*)&m_pIKsPropertySet);

::EnterCriticalSection(&m_CriticalSection);
hr = asicen_GetFlags(m_pIKsPropertySet, &m_dwFlag);
::LeaveCriticalSection(&m_CriticalSection);
Expand All @@ -330,13 +325,6 @@ CPlexPXSpecials::~CPlexPXSpecials()
{
m_hMySelf = NULL;

SAFE_RELEASE(m_pIKsPropertySet);

if (m_pTunerDevice) {
m_pTunerDevice.Release();
m_pTunerDevice = NULL;
}

::DeleteCriticalSection(&m_CriticalSection);

return;
Expand Down Expand Up @@ -376,7 +364,7 @@ const HRESULT CPlexPXSpecials::LockChannel(BYTE bySatellite, BOOL bHorizontal, u
return E_NOINTERFACE;
}

const HRESULT CPlexPXSpecials::LockChannel(const TuningParam *pTuningParm)
const HRESULT CPlexPXSpecials::LockChannel(const TuningParam *pTuningParam)
{
return E_NOINTERFACE;
}
Expand Down Expand Up @@ -450,38 +438,40 @@ const HRESULT CPlexPXSpecials::GetSignalStrength(float *fVal)
return S_OK;
}

const HRESULT CPlexPXSpecials::PreTuneRequest(const TuningParam *pTuningParm, ITuneRequest *pITuneRequest)
const HRESULT CPlexPXSpecials::PreLockChannel(TuningParam *pTuningParam)
{
HRESULT hr;
// Bandwidthは固定値6を設定しておかないとチューニングに失敗する
pTuningParam->Modulation.BandWidth = 6;

CComPtr<ILocator> pILocator;
if (SUCCEEDED(hr = pITuneRequest->get_Locator(&pILocator))) {
CComQIPtr<IDVBTLocator> pIDVBTLocator(pILocator);
if (pIDVBTLocator) {
// Bandwidthは固定値6を設定しておかないとチューニングに失敗する
pIDVBTLocator->put_Bandwidth(6);
}
hr = pITuneRequest->put_Locator(pILocator);
}
return S_OK;
}

const HRESULT CPlexPXSpecials::PostLockChannel(const TuningParam *pTuningParm)
const HRESULT CPlexPXSpecials::PreTuneRequest(const TuningParam *pTuningParam, ITuneRequest *pITuneRequest)
{
return S_OK;
}

const HRESULT CPlexPXSpecials::PostTuneRequest(const TuningParam * pTuningParam)
{
return S_OK;
}

const HRESULT CPlexPXSpecials::PostLockChannel(const TuningParam *pTuningParam)
{
HRESULT hr = S_OK;

if (pTuningParm->TSID != 0 && pTuningParm->TSID != -1) {
if (pTuningParam->TSID != 0 && pTuningParam->TSID != -1) {
::EnterCriticalSection(&m_CriticalSection);
hr = asicen_SetTSID(m_pIKsPropertySet, pTuningParm->TSID);
hr = asicen_SetTSID(m_pIKsPropertySet, pTuningParam->TSID);
::LeaveCriticalSection(&m_CriticalSection);
if (FAILED(hr)) {
return hr;
}
}

if (pTuningParm->SID != 0 && pTuningParm->SID != -1) {
if (pTuningParam->SID != 0 && pTuningParam->SID != -1) {
::EnterCriticalSection(&m_CriticalSection);
hr = asicen_SetSID(m_pIKsPropertySet, (DWORD)pTuningParm->SID);
hr = asicen_SetSID(m_pIKsPropertySet, (DWORD)pTuningParam->SID);
::LeaveCriticalSection(&m_CriticalSection);
}

Expand Down
12 changes: 7 additions & 5 deletions BdaSpecials/PlexPX/PlexPX.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

#include "IBdaSpecials2.h"

class CPlexPXSpecials : public IBdaSpecials2a2
class CPlexPXSpecials : public IBdaSpecials2b2
{
public:
CPlexPXSpecials(HMODULE hMySelf, CComPtr<IBaseFilter> pTunerDevice);
Expand All @@ -18,21 +18,23 @@ class CPlexPXSpecials : public IBdaSpecials2a2
const HRESULT SetLNBPower(bool bActive);

const HRESULT Set22KHz(long nTone);
const HRESULT LockChannel(const TuningParam *pTuningParm);
const HRESULT LockChannel(const TuningParam *pTuningParam);

const HRESULT ReadIniFile(const WCHAR *szIniFilePath);
const HRESULT IsDecodingNeeded(BOOL *pbAns);
const HRESULT Decode(BYTE *pBuf, DWORD dwSize);
const HRESULT GetSignalStrength(float *fVal);
const HRESULT PreTuneRequest(const TuningParam *pTuningParm, ITuneRequest *pITuneRequest);
const HRESULT PostLockChannel(const TuningParam *pTuningParm);
const HRESULT PreLockChannel(TuningParam *pTuningParam);
const HRESULT PreTuneRequest(const TuningParam *pTuningParam, ITuneRequest *pITuneRequest);
const HRESULT PostTuneRequest(const TuningParam *pTuningParam);
const HRESULT PostLockChannel(const TuningParam *pTuningParam);

virtual void Release(void);

private:
HMODULE m_hMySelf;
CComPtr<IBaseFilter> m_pTunerDevice;
IKsPropertySet *m_pIKsPropertySet;
CComQIPtr<IKsPropertySet> m_pIKsPropertySet;
DWORD m_dwFlag;
CRITICAL_SECTION m_CriticalSection;
};
Loading

0 comments on commit 72648d9

Please sign in to comment.