Skip to content

rust: Port obs_output_get_video_conversion to obs-output #6104

Done

Description

@KelboLive

Unit

libobs/obs-output.c.h, function obs_output_get_video_conversion() (~39 lines). Free: no open issue or PR mentions it, and the file's claimed PRs touch other functions (encoder setters, start/stop, audio, service) in separate hunks.

Function

const struct video_scale_info *obs_output_get_video_conversion(struct obs_output *output) — decides what the output must convert its video to, and fills output->video_conversion in place when it changes.

Semantics to preserve exactly:

  1. log_flag_encoded(output, __func__, true) || !log_flag_video(output, __func__) → NULL; both log helpers are file-local static inlines and must be reproduced with their exact level/text.
  2. Build obs_output_conversion_sizes from video_conversion_set, the current video_conversion.width/height, scaled_width/height, and video_output_get_width/height(output->video); ask the already-ported obs_output_conversion_plan().
  3. CONVERSION_SET: write the plan's width/height into output->video_conversion and return its address.
  4. CONVERSION_SCALED: video_output_get_info(output->video); if NULL (scaled size but no video) return NULL; otherwise write format from the video info, colorspace/range VIDEO_CS_DEFAULT/VIDEO_RANGE_DEFAULT, plan width/height, and return the same address.
  5. Any other plan kind returns NULL without touching the conversion.
  6. The returned pointer is the output's own &output->video_conversion, never a copy.

Dependencies

obs_output_conversion_plan and video_output_get_* are Rust exports; obs_output fields come through a private fields adapter; the two log_flag_* helpers are copied verbatim into the unit, as the viewport port copied gs_valid/gs_obj_valid. No graphics, no threads.

Tests

Already characterized in test/cmocka/test_output_input_checks.c (§ "obs_output_get_video_conversion"): with/without video, with/without a scaled size, and a set conversion with and without video.

  • Tier 1 in obs-tests-core: mirror those cases plus the no-video + scaled-size NULL path, pointer identity, flags/format side effects, and that other plan kinds leave the conversion untouched.
  • Tier 2: the unchanged cmocka test on hybrid libobs and libobs-c-reference.
  • Tier 3: oracle over the original C and the shim with identical fixture outputs, comparing the returned pointer, every conversion field, the video-info lookups and the log lines; mutation check (drop the encoded/video gate, copy instead of returning the field, write before the NULL check).
  • Tier 4: not applicable.

Wiring

  • Ported group libobs.ported-output-video-conversion + libobs/build/ported-source-sets/output-video-conversion.json; include swapped in libobs/build/libobs.core-output+.h.c.
  • Export fragment libobs/cmake/rust-exports.d/obs-output-get_video_conversion.txt.
  • Link support: test/cmocka/output-video-conversion-link-support.c + tests.d/output_video_conversion_link_support.cmake (mandatory: every *_rust test binary links libobs_rust-static).
  • rust/README.md row; registration test.

Risks

  • obs-output.c.h carries several open PRs; this hunk is distinct, but rebase before pushing.
  • The two log helpers' exact text/level and the in-place write order are pinned by Tier 3.
  • Returning the field address (not a copy) is an ABI property; assert pointer identity.

Activity

  1. KelboLive commented on Dec 3, 2026

    @KelboLive
    ContributorAuthor

    Claiming: investigation — free function in obs-output.c.h (distinct hunk), already characterized in test_output_input_checks.c; depends only on Rust conversion/video getters plus two copied log inlines.

  2. added
    needs-investigation
    on Dec 3, 2026
  3. KelboLive commented on Dec 3, 2026

    @KelboLive
    ContributorAuthor

    /ready — semantics, dependencies, four-tier plan, wiring and risks are in the body.

  4. added
    ready
    and removed
    needs-investigation
    on Dec 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

ready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions