Commit graph

19 commits

Author SHA1 Message Date
Georges Basile Stavracas Neto 03358961aa linux-pipewire: Pass framerate and resolution at construction
This allows the stream negotiation to set the camera values right
from the start.
2024-01-11 09:57:08 -03:00
Wim Taymans a44228ef50 linux-pipewire: Add resolution and framerate list contents
Trigger a renegotiation of the camera stream when either the
resolution or the framerate change.
2024-01-11 09:57:08 -03:00
Georges Basile Stavracas Neto 261cb91c62 linux-pipewire: Rename a function
Make it a bit more semantic, and matching of PipeWire API.
2024-01-11 09:57:08 -03:00
Georges Basile Stavracas Neto 56d3720ffa linux-pipewire: Add obs_pipewire_roundtrip()
Generalize the async server roundtrip wait so that future consumers
can, for example, wait for all devices to be listed before acting
on the registry.
2024-01-11 09:57:08 -03:00
Georges Basile Stavracas Neto 6499d01bec linux-pipewire: Allow passing registry events on creation
This will allow consumers of obs_pipewire to handle the device
registry themselves. This is not useful for the screencast code
since there's always only one node in the registry, but it will
be used by the camera and audio code to list hardware devices.
2024-01-11 09:57:08 -03:00
Georges Basile Stavracas Neto 67c1202849 linux-pipewire: Add screencast cursor_visible prop
This commit adds the screencast-specific 'cursor_visible' field
in an anonymous struct within the constructor struct.

This slightly improves the connection code by properly treating
construction-time information in a constructor struct. It allows
removing the extra function call that sets cursor visibility from
the Screencast portal code.

Admittedly that's not much, but again, this will be an important
distinction when introducing the Camera portal code, since some
camera properties will need to trigger renegotiation.
2023-12-14 10:20:55 -03:00
Georges Basile Stavracas Neto a1db8e5bde linux-pipewire: Factor out connection props in a struct
So that we can expand the number of construct-time connection
properties without changing the function signature every time.
This is mostly an ergonomic change for now, but it'll be very
useful when introducing the Camera portal code.
2023-12-14 10:20:55 -03:00
Georges Basile Stavracas Neto afab71aa80 linux-pipewire: Standardize argument names
Always name obs_pipewire_stream pointers 'obs_pw_stream', so as not
to confuse with obs_pipewire pointers which are called 'obs_pw'.
2023-12-14 10:20:55 -03:00
Georges Basile Stavracas Neto c7e355e89c linux-pipewire: Store source when creating streams
We'll need to peek information about the source to determine how
to process frames, so store it for later usage.
2023-07-15 20:46:51 -03:00
Georges Basile Stavracas Neto 330d54fada linux-pipewire: Separate PipeWire core and streams
Sorry, this is a painful commit to review :(

Until now, the only consumer of the PipeWire code is the screen
cast portal code. This portal code only ever has one PipeWire
connection, and one PipeWire stream, every time a monitor or a
window is selected. This is reflected on obs_pipewire, which only
handles a single stream for any given connection.

For cameras and audio, however, a single PipeWire connection can
and most likely always will provide multiple streams. For example,
computers with multiple webcams will have one PipeWire connection
reporting multiple PipeWire nodes, one node for each camera.

This commit breaks this one-stream-per-connection assumption, and
makes obs_pipewire_connect_stream() return an independent object
(obs_pipewire_stream) that represents a single stream.

The screencast portal code continues to only ever have one connection
and one stream.
2023-07-15 20:46:51 -03:00
Georges Basile Stavracas Neto fad7420198 linux-pipewire: Trivially shuffle some code around
A trivial cosmetic change. This groups the constructor and
destructor together. Two sides of the same coin, yin and yang,
bound by their nature, and linked by their position in code.
2023-02-13 12:28:09 -03:00
Georges Basile Stavracas Neto f8a7b13cd3 linux-pipewire: Rename obs_pipewire_data to obs_pipewire
Next commits will introduce new obs_pipewire_* types, so this
renaming will make it slightly easier to read the code with
different types.
2023-02-13 12:28:09 -03:00
Georges Basile Stavracas Neto b7daa89f85 linux-pipewire: Split initialization of core and streams
This commit introduces an important distinction in the initialization
process that is essential to future camera and audio work: it splits
creating and connecting to the PipeWire socket, from connecting to
specific PipeWire nodes.

Right now, for the only consumer in existence - the ScreenCast portal
code - this distinction is irrelevant, but from an API perspective it
just makes sense to model it this way.
2023-02-13 12:28:09 -03:00
columbarius 86be35ae99 linux-pipewire: Move stream properties to constructors
And let each portal pass the stream properties relevant to them.
This makes the pipewire.c more independent of the actual portal
by providing a wrapper to create a stream. This will be relevant
later, when linux-pipewire introduces more portals like the Camera
one.
2023-02-13 12:28:09 -03:00
Georges Basile Stavracas Neto b8cfe1aab1 linux-pipewire: Return actual type in obs_pipewire_create
Instead of returning an opaque void* pointer, return the leaf
C type obs_pipewire_data*.

This commit introduces no functional changes.
2023-02-13 12:28:09 -03:00
Georges Basile Stavracas Neto 6f1521e944 linux-pipewire: Cleanup includes
We can remove and shuffle some includes now.
2022-06-24 10:28:47 -03:00
Georges Basile Stavracas Neto 0e9c208fc5 linux-pipewire: Move all portal code to screencast-portal.c
Sorry this is such a massive commit. The entangled nature of the
code in pipewire.c makes it impossible to reasonably split this
in smaller commits.

Move all D-Bus / portals code from pipewire.c into the recently
introduced screencast-portal.c.
2022-06-24 10:28:45 -03:00
Georges Basile Stavracas Neto 3d7663f417 linux-pipewire: Explicitly enumerate portal capture types
This is very much like previous commit, but there's a catch: there
already was an enumeration in place, which is replaced in this
commit. The obs_pw_capture_type enum was introduced before splitting
the portal code into a separate file, and the enum itself is specific
to the screencast portal, so the appropriate place to enumerate it
is in portal.h.

For completude, PORTAL_CAPTURE_TYPE_VIRTUAL was added to the enum,
even though we never used, and probably never will.

The values are still the same, since both the old and this new enum
were extracted from the screencast portal [1].

https://github.com/flatpak/xdg-desktop-portal/blob/main/data/org.freedesktop.portal.ScreenCast.xml#L290-300
2022-04-09 16:45:02 -07:00
Georges Basile Stavracas Neto a147315f33 project: Migrate PipeWire capture into linux-pipewire
The capture ids are preserved, so that it's compatible with the
previous code. No code changes were necessary whatsoever.
2022-03-20 20:53:39 -03:00
Renamed from plugins/linux-capture/pipewire.h (Browse further)