Repository navigation
Description
Scout C / rank 3: C-only prerequisite for the remaining Phase 6 legacy image-file data orchestration, later targeting obs-graphics. Snapshot: master 5889b3936 (2026-11-18). This follows the existing policy/helper ports; it does not repeat them.
Context and scope
Exported entry points: gs_create_texture_file_data. Their live C definitions remain in libobs/graphics/graphics-ffmpeg.c.h:189-207. Public declarations are in the unchanged libobs headers.
Move only these public bodies verbatim to proposed libobs/graphics/graphics-texture-file-data.c.h, in the existing libobs/build/libobs.media+.h.c PCH family. Keep signatures, behavior, private dependency semantics and all original read/callback ordering unchanged. No Rust in this prerequisite; the whole-file Rust swap is a separate follow-up after this lands.
Rust-side confirmation: rust/obs-graphics/src/ffi/image_init.rs:40-66 owns the existing init/free engines; src/ffi/image_decode.rs:91-104 owns the decoder engine. src/ffi/texture_file_data2.rs:65-83 exports only data2 and forwards to data3. They do not implement the legacy public wrapper; exact Rust grep is empty. This is remaining orchestration around already ported engines, not a nomination to port FFmpeg shims themselves.
Characterization and build brief
Keep this legacy API distinct from data2/data3: init an FFmpeg image with gs_image_max_texture_size, decode with GS_IMAGE_ALPHA_STRAIGHT, publish format/width/height only when decode returns data, and free the initialized image on both decode-success and decode-failure paths. Failed init returns NULL without a second free or output writes. There is no data3 host fallback in this entry point. Reuse the real generated-PPM/max-size coverage in unchanged test_graphics_viewport::image_width (199-221); a new focused fixture should cover missing/corrupt images, successful output contents/ownership and output sentinels on failure. Keep all FFmpeg calls and ffmpeg_image storage in a thin private C session adapter for the later swap; no new ffmpeg-sys crate and no copied FFmpeg layout.
Existing coverage to preserve: test/cmocka/test_graphics_viewport.c:199-221; test/cmocka/tests.d/test_graphics_viewport.cmake
Dependencies and sequencing: No functional prerequisite. Preserve private ffmpeg_image/static reformat dependencies through declarations or a minimal existing-boundary seam in the media unity/PCH family; do not move this file into a graphics PCH without FFmpeg types. Coordinate future obs-graphics module additions with graphics swaps, although the C group is independent.
Acceptance criteria
- Reuse every applicable existing C characterization unchanged. Where coverage is incomplete, add a new focused test (never rewrite an existing C test). Show baseline behavior against unchanged original C first. Record RED for the missing extraction seam/new focused contract before GREEN; if the existing tests already pin the complete contract, use a focused extraction/build contract rather than inventing redundant assertions.
- Extract the selected bodies behavior-neutrally in a separate C-only commit/PR; no public-header or signature edits, no existing C-test edits, no WebSocket plugin changes, no new workflow files. Scope any unity-local aliases/macros and undefine them at file end. New source membership and sorted metadata must agree.
- Run the focused C tests against both C-reference and hybrid libobs, verify equal public symbol sets, and check affected native-build registrations. Run the repository lint once. Preserve host conditions from existing fixtures and validate Windows MSVC fixture linkage as applicable; no max_align_t or out-of-range enum sentinels.
- Later swap: mirror the unchanged C assertions in the existing Graphics / obs-graphics --test obs-tests-graphics category (no new Rust executable), commit Tier 1 RED before GREEN, add original-C Tier 3 differential/mutation coverage, and link any real private adapter into every affected Rust-static consumer. Rust through soldr, Python through uv; publication through ./push. Tier 4 is inapplicable to these non-protocol entry points; existing C++ WebSocket compatibility remains required.
Append points / lane M / media: libobs/build/libobs.media+.h.c; libobs/build/modules.d/media.json; applicable existing source inventories. New characterization only: test/cmocka/test_texture_file_data_legacy.c, its tests.d fragment and sorted test/cmocka/build/test-graph.json registration. Later Rust append points are rust/obs-graphics/src/lib.rs, src/ffi/mod.rs, its existing category suite modules, per-unit source/export/oracle fragments and applicable real-adapter link-support fragments. Use existing native groups unless BUILD.md justifies a distinct family; a different source filename does not make the group independent.
Decisions
P2 / port / size:S / ready: the deliverable is one small, deterministic C extraction/characterization prerequisite, not the later Rust implementation or a behavior fix. Existing helper ports are reusable dependencies, not proof that the public entry points are ported. Naming is proposed and may follow equivalent current repository conventions. Coordinate shared-file/group landings and refresh claims immediately before implementation. This issue is unclaimed; the scout posted no Claiming comment.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 18, 2026
Claiming: #5125 in pool slot obs-studio5, branch test/5125-image-file. 1. Characterize the legacy wrapper with deterministic FFmpeg fakes and preserve existing image_width coverage. 2. Commit RED extraction-contract evidence, then extract the C body verbatim in the media unity family. 3. Run native_build::, focused OFF/ON checks and lint, publish under backpressure, and file the separate Rust swap. First PR expected this session.
zackees commentedon Nov 18, 2026
Landed on master in #5144 (9e207c5): the legacy image-file data orchestration is characterized and extracted to libobs/graphics/graphics-texture-file-data.c.h. The Rust swap is #5145.
graphics: extract legacy image-file data orchestration (Refs obs-rust…