@@ -119,14 +119,19 @@ private static IEnumerable<FramesPerSecond> EnumerateFramesPerSecond(
119
119
} ) .
120
120
SelectMany ( frmivalenum =>
121
121
{
122
- // v4l2_fract is "interval", so makes fps to do reciprocal.
123
- // (numerator <--> denominator)
122
+
124
123
static IEnumerable < FramesPerSecond > EnumerateStepWise (
125
124
v4l2_frmival_stepwise stepwise )
126
125
{
127
- var min = new Fraction ( ( int ) stepwise . min . denominator , ( int ) stepwise . min . numerator ) ;
128
- var max = new Fraction ( ( int ) stepwise . max . denominator , ( int ) stepwise . max . numerator ) ;
126
+ // v4l2_fract is "interval", so do reciprocal to make fps.
127
+ // (numerator <--> denominator)
128
+
129
+ // Since we're inverting the interval to get the FPS, we also need to swap the meaning of min/max
130
+ var min = new Fraction ( ( int ) stepwise . max . denominator , ( int ) stepwise . max . numerator ) ;
131
+ var max = new Fraction ( ( int ) stepwise . min . denominator , ( int ) stepwise . min . numerator ) ;
132
+
129
133
var step = new Fraction ( ( int ) stepwise . step . denominator , ( int ) stepwise . step . numerator ) ;
134
+
130
135
return NativeMethods . DefactoStandardFramesPerSecond .
131
136
Where ( fps =>
132
137
fps >= min && fps <= max &&
@@ -138,8 +143,13 @@ static IEnumerable<FramesPerSecond> EnumerateStepWise(
138
143
static IEnumerable < FramesPerSecond > EnumerateContinuous (
139
144
v4l2_frmival_stepwise stepwise )
140
145
{
141
- var min = new Fraction ( ( int ) stepwise . min . denominator , ( int ) stepwise . min . numerator ) ;
142
- var max = new Fraction ( ( int ) stepwise . max . denominator , ( int ) stepwise . max . numerator ) ;
146
+ // v4l2_fract is "interval", so do reciprocal to make fps.
147
+ // (numerator <--> denominator)
148
+
149
+ // Since we're inverting the interval to get the FPS, we also need to swap the meaning of min/max
150
+ var min = new Fraction ( ( int ) stepwise . max . denominator , ( int ) stepwise . max . numerator ) ;
151
+ var max = new Fraction ( ( int ) stepwise . min . denominator , ( int ) stepwise . min . numerator ) ;
152
+
143
153
return NativeMethods . DefactoStandardFramesPerSecond .
144
154
Where ( fps => fps >= min && fps <= max ) .
145
155
OrderByDescending ( fps => fps ) .
0 commit comments