summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorCharlie Root <root@dangofactory.local>2026-10-25 10:15:31 +0900
committerCharlie Root <root@dangofactory.local>2026-10-25 10:15:31 +0900
commit7318435b737394904bb1c5ce9fe013b0eee1882f (patch)
tree41adf14909f5f8d15c8e1c5db361e6ea0ac97598 /Makefile
downloadmpegcap-baseline-1016.tar.gz
mpegcap-baseline-1016.zip
kare / spoon - CX23416 + FX2 USB MPEG capture toolHEADbaseline-1016
Capture tool for the I-O DATA GV-MVP/RZ2 (04bb:0514): Conexant CX23416 MPEG encoder behind an EZ-USB FX2 bridge, with a CX25837 video decoder (I2C 0x44) and a WM8739 audio ADC (I2C 0x1a). libusb-1.0, C99, built with GNU make on FreeBSD/Linux. kare capture: MPEG-2 PS or raw HM12 (y4m), MPEG audio, --pcm WAV, live parameter control through CTLFILE spoon live viewer: pipe -> ffmpeg -> SDL2, clickable control bar, resizable window, raw PCM playback on -r State at this commit: - MPEG-2 PS 720x480 ~6.5 Mbit/s, colour, mp2 48 kHz stereo 224 kbit/s - raw HM12 (NV12_16L16, 518,416-byte frames) with selective median denoise - S-Video works: luma In1 + chroma In5 (0x103=0xd0); RCA is In2+In6 (0xe1) - VBI cropped: 0x0474=24 with 0x0477=28 (they must move together, +4) - audio: never issue an I2C READ to the WM8739 (write-only part) History note: this repository was squashed to a single commit on 2026-10-25 because the earlier history carried the CX23416 firmware images and the vendor trees. Those still exist on the working copy (firmware/, ref/) and are in .gitignore; only src/, include/, Makefile, README.md and .gitignore are versioned. The pre-squash history is preserved locally as a bundle.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile55
1 files changed, 55 insertions, 0 deletions
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..6a0dcdc
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,55 @@
+#
+# kare / spoon - CX23416/FX2 USB MPEG capture
+#
+# FreeBSD / Linux : gmake (GNU make; plain make on Linux)
+#
+
+CC ?= cc
+PKG_CONFIG ?= pkg-config
+
+CFLAGS ?= -O2 -Wall -Wextra -std=c99
+CFLAGS += -Iinclude
+
+SRCS = src/cx2584x_ser_test.c src/cx2584x_pll_test.c src/device.c src/firmware.c src/encoder.c src/capture.c src/hm12.c src/cx2584x_audio.c src/cx2584x_tables.c src/cx2584x_ser_init.c src/driver_seq.c src/kare.c
+OBJS = $(SRCS:.c=.o)
+BIN = kare
+
+# --- libusb-1.0 detection -------------------------------------------
+# Prefer pkg-config; if it is unavailable, fall back to platform defaults.
+HAVE_PC := $(shell $(PKG_CONFIG) --exists libusb-1.0 2>/dev/null && echo yes)
+
+ifeq ($(HAVE_PC),yes)
+LDLIBS += $(shell $(PKG_CONFIG) --libs libusb-1.0)
+else
+LDLIBS += -lusb-1.0
+endif
+
+# pthread for the -t timeout worker thread
+CFLAGS += -pthread
+LDLIBS += -pthread
+LDLIBS += -lm
+
+# gmake used to build ONLY mpegcap (all: $(BIN)), so mpegview stayed at
+# whatever binary was last built by hand and a fix in mpegview.c looked like
+# "no effect" while the viewer was the previous build. Build both.
+all: $(BIN) spoon
+
+$(BIN): $(OBJS)
+ $(CC) -o $@ $(OBJS) $(LDFLAGS) $(LDLIBS)
+
+%.o: %.c include/pvrusb2.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+src/capture.o: src/capture.c include/pvrusb2.h include/capture.h
+ $(CC) $(CFLAGS) -c -o $@ $<
+
+clean:
+ rm -f $(OBJS) $(BIN) spoon
+
+.PHONY: all clean
+
+# --- spoon: single-binary live viewer (SDL2 + libav, OSS audio) ---
+spoon: src/spoon.c
+ $(CC) $(CFLAGS) -o $@ $< \
+ $(shell $(PKG_CONFIG) --cflags --libs libavformat libavcodec \
+ libswresample libavutil sdl2) -lm