Repository navigation
rust: Port media-io/video-fourcc.c to a new obs-media-io crate - #97
Merged
Merged
Conversation
Pins video_format_from_fourcc from media-io/video-fourcc.c before the Rust port: every mapped fourcc, unknown codes and the fourccs of other enum formats going to VIDEO_FORMAT_NONE, case sensitivity, and the first character being the low byte. Co-Authored-By: Claude Opus 5.5 <[email protected]>
New crate for libobs/media-io, the second Phase 5 area, laid out like obs-graphics: a safe core at the crate root, the C ABI shim in src/ffi/, re-exported through libobs-rust, and scanned by the export_list check. Tier 1, Tier 2 layout and Tier 3 parity tests for video_format_from_fourcc against a todo!() core. enum video_format crosses the C ABI as a c_int, like serialize_seek_type in obs-util: a C caller can pass any value, which a Rust enum must not hold. The safe VideoFormat keeps the header's values as discriminants, and the layout test checks the enum's size and alignment and every enumerator's value against the oracle. Random u32s almost never hit the fourcc table, so parity also enumerates every code over the characters the table uses, single-bit and single-byte changes of each mapped code, and the cmocka cases. Co-Authored-By: Claude Opus 5.5 <[email protected]>
video_format_from_fourcc moves to Rust. With ENABLE_RUST_LIBOBS=ON libobs builds without media-io/video-fourcc.c and exports the Rust shim under the same name. No intentional differences. Parity adds a test over every u32, the only one that catches an extra code built from characters outside the table. It splits the range across threads, and the root Cargo.toml builds obs-media-io with opt-level = 3 in the dev profile, so it runs in the default cargo test: about 3 s on 20 cores, 8 s on 4. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=e78b704eecb982a8ada77bfc87e4835dd6d79cdc secs=21 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791640783,"gate":"rust/all/fmt","host":"linux-x86_64","key":"c967111d9595ffc4a88d675fe8f571d5354fb6b257280eff44335f294592a6c4","lane":"lint","parents":["9faffcf1a7e0057453b4dd4f35658c680e41f9ac"],"secs":6,"stamp":"57a2d155574b457d1d887fb3bd2e49ab","tree":"e78b704eecb982a8ada77bfc87e4835dd6d79cdc","v":1,"via":"run"} Ci-Attestation: {"at":1791640783,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"c967111d9595ffc4a88d675fe8f571d5354fb6b257280eff44335f294592a6c4","lane":"lint","parents":["9faffcf1a7e0057453b4dd4f35658c680e41f9ac"],"secs":6,"stamp":"76b49d2da9e05f781b7156db3ef34c0e","tree":"e78b704eecb982a8ada77bfc87e4835dd6d79cdc","v":1,"via":"run"} Ci-Attestation: {"at":1791640783,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"4e8d65d4ef6456f94c3ae3bbea93b4ac4b1883dade626cc39c80ddd034de82a7","lane":"rust-test","parents":["9faffcf1a7e0057453b4dd4f35658c680e41f9ac"],"secs":6,"stamp":"215259edd320ad140f79d24759ff3cb0","tree":"e78b704eecb982a8ada77bfc87e4835dd6d79cdc","v":1,"via":"run"} Ci-Attestation: {"at":1791640783,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"edb828316af0d977c75e39300ff626f59aa4c95cd9ae8bb52b03c238457b9335","lane":"tier2-linux","parents":["9faffcf1a7e0057453b4dd4f35658c680e41f9ac"],"secs":9,"stamp":"87ab094f00c98c2628a0d20bd05d2a20","tree":"e78b704eecb982a8ada77bfc87e4835dd6d79cdc","v":1,"via":"run"}
fail_msg() expands to cm_print_error(), which the Windows cmocka library does not export, so test_video_fourcc failed to link in the Windows Tier 2 job (LNK2019). Report the code on stderr and use fail(), as test_base.c does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=76670177c6e2b348d3ca98ff616af3faf3bdc63c secs=29 lanes=lint:reused@3c80731fea35,rust-test:reused@6c77b30469cb,tier2-linux:run Ci-Attestation: {"at":1791650123,"gate":"rust/all/fmt","host":"linux-x86_64","key":"3c80731fea35e7882948581c7d69d953da1765755631a150520928e7dfaafa3e","lane":"lint","parents":["327057cf76712d2c9d53bfe0f26522dc88c22f1c"],"secs":null,"stamp":"09f96cff6691442727302f065db85115","tree":"76670177c6e2b348d3ca98ff616af3faf3bdc63c","v":1,"via":"reused"} Ci-Attestation: {"at":1791650123,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"3c80731fea35e7882948581c7d69d953da1765755631a150520928e7dfaafa3e","lane":"lint","parents":["327057cf76712d2c9d53bfe0f26522dc88c22f1c"],"secs":null,"stamp":"791aaa691014962dbd3f572f86f5ed3f","tree":"76670177c6e2b348d3ca98ff616af3faf3bdc63c","v":1,"via":"reused"} Ci-Attestation: {"at":1791650123,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"6c77b30469cb81de1a1fea60f9ae18b11a3c44e2598eb6671746f3ec30ecd070","lane":"rust-test","parents":["327057cf76712d2c9d53bfe0f26522dc88c22f1c"],"secs":null,"stamp":"d8bebf1b41b25fbca2dc608f47436ce5","tree":"76670177c6e2b348d3ca98ff616af3faf3bdc63c","v":1,"via":"reused"} Ci-Attestation: {"at":1791650677,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"b1c1da1fed49c3cdc72c7fbe210d1410bb441f18b165f25512cae998737b9417","lane":"tier2-linux","parents":["327057cf76712d2c9d53bfe0f26522dc88c22f1c"],"secs":29,"stamp":"82375c53cff6fa3a8723952f086c3a6d","tree":"76670177c6e2b348d3ca98ff616af3faf3bdc63c","v":1,"via":"run"}
zackees
force-pushed
the
port/video-fourcc
branch
from
October 10, 2026 16:44
1bb56af to
3a37bb2
Compare
5 tasks done
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=21926a8ffae3e3de7be0daaa6a529723f7497869 secs=50 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791654631,"gate":"rust/all/fmt","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"92e0f34f8074164ecb0208cbd6f8ab26","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"6277551b1197bae61a0a3563f9047b17c1e6d651b5cab860d7def119d1cbc569","lane":"lint","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":12,"stamp":"4d3ace010dbaab4ed252006d22ec59aa","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"c6b1b608fc16817859a28490ada2b38a926103a0094ec23e3bb7d594979793d7","lane":"rust-test","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":18,"stamp":"d73d3c14d2d133a677293234ca581902","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"} Ci-Attestation: {"at":1791654631,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"d05a3c8a53e501ee21ca4d301b5ba053c0dccd6b86b39d46af0486606d1d851e","lane":"tier2-linux","parents":["5502191074629b7f2e51dda6d89fa601ce22a01d"],"secs":20,"stamp":"7dedfefe7e32a22a666716a1fd3efcb5","tree":"21926a8ffae3e3de7be0daaa6a529723f7497869","v":1,"via":"run"}
This was referenced Oct 10, 2026
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=1b426910df018155f8be2a2ed4dc5fd8b42d68a0 secs=17 lanes=lint:reused@12a747713c0b,rust-test:reused@8f0383f521c9,tier2-linux:run Ci-Attestation: {"at":1791655075,"gate":"rust/all/fmt","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"58719f015cf7d13d7f971c86c36023dd","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"12a747713c0b7b727bbfb48e33e2c7c1aa431a3c77062fee88a56e5821c8b6c5","lane":"lint","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"42c3a2e402903d1da67f91e332763625","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655075,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"8f0383f521c9857941f5429d53f8403e48869775747f8ce4edeee1af4e935da8","lane":"rust-test","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":null,"stamp":"814d385ae14911c99b750eff7d8faa6a","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"reused"} Ci-Attestation: {"at":1791655401,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"2e94b41fc041e0c98bd1709f7ab30cb7f5b5b835b799b4c3abb2c5414d4b62ec","lane":"tier2-linux","parents":["84c80bce3c20e772d563e2c85b32ed5ac51020b4"],"secs":17,"stamp":"e6e3337d94f8a4dbafc4a9892b369084","tree":"1b426910df018155f8be2a2ed4dc5fd8b42d68a0","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=44ac22e2f9bf9093f2a87bc1c0860393942c7f05 secs=31 lanes=lint:reused@9b0282a9e1c3,rust-test:reused@e3680ff66806,tier2-linux:run Ci-Attestation: {"at":1791656844,"gate":"rust/all/fmt","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"ed3cee40895adfa7780a781e7ead1f4d","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"9b0282a9e1c35c80eae0d4f0c7540b1c3b1c9f193daad522570bc7b20e609cdc","lane":"lint","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"9bde047cbb6c054fa18fa8143826c0c7","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791656844,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"e3680ff66806191a1385606c7996530d1becc162ef5a3444eeefce614a7d0c02","lane":"rust-test","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":null,"stamp":"46cf777b2d672af2f62536e2d4132bf2","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"reused"} Ci-Attestation: {"at":1791657116,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"99939507781ddefb1aa7855e1a0c9b4af9092524f38999d7db36a74a20f1ccce","lane":"tier2-linux","parents":["07223a5abc85d40d9b7c016092ce37a672aca501"],"secs":31,"stamp":"8164638665d4208fabc4b0a768fbc870","tree":"44ac22e2f9bf9093f2a87bc1c0860393942c7f05","v":1,"via":"run"}
zackees
added a commit
that referenced
this pull request
Oct 10, 2026
…43) Phase 3 ports of libobs/util into the obs-util crate, each with a safe core, a C ABI shim, Tier 1 tests, a layout test where a struct crosses the ABI, and a proptest parity suite against the original C built as an oracle. ENABLE_RUST_LIBOBS=ON drops the matching C sources from libobs. - utf8: hidden and non-Windows only (Windows keeps the C utf8.c). - lexer.c: follows master's C, including the #48 strref ordering. - text-lookup: no longer crashes on an opening quote at end of line; the shim returns false for a NULL lookup. - dstr: follows master's #46/#47 fixes; strlist_split takes a NUL separator. Wide-char and printf helpers stay in dstr-libc.c. - bmem: Windows _aligned_* branch and the allocation counter. The oracle vendors uthash 2.3.0 (BSD-1-Clause) for text-lookup.c, since the Rust test runners have no uthash package. Refs #43 Rebased onto master after #61 (base), #66 (file-serializer) and #85 (real utf8.c in the oracle): the oracle's utf8.c/platform_conv_host.c now use oracle_* utf8 names so they no longer clash with the Rust shims; the dstr-conversion oracle test moved to obs-util and calls oracle_dstr_*; duplicate bcrash/os_fopen/bmemdup/os_*_ptr stand-ins were dropped in favour of master's base-variadic.c, file_serializer_host.c and platform_conv_host.c; utf8 shims are listed in rust-hidden.txt; the vendored uthash is excluded from clang-format. Rebased again onto master after #82/#83/#87/#97/#89/#98/#88/#105: oracle build.rs keeps video_fourcc.c/task.c and drops the direct util/utf8.c (oracle/utf8.c already compiles it under oracle_* names, which platform_conv_host.c and #82's file_serializer_host.c use). Co-Authored-By: Claude Opus 5.5 <[email protected]> Local-Gate: v1 tree=58f2156a689831720a1e6ad9004041e400917579 secs=135 lanes=lint:run,rust-test:run,tier2-linux:run Ci-Attestation: {"at":1791658556,"gate":"rust/all/fmt","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"a33efc3cd6c98f3fbd2fa57e9a61a281","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"e533312cff231c50944045005e90c2b48ce1920b317c9037a705bfda5b49ef4c","lane":"lint","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":17,"stamp":"fb2d0a58bcefb05085a4b512fc916740","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"1a00cb7a8eb7b67b33a108e748711133d604e544b254813435cc1ca5ea24cd26","lane":"rust-test","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":22,"stamp":"d80b75173a27c995da2676193fa36904","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"} Ci-Attestation: {"at":1791658556,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"a950373231b455174e5c031fe578e1e48c61e04f0387195a7ddc0e265e371e15","lane":"tier2-linux","parents":["930903b5e8c0cac6cec54edd05abeaacb825637c"],"secs":96,"stamp":"f1c2d81609277e26492a5a3f3553cd9c","tree":"58f2156a689831720a1e6ad9004041e400917579","v":1,"via":"run"}
10 of 22 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Ports
libobs/media-io/video-fourcc.c(video_format_from_fourcc) into a newobs-media-iocrate, the second Phase 5 area. WithENABLE_RUST_LIBOBS=ONlibobs builds withoutmedia-io/video-fourcc.cand exports the Rust shim under the same name. No intentional differences.New crate.
rust/obs-media-iofollows the layout #39 set up forobs-graphics: the safe core at the crate root, the C ABI shim insrc/ffi/, re-exported throughlibobs-rust. Like #39, this also adds the crate to theexport_listscan, the testing policy's layout tree andrust/README.md.enum video_formatat the C boundary. It crosses the C ABI as ac_int, the way the serializer ports passserialize_seek_type, since a C caller can pass any value and a Rust enum must not hold an unlisted one. The safe core'sVideoFormatis a plain Rust enum. It keeps the header's values as discriminants, sovideo_format_to_cis a cast. The layout test checks thatc_intmatches the size and alignment of the C enum, and compares every enumerator's value against the C compiler's.video-matrices.ctakes these enums as inputs and will add the checked conversion from C, using the sameVideoFormat::ALL.Exhaustive parity, and a per-crate optimization level (needs your call).
every_u32_matches_c_oraclecompares the shim and the core with the C oracle for everyu32. It is the only test that catches an extra code built from characters outside the table (see the mutation check below). To keep it in the defaultcargo testrather than an opt-in#[ignore]test that nobody runs, it splits the range across threads, and the rootCargo.tomlbuilds this one crate optimized in the dev profile:It takes about 3 s on 20 cores and 8 s on 4, against minutes unoptimized. The override covers only
obs-media-io.obs-c-oracleand the other crates are unchanged, so the bit-exact float oracles are unaffected. This is the first per-crate profile override in the workspace; if you would rather not have one, the alternative is dropping the exhaustive test and relying on the structured parity tests.Motivation and Context
Claimed on #45 (media-io:
video-fourcc.candvideo-matrices.c). This is the first of the two;video-matrices.cfollows once #75 (vec3) lands.Refs #45
How Has This Been Tested?
Linux x86_64 (WSL2), Rust via soldr 0.9.31.
test/cmocka/test_video_fourcc.c(C characterization, passes OFF and ON before any Rust), then RED (todo!()core: Tier 1 fails, parity aborts in the shim, layout andexport_listpass), then GREEN.soldr cargo test -p obs-media-io: Tier 1 (1:1 port of the cmocka cases plus edge cases), Tier 2 layout, Tier 3 parity against the C oracle. Randomu32s almost never hit the table, so besides proptest and the exhaustive test, parity enumerates every code over the characters the table uses, single-bit flips and single-byte changes of every mapped code, and replays the cmocka cases (cmocka_cases_match_c_oracle).2Vuy, mappingYVYUto YUY2 and packing big-endian each fail 5 of the 6 parity tests. An extra code from characters outside the table ("Y8 ") passes the structured tests and failsevery_u32_matches_c_oracle. All reverted../lintand./unittest: ok. tier2-linux rantest_video_fourccwith ENABLE_RUST_LIBOBS OFF and ON. The libobs exported symbols are identical OFF vs ON (1752). In the ON build,video-fourcc.c.ois not among libobs's Ninja inputs andvideo_format_from_fourccis still exported. HEAD carries the local-gate stamp.rust-tier2CI jobs cover them.Types of changes
Checklist:
🤖 Generated with Claude Code