From b88b34dbd672ac2b58d4f7c12f96fa79337cfe1f Mon Sep 17 00:00:00 2001 From: pommicket Date: Tue, 25 Feb 2025 22:19:37 -0500 Subject: start work on application --- Makefile | 20 ++++++++++++++++++++ README.md | 19 +++++++++++++++---- camlet.desktop | 9 +++++++++ control | 11 +++++++++++ main.c | 13 ++++++++++++- 5 files changed, 67 insertions(+), 5 deletions(-) create mode 100644 camlet.desktop create mode 100644 control diff --git a/Makefile b/Makefile index d09287a..f449444 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,5 @@ +INSTALL_PREFIX?=/usr/local + camlet.debug: meson.build *.[ch] 3rd_party/*.[ch] debug/setup meson compile -C debug ln -sf debug/camlet camlet.debug @@ -13,3 +15,21 @@ release/setup2: rm -rf release meson setup --buildtype=release release touch release/setup2 +camlet.deb: release control + rm -rf tmp + mkdir -p tmp/camlet/usr/bin tmp/camlet/DEBIAN tmp/camlet/usr/share/applications tmp/camlet/usr/share/icons/hicolor/48x48/apps + cp release/camlet tmp/camlet/usr/bin/ + cp camlet.desktop tmp/camlet/usr/share/applications/ + cp camlet.png tmp/camlet/usr/share/icons/hicolor/48x48/apps + cp control tmp/camlet/DEBIAN/ + dpkg-deb --build tmp/camlet + rm -rf tmp +install: release + @[ -w $(INSTALL_PREFIX) ] || { echo "You need permission to write to $(INSTALL_PREFIX). Try running with sudo/as root." && exit 1; } + mkdir -p $(INSTALL_PREFIX)/bin $(INSTALL_PREFIX)/share/applications $(INSTALL_PREFIX)/share/icons/hicolor/48x48/apps + install -m 755 release/camlet $(INSTALL_PREFIX)/bin + install -m 644 camlet.desktop $(INSTALL_PREFIX)/share/applications + install -m 644 camlet.png $(INSTALL_PREFIX)/share/icons/hicolor/48x48/apps +uninstall: + @[ -w $(INSTALL_PREFIX) ] || { echo "You need permission to write to $(INSTALL_PREFIX). Try running with sudo/as root." && exit 1; } + rm -f $(INSTALL_PREFIX)/bin/camlet $(INSTALL_PREFIX)/share/applications/camlet.desktop $(INSTALL_PREFIX)/share/icons/hicolor/48x48/apps/camlet.png diff --git a/README.md b/README.md index de93934..ac96955 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,20 @@ # camlet -Camlet is a picture-taking application for Linux. +Camlet is a webcam application for Linux. It features -- Reasonably good performance -- Proper handling of disconnecting/reconnecting devices, including the ability to prioritize some cameras over others -- JPEG and PNG output +- Proper handling of disconnecting/reconnecting devices +- Capture JPEG and PNG images and MP4 (H264+AAC) videos - Full selection of resolutions available from camera - Remembers settings across program launches +# Debugging + +If you find a bug, please create an issue on GitHub; it will be helpful to have +your settings and log file, located in `~/.config/camlet`. + +You can try deleting/renaming your settings file as a temporary solution, to reset camlet to its default settings. + # Building from source camlet requires meson-build, a C compiler, and the development libraries @@ -19,3 +25,8 @@ These can all be installed on Debian/Ubuntu with ```sh sudo apt install clang meson libv4l-dev libudev-dev libsodium-dev libfontconfig-dev libgl-dev libsdl2-dev libsdl2-ttf-dev libjpeg-dev libpulse-dev libavcodec-dev libavformat-dev ``` + +You can build the debug version of camlet with `make` (outputs `camlet.debug`), the release +version with `make release` (outputs `release/camlet`), and install it with +`make install`, or e.g. `INSTALL_PREFIX=~/.local make install` to customize the installation directory (default: `/usr/local`). +You can also build the .deb installer with `make camlet.deb`. diff --git a/camlet.desktop b/camlet.desktop new file mode 100644 index 0000000..30455e1 --- /dev/null +++ b/camlet.desktop @@ -0,0 +1,9 @@ +[Desktop Entry] +Type=Application +Encoding=UTF-8 +Name=camlet +Comment=Take pictures and videos with a webcam +Exec=camlet +Icon=camlet.png +Terminal=false +Categories=AudioVideo;Video;Recorder diff --git a/control b/control new file mode 100644 index 0000000..4133802 --- /dev/null +++ b/control @@ -0,0 +1,11 @@ +Package: camlet +Version: 0.0.0 +Section: video +Priority: optional +Architecture: amd64 +Essential: no +Maintainer: pommicket +Description: Take pictures and videos with a webcam +Installed-Size: 156024 +Depends: libsdl2-2.0-0, libv4l-0, libudev1, libsodium23, libfontconfig1, libsdl2-ttf-2.0-0, libjpeg62-turbo, libavcodec59, libavformat59 +Homepage: https://github.com/pommicket/camlet diff --git a/main.c b/main.c index 7adbcef..00bcf1b 100644 --- a/main.c +++ b/main.c @@ -1,3 +1,12 @@ +#define VERSION "0.0.0" + +/* +TODO: +- switch back to SDL for audio now that that bug has been fixed +- application icon (and SDL_SetWindowIcon) +- cmdline argument for starting in video mode +*/ + #define _GNU_SOURCE #include #include @@ -19,6 +28,7 @@ #include "video.h" #include "log.h" + // pixel format used for convenience #define PIX_FMT_XXXGRAY 0x47585858 @@ -1778,7 +1788,8 @@ void main() {\n\ camera_hash_str(state->camera, hash); strcpy(&hash[8], "..."); } - snprintf(text, sizeof text, "Camera FPS: %" PRId32 " Render FPS: %" PRId32 " Camera ID: %s", + snprintf(text, sizeof text, + "Camera FPS: %" PRId32 " | Render FPS: %" PRId32 " | Camera ID: %s | v. " VERSION, smoothed_camera_time > 1e-9 && smoothed_camera_time < 1 ? (int32_t)(1/smoothed_camera_time) : 0, smoothed_frame_time > 1e-9 && smoothed_frame_time < 1 ? (int32_t)(1/smoothed_frame_time) : 0, state->camera ? hash : "(None)"); -- cgit v1.2.3