You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found this code sample / library really useful, but have been struggling to add one feature to the code base. I am trying to add support for detecting resolutions supported by the WebCam. I have some code previously that was leveraging DirectShowLib, but I much prefer the simplicity of this code base (I feel like I can understand it). Any ideas/thoughts would be greatly appreciated.
Code Sample:: so after getting the capture pin from the output filter... I am calling the below method I wrote. All looks good, but the data I get back from GetNumberOfCapabilities makes no sense. capabilitiesCount is random (but huge) and capabilitiesResultStructureSize is zero. Also, GetStreamCaps throws a memory error.
private void SelectWebcamResolution(IPin sourcePin)
{
var cfg = sourcePin as IAMStreamConfig;
int capsCount = 0;
int capsStructSize = 0;
var result = cfg.GetNumberOfCapabilities(out capsCount, out capsStructSize);
if (result == 0 && capabilitiesResultStructureSize > 0)
{
var ptr = Marshal.AllocCoTaskMem(capabilitiesResultStructureSize);
try
{
for (int i = 0; i != capabilitiesCount; ++i)
{
AMMediaType capabilityInfo = null;
result = cfg.GetStreamCaps(0, out capabilityInfo, ptr); // this throws mem error
}
}
finally
{ Marshal.Release(ptr); }
}
}
Thanks in advance,
Chris Evans
The text was updated successfully, but these errors were encountered:
Hi Sam,
I have found this code sample / library really useful, but have been struggling to add one feature to the code base. I am trying to add support for detecting resolutions supported by the WebCam. I have some code previously that was leveraging DirectShowLib, but I much prefer the simplicity of this code base (I feel like I can understand it). Any ideas/thoughts would be greatly appreciated.
Code Sample:: so after getting the capture pin from the output filter... I am calling the below method I wrote. All looks good, but the data I get back from GetNumberOfCapabilities makes no sense. capabilitiesCount is random (but huge) and capabilitiesResultStructureSize is zero. Also, GetStreamCaps throws a memory error.
private void SelectWebcamResolution(IPin sourcePin)
{
var cfg = sourcePin as IAMStreamConfig;
}
Thanks in advance,
Chris Evans
The text was updated successfully, but these errors were encountered: