@@ -704,34 +704,21 @@ static int vidioc_enum_framesizes(struct file *file, void *fh,
704
704
return - EINVAL ;
705
705
706
706
dev = file_to_loopdev (file );
707
- if (dev -> ready_for_capture ) {
708
- /* format has already been negotiated
709
- * cannot change during runtime
710
- */
711
- if (argp -> pixel_format != dev -> pix_format .pixelformat )
712
- return - EINVAL ;
713
707
714
- argp -> type = V4L2_FRMSIZE_TYPE_DISCRETE ;
708
+ if (NULL == format_by_fourcc (argp -> pixel_format ))
709
+ return - EINVAL ;
715
710
716
- argp -> discrete .width = dev -> pix_format .width ;
717
- argp -> discrete .height = dev -> pix_format .height ;
718
- } else {
719
- /* if the format has not been negotiated yet, we accept anything
720
- */
721
- if (NULL == format_by_fourcc (argp -> pixel_format ))
722
- return - EINVAL ;
711
+ argp -> type = V4L2_FRMSIZE_TYPE_CONTINUOUS ;
723
712
724
- argp -> type = V4L2_FRMSIZE_TYPE_CONTINUOUS ;
713
+ argp -> stepwise .min_width = V4L2LOOPBACK_SIZE_MIN_WIDTH ;
714
+ argp -> stepwise .min_height = V4L2LOOPBACK_SIZE_MIN_HEIGHT ;
725
715
726
- argp -> stepwise .min_width = V4L2LOOPBACK_SIZE_MIN_WIDTH ;
727
- argp -> stepwise .min_height = V4L2LOOPBACK_SIZE_MIN_HEIGHT ;
716
+ argp -> stepwise .max_width = dev -> max_width ;
717
+ argp -> stepwise .max_height = dev -> max_height ;
728
718
729
- argp -> stepwise .max_width = dev -> max_width ;
730
- argp -> stepwise .max_height = dev -> max_height ;
719
+ argp -> stepwise .step_width = 1 ;
720
+ argp -> stepwise .step_height = 1 ;
731
721
732
- argp -> stepwise .step_width = 1 ;
733
- argp -> stepwise .step_height = 1 ;
734
- }
735
722
return 0 ;
736
723
}
737
724
@@ -747,30 +734,20 @@ static int vidioc_enum_frameintervals(struct file *file, void *fh,
747
734
if (argp -> index )
748
735
return - EINVAL ;
749
736
750
- if (dev -> ready_for_capture ) {
751
- if (argp -> width != dev -> pix_format .width ||
752
- argp -> height != dev -> pix_format .height ||
753
- argp -> pixel_format != dev -> pix_format .pixelformat )
754
- return - EINVAL ;
755
-
756
- argp -> type = V4L2_FRMIVAL_TYPE_DISCRETE ;
757
- argp -> discrete = dev -> capture_param .timeperframe ;
758
- } else {
759
- if (argp -> width < V4L2LOOPBACK_SIZE_MIN_WIDTH ||
760
- argp -> width > dev -> max_width ||
761
- argp -> height < V4L2LOOPBACK_SIZE_MIN_HEIGHT ||
762
- argp -> height > dev -> max_height ||
763
- NULL == format_by_fourcc (argp -> pixel_format ))
764
- return - EINVAL ;
737
+ if (argp -> width < V4L2LOOPBACK_SIZE_MIN_WIDTH ||
738
+ argp -> width > dev -> max_width ||
739
+ argp -> height < V4L2LOOPBACK_SIZE_MIN_HEIGHT ||
740
+ argp -> height > dev -> max_height ||
741
+ NULL == format_by_fourcc (argp -> pixel_format ))
742
+ return - EINVAL ;
765
743
766
- argp -> type = V4L2_FRMIVAL_TYPE_CONTINUOUS ;
767
- argp -> stepwise .min .numerator = 1 ;
768
- argp -> stepwise .min .denominator = V4L2LOOPBACK_FPS_MAX ;
769
- argp -> stepwise .max .numerator = 1 ;
770
- argp -> stepwise .max .denominator = V4L2LOOPBACK_FPS_MIN ;
771
- argp -> stepwise .step .numerator = 1 ;
772
- argp -> stepwise .step .denominator = 1 ;
773
- }
744
+ argp -> type = V4L2_FRMIVAL_TYPE_CONTINUOUS ;
745
+ argp -> stepwise .min .numerator = 1 ;
746
+ argp -> stepwise .min .denominator = V4L2LOOPBACK_FPS_MAX ;
747
+ argp -> stepwise .max .numerator = 1 ;
748
+ argp -> stepwise .max .denominator = V4L2LOOPBACK_FPS_MIN ;
749
+ argp -> stepwise .step .numerator = 1 ;
750
+ argp -> stepwise .step .denominator = 1 ;
774
751
775
752
return 0 ;
776
753
}
@@ -2448,6 +2425,8 @@ static const struct v4l2_file_operations output_fops = {
2448
2425
static const struct v4l2_ioctl_ops output_ioctl_ops = {
2449
2426
// clang-format off
2450
2427
.vidioc_querycap = vidioc_querycap ,
2428
+ .vidioc_enum_framesizes = vidioc_enum_framesizes ,
2429
+ .vidioc_enum_frameintervals = vidioc_enum_frameintervals ,
2451
2430
2452
2431
.vidioc_enum_output = vidioc_enum_output ,
2453
2432
.vidioc_g_output = vidioc_g_output ,
0 commit comments