Curve/rohrkabel

interop with native api

Closed this issue · 7 comments

is it possible to use the c-types to create wrapper objects?

eg:

    auto pw_loop = pw::main_loop::create();
    auto pw_context = pw::context::create(pw_loop);
    // call not-wrapped c api
    auto* core_ptr = pw_context_connect_fd(pw_context->get(), remote_fd, nullptr, 0);
    auto core = pw::core::from(core_ptr); // takes ownership
Curve commented

Currently all types, except loop, core, registry and context can be created from the raw c-type.

Reason being that e.g. the loop needs pw_init to be called, and the others depend on (the life-time of) each other thus they're currently not exposed.

Having a nice way of taking over existing raw-types is still on my TODO list :)

okay so unfortunately, this specifc use case isn't covered by the library yet,

anyway i could help?

Curve commented

okay so unfortunately, this specifc use case isn't covered by the library yet,

anyway i could help?

I actually wanted to implement this right away, however the pipewire docs are currently down due to maintenance:
image

So unless you have a mirror, I don't think there's much to help with, it should be more or less straight forward to implement :)

haha yes i saw too

i can install sudo apt install pipewire-doc then i get the website at /usr/share/doc/pipewire/html/index.html

Curve commented

haha yes i saw too

i can install sudo apt install pipewire-doc then i get the website at /usr/share/doc/pipewire/html/index.html

Oh wow good to know! Thanks :)

Curve commented

Sorry, didn't get to it yet, will tackle this tomorrow :)

Curve commented

@17steen I've added a few ways to take-over or wrap (without taking ownership) existing raw-types :)

The update introduced multiple breaking changes, let me know if the new API works for your use case!

Edit: I will update the CI a little and then do a proper release later today. Your example would now work like this:

auto pw_loop = pw::main_loop::create();
auto pw_context = pw::context::create(pw_loop);

auto* core_ptr = pw_context_connect_fd(pw_context->get(), remote_fd, nullptr, 0);
auto core = pw::core::from(core_ptr, pw_context); // takes ownership