Skip to content

Commit

Permalink
Merge pull request #367 from JustFred51/master
Browse files Browse the repository at this point in the history
HD-PVR2 & HD PVR 60 capture device support (Windows)
  • Loading branch information
Narflex committed Oct 30, 2017
2 parents 975ba9b + 506af5d commit 0be35bb
Show file tree
Hide file tree
Showing 6 changed files with 384 additions and 152 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
@@ -1,5 +1,8 @@
# Change Log

* HD-PVR2 video capture device: add ability to select multiple audio inputs (Windows)
* HD PVR 60 video capture device: new device support (Windows)

## Version 9.1.7 (2017-09-24)
* Fix: add support for 2nd tuner of Hauppauge WinTV-dualHD usb tuner stick (Windows).
* Changes in the STV set 2017081201 for the next SageTV release v9.1.7.0:
Expand Down
10 changes: 9 additions & 1 deletion installer/wix/SageTVSetup/sagetvregistry.wxs
Expand Up @@ -292,6 +292,13 @@
<RegistryValue Name="CaptureMask" Value="2048" Type="integer" />
<RegistryValue Name="ChipsetMask" Value="1048576" Type="integer" />
</RegistryKey>
</Component>
<Component Id="cmpRegFreyCommonAddCaptureHDPVR60CaptureFilterHD" Guid="{B8FE962B-AA0A-495C-91D5-3043CE986AEC}" KeyPath="yes">
<RegistryKey ForceCreateOnInstall="yes" Key="SOFTWARE\Frey Technologies\Common\AdditionalCaptureSetups\HD PVR 60 Capture Filter (HD)" Root="HKLM">
<Permission GenericAll="yes" User="Everyone"/>
<RegistryValue Name="CaptureMask" Value="2048" Type="integer" />
<RegistryValue Name="ChipsetMask" Value="1048576" Type="integer" />
</RegistryKey>
</Component>
<Component Id="cmpRegFreyCommonDSFilters" Guid="{6E0BEF6D-3033-46DF-A5E1-9C92C72793B0}" KeyPath="yes">
<RegistryKey ForceCreateOnInstall="yes" Key="SOFTWARE\Frey Technologies\Common\DSFilters" Root="HKLM">
Expand Down Expand Up @@ -364,9 +371,10 @@
<ComponentRef Id="cmpRegFreyCommonAddCaptureViXSPureTVCapture" />
<ComponentRef Id="cmpRegFreyCommonAddCaptureXtremeTVPCITVTuner" />
<ComponentRef Id="cmpRegFreyCommonAddCaptureHauppaugeSienaVideoCapture" />
<ComponentRef Id="cmpRegFreyCommonAddCaptureHDPVR60CaptureFilterHD" />
<ComponentRef Id="cmpRegFreyCommonDSFilters" />
<ComponentRef Id="cmpRegFreyCommonDSFiltersMpegDeMux" />
<ComponentRef Id="cmpRegFreyCommonDSFiltersMpegMux" />
</ComponentGroup>
</Fragment>
</Wix>
</Wix>
11 changes: 10 additions & 1 deletion java/sage/CaptureDeviceInput.java
Expand Up @@ -39,6 +39,9 @@ public class CaptureDeviceInput
public static final String TUNING_PLUGIN_PORT = "tuning_plugin_port";
private static final String SFIR_DEV_NAME = "sfir_dev_name";
private static final String IR_XMT_PORT = "ir_xmt_port";
public static final int HDMI_LINEIN_CROSSBAR_INDEX = 80;
public static final int HDMI_AES_CROSSBAR_INDEX = 81; // HDMI Video & Audio
public static final int HDMI_SPDIF_CROSSBAR_INDEX = 82;
public static final int YPBPR_SPDIF_CROSSBAR_INDEX = 90;
public static final int FM_RADIO_CROSSBAR_INDEX = 99;
public static final int DIGITAL_TUNER_CROSSBAR_INDEX = 100;
Expand All @@ -61,7 +64,7 @@ else if (x == COMPONENT_CROSSBAR_INDEX)
else if (x == 6)
return "HDMI"; // DShow says 'SerialDigital', but I've only ever seen this with the Hauppauge HD PVR PCIe card and on that it's HDMI
else if (x == 7)
return "ParallelDigital";
return Sage.rez("Digital"); // Dshow 'PhysConn_Video_ParallelDigital'
else if (x == 8)
return "SCSI";
else if (x == 9)
Expand All @@ -84,6 +87,12 @@ else if (x == DIGITAL_TUNER_CROSSBAR_INDEX)
return Sage.rez("Digital_TV_Tuner");
else if (x == YPBPR_SPDIF_CROSSBAR_INDEX)
return Sage.rez("Component") + "+SPDIF";
else if (x == HDMI_LINEIN_CROSSBAR_INDEX)
return Sage.rez("HDMI") + "+LineIn";
else if (x == HDMI_AES_CROSSBAR_INDEX)
return Sage.rez("HDMI") + "_AV";
else if (x == HDMI_SPDIF_CROSSBAR_INDEX)
return Sage.rez("HDMI") + "+SPDIF";
else
return Sage.rez("Unknown");
}
Expand Down
118 changes: 94 additions & 24 deletions native/dll/DShowCapture-2/Crossbar.cpp
Expand Up @@ -266,6 +266,7 @@ JNIEXPORT void JNICALL Java_sage_DShowCaptureDevice_switchToConnector0
HRESULT hr = pCapInfo->pCrossbar->QueryInterface(IID_IAMCrossbar, (void**)&pXBar1);
HTESTPRINT(hr);

// This handles A-V "related" pins, as reported by the driver
// Look through the pins on the crossbar and find the correct one for the type of
// connector we're routing. Also find the aligned audio pin and set that too.
int tempCrossIndex = crossIndex;
Expand All @@ -289,8 +290,9 @@ JNIEXPORT void JNICALL Java_sage_DShowCaptureDevice_switchToConnector0
{
hr = pXBar1->get_CrossbarPinInfo(TRUE, i, &relatedPin, &pinType);
HTESTPRINT(hr);
if (pinType == crossType || (pinType == PhysConn_Video_YRYBY && crossType == 90)) // 90 is Component+SPDIF
{

if (pinType == crossType || (pinType == PhysConn_Video_YRYBY && crossType == 90)) // 90 is Component+SPDIF; YPBPR_SPDIF_CROSSBAR_INDEX
{
if ((crossType != 1 && tempCrossIndex > 0) ||
tempCrossIndex == 1)
{
Expand All @@ -313,26 +315,26 @@ JNIEXPORT void JNICALL Java_sage_DShowCaptureDevice_switchToConnector0
long relatedPinType = 0;
long junk = 0;
pXBar1->get_CrossbarPinInfo(TRUE, relatedPin, &junk, &relatedPinType);
if ((relatedPinType != PhysConn_Audio_SPDIFDigital && crossType == 90) ||
(relatedPinType == PhysConn_Audio_SPDIFDigital && crossType == PhysConn_Video_YRYBY))
{
// Find the other audio input pin that's related to the component input and use that
int j;
long otherRelatedPin = 0;
for (j = 0; j < numIn; j++)
{
if (j == relatedPin) continue;
otherRelatedPin = 0;
pXBar1->get_CrossbarPinInfo(TRUE, j, &otherRelatedPin, &junk);
if (otherRelatedPin == i)
{
slog(( env, "Crossbar swapping related audio pins on component video input old:%d new:%d\r\n", relatedPin, j));
relatedPin = j;
break;
}
}
}

if ((relatedPinType != PhysConn_Audio_SPDIFDigital && crossType == 90) ||
(relatedPinType == PhysConn_Audio_SPDIFDigital && crossType == PhysConn_Video_YRYBY))
{
// Find the other audio input pin that's related to the component input and use that
int j;
long otherRelatedPin = 0;
for (j = 0; j < numIn; j++)
{
if (j == relatedPin) continue;
otherRelatedPin = 0;
pXBar1->get_CrossbarPinInfo(TRUE, j, &otherRelatedPin, &junk);
if (otherRelatedPin == i)
{
slog(( env, "Crossbar swapping related audio pins on component video input old:%d new:%d\r\n", relatedPin, j));
relatedPin = j;
break;
}
}
}
}
// Route any related audio
// hr = pXBar1->get_IsRoutedTo(audioOutNum, &currRoute);
Expand All @@ -342,10 +344,78 @@ JNIEXPORT void JNICALL Java_sage_DShowCaptureDevice_switchToConnector0
HTESTPRINT(hr);
}
}
slog(( env, "Crossbar route: video:%d, auido:%d\r\n", i, relatedPin ));
slog(( env, "Crossbar route: videoIn pin:%d, auido:%d videoOutNum=%d audioOutNum=%d \r\n", i, relatedPin, videoOutNum, audioOutNum));
break;
}
}

// Normal HDMI (V=HDMI and A='related' pin, as defined in .inf) was handled above.
// Also handle other A-V pin-pairs, even though the driver might not report them as related.
// Example: Hauppauge HD-PVR2 supports HDMI+SPDIF, but driver doesn't report that combo.
// so we don't look for 'relatedPin' here, instead relying on getCrossbarConnections0() to have
// previously confirmed presense of HDMI & some other audio pin(s).
// Codes 80-89 are only possible if we already know the device supports it.
else if ((pinType == PhysConn_Video_SerialDigital) && (crossType >= 80) && (crossType <= 89) ) // 80-89 is HDMI+<something>
{
if ((crossType != 1 && tempCrossIndex > 0) ||
tempCrossIndex == 1)
{
tempCrossIndex--;
continue;
}

// Route the video
long currRoute = -1;
// hr = pXBar1->get_IsRoutedTo(videoOutNum, &currRoute);
// if (FAILED(hr) || currRoute != i)
{
hr = pXBar1->Route(videoOutNum, i);
HTESTPRINT(hr);
}

if (audioOutNum >= 0)
{
long audioHdmiPinType;
long junk = 0;
switch (crossType)
{
case 80: // HDMI+LineIn; HDMI_LINEIN_CROSSBAR_INDEX
audioHdmiPinType = PhysConn_Audio_Line;
break;
case 81: // HDMI+HDMI; HDMI_AES_CROSSBAR_INDEX
audioHdmiPinType = PhysConn_Audio_AESDigital;
break;
case 82: // HDMI+SPDIF; HDMI_SPDIF_CROSSBAR_INDEX
audioHdmiPinType = PhysConn_Audio_SPDIFDigital;
break;
default: // use 'related' audio pin; should never happen
pXBar1->get_CrossbarPinInfo(TRUE, relatedPin, &junk, &audioHdmiPinType);
slog((env, "using default related audio pin; relatedPin=%d pinType=%d \r\n", relatedPin, audioHdmiPinType));
break;
}

// Find the desired audio input pin
int j;
for (j = 0; j < numIn; j++)
{
pXBar1->get_CrossbarPinInfo(TRUE, j, &junk, &pinType);
if (pinType == audioHdmiPinType)
{
slog((env, "Located audio input pin %d; HDMI video input pin %d \r\n", j, i));
// Route any related audio
// hr = pXBar1->get_IsRoutedTo(audioOutNum, &currRoute);
// if (FAILED(hr) || currRoute != j)
{
hr = pXBar1->Route(audioOutNum, j);
HTESTPRINT(hr);
}
slog((env, "Crossbar route: video:%d, auido:%d \r\n", i, j));
break;
}
}
}
break;
}
}

SAFE_RELEASE(pXBar1);

Expand Down

0 comments on commit 0be35bb

Please sign in to comment.