diff options
author | pommicket <pommicket@gmail.com> | 2025-02-23 13:52:44 -0500 |
---|---|---|
committer | pommicket <pommicket@gmail.com> | 2025-02-25 15:16:08 -0500 |
commit | 27b5aa8289330bc7b9f3499bf98a84f0127f4899 (patch) | |
tree | 7bffb0ce28a7924d425fde6fc2f7112f1b6ea7da /camera.c | |
parent | 78f28b310251cd3e35d588c9f1476e3d0ef6d983 (diff) |
separate video stuff into its own file
Diffstat (limited to 'camera.c')
-rw-r--r-- | camera.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -1,4 +1,5 @@ #include "camera.h" +#include <stdatomic.h> #include <linux/videodev2.h> #include <sodium.h> #include <libv4l2.h> @@ -7,10 +8,10 @@ #include <fcntl.h> #include <time.h> #include <tgmath.h> -#include "ds.h" #include "3rd_party/stb_image_write.h" #include <jpeglib.h> #include <libavcodec/avcodec.h> +#include "util.h" #define CAMERA_MAX_BUFFERS 4 struct Camera { @@ -936,6 +937,10 @@ bool camera_copy_to_av_frame(Camera *camera, struct AVFrame *frame_out) { || frame_height != frame_out->height || camera_pixel_format(camera) != V4L2_PIX_FMT_YUV420 || frame_out->format != AV_PIX_FMT_YUV420P) { + static atomic_flag warned = ATOMIC_FLAG_INIT; + if (!atomic_flag_test_and_set_explicit(&warned, memory_order_relaxed)) { + fprintf(stderr, "%s: Bad picture format.", __func__); + } return false; } // copy Y plane |