I'm Noah, a C++ Enthusiast and Software Engineering Student from Germany
curve / rohrkabel Goto Github PK
View Code? Open in Web Editor NEWπ A C++ RAII Pipewire-API Wrapper
License: MIT License
π A C++ RAII Pipewire-API Wrapper
License: MIT License
It would be nice to be able to capture V4L devices like WebCams and capture cards. The way this works on Pipewire seems similar to how audio works. One example here. I'd like to be able to list v4l devices (name and uuid) and be able to capture video from a v4l device specified by uuid (and perhaps select framerate and resolution mode if that is supported)
Hi, thanks a lot for your library!
I am not that familiar with C++ and Pipewire so sorry if the answer is trivial. But after looking at the link-app-to-mic example, I cant figure out how to delete a link again without deleting the whole microphone (I am searching for something like this). Is this something still missing in the library or am I just doing something wrong?
build/_deps/rohrkabel-src/include/rohrkabel/context.hpp:26:45: error: declaration of βstd::shared_ptrpipewire::core pipewire::context::core()β changes meaning of βcoreβ [-fpermissive]
[build] 26 | [[nodiscard]] std::shared_ptr core();
Rohrkabel needs some heavy improvements regarding the Thread-Loop.
The current support for the thread-loop is a bit unintuitive, namely the following things are not as clear and simple as I'd like them to be:
core::create(_simple)
) are not safe to be deleted without locking the thread-loop
thread-loop
and then explicitly delete the created objectevents
the callback for the event
will be called from the thread-loop
s thread.update
from within it.Exceptions
Generally, I'd like to avoid throwing exceptions where possible. Currently we throw on pw_proxy_events::error
.
This is problematic when the thread-loop
is used because the exception can then not be properly caught.
I'd like to replace the exceptions, maybe we could make the constructor of proxy
, node
, etc. private and have a static method create
/ bind
that returns a tl::expected
and constructs the object - It would then return the exception when an error was thrown.
However this would require create
to wait for the object to be successfully bound/created to know if it has an error (i.e. update
the core, which in turn would also complicate things a little)
(implemented in f531d2c)
thread-loop
changes and bring back call_safe
.Pros:
events
issue.Cons:
call_safe
had it's own caveats and things I didn't like about itnode
, port
, ...) private and use static method to instantiate the objectAnd return shared_ptr
that has custom deleter to make sure object is deleted safely.
Pros:
Cons:
events
issuepipewire-rs
appraochSee https://pipewire.pages.freedesktop.org/pipewire-rs/pipewire/channel/index.html#examples
Design:
Channel
node
, device
, proxy
) we throw a compile-time error (in case the passed object is not a const-reference
or borrow_ptr
) to make sure the passed object stays in the loop threadRequired changes to current code
main-loop
they get bound to was initialized on the same thread.main_loop::run()
should assert that the creation thread is also the execution threadPros:
events
issueCons:
Design:
thread_loop
) lock the core and bind / create the object, then unlock it and return the not yet evaluated result
event
main_loop
) bind / create the object, trigger an update
and return the promisepromise::get()
, promise::wait()
assert
if called from within the thread-loop
s thread.promise::error()
that takes a callback which is invoked in case of an errorpromise::then()
that takes a callback which is invoked once the result is ready
state
which will live until the callback
has been calledthread-loop
s thread (as long as the object is not movable, copyable, ...)thread-loop
s threadPros:
call_safe
mechanism had (namely that the object is guaranteed to die within the thread-loop
s thread)call_safe
approach, as all functions that would require special care would return a promiseCons:
call_safe
) it's still easy to do things wrong by accidentThis issue currently serves as an outlet for my ideas regarding this issue.
I will keep updating this post with ideas that come to mind and will leave it open until I have found a solution that I'm pleased with.
π‘ Help is always appreciated! |
---|
In case you're reading this issue and have any ideas or suggestions on how to tackle this problem, feel free to comment! |
After some back and forth I think I will settle with solution 3
Maybe optionally, using __has_include
built-in preprocessor macro.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.