Skip to content

Commit 29c43af

Browse files
committed
samples: drivers: video: tcpserversink: add _dev suffix to variable
Variables that holds pointers to 'const struct device' typically end-up with '_dev'. The tcpserversink video sample did not have it. Add it. Signed-off-by: Josuah Demangeon <me@josuah.net>
1 parent b6b8812 commit 29c43af

File tree

1 file changed

+12
-12
lines changed
  • samples/drivers/video/tcpserversink/src

1 file changed

+12
-12
lines changed

samples/drivers/video/tcpserversink/src/main.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,11 @@ int main(void)
3838
int i, ret, sock, client;
3939
struct video_format fmt;
4040
struct video_caps caps;
41-
const struct device *video;
41+
const struct device *video_dev;
4242

43-
video = DEVICE_DT_GET(DT_CHOSEN(zephyr_camera));
44-
if (!device_is_ready(video)) {
45-
LOG_ERR("%s: video device not ready.", video->name);
43+
video_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_camera));
44+
if (!device_is_ready(video_dev)) {
45+
LOG_ERR("%s: video device not ready.", video_dev->name);
4646
return 0;
4747
}
4848

@@ -72,13 +72,13 @@ int main(void)
7272
}
7373

7474
/* Get capabilities */
75-
if (video_get_caps(video, VIDEO_EP_OUT, &caps)) {
75+
if (video_get_caps(video_dev, VIDEO_EP_OUT, &caps)) {
7676
LOG_ERR("Unable to retrieve video capabilities");
7777
return 0;
7878
}
7979

8080
/* Get default/native format */
81-
if (video_get_format(video, VIDEO_EP_OUT, &fmt)) {
81+
if (video_get_format(video_dev, VIDEO_EP_OUT, &fmt)) {
8282
LOG_ERR("Unable to retrieve video format");
8383
return 0;
8484
}
@@ -114,11 +114,11 @@ int main(void)
114114

115115
/* Enqueue Buffers */
116116
for (i = 0; i < ARRAY_SIZE(buffers); i++) {
117-
video_enqueue(video, VIDEO_EP_OUT, buffers[i]);
117+
video_enqueue(video_dev, VIDEO_EP_OUT, buffers[i]);
118118
}
119119

120120
/* Start video capture */
121-
if (video_stream_start(video)) {
121+
if (video_stream_start(video_dev)) {
122122
LOG_ERR("Unable to start video");
123123
return 0;
124124
}
@@ -128,7 +128,7 @@ int main(void)
128128
/* Capture loop */
129129
i = 0;
130130
do {
131-
ret = video_dequeue(video, VIDEO_EP_OUT, &vbuf, K_FOREVER);
131+
ret = video_dequeue(video_dev, VIDEO_EP_OUT, &vbuf, K_FOREVER);
132132
if (ret) {
133133
LOG_ERR("Unable to dequeue video buf");
134134
return 0;
@@ -144,18 +144,18 @@ int main(void)
144144
close(client);
145145
}
146146

147-
(void)video_enqueue(video, VIDEO_EP_OUT, vbuf);
147+
(void)video_enqueue(video_dev, VIDEO_EP_OUT, vbuf);
148148
} while (!ret);
149149

150150
/* stop capture */
151-
if (video_stream_stop(video)) {
151+
if (video_stream_stop(video_dev)) {
152152
LOG_ERR("Unable to stop video");
153153
return 0;
154154
}
155155

156156
/* Flush remaining buffers */
157157
do {
158-
ret = video_dequeue(video, VIDEO_EP_OUT, &vbuf, K_NO_WAIT);
158+
ret = video_dequeue(video_dev, VIDEO_EP_OUT, &vbuf, K_NO_WAIT);
159159
} while (!ret);
160160

161161
} while (1);

0 commit comments

Comments
 (0)