net-im/teams-bin: Add version 1.3.00.5153
[shuber-gentoo-overlay.git] / media-video / v4l2loopback / files / use-v4l2-buffer-ptr-instead-timeval.patch
1 commit d7b657802c109ece5195208db26059921d2d6ebe
2 Author: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
3 Date: Fri Jan 31 22:04:36 2020 -0500
4
5 use v4l2_buffer ptr instead of timeval
6
7 577c89b0ce726e44c08c396d14f84a00070a57b7 changes timestamp to type
8 __kernel_v4l2_timeval. use v4l2_buffer instead of raw timeval for better
9 compatibility.
10
11 diff --git a/v4l2loopback.c b/v4l2loopback.c
12 index f43f98c..4f43a73 100644
13 --- a/v4l2loopback.c
14 +++ b/v4l2loopback.c
15 @@ -134,7 +134,7 @@ void *v4l2l_vzalloc(unsigned long size)
16 # define v4l2l_vzalloc vzalloc
17 #endif
18
19 -static inline void v4l2l_get_timestamp(struct timeval *tv) {
20 +static inline void v4l2l_get_timestamp(struct v4l2_buffer *b) {
21 /* ktime_get_ts is considered deprecated, so use ktime_get_ts64 if possible */
22 #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
23 struct timespec ts;
24 @@ -144,8 +144,8 @@ static inline void v4l2l_get_timestamp(struct timeval *tv) {
25 ktime_get_ts64(&ts);
26 #endif
27
28 - tv->tv_sec = (time_t)ts.tv_sec;
29 - tv->tv_usec = (suseconds_t)(ts.tv_nsec / NSEC_PER_USEC);
30 + b->timestamp.tv_sec = (time_t)ts.tv_sec;
31 + b->timestamp.tv_usec = (suseconds_t)(ts.tv_nsec / NSEC_PER_USEC);
32 }
33
34
35 @@ -1520,7 +1520,7 @@ static int vidioc_qbuf(struct file *file, void *private_data, struct v4l2_buffer
36 case V4L2_BUF_TYPE_VIDEO_OUTPUT:
37 dprintkrw("output QBUF pos: %d index: %d\n", dev->write_position, index);
38 if (buf->timestamp.tv_sec == 0 && buf->timestamp.tv_usec == 0)
39 - v4l2l_get_timestamp(&b->buffer.timestamp);
40 + v4l2l_get_timestamp(&b->buffer);
41 else
42 b->buffer.timestamp = buf->timestamp;
43 b->buffer.bytesused = buf->bytesused;
44 @@ -1947,7 +1947,7 @@ static ssize_t v4l2_loopback_write(struct file *file,
45 count);
46 return -EFAULT;
47 }
48 - v4l2l_get_timestamp(&b->timestamp);
49 + v4l2l_get_timestamp(b);
50 b->bytesused = count;
51 b->sequence = dev->write_position;
52 buffer_written(dev, &dev->buffers[write_index]);
53 @@ -2052,7 +2052,7 @@ static void init_buffers(struct v4l2_loopback_device *dev)
54 b->timestamp.tv_usec = 0;
55 b->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
56
57 - v4l2l_get_timestamp(&b->timestamp);
58 + v4l2l_get_timestamp(b);
59 }
60 dev->timeout_image_buffer = dev->buffers[0];
61 dev->timeout_image_buffer.buffer.m.offset = MAX_BUFFERS * buffer_size;