Repository navigation
Description
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:
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.- Build
obs_output_conversion_sizesfromvideo_conversion_set, the currentvideo_conversion.width/height,scaled_width/height, andvideo_output_get_width/height(output->video); ask the already-portedobs_output_conversion_plan(). CONVERSION_SET: write the plan's width/height intooutput->video_conversionand return its address.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/rangeVIDEO_CS_DEFAULT/VIDEO_RANGE_DEFAULT, plan width/height, and return the same address.- Any other plan kind returns NULL without touching the conversion.
- 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 inlibobs/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*_rusttest binary linkslibobs_rust-static). rust/README.mdrow; registration test.
Risks
obs-output.c.hcarries 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.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
KelboLive commentedon Dec 3, 2026
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.
KelboLive commentedon Dec 3, 2026
/ready — semantics, dependencies, four-tier plan, wiring and risks are in the body.
test(output-video-conversion): fix review findings
obs-output: port obs_output_get_video_conversion to Rust (obs-rust#6104…