Skip to content

libobs: Extract obs_encoder_get_name without behavior changes - #5044

Merged
rdoupe merged 2 commits into
masterfrom
refactor/4239-encoder-get-name
Nov 18, 2026
Merged

rdoupe merged 2 commits into
masterfrom
refactor/4239-encoder-get-name

Conversation

@rdoupe

@rdoupe rdoupe commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Moves obs_encoder_get_name verbatim from libobs/obs-encoder.c.h into libobs/obs-encoder-get-name.c.h, in sorted position in the core-output unity group, ahead of its obs-output port. No behaviour, signature, public header or existing test changes.

Refs #4239 (stays open for the Rust port).

Commits

  1. test: Characterize obs_encoder_get_name: new test/cmocka/test_encoder_get_name.c. test_context_names already covers generated and duplicate names, but nothing covered the NULL path. The new test pins it: NULL in, NULL out, exactly one LOG_DEBUG line obs_encoder_get_name: Null 'encoder' parameter. It also checks that a valid encoder returns its own context.name pointer without logging, for a given name, the name generated for an empty one, and the new name after obs_encoder_set_name.
  2. libobs: Extract obs_encoder_get_name without behavior changes: the move only.

Evidence

This is an extraction, so the characterization has to pass on unchanged C before and after the move.

Before the move (commit 1 only, on master 0ac589d30):

OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 1 --tests 'test_encoder_get_name|test_context_names'
[OFF] (libobs-c-reference) 100% tests passed, 0 tests failed out of 976
[ON]  (hybrid libobs)      100% tests passed, 0 tests failed out of 976

After the move (rebased on 428904c09):

OBS_CTEST_JOBS=10 uv run rust/tools/linux-validate/run.py --repeat 3 --tests 'test_encoder_get_name|test_context_names'
[OFF] 976/976 passed, then 2/2 x3
[ON]  976/976 passed, then 2/2 x3
./lint   -> lane lint: ok

ctest reports a cmocka skip() as Passed, so I also ran the binary from the build volume under xvfb-run against each library. All four cases ran on both:

== libobs                    [  PASSED  ] 4 test(s).
== libobs-c-reference        [  PASSED  ] 4 test(s).

The first draft of the test called obs_video_encoder_create(id, NULL, ...) for the unnamed case and failed on both builds, because a NULL name is refused before a name is generated. The test now uses "", which is what test_context_names does.

🤖 Generated with Claude Code

rdoupe and others added 2 commits November 17, 2026 23:17
Pin obs_encoder_get_name against the unchanged C before its body moves
out of obs-encoder.c.h: the NULL encoder returns NULL with exactly one
debug log naming the function and parameter, and a valid encoder returns
its own context name pointer without logging, for a given name, the name
generated for an empty one, and the new name after a rename.

Refs #4239

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Move the obs_encoder_get_name body verbatim from obs-encoder.c.h into
libobs/obs-encoder-get-name.c.h, in sorted position in the core-output
unity group, ahead of its Rust port. No code changes: the function keeps
its exported signature and its NULL-parameter debug log.

Refs #4239

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Ci-Attestation: {"at":1794975622,"gate":"data/all/compatibility","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":56,"stamp":"6bd87bc99a527338ecc4465c8d737269","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975622,"gate":"data/all/flatpak-manifest","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":56,"stamp":"2f91a8f95d75e24e208df6d52bc9f6b0","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975622,"gate":"data/all/qt-xml","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":56,"stamp":"fbbe0cdb04a9e0befe1441fa197e7128","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975622,"gate":"data/all/services-schema","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":56,"stamp":"35cdb37a62ee0cae4dbe6bd7f8f4b10c","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"general/all/client-lint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"df0dec095958b658054c62bf541f77eb","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975622,"gate":"python/all/self-test","host":"linux-x86_64","key":"","lane":"client-checks","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":56,"stamp":"889fcd7f281d23a1ab049bcc584fbd47","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-apple-darwin/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"dd43e98c4d5a7edb30b8247a701ea712","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-apple-darwin/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"560a6a0b6440ccb217870480d8da8cde","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"06ffc5a2f10076bbaedac25de74a6829","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"5f69c8f7df73f874508dd8315ad29ba9","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"3da2aefdca7aa2a5070e5ac354205ab2","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/aarch64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"43057d40c13f082683c2b0eceb2f1446","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-apple-darwin/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"57c825bb29afc053ea058632b01652f2","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-apple-darwin/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"dd2d5b3eb96d66160a09bc558b89ae9a","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-pc-windows-msvc/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"5dbeefde3de6c382f27259f8f5a11057","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-pc-windows-msvc/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"cb01b33b31c321ea1ab920c7699d711b","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-unknown-linux-gnu/client-clippy","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"3cc89c13a39b49cc5e32e6455cd562bc","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975565,"gate":"rust/x86_64-unknown-linux-gnu/client-dylint","host":"linux-x86_64","key":"1b80c1c487eb116aa80e187d291b7cd5e09ca9528ee4d9603735d30b9f976609","lane":"client-lint","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":88,"stamp":"830ca3f21bb38c1471013f2810132ab0","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}
Ci-Attestation: {"at":1794975824,"gate":"rust/x86_64-unknown-linux-gnu/client-test","host":"linux-x86_64","key":"3613fd7a077275629f154941090941430a9c00a3f35fda3fe8f1b0f9303885f1","lane":"client-test-x86_64-unknown-linux-gnu","parents":["3c07377a58278988df5bdd1f877b9cd838d59a88"],"secs":201,"stamp":"93b532557abc6a080ff5baf8161d4981","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28","v":1,"via":"run"}

Client-Checks: {"checks":{"base":"428904c09ca8b3ac457888c6ea57cd9c13b0e820","coverage":"all-tracked-applicable-files","diff":["libobs/build/libobs.core-output+.h.c","libobs/obs-encoder-get-name.c.h","libobs/obs-encoder.c.h","test/cmocka/test_encoder_get_name.c","test/cmocka/tests.d/test_encoder_get_name.cmake"],"head":"4417a28996b7fd9d3f4ac95c55ae9d1815ed73e8","tools":{"orchestrator-python":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]","schema-dependencies":"3.13.16 (main, Oct 14 2026, 01:04:01) [Clang 23.1.3 ]\n{'jsonschema': '4.26.0', 'json_source_map': '1.0.5'}","uv":"uv 0.13.5 (x86_64-unknown-linux-gnu)","xmllint":"xmllint: using libxml version 21504-GITv2.15.4\n   compiled with: Threads Tree Output Push Reader Patterns Writer SAXv1 DTDValid HTML C14N Catalog XPath XPointer XInclude Iconv ICU ISO8859X Regexps Automata RelaxNG Schemas Schematron Modules Debug Zlib"},"tracked-digest":"ee91927457a52be261e353a06d504e4894506eae4208bc6a9fca67346203ed16","tree":"d1a0a133ff5f1c6d91474947e5cc8c7b64690b28"}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant