summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2025-02-17 12:14:12 -0500
committerpommicket <pommicket@gmail.com>2025-02-18 00:35:41 -0500
commit25786c1a97451b5093ebcdb09e41a9fb36cd6102 (patch)
tree2f1813b4712549264042a3f31384e364ad6d6f07
parentf60759edfb24372bf62efbb44490a22595d44234 (diff)
small fixes
-rw-r--r--Makefile7
-rw-r--r--main.c17
-rw-r--r--meson.build2
3 files changed, 20 insertions, 6 deletions
diff --git a/Makefile b/Makefile
index 64ae400..e55eb63 100644
--- a/Makefile
+++ b/Makefile
@@ -1,5 +1,8 @@
-camlet.debug: meson.build main.c
- @if [ '!' '-d' debug ]; then meson setup debug; fi
+camlet.debug: meson.build main.c debug/setup
meson compile -C debug
ln -sf debug/camlet camlet.debug
cp debug/compile_commands.json .
+debug/setup:
+ rm -rf debug
+ meson setup debug
+ touch debug/setup
diff --git a/main.c b/main.c
index f14f957..a321990 100644
--- a/main.c
+++ b/main.c
@@ -194,7 +194,7 @@ static bool camera_setup_with_userp(Camera *camera) {
camera->access_method = CAMERA_ACCESS_USERP;
return false;
/*
-TODO: test me with a camera that supports user i/o
+TODO: test me with a camera that supports userptr i/o
struct v4l2_requestbuffers req = {0};
req.count = CAMERA_MAX_BUFFERS;
req.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
@@ -288,7 +288,11 @@ bool camera_next_frame(Camera *camera) {
buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
buf.memory = memory;
if (v4l2_ioctl(camera->fd, VIDIOC_DQBUF, &buf) != 0) {
- perror("v4l2_ioctl VIDIOC_DQBUF");
+ static bool printed_error;
+ if (!printed_error) {
+ perror("v4l2_ioctl VIDIOC_DQBUF");
+ printed_error = true;
+ }
return false;
}
camera->frame_bytes_set = buf.bytesused;
@@ -617,7 +621,7 @@ void get_cameras_from_device(const char *dev_path, const char *serial, int fd, C
}
}
-int main() {
+int main(void) {
if (sodium_init() < 0) {
fprintf(stderr, "couldn't initialize libsodium");
return EXIT_FAILURE;
@@ -641,8 +645,15 @@ int main() {
printf("couldn't create GL context: %s\n", SDL_GetError());
}
SDL_GL_SetSwapInterval(1); // vsync
+ #if __GNUC__
+ #pragma GCC diagnostic push
+ #pragma GCC diagnostic ignored "-Wpedantic"
+ #endif
#define gl_get_proc(upper, lower) gl_##lower = (PFNGL##upper##PROC)SDL_GL_GetProcAddress("gl" #lower);
gl_for_each_proc(gl_get_proc);
+ #if __GNUC__
+ #pragma GCC diagnostic pop
+ #endif
#if DEBUG
{
GLint flags = 0;
diff --git a/meson.build b/meson.build
index 54cffb0..c972045 100644
--- a/meson.build
+++ b/meson.build
@@ -1,7 +1,7 @@
project('camlet',
'c',
default_options: [
- 'warning_level=4',
+ 'warning_level=3',
]
)