diff options
| author | Charlie Root <root@dangofactory.local> | 2026-10-25 10:15:31 +0900 |
|---|---|---|
| committer | Charlie Root <root@dangofactory.local> | 2026-10-25 10:15:31 +0900 |
| commit | 7318435b737394904bb1c5ce9fe013b0eee1882f (patch) | |
| tree | 41adf14909f5f8d15c8e1c5db361e6ea0ac97598 /src/driver_seq.c | |
| download | mpegcap-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 'src/driver_seq.c')
| -rw-r--r-- | src/driver_seq.c | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/driver_seq.c b/src/driver_seq.c new file mode 100644 index 0000000..307f49f --- /dev/null +++ b/src/driver_seq.c @@ -0,0 +1,67 @@ +/* + * driver_seq.c - the GV-MVP/RZ2 official driver's extra capture-start + * commands (recovered with Ghidra from p2usbRZ2.sys FUN_000217a2). + * + * IMPORTANT FINDING (verified on hardware): + * The driver's *complete* command list is NOT a drop-in replacement for + * the mpegcapt.c config: it omits several commands (0xbb/0xc7/0xd6/ + * 0x99/0xb7/0x89/0x95/0xa1) and sending only the driver list stalls the + * MPEG stream after one transfer. Conversely, the mpegcapt.c config + * plus the driver's 0xdc (MISC) group produces a full-rate, stable + * stream. + * + * So this function keeps the known-good mpegcapt.c config and appends + * the driver-only extras: the seven 0xdc (MISC) commands and the + * encoder status-flag clear. Video is stable; audio still does not + * appear, so the remaining audio enabler is elsewhere (see NOTES.md). + * + * Part of mpegcap. + */ +#include <stdio.h> + +#include "pvrusb2.h" + +int pvr2_encoder_config_driver(pvr2_dev *p, int sample_rate) +{ + uint32_t a[8]; + + /* Known-good base config (mpegcapt.c / Linux pvrusb2). */ + if (pvr2_encoder_config(p, sample_rate) < 0) { + if (p->verbose) + fprintf(stderr, "driver-seq: base config errors\n"); + return -1; + } + + /* + * Driver-only MISC (0xdc) group. + * + * ★ The values below were WRONG until 2026-10-14: they had been + * guessed from driver_capture_seq.txt, whose argument list is written + * in PUSH order (last argument first), so param0 and param1 came out + * swapped and two entries were invented. These are the values the + * driver actually sends, read out of the USB capture + * (/ROM/rz2-usb.pcap, EP 0x01, cmd 0xdc): six calls per session, in + * this order, with every other argument zero: + * MISC(5,0) MISC(3,1) MISC(8,0) + * MISC(4,1) MISC(0,3) MISC(15,0) + * (driver_capture_seq.txt's #5 "3,0" and #7 "[obj+0x1d8],EAX,0x0f" + * reverse to (0,3) and (0x0f,...) = 15, which do agree; #6 does not + * appear in the capture at all.) + * The same values are available as ENCMISC=1 in encoder.c. + */ + a[0] = 5; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 3; a[1] = 1; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 8; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 4; a[1] = 1; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 0; a[1] = 3; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + a[0] = 15; a[1] = 0; + (void)pvr2_enc_cmd(p, CX2341X_ENC_MISC, a, 2); + + return 0; +} + |
