diff --git a/Sources/Video.DirectShow/VideoCapabilities.cs b/Sources/Video.DirectShow/VideoCapabilities.cs index a7c8dd41..d94ee9f2 100644 --- a/Sources/Video.DirectShow/VideoCapabilities.cs +++ b/Sources/Video.DirectShow/VideoCapabilities.cs @@ -77,24 +77,25 @@ static internal VideoCapabilities[] FromStreamConfig( IAMStreamConfig videoStrea throw new NotSupportedException( "Unable to retrieve video device capabilities. This video device requires a larger VideoStreamConfigCaps structure." ); // group capabilities with similar parameters - Dictionary videocapsList = new Dictionary( ); + Dictionary videocapsList = new Dictionary(); - for ( int i = 0; i < count; i++ ) + for (int i = 0; i < count; i++) { try { - VideoCapabilities vc = new VideoCapabilities( videoStreamConfig, i ); + VideoCapabilities vc = new VideoCapabilities(videoStreamConfig, i); - uint key = ( ( (uint) vc.FrameSize.Height ) << 32 ) | - ( ( (uint) vc.FrameSize.Width ) << 16 ); + ulong key = (((uint)vc.AverageFrameRate) << 48) | + (((uint)vc.FrameSize.Height) << 32) | + (((uint)vc.FrameSize.Width) << 16); - if ( !videocapsList.ContainsKey( key ) ) + if (!videocapsList.ContainsKey(key)) { - videocapsList.Add( key, vc ); + videocapsList.Add(key, vc); } else { - if ( vc.BitCount > videocapsList[key].BitCount ) + if (vc.BitCount > videocapsList[key].BitCount) { videocapsList[key] = vc; } @@ -105,6 +106,7 @@ static internal VideoCapabilities[] FromStreamConfig( IAMStreamConfig videoStrea } } + VideoCapabilities[] videocaps = new VideoCapabilities[videocapsList.Count]; videocapsList.Values.CopyTo( videocaps, 0 );