further deprecate v4l2 tests and spacing

This commit is contained in:
Isaac Connor 2021-10-05 17:44:26 -04:00
parent c72d34f176
commit ba26235763
1 changed files with 199 additions and 213 deletions

View File

@ -49,7 +49,6 @@ static int vidioctl(int fd, int request, void *arg) {
static _AVPIXELFORMAT getFfPixFormatFromV4lPalette(int v4l_version, int palette) {
_AVPIXELFORMAT pixFormat = AV_PIX_FMT_NONE;
if ( v4l_version == 2 ) {
switch (palette) {
#if defined(V4L2_PIX_FMT_RGB444) && defined(AV_PIX_FMT_RGB444)
case V4L2_PIX_FMT_RGB444 :
@ -172,7 +171,6 @@ static _AVPIXELFORMAT getFfPixFormatFromV4lPalette(int v4l_version, int palette)
#endif
}
} // end switch palette
} // end if v4l2
return pixFormat;
} // end getFfPixFormatFromV4lPalette
@ -289,7 +287,7 @@ LocalCamera::LocalCamera(
BigEndian = 0;
}
if (v4l_version == 2 && palette == 0) {
if (palette == 0) {
/* Use automatic format selection */
Debug(2,"Using automatic format selection");
palette = AutoSelectFormat(colours);
@ -310,9 +308,6 @@ LocalCamera::LocalCamera(
if (capture) {
if (last_camera) {
if ((p_method == "v4l2" && v4l_version != 2) || (p_method == "v4l1" && v4l_version != 1))
Fatal("Different Video For Linux version used for monitors sharing same device");
if (standard != last_camera->standard)
Warning("Different video standards defined for monitors sharing same device, results may be unpredictable or completely wrong");
@ -499,7 +494,6 @@ void LocalCamera::Initialise() {
if (!S_ISCHR(st.st_mode))
Fatal("File %s is not device file: %s", device.c_str(), strerror(errno));
Debug(2, "V4L2 support enabled, using V4L%d api", v4l_version);
struct v4l2_capability vid_cap;
Debug(3, "Checking video device capabilities");
@ -1212,8 +1206,6 @@ int LocalCamera::PrimeCapture() {
if (!device_prime)
return 1;
Debug(2, "Priming capture");
if ( v4l_version == 2 ) {
Debug(3, "Queueing (%d) buffers", v4l2_data.reqbufs.count);
for (unsigned int frame = 0; frame < v4l2_data.reqbufs.count; frame++) {
struct v4l2_buffer vid_buf;
@ -1242,13 +1234,11 @@ int LocalCamera::PrimeCapture() {
Error("Failed to start capture stream: %s", strerror(errno));
return -1;
}
} // end if v4l_version == 2
return 1;
} // end LocalCamera::PrimeCapture
int LocalCamera::PreCapture() {
//Debug(5, "Pre-capturing");
return 1;
}
@ -1268,7 +1258,6 @@ int LocalCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
// Do the capture, unless we are the second or subsequent camera on a channel, in which case just reuse the buffer
if (channel_prime) {
if ( v4l_version == 2 ) {
static struct v4l2_buffer vid_buf;
memset(&vid_buf, 0, sizeof(vid_buf));
@ -1313,9 +1302,7 @@ int LocalCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
Error("Captured image dimensions differ: V4L2: %dx%d monitor: %dx%d",
v4l2_data.fmt.fmt.pix.width, v4l2_data.fmt.fmt.pix.height, width, height);
}
} // end if v4l2
if ( v4l_version == 2 ) {
if (channel_count > 1) {
int next_channel = (channel_index+1)%channel_count;
Debug(3, "Switching video source to %d", channels[next_channel]);
@ -1338,7 +1325,6 @@ int LocalCamera::Capture(std::shared_ptr<ZMPacket> &zm_packet) {
} else {
Error("Unable to requeue buffer due to not v4l2_data");
}
}
} /* prime capture */
if (!zm_packet->image) {