summaryrefslogtreecommitdiff
path: root/include/capture.h
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 /include/capture.h
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 'include/capture.h')
-rw-r--r--include/capture.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/include/capture.h b/include/capture.h
new file mode 100644
index 0000000..928ed0c
--- /dev/null
+++ b/include/capture.h
@@ -0,0 +1,36 @@
+/*
+ * capture.h - capture API
+ */
+#ifndef PVR2_CAPTURE_H
+#define PVR2_CAPTURE_H
+
+#include "pvrusb2.h"
+
+typedef struct pvr2_capture pvr2_capture_t;
+
+/* USB stream health. short/zero completions and stalls indicate the
+ * encoder is not keeping up, which makes the player lag behind live. */
+typedef struct {
+ long packets; /* completed non-empty bulk transfers */
+ long short_xfer; /* completed, but fewer bytes than requested */
+ long zero_xfer; /* completed with 0 bytes */
+ long stall; /* LIBUSB_TRANSFER_STALL */
+ long overflow; /* LIBUSB_TRANSFER_OVERFLOW */
+ long errors; /* hard errors */
+} pvr2_capture_stats_t;
+
+pvr2_capture_t *pvr2_capture_new(pvr2_dev *p, pvr2_data_cb cb, void *user);
+int pvr2_capture_run(pvr2_capture_t *c);
+void pvr2_capture_stop(pvr2_capture_t *c);
+void pvr2_capture_free(pvr2_capture_t *c);
+void pvr2_capture_stats(pvr2_capture_t *c, pvr2_capture_stats_t *st);
+/* Tell the capture context which (type, subtype) the encoder was started
+ * with, so it can send CX2341X_ENC_STOP_CAPTURE (0x82) BEFORE switching
+ * USB streaming off -- the vendor order is STOP_CAPTURE then 0x37. Not
+ * calling it leaves the encoder holding the previous mode/buffer, which is
+ * what made a later mode switch (MPEG -> raw) come up stuck on the old
+ * buffer. */
+void pvr2_capture_set_enc_stop(pvr2_capture_t *c, uint32_t captype,
+ uint32_t subtype);
+
+#endif