umlaeute / v4l2loopback

v4l2-loopback device
GNU General Public License v2.0
3.69k stars 523 forks source link

VIDIOC_ENUMINPUT returns status OK when no input signal is present #511

Closed pinefan closed 1 year ago

pinefan commented 1 year ago

Hello umlaeute

Thank you for your excellent work.

Would you please consider setting the input status in vidioc_enum_input() to correctly report the absence of an input signal? Below is a suggested implementation:

*** 1426,1431 ****                                                                  
--- 1426,1433 ----                                                                  
  static int vidioc_enum_input(struct file *file, void *fh,                         
                             struct v4l2_input *inp)                                
  {                                                                                 
+       struct v4l2_loopback_device *dev = v4l2loopback_getdevice(file);
+ 
        __u32 index = inp->index;
        MARK();

***************
*** 1441,1446 ****
--- 1443,1451 ----
        inp->audioset = 0;
        inp->tuner = 0;
        inp->status = 0;
+       if (!dev->ready_for_capture) {
+               inp->status |= V4L2_IN_ST_NO_SIGNAL;
+       }

  #ifdef V4L2LOOPBACK_WITH_STD
        inp->std = V4L2_STD_ALL;

Environment:

Steps to reproduce:

Observed Results: ioctl: VIDIOC_ENUMINPUT Input : 0 Name : loopback Type : 0x00000002 (Camera) Audioset : 0x00000000 Tuner : 0x00000000 Standard : 0x0000000000000000 () Status : 0x00000000 (ok) Capabilities: 0x00000000 (not defined)

Expected Results: ioctl: VIDIOC_ENUMINPUT Input : 0 Name : loopback Type : 0x00000002 (Camera) Audioset : 0x00000000 Tuner : 0x00000000 Standard : 0x0000000000000000 () Status : 0x00000002 (no signal) Capabilities: 0x00000000 (not defined)

Thanks!