Skip to content

Commit c95ec70

Browse files
ngphibangjhedberg
authored andcommitted
samples: video: capture: Drop buffers array variable
The buffers array variable is not needed. Drop it. Signed-off-by: Phi Bang Nguyen <[email protected]>
1 parent 086bdae commit c95ec70

File tree

1 file changed

+5
-6
lines changed
  • samples/drivers/video/capture/src

1 file changed

+5
-6
lines changed

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

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ static inline void video_display_frame(const struct device *const display_dev,
9191

9292
int main(void)
9393
{
94-
struct video_buffer *buffers[CONFIG_VIDEO_BUFFER_POOL_NUM_MAX];
9594
struct video_buffer *vbuf = &(struct video_buffer){};
9695
const struct device *video_dev;
9796
struct video_format fmt;
@@ -285,19 +284,19 @@ int main(void)
285284
}
286285

287286
/* Alloc video buffers and enqueue for capture */
288-
for (i = 0; i < ARRAY_SIZE(buffers); i++) {
287+
for (i = 0; i < CONFIG_VIDEO_BUFFER_POOL_NUM_MAX; i++) {
289288
/*
290289
* For some hardwares, such as the PxP used on i.MX RT1170 to do image rotation,
291290
* buffer alignment is needed in order to achieve the best performance
292291
*/
293-
buffers[i] = video_buffer_aligned_alloc(bsize, CONFIG_VIDEO_BUFFER_POOL_ALIGN,
292+
vbuf = video_buffer_aligned_alloc(bsize, CONFIG_VIDEO_BUFFER_POOL_ALIGN,
294293
K_FOREVER);
295-
if (buffers[i] == NULL) {
294+
if (vbuf == NULL) {
296295
LOG_ERR("Unable to alloc video buffer");
297296
return 0;
298297
}
299-
buffers[i]->type = type;
300-
video_enqueue(video_dev, buffers[i]);
298+
vbuf->type = type;
299+
video_enqueue(video_dev, vbuf);
301300
}
302301

303302
/* Start video capture */

0 commit comments

Comments
 (0)