There appears to be a bug in the TImageEnIO.IO.DShowParams.SetVideoInput() method.
The specified video input is never selected.
I traced the problem to the SetMediaType() procedure in ieds.pas
This procedure contaisns the following if statement
if ((width >= pSCC^.MinOutputSize.cx) and (width <= pSCC^.MaxOutputSize.cx))
and ((height >= pSCC^.MinOutputSize.cy) and (height <= pSCC^.MaxOutputSize.cy))
and ((ihBitmapWidth = 0) or (ihBitmapWidth = width))
and ((ihBitmapHeight = 0) or (ihBitmapHeight = height))
and ((format = '') or (CompareGUID(formatID, pmt^.subtype)))
and ((bitrate > 0) and (ihBitRate = bitrate)) or ((bitrate = 0) and (ihBitRate > bestBitrate)) then
begin
selectedIndex := i;
bestBitrate := ih^.dwBitRate;
end;
I think the last "and" should be enclosed in an extra "()".
With the new code it works as expected.
if ((width >= pSCC^.MinOutputSize.cx) and (width <= pSCC^.MaxOutputSize.cx))
and ((height >= pSCC^.MinOutputSize.cy) and (height <= pSCC^.MaxOutputSize.cy))
and ((ihBitmapWidth = 0) or (ihBitmapWidth = width))
and ((ihBitmapHeight = 0) or (ihBitmapHeight = height))
and ((format = '') or (CompareGUID(formatID, pmt^.subtype)))
and (((bitrate > 0) and (ihBitRate = bitrate)) or ((bitrate = 0) and (ihBitRate > bestBitrate))) then
begin
selectedIndex := i;
bestBitrate := ih^.dwBitRate;
end;