@@ -119,14 +119,19 @@ private static IEnumerable<FramesPerSecond> EnumerateFramesPerSecond(
119119 } ) .
120120 SelectMany ( frmivalenum =>
121121 {
122- // v4l2_fract is "interval", so makes fps to do reciprocal.
123- // (numerator <--> denominator)
122+
124123 static IEnumerable < FramesPerSecond > EnumerateStepWise (
125124 v4l2_frmival_stepwise stepwise )
126125 {
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+
129133 var step = new Fraction ( ( int ) stepwise . step . denominator , ( int ) stepwise . step . numerator ) ;
134+
130135 return NativeMethods . DefactoStandardFramesPerSecond .
131136 Where ( fps =>
132137 fps >= min && fps <= max &&
@@ -138,8 +143,13 @@ static IEnumerable<FramesPerSecond> EnumerateStepWise(
138143 static IEnumerable < FramesPerSecond > EnumerateContinuous (
139144 v4l2_frmival_stepwise stepwise )
140145 {
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+
143153 return NativeMethods . DefactoStandardFramesPerSecond .
144154 Where ( fps => fps >= min && fps <= max ) .
145155 OrderByDescending ( fps => fps ) .
0 commit comments