summaryrefslogtreecommitdiff
path: root/wireplumber
diff options
context:
space:
mode:
Diffstat (limited to 'wireplumber')
-rw-r--r--wireplumber/.gitignore3
-rw-r--r--wireplumber/LICENSE503
-rw-r--r--wireplumber/README.md34
-rw-r--r--wireplumber/flake.lock27
-rw-r--r--wireplumber/flake.nix54
-rw-r--r--wireplumber/include/astal-wp.h4
-rw-r--r--wireplumber/include/astal/wireplumber/audio.h33
-rw-r--r--wireplumber/include/astal/wireplumber/device.h29
-rw-r--r--wireplumber/include/astal/wireplumber/endpoint.h43
-rw-r--r--wireplumber/include/astal/wireplumber/meson.build10
-rw-r--r--wireplumber/include/astal/wireplumber/profile.h17
-rw-r--r--wireplumber/include/astal/wireplumber/video.h29
-rw-r--r--wireplumber/include/astal/wireplumber/wp.h47
-rw-r--r--wireplumber/include/meson.build8
-rw-r--r--wireplumber/include/private/device-private.h15
-rw-r--r--wireplumber/include/private/endpoint-private.h22
-rw-r--r--wireplumber/meson.build22
-rw-r--r--wireplumber/meson_options.txt2
-rw-r--r--wireplumber/src/audio.c503
-rw-r--r--wireplumber/src/device.c371
-rw-r--r--wireplumber/src/endpoint.c554
-rw-r--r--wireplumber/src/meson.build73
-rw-r--r--wireplumber/src/profile.c84
-rw-r--r--wireplumber/src/video.c428
-rw-r--r--wireplumber/src/wireplumber.c503
-rw-r--r--wireplumber/version1
26 files changed, 0 insertions, 3419 deletions
diff --git a/wireplumber/.gitignore b/wireplumber/.gitignore
deleted file mode 100644
index 6bf41b5..0000000
--- a/wireplumber/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-build/
-result/
-.cache/
diff --git a/wireplumber/LICENSE b/wireplumber/LICENSE
deleted file mode 100644
index 67cd97b..0000000
--- a/wireplumber/LICENSE
+++ /dev/null
@@ -1,503 +0,0 @@
- GNU LESSER GENERAL PUBLIC LICENSE
- Version 2.1, February 1999
-
- Copyright (C) 1991, 1999 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-[This is the first released version of the Lesser GPL. It also counts
- as the successor of the GNU Library Public License, version 2, hence
- the version number 2.1.]
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-Licenses are intended to guarantee your freedom to share and change
-free software--to make sure the software is free for all its users.
-
- This license, the Lesser General Public License, applies to some
-specially designated software packages--typically libraries--of the
-Free Software Foundation and other authors who decide to use it. You
-can use it too, but we suggest you first think carefully about whether
-this license or the ordinary General Public License is the better
-strategy to use in any particular case, based on the explanations below.
-
- When we speak of free software, we are referring to freedom of use,
-not price. Our General Public Licenses are designed to make sure that
-you have the freedom to distribute copies of free software (and charge
-for this service if you wish); that you receive source code or can get
-it if you want it; that you can change the software and use pieces of
-it in new free programs; and that you are informed that you can do
-these things.
-
- To protect your rights, we need to make restrictions that forbid
-distributors to deny you these rights or to ask you to surrender these
-rights. These restrictions translate to certain responsibilities for
-you if you distribute copies of the library or if you modify it.
-
- For example, if you distribute copies of the library, whether gratis
-or for a fee, you must give the recipients all the rights that we gave
-you. You must make sure that they, too, receive or can get the source
-code. If you link other code with the library, you must provide
-complete object files to the recipients, so that they can relink them
-with the library after making changes to the library and recompiling
-it. And you must show them these terms so they know their rights.
-
- We protect your rights with a two-step method: (1) we copyright the
-library, and (2) we offer you this license, which gives you legal
-permission to copy, distribute and/or modify the library.
-
- To protect each distributor, we want to make it very clear that
-there is no warranty for the free library. Also, if the library is
-modified by someone else and passed on, the recipients should know
-that what they have is not the original version, so that the original
-author's reputation will not be affected by problems that might be
-introduced by others.
-
- Finally, software patents pose a constant threat to the existence of
-any free program. We wish to make sure that a company cannot
-effectively restrict the users of a free program by obtaining a
-restrictive license from a patent holder. Therefore, we insist that
-any patent license obtained for a version of the library must be
-consistent with the full freedom of use specified in this license.
-
- Most GNU software, including some libraries, is covered by the
-ordinary GNU General Public License. This license, the GNU Lesser
-General Public License, applies to certain designated libraries, and
-is quite different from the ordinary General Public License. We use
-this license for certain libraries in order to permit linking those
-libraries into non-free programs.
-
- When a program is linked with a library, whether statically or using
-a shared library, the combination of the two is legally speaking a
-combined work, a derivative of the original library. The ordinary
-General Public License therefore permits such linking only if the
-entire combination fits its criteria of freedom. The Lesser General
-Public License permits more lax criteria for linking other code with
-the library.
-
- We call this license the "Lesser" General Public License because it
-does Less to protect the user's freedom than the ordinary General
-Public License. It also provides other free software developers Less
-of an advantage over competing non-free programs. These disadvantages
-are the reason we use the ordinary General Public License for many
-libraries. However, the Lesser license provides advantages in certain
-special circumstances.
-
- For example, on rare occasions, there may be a special need to
-encourage the widest possible use of a certain library, so that it becomes
-a de-facto standard. To achieve this, non-free programs must be
-allowed to use the library. A more frequent case is that a free
-library does the same job as widely used non-free libraries. In this
-case, there is little to gain by limiting the free library to free
-software only, so we use the Lesser General Public License.
-
- In other cases, permission to use a particular library in non-free
-programs enables a greater number of people to use a large body of
-free software. For example, permission to use the GNU C Library in
-non-free programs enables many more people to use the whole GNU
-operating system, as well as its variant, the GNU/Linux operating
-system.
-
- Although the Lesser General Public License is Less protective of the
-users' freedom, it does ensure that the user of a program that is
-linked with the Library has the freedom and the wherewithal to run
-that program using a modified version of the Library.
-
- The precise terms and conditions for copying, distribution and
-modification follow. Pay close attention to the difference between a
-"work based on the library" and a "work that uses the library". The
-former contains code derived from the library, whereas the latter must
-be combined with the library in order to run.
-
- GNU LESSER GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License Agreement applies to any software library or other
-program which contains a notice placed by the copyright holder or
-other authorized party saying it may be distributed under the terms of
-this Lesser General Public License (also called "this License").
-Each licensee is addressed as "you".
-
- A "library" means a collection of software functions and/or data
-prepared so as to be conveniently linked with application programs
-(which use some of those functions and data) to form executables.
-
- The "Library", below, refers to any such software library or work
-which has been distributed under these terms. A "work based on the
-Library" means either the Library or any derivative work under
-copyright law: that is to say, a work containing the Library or a
-portion of it, either verbatim or with modifications and/or translated
-straightforwardly into another language. (Hereinafter, translation is
-included without limitation in the term "modification".)
-
- "Source code" for a work means the preferred form of the work for
-making modifications to it. For a library, complete source code means
-all the source code for all modules it contains, plus any associated
-interface definition files, plus the scripts used to control compilation
-and installation of the library.
-
- Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running a program using the Library is not restricted, and output from
-such a program is covered only if its contents constitute a work based
-on the Library (independent of the use of the Library in a tool for
-writing it). Whether that is true depends on what the Library does
-and what the program that uses the Library does.
-
- 1. You may copy and distribute verbatim copies of the Library's
-complete source code as you receive it, in any medium, provided that
-you conspicuously and appropriately publish on each copy an
-appropriate copyright notice and disclaimer of warranty; keep intact
-all the notices that refer to this License and to the absence of any
-warranty; and distribute a copy of this License along with the
-Library.
-
- You may charge a fee for the physical act of transferring a copy,
-and you may at your option offer warranty protection in exchange for a
-fee.
-
- 2. You may modify your copy or copies of the Library or any portion
-of it, thus forming a work based on the Library, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) The modified work must itself be a software library.
-
- b) You must cause the files modified to carry prominent notices
- stating that you changed the files and the date of any change.
-
- c) You must cause the whole of the work to be licensed at no
- charge to all third parties under the terms of this License.
-
- d) If a facility in the modified Library refers to a function or a
- table of data to be supplied by an application program that uses
- the facility, other than as an argument passed when the facility
- is invoked, then you must make a good faith effort to ensure that,
- in the event an application does not supply such function or
- table, the facility still operates, and performs whatever part of
- its purpose remains meaningful.
-
- (For example, a function in a library to compute square roots has
- a purpose that is entirely well-defined independent of the
- application. Therefore, Subsection 2d requires that any
- application-supplied function or table used by this function must
- be optional: if the application does not supply it, the square
- root function must still compute square roots.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Library,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Library, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote
-it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Library.
-
-In addition, mere aggregation of another work not based on the Library
-with the Library (or with a work based on the Library) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may opt to apply the terms of the ordinary GNU General Public
-License instead of this License to a given copy of the Library. To do
-this, you must alter all the notices that refer to this License, so
-that they refer to the ordinary GNU General Public License, version 2,
-instead of to this License. (If a newer version than version 2 of the
-ordinary GNU General Public License has appeared, then you can specify
-that version instead if you wish.) Do not make any other change in
-these notices.
-
- Once this change is made in a given copy, it is irreversible for
-that copy, so the ordinary GNU General Public License applies to all
-subsequent copies and derivative works made from that copy.
-
- This option is useful when you wish to copy part of the code of
-the Library into a program that is not a library.
-
- 4. You may copy and distribute the Library (or a portion or
-derivative of it, under Section 2) in object code or executable form
-under the terms of Sections 1 and 2 above provided that you accompany
-it with the complete corresponding machine-readable source code, which
-must be distributed under the terms of Sections 1 and 2 above on a
-medium customarily used for software interchange.
-
- If distribution of object code is made by offering access to copy
-from a designated place, then offering equivalent access to copy the
-source code from the same place satisfies the requirement to
-distribute the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 5. A program that contains no derivative of any portion of the
-Library, but is designed to work with the Library by being compiled or
-linked with it, is called a "work that uses the Library". Such a
-work, in isolation, is not a derivative work of the Library, and
-therefore falls outside the scope of this License.
-
- However, linking a "work that uses the Library" with the Library
-creates an executable that is a derivative of the Library (because it
-contains portions of the Library), rather than a "work that uses the
-library". The executable is therefore covered by this License.
-Section 6 states terms for distribution of such executables.
-
- When a "work that uses the Library" uses material from a header file
-that is part of the Library, the object code for the work may be a
-derivative work of the Library even though the source code is not.
-Whether this is true is especially significant if the work can be
-linked without the Library, or if the work is itself a library. The
-threshold for this to be true is not precisely defined by law.
-
- If such an object file uses only numerical parameters, data
-structure layouts and accessors, and small macros and small inline
-functions (ten lines or less in length), then the use of the object
-file is unrestricted, regardless of whether it is legally a derivative
-work. (Executables containing this object code plus portions of the
-Library will still fall under Section 6.)
-
- Otherwise, if the work is a derivative of the Library, you may
-distribute the object code for the work under the terms of Section 6.
-Any executables containing that work also fall under Section 6,
-whether or not they are linked directly with the Library itself.
-
- 6. As an exception to the Sections above, you may also combine or
-link a "work that uses the Library" with the Library to produce a
-work containing portions of the Library, and distribute that work
-under terms of your choice, provided that the terms permit
-modification of the work for the customer's own use and reverse
-engineering for debugging such modifications.
-
- You must give prominent notice with each copy of the work that the
-Library is used in it and that the Library and its use are covered by
-this License. You must supply a copy of this License. If the work
-during execution displays copyright notices, you must include the
-copyright notice for the Library among them, as well as a reference
-directing the user to the copy of this License. Also, you must do one
-of these things:
-
- a) Accompany the work with the complete corresponding
- machine-readable source code for the Library including whatever
- changes were used in the work (which must be distributed under
- Sections 1 and 2 above); and, if the work is an executable linked
- with the Library, with the complete machine-readable "work that
- uses the Library", as object code and/or source code, so that the
- user can modify the Library and then relink to produce a modified
- executable containing the modified Library. (It is understood
- that the user who changes the contents of definitions files in the
- Library will not necessarily be able to recompile the application
- to use the modified definitions.)
-
- b) Use a suitable shared library mechanism for linking with the
- Library. A suitable mechanism is one that (1) uses at run time a
- copy of the library already present on the user's computer system,
- rather than copying library functions into the executable, and (2)
- will operate properly with a modified version of the library, if
- the user installs one, as long as the modified version is
- interface-compatible with the version that the work was made with.
-
- c) Accompany the work with a written offer, valid for at
- least three years, to give the same user the materials
- specified in Subsection 6a, above, for a charge no more
- than the cost of performing this distribution.
-
- d) If distribution of the work is made by offering access to copy
- from a designated place, offer equivalent access to copy the above
- specified materials from the same place.
-
- e) Verify that the user has already received a copy of these
- materials or that you have already sent this user a copy.
-
- For an executable, the required form of the "work that uses the
-Library" must include any data and utility programs needed for
-reproducing the executable from it. However, as a special exception,
-the materials to be distributed need not include anything that is
-normally distributed (in either source or binary form) with the major
-components (compiler, kernel, and so on) of the operating system on
-which the executable runs, unless that component itself accompanies
-the executable.
-
- It may happen that this requirement contradicts the license
-restrictions of other proprietary libraries that do not normally
-accompany the operating system. Such a contradiction means you cannot
-use both them and the Library together in an executable that you
-distribute.
-
- 7. You may place library facilities that are a work based on the
-Library side-by-side in a single library together with other library
-facilities not covered by this License, and distribute such a combined
-library, provided that the separate distribution of the work based on
-the Library and of the other library facilities is otherwise
-permitted, and provided that you do these two things:
-
- a) Accompany the combined library with a copy of the same work
- based on the Library, uncombined with any other library
- facilities. This must be distributed under the terms of the
- Sections above.
-
- b) Give prominent notice with the combined library of the fact
- that part of it is a work based on the Library, and explaining
- where to find the accompanying uncombined form of the same work.
-
- 8. You may not copy, modify, sublicense, link with, or distribute
-the Library except as expressly provided under this License. Any
-attempt otherwise to copy, modify, sublicense, link with, or
-distribute the Library is void, and will automatically terminate your
-rights under this License. However, parties who have received copies,
-or rights, from you under this License will not have their licenses
-terminated so long as such parties remain in full compliance.
-
- 9. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Library or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Library (or any work based on the
-Library), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Library or works based on it.
-
- 10. Each time you redistribute the Library (or any work based on the
-Library), the recipient automatically receives a license from the
-original licensor to copy, distribute, link with or modify the Library
-subject to these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties with
-this License.
-
- 11. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Library at all. For example, if a patent
-license would not permit royalty-free redistribution of the Library by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Library.
-
-If any portion of this section is held invalid or unenforceable under any
-particular circumstance, the balance of the section is intended to apply,
-and the section as a whole is intended to apply in other circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 12. If the distribution and/or use of the Library is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Library under this License may add
-an explicit geographical distribution limitation excluding those countries,
-so that distribution is permitted only in or among countries not thus
-excluded. In such case, this License incorporates the limitation as if
-written in the body of this License.
-
- 13. The Free Software Foundation may publish revised and/or new
-versions of the Lesser General Public License from time to time.
-Such new versions will be similar in spirit to the present version,
-but may differ in detail to address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Library
-specifies a version number of this License which applies to it and
-"any later version", you have the option of following the terms and
-conditions either of that version or of any later version published by
-the Free Software Foundation. If the Library does not specify a
-license version number, you may choose any version ever published by
-the Free Software Foundation.
-
- 14. If you wish to incorporate parts of the Library into other free
-programs whose distribution conditions are incompatible with these,
-write to the author to ask for permission. For software which is
-copyrighted by the Free Software Foundation, write to the Free
-Software Foundation; we sometimes make exceptions for this. Our
-decision will be guided by the two goals of preserving the free status
-of all derivatives of our free software and of promoting the sharing
-and reuse of software generally.
-
- NO WARRANTY
-
- 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
-WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
-EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
-OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
-KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
-IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
-LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
-THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
-
- 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
-WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
-AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
-FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
-CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
-LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
-RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
-FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
-SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
-DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Libraries
-
- If you develop a new library, and you want it to be of the greatest
-possible use to the public, we recommend making it free software that
-everyone can redistribute and change. You can do so by permitting
-redistribution under these terms (or, alternatively, under the terms of the
-ordinary General Public License).
-
- To apply these terms, attach the following notices to the library. It is
-safest to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least the
-"copyright" line and a pointer to where the full notice is found.
-
- <one line to give the library's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with this library; if not, write to the Free Software
- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
-
-Also add information on how to contact you by electronic and paper mail.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the library, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the
- library `Frob' (a library for tweaking knobs) written by James Random Hacker.
-
- <signature of Ty Coon>, 1 April 1990
- Ty Coon, President of Vice
-
-That's all there is to it!
-
diff --git a/wireplumber/README.md b/wireplumber/README.md
deleted file mode 100644
index cfbb6db..0000000
--- a/wireplumber/README.md
+++ /dev/null
@@ -1,34 +0,0 @@
-# astal-wireplumber
-
-A libwireplumber wrapper.
-
-## Build from source
-### Dependencies
-
-- meson
-- libwireplumber
-- glib
-- gobject-introspection
-- vala (only required for the vapi option)
-
-### Meson options
-
-* `-Dintrospection` (default: `true`): build GObject Introspection data (needed for language bindings)
-* `-Dvapi` (default: `true`): build VAPI data (required to make this lib usable in vala). Requires `-Dintrospection=true`
-
-### build instructions
-
-```sh
-# Clone the repository
-git clone https://github.com/astal-sh/wireplumber
-cd wireplumber
-
-# Setup and build
-meson setup build
-meson compile -C build
-
-# Install
-meson install -C build
-```
-
-
diff --git a/wireplumber/flake.lock b/wireplumber/flake.lock
deleted file mode 100644
index f1034b0..0000000
--- a/wireplumber/flake.lock
+++ /dev/null
@@ -1,27 +0,0 @@
-{
- "nodes": {
- "nixpkgs": {
- "locked": {
- "lastModified": 1720957393,
- "narHash": "sha256-oedh2RwpjEa+TNxhg5Je9Ch6d3W1NKi7DbRO1ziHemA=",
- "owner": "nixos",
- "repo": "nixpkgs",
- "rev": "693bc46d169f5af9c992095736e82c3488bf7dbb",
- "type": "github"
- },
- "original": {
- "owner": "nixos",
- "ref": "nixos-unstable",
- "repo": "nixpkgs",
- "type": "github"
- }
- },
- "root": {
- "inputs": {
- "nixpkgs": "nixpkgs"
- }
- }
- },
- "root": "root",
- "version": 7
-}
diff --git a/wireplumber/flake.nix b/wireplumber/flake.nix
deleted file mode 100644
index 96ffc6f..0000000
--- a/wireplumber/flake.nix
+++ /dev/null
@@ -1,54 +0,0 @@
-{
- description = "Wrapper library for WirePlumber";
-
- inputs.nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
-
- outputs = {
- self,
- nixpkgs,
- }: let
- version = builtins.replaceStrings ["\n"] [""] (builtins.readFile ./version);
- system = "x86_64-linux";
- pkgs = import nixpkgs {inherit system;};
-
- nativeBuildInputs = with pkgs; [
- gobject-introspection
- meson
- pkg-config
- ninja
- vala
- ];
-
- buildInputs = with pkgs; [
- glib
- wireplumber
- # json-glib
- ];
- in {
- packages.${system} = rec {
- default = wireplumber;
- wireplumber = pkgs.stdenv.mkDerivation {
- inherit nativeBuildInputs buildInputs;
- pname = "astal-wireplumber";
- version = version;
- src = ./.;
- outputs = ["out" "dev"];
- };
- };
-
- devShells.${system} = {
- default = pkgs.mkShell {
- inherit nativeBuildInputs buildInputs;
- };
- wireplumber = pkgs.mkShell {
- inherit nativeBuildInputs;
- buildInputs =
- buildInputs
- ++ [
- self.packages.${system}.default
- pkgs.gjs
- ];
- };
- };
- };
-}
diff --git a/wireplumber/include/astal-wp.h b/wireplumber/include/astal-wp.h
deleted file mode 100644
index 6c48211..0000000
--- a/wireplumber/include/astal-wp.h
+++ /dev/null
@@ -1,4 +0,0 @@
-
-#include "astal/wireplumber/audio.h"
-#include "astal/wireplumber/endpoint.h"
-#include "astal/wireplumber/wp.h"
diff --git a/wireplumber/include/astal/wireplumber/audio.h b/wireplumber/include/astal/wireplumber/audio.h
deleted file mode 100644
index c1176e2..0000000
--- a/wireplumber/include/astal/wireplumber/audio.h
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef ASTAL_WIREPLUMBER_AUDIO_H
-#define ASTAL_WIREPLUMBER_AUDIO_H
-
-#include <glib-object.h>
-
-#include "device.h"
-#include "endpoint.h"
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_AUDIO (astal_wp_audio_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpAudio, astal_wp_audio, ASTAL_WP, AUDIO, GObject)
-
-AstalWpEndpoint *astal_wp_audio_get_speaker(AstalWpAudio *self, guint id);
-AstalWpEndpoint *astal_wp_audio_get_microphone(AstalWpAudio *self, guint id);
-AstalWpEndpoint *astal_wp_audio_get_recorder(AstalWpAudio *self, guint id);
-AstalWpEndpoint *astal_wp_audio_get_stream(AstalWpAudio *self, guint id);
-AstalWpEndpoint *astal_wp_audio_get_endpoint(AstalWpAudio *self, guint id);
-AstalWpDevice *astal_wp_audio_get_device(AstalWpAudio *self, guint id);
-
-AstalWpEndpoint *astal_wp_audio_get_default_speaker(AstalWpAudio *self);
-AstalWpEndpoint *astal_wp_audio_get_default_microphone(AstalWpAudio *self);
-
-GList *astal_wp_audio_get_microphones(AstalWpAudio *self);
-GList *astal_wp_audio_get_speakers(AstalWpAudio *self);
-GList *astal_wp_audio_get_recorders(AstalWpAudio *self);
-GList *astal_wp_audio_get_streams(AstalWpAudio *self);
-GList *astal_wp_audio_get_devices(AstalWpAudio *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WIREPLUMBER_AUDIO_H
diff --git a/wireplumber/include/astal/wireplumber/device.h b/wireplumber/include/astal/wireplumber/device.h
deleted file mode 100644
index 9f633e3..0000000
--- a/wireplumber/include/astal/wireplumber/device.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef ASTAL_WP_DEVICE_H
-#define ASTAL_WP_DEVICE_H
-
-#include <glib-object.h>
-
-#include "profile.h"
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_DEVICE (astal_wp_device_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpDevice, astal_wp_device, ASTAL_WP, DEVICE, GObject)
-
-#define ASTAL_WP_TYPE_DEVICE_TYPE (astal_wp_device_type_get_type())
-
-typedef enum { ASTAL_WP_DEVICE_TYPE_AUDIO, ASTAL_WP_DEVICE_TYPE_VIDEO } AstalWpDeviceType;
-
-guint astal_wp_device_get_id(AstalWpDevice *self);
-const gchar *astal_wp_device_get_description(AstalWpDevice *self);
-const gchar *astal_wp_device_get_icon(AstalWpDevice *self);
-AstalWpProfile *astal_wp_device_get_profile(AstalWpDevice *self, gint id);
-GList *astal_wp_device_get_profiles(AstalWpDevice *self);
-void astal_wp_device_set_active_profile(AstalWpDevice *self, int profile_id);
-gint astal_wp_device_get_active_profile(AstalWpDevice *self);
-AstalWpDeviceType astal_wp_device_get_device_type(AstalWpDevice *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WP_DEVICE_H
diff --git a/wireplumber/include/astal/wireplumber/endpoint.h b/wireplumber/include/astal/wireplumber/endpoint.h
deleted file mode 100644
index 6ef0329..0000000
--- a/wireplumber/include/astal/wireplumber/endpoint.h
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef ASTAL_WP_ENDPOINT_H
-#define ASTAL_WP_ENDPOINT_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_ENDPOINT (astal_wp_endpoint_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpEndpoint, astal_wp_endpoint, ASTAL_WP, ENDPOINT, GObject)
-
-#define ASTAL_WP_TYPE_MEDIA_CLASS (astal_wp_media_class_get_type())
-
-typedef enum {
- ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE,
- ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER,
- ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER,
- ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM,
- ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE,
- ASTAL_WP_MEDIA_CLASS_VIDEO_SINK,
- ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER,
- ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM,
-} AstalWpMediaClass;
-
-void astal_wp_endpoint_set_volume(AstalWpEndpoint *self, gdouble volume);
-void astal_wp_endpoint_set_mute(AstalWpEndpoint *self, gboolean mute);
-gboolean astal_wp_endpoint_get_is_default(AstalWpEndpoint *self);
-void astal_wp_endpoint_set_is_default(AstalWpEndpoint *self, gboolean is_default);
-gboolean astal_wp_endpoint_get_lock_channels(AstalWpEndpoint *self);
-void astal_wp_endpoint_set_lock_channels(AstalWpEndpoint *self, gboolean lock_channels);
-
-AstalWpMediaClass astal_wp_endpoint_get_media_class(AstalWpEndpoint *self);
-guint astal_wp_endpoint_get_id(AstalWpEndpoint *self);
-gboolean astal_wp_endpoint_get_mute(AstalWpEndpoint *self);
-gdouble astal_wp_endpoint_get_volume(AstalWpEndpoint *self);
-const gchar *astal_wp_endpoint_get_description(AstalWpEndpoint *self);
-const gchar *astal_wp_endpoint_get_name(AstalWpEndpoint *self);
-const gchar *astal_wp_endpoint_get_icon(AstalWpEndpoint *self);
-const gchar *astal_wp_endpoint_get_volume_icon(AstalWpEndpoint *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WP_ENDPOINT_H
diff --git a/wireplumber/include/astal/wireplumber/meson.build b/wireplumber/include/astal/wireplumber/meson.build
deleted file mode 100644
index d02563c..0000000
--- a/wireplumber/include/astal/wireplumber/meson.build
+++ /dev/null
@@ -1,10 +0,0 @@
-astal_wireplumber_subheaders = files(
- 'wp.h',
- 'endpoint.h',
- 'device.h',
- 'video.h',
- 'audio.h',
- 'profile.h',
-)
-
-install_headers(astal_wireplumber_subheaders, subdir : 'astal/wireplumber')
diff --git a/wireplumber/include/astal/wireplumber/profile.h b/wireplumber/include/astal/wireplumber/profile.h
deleted file mode 100644
index 2ec768e..0000000
--- a/wireplumber/include/astal/wireplumber/profile.h
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef ASTAL_WP_PROFILE_H
-#define ASTAL_WP_PROFILE_H
-
-#include <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_PROFILE (astal_wp_profile_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpProfile, astal_wp_profile, ASTAL_WP, PROFILE, GObject)
-
-gint astal_wp_profile_get_index(AstalWpProfile *self);
-const gchar *astal_wp_profile_get_description(AstalWpProfile *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WP_PROFILE_H
diff --git a/wireplumber/include/astal/wireplumber/video.h b/wireplumber/include/astal/wireplumber/video.h
deleted file mode 100644
index 3c4ae74..0000000
--- a/wireplumber/include/astal/wireplumber/video.h
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef ASTAL_WIREPLUMBER_VIDEO_H
-#define ASTAL_WIREPLUMBER_VIDEO_H
-
-#include <glib-object.h>
-
-#include "device.h"
-#include "endpoint.h"
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_VIDEO (astal_wp_video_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpVideo, astal_wp_video, ASTAL_WP, VIDEO, GObject)
-
-AstalWpEndpoint *astal_wp_video_get_source(AstalWpVideo *self, guint id);
-AstalWpEndpoint *astal_wp_video_get_sink(AstalWpVideo *self, guint id);
-AstalWpEndpoint *astal_wp_video_get_recorder(AstalWpVideo *self, guint id);
-AstalWpEndpoint *astal_wp_video_get_stream(AstalWpVideo *self, guint id);
-AstalWpDevice *astal_wp_video_get_device(AstalWpVideo *self, guint id);
-
-GList *astal_wp_video_get_sources(AstalWpVideo *self);
-GList *astal_wp_video_get_sinks(AstalWpVideo *self);
-GList *astal_wp_video_get_recorders(AstalWpVideo *self);
-GList *astal_wp_video_get_streams(AstalWpVideo *self);
-GList *astal_wp_video_get_devices(AstalWpVideo *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WIREPLUMBER_VIDEO_H
diff --git a/wireplumber/include/astal/wireplumber/wp.h b/wireplumber/include/astal/wireplumber/wp.h
deleted file mode 100644
index 1ff341c..0000000
--- a/wireplumber/include/astal/wireplumber/wp.h
+++ /dev/null
@@ -1,47 +0,0 @@
-#ifndef ASTAL_WIREPLUMBER_H
-#define ASTAL_WIREPLUMBER_H
-
-#include <glib-object.h>
-
-#include "audio.h"
-#include "device.h"
-#include "endpoint.h"
-#include "video.h"
-
-G_BEGIN_DECLS
-
-#define ASTAL_WP_TYPE_SCALE (astal_wp_scale_get_type())
-
-typedef enum {
- ASTAL_WP_SCALE_LINEAR,
- ASTAL_WP_SCALE_CUBIC,
-} AstalWpScale;
-
-#define ASTAL_WP_TYPE_WP (astal_wp_wp_get_type())
-
-G_DECLARE_FINAL_TYPE(AstalWpWp, astal_wp_wp, ASTAL_WP, WP, GObject)
-
-AstalWpWp* astal_wp_wp_get_default();
-AstalWpWp* astal_wp_get_default_wp();
-
-AstalWpAudio* astal_wp_wp_get_audio(AstalWpWp* self);
-AstalWpVideo* astal_wp_wp_get_video(AstalWpWp* self);
-
-AstalWpEndpoint* astal_wp_wp_get_endpoint(AstalWpWp* self, guint id);
-GList* astal_wp_wp_get_endpoints(AstalWpWp* self);
-
-AstalWpDevice* astal_wp_wp_get_device(AstalWpWp* self, guint id);
-GList* astal_wp_wp_get_devices(AstalWpWp* self);
-
-AstalWpEndpoint* astal_wp_wp_get_default_speaker(AstalWpWp* self);
-AstalWpEndpoint* astal_wp_wp_get_default_microphone(AstalWpWp* self);
-
-AstalWpScale astal_wp_wp_get_scale(AstalWpWp* self);
-void astal_wp_wp_set_scale(AstalWpWp* self, AstalWpScale scale);
-
-AstalWpVideo* astal_wp_video_new(AstalWpWp* wp);
-AstalWpAudio* astal_wp_audio_new(AstalWpWp* wp);
-
-G_END_DECLS
-
-#endif // !ASTAL_WIREPLUMBER_H
diff --git a/wireplumber/include/meson.build b/wireplumber/include/meson.build
deleted file mode 100644
index 441097c..0000000
--- a/wireplumber/include/meson.build
+++ /dev/null
@@ -1,8 +0,0 @@
-astal_wireplumber_inc = include_directories('.', 'astal/wireplumber', 'private')
-astal_wireplumber_headers = files(
- 'astal-wp.h',
-)
-
-install_headers(astal_wireplumber_headers)
-
-subdir('astal/wireplumber')
diff --git a/wireplumber/include/private/device-private.h b/wireplumber/include/private/device-private.h
deleted file mode 100644
index e98a7f7..0000000
--- a/wireplumber/include/private/device-private.h
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef ASTAL_WP_DEVICE_PRIVATE_H
-#define ASTAL_WP_DEVICE_PRIVATE_H
-
-#include <glib-object.h>
-#include <wp/wp.h>
-
-#include "device.h"
-
-G_BEGIN_DECLS
-
-AstalWpDevice *astal_wp_device_create(WpDevice *device);
-
-G_END_DECLS
-
-#endif // !ASTAL_WP_DEVICE_PRIATE_H
diff --git a/wireplumber/include/private/endpoint-private.h b/wireplumber/include/private/endpoint-private.h
deleted file mode 100644
index 7431c78..0000000
--- a/wireplumber/include/private/endpoint-private.h
+++ /dev/null
@@ -1,22 +0,0 @@
-#ifndef ASTAL_WP_ENDPOINT_PRIV_H
-#define ASTAL_WP_ENDPOINT_PRIV_H
-
-#include <glib-object.h>
-#include <wp/wp.h>
-
-#include "endpoint.h"
-#include "wp.h"
-
-G_BEGIN_DECLS
-
-AstalWpEndpoint *astal_wp_endpoint_create(WpNode *node, WpPlugin *mixer, WpPlugin *defaults,
- AstalWpWp *wp);
-AstalWpEndpoint *astal_wp_endpoint_init_as_default(AstalWpEndpoint *self, WpPlugin *mixer,
- WpPlugin *defaults, AstalWpMediaClass type,
- AstalWpWp *wp);
-void astal_wp_endpoint_update_default(AstalWpEndpoint *self, gboolean is_default);
-void astal_wp_endpoint_update_volume(AstalWpEndpoint *self);
-
-G_END_DECLS
-
-#endif // !ASTAL_WP_ENDPOINT_PRIV_H
diff --git a/wireplumber/meson.build b/wireplumber/meson.build
deleted file mode 100644
index b295b31..0000000
--- a/wireplumber/meson.build
+++ /dev/null
@@ -1,22 +0,0 @@
-project('astal_wireplumber',
- 'c',
- version : '0.1.0',
- default_options : [
- 'c_std=gnu11',
- 'warning_level=3',
- 'prefix=/usr'
- ]
-)
-
-add_project_arguments(
- ['-Wno-pedantic', '-Wno-unused-parameter'],
- language : 'c')
-
-version_split = meson.project_version().split('.')
-lib_so_version = version_split[0] + '.' + version_split[1]
-
-pkg_config = import('pkgconfig')
-gnome = import('gnome')
-
-subdir('include')
-subdir('src')
diff --git a/wireplumber/meson_options.txt b/wireplumber/meson_options.txt
deleted file mode 100644
index d585854..0000000
--- a/wireplumber/meson_options.txt
+++ /dev/null
@@ -1,2 +0,0 @@
-option('introspection', type : 'boolean', value : true, description : 'Build gobject-introspection data')
-option('vapi', type : 'boolean', value : true, description : 'Generate vapi data (needs vapigen & introspection option)')
diff --git a/wireplumber/src/audio.c b/wireplumber/src/audio.c
deleted file mode 100644
index 15582d7..0000000
--- a/wireplumber/src/audio.c
+++ /dev/null
@@ -1,503 +0,0 @@
-#include "audio.h"
-
-#include <wp/wp.h>
-
-#include "device.h"
-#include "endpoint.h"
-#include "glib-object.h"
-#include "wp.h"
-
-struct _AstalWpAudio {
- GObject parent_instance;
-};
-
-typedef struct {
- AstalWpWp *wp;
-} AstalWpAudioPrivate;
-
-G_DEFINE_FINAL_TYPE_WITH_PRIVATE(AstalWpAudio, astal_wp_audio, G_TYPE_OBJECT);
-
-typedef enum {
- ASTAL_WP_AUDIO_SIGNAL_MICROPHONE_ADDED,
- ASTAL_WP_AUDIO_SIGNAL_MICROPHONE_REMOVED,
- ASTAL_WP_AUDIO_SIGNAL_SPEAKER_ADDED,
- ASTAL_WP_AUDIO_SIGNAL_SPEAKER_REMOVED,
- ASTAL_WP_AUDIO_SIGNAL_STREAM_ADDED,
- ASTAL_WP_AUDIO_SIGNAL_STREAM_REMOVED,
- ASTAL_WP_AUDIO_SIGNAL_RECORDER_ADDED,
- ASTAL_WP_AUDIO_SIGNAL_RECORDER_REMOVED,
- ASTAL_WP_AUDIO_SIGNAL_DEVICE_ADDED,
- ASTAL_WP_AUDIO_SIGNAL_DEVICE_REMOVED,
- ASTAL_WP_AUDIO_N_SIGNALS
-} AstalWpWpSignals;
-
-static guint astal_wp_audio_signals[ASTAL_WP_AUDIO_N_SIGNALS] = {
- 0,
-};
-
-typedef enum {
- ASTAL_WP_AUDIO_PROP_MICROPHONES = 1,
- ASTAL_WP_AUDIO_PROP_SPEAKERS,
- ASTAL_WP_AUDIO_PROP_STREAMS,
- ASTAL_WP_AUDIO_PROP_RECORDERS,
- ASTAL_WP_AUDIO_PROP_DEVICES,
- ASTAL_WP_AUDIO_PROP_DEFAULT_SPEAKER,
- ASTAL_WP_AUDIO_PROP_DEFAULT_MICROPHONE,
- ASTAL_WP_AUDIO_N_PROPERTIES,
-} AstalWpAudioProperties;
-
-static GParamSpec *astal_wp_audio_properties[ASTAL_WP_AUDIO_N_PROPERTIES] = {
- NULL,
-};
-
-/**
- * astal_wp_audio_get_speaker:
- * @self: the AstalWpAudio object
- * @id: the id of the endpoint
- *
- * gets the speaker with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpEndpoint *astal_wp_audio_get_speaker(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_audio_get_microphone:
- * @self: the AstalWpAudio object
- * @id: the id of the endpoint
- *
- * gets the microphone with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpEndpoint *astal_wp_audio_get_microphone(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_audio_get_recorder:
- * @self: the AstalWpAudio object
- * @id: the id of the endpoint
- *
- * gets the recorder with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpEndpoint *astal_wp_audio_get_recorder(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_audio_get_stream:
- * @self: the AstalWpAudio object
- * @id: the id of the endpoint
- *
- * gets the stream with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpEndpoint *astal_wp_audio_get_stream(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_audio_get_device:
- * @self: the AstalWpAudio object
- * @id: the id of the device
- *
- * gets the device with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpDevice *astal_wp_audio_get_device(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- return astal_wp_wp_get_device(priv->wp, id);
-}
-
-/**
- * astal_wp_audio_get_microphones:
- * @self: the AstalWpAudio object
- *
- * a GList containing the microphones
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint))
- */
-GList *astal_wp_audio_get_microphones(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *mics = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE) {
- mics = g_list_append(mics, l->data);
- }
- }
- g_list_free(eps);
- return mics;
-}
-
-/**
- * astal_wp_audio_get_speakers:
- * @self: the AstalWpAudio object
- *
- * a GList containing the speakers
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint))
- */
-GList *astal_wp_audio_get_speakers(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *speakers = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER) {
- speakers = g_list_append(speakers, l->data);
- }
- }
- g_list_free(eps);
- return speakers;
-}
-
-/**
- * astal_wp_audio_get_recorders:
- * @self: the AstalWpAudio object
- *
- * a GList containing the recorders
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint))
- */
-GList *astal_wp_audio_get_recorders(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *recorders = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER) {
- recorders = g_list_append(recorders, l->data);
- }
- }
- g_list_free(eps);
- return recorders;
-}
-
-/**
- * astal_wp_audio_get_streams:
- * @self: the AstalWpAudio object
- *
- * a GList containing the streams
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint))
- */
-GList *astal_wp_audio_get_streams(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *streams = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM) {
- streams = g_list_append(streams, l->data);
- }
- }
- g_list_free(eps);
- return streams;
-}
-
-/**
- * astal_wp_audio_get_devices:
- * @self: the AstalWpAudio object
- *
- * a GList containing the devices
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpDevice))
- */
-GList *astal_wp_audio_get_devices(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- GList *eps = astal_wp_wp_get_devices(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_device_get_device_type(l->data) == ASTAL_WP_DEVICE_TYPE_AUDIO) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-/**
- * astal_wp_audio_get_endpoint:
- * @self: the AstalWpAudio object
- * @id: the id of the endpoint
- *
- * the endpoint with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpEndpoint *astal_wp_audio_get_endpoint(AstalWpAudio *self, guint id) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- return endpoint;
-}
-
-/**
- * astal_wp_audio_get_default_speaker
- *
- * gets the default speaker object
- *
- * Returns: (nullable) (transfer none)
- */
-AstalWpEndpoint *astal_wp_audio_get_default_speaker(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- return astal_wp_wp_get_default_speaker(priv->wp);
-}
-
-/**
- * astal_wp_audio_get_default_microphone
- *
- * gets the default microphone object
- *
- * Returns: (nullable) (transfer none)
- */
-AstalWpEndpoint *astal_wp_audio_get_default_microphone(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- return astal_wp_wp_get_default_microphone(priv->wp);
-}
-
-static void astal_wp_audio_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpAudio *self = ASTAL_WP_AUDIO(object);
-
- switch (property_id) {
- case ASTAL_WP_AUDIO_PROP_MICROPHONES:
- g_value_set_pointer(value, astal_wp_audio_get_microphones(self));
- break;
- case ASTAL_WP_AUDIO_PROP_SPEAKERS:
- g_value_set_pointer(value, astal_wp_audio_get_speakers(self));
- break;
- case ASTAL_WP_AUDIO_PROP_STREAMS:
- g_value_set_pointer(value, astal_wp_audio_get_streams(self));
- break;
- case ASTAL_WP_AUDIO_PROP_RECORDERS:
- g_value_set_pointer(value, astal_wp_audio_get_recorders(self));
- break;
- case ASTAL_WP_AUDIO_PROP_DEFAULT_SPEAKER:
- g_value_set_object(value, astal_wp_audio_get_default_speaker(self));
- break;
- case ASTAL_WP_AUDIO_PROP_DEVICES:
- g_value_set_pointer(value, astal_wp_audio_get_devices(self));
- break;
- case ASTAL_WP_AUDIO_PROP_DEFAULT_MICROPHONE:
- g_value_set_object(value, astal_wp_audio_get_default_microphone(self));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_audio_device_added(AstalWpAudio *self, gpointer object) {
- AstalWpDevice *device = ASTAL_WP_DEVICE(object);
- if (astal_wp_device_get_device_type(device) == ASTAL_WP_DEVICE_TYPE_AUDIO) {
- g_signal_emit_by_name(self, "device-added", device);
- g_object_notify(G_OBJECT(self), "devices");
- }
-}
-
-static void astal_wp_audio_device_removed(AstalWpAudio *self, gpointer object) {
- AstalWpDevice *device = ASTAL_WP_DEVICE(object);
- if (astal_wp_device_get_device_type(device) == ASTAL_WP_DEVICE_TYPE_AUDIO) {
- g_signal_emit_by_name(self, "device-removed", device);
- g_object_notify(G_OBJECT(self), "devices");
- }
-}
-
-static void astal_wp_audio_object_added(AstalWpAudio *self, gpointer object) {
- AstalWpEndpoint *endpoint = ASTAL_WP_ENDPOINT(object);
- switch (astal_wp_endpoint_get_media_class(endpoint)) {
- case ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE:
- g_signal_emit_by_name(self, "microphone-added", endpoint);
- g_object_notify(G_OBJECT(self), "microphones");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER:
- g_signal_emit_by_name(self, "speaker-added", endpoint);
- g_object_notify(G_OBJECT(self), "speakers");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM:
- g_signal_emit_by_name(self, "stream-added", endpoint);
- g_object_notify(G_OBJECT(self), "streams");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER:
- g_signal_emit_by_name(self, "recorder-added", endpoint);
- g_object_notify(G_OBJECT(self), "recorders");
- break;
- default:
- break;
- }
-}
-
-static void astal_wp_audio_object_removed(AstalWpAudio *self, gpointer object) {
- AstalWpEndpoint *endpoint = ASTAL_WP_ENDPOINT(object);
- switch (astal_wp_endpoint_get_media_class(endpoint)) {
- case ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE:
- g_signal_emit_by_name(self, "microphone-removed", endpoint);
- g_object_notify(G_OBJECT(self), "microphones");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER:
- g_signal_emit_by_name(self, "speaker-removed", endpoint);
- g_object_notify(G_OBJECT(self), "speakers");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM:
- g_signal_emit_by_name(self, "stream-removed", endpoint);
- g_object_notify(G_OBJECT(self), "streams");
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER:
- g_signal_emit_by_name(self, "recorder-removed", endpoint);
- g_object_notify(G_OBJECT(self), "recorders");
- break;
- default:
- break;
- }
-}
-
-AstalWpAudio *astal_wp_audio_new(AstalWpWp *wp) {
- AstalWpAudio *self = g_object_new(ASTAL_WP_TYPE_AUDIO, NULL);
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- priv->wp = g_object_ref(wp);
-
- g_signal_connect_swapped(priv->wp, "endpoint-added", G_CALLBACK(astal_wp_audio_object_added),
- self);
- g_signal_connect_swapped(priv->wp, "endpoint-removed",
- G_CALLBACK(astal_wp_audio_object_removed), self);
- g_signal_connect_swapped(priv->wp, "device-added", G_CALLBACK(astal_wp_audio_device_added),
- self);
- g_signal_connect_swapped(priv->wp, "device-removed", G_CALLBACK(astal_wp_audio_device_removed),
- self);
-
- return self;
-}
-
-static void astal_wp_audio_dispose(GObject *object) {
- AstalWpAudio *self = ASTAL_WP_AUDIO(object);
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
- g_clear_object(&priv->wp);
-}
-
-static void astal_wp_audio_init(AstalWpAudio *self) {
- AstalWpAudioPrivate *priv = astal_wp_audio_get_instance_private(self);
-}
-
-static void astal_wp_audio_class_init(AstalWpAudioClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->get_property = astal_wp_audio_get_property;
- object_class->dispose = astal_wp_audio_dispose;
-
- /**
- * AstalWpAudio:microphones: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_MICROPHONES] =
- g_param_spec_pointer("microphones", "microphones", "microphones", G_PARAM_READABLE);
- /**
- * AstalWpAudio:speakers: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_SPEAKERS] =
- g_param_spec_pointer("speakers", "speakers", "speakers", G_PARAM_READABLE);
- /**
- * AstalWpAudio:recorders: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_RECORDERS] =
- g_param_spec_pointer("recorders", "recorders", "recorders", G_PARAM_READABLE);
- /**
- * AstalWpAudio:streams: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_STREAMS] =
- g_param_spec_pointer("streams", "streams", "streams", G_PARAM_READABLE);
- /**
- * AstalWpAudio:devices: (type GList(AstalWpDevice)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_DEVICES] =
- g_param_spec_pointer("devices", "devices", "devices", G_PARAM_READABLE);
- /**
- * AstalWpAudio:default-speaker:
- *
- * The AstalWndpoint object representing the default speaker
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_DEFAULT_SPEAKER] =
- g_param_spec_object("default-speaker", "default-speaker", "default-speaker",
- ASTAL_WP_TYPE_ENDPOINT, G_PARAM_READABLE);
- /**
- * AstalWpAudio:default-microphone:
- *
- * The AstalWndpoint object representing the default speaker
- */
- astal_wp_audio_properties[ASTAL_WP_AUDIO_PROP_DEFAULT_MICROPHONE] =
- g_param_spec_object("default-microphone", "default-microphone", "default-microphone",
- ASTAL_WP_TYPE_ENDPOINT, G_PARAM_READABLE);
-
- g_object_class_install_properties(object_class, ASTAL_WP_AUDIO_N_PROPERTIES,
- astal_wp_audio_properties);
-
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_MICROPHONE_ADDED] =
- g_signal_new("microphone-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_MICROPHONE_REMOVED] =
- g_signal_new("microphone-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_SPEAKER_ADDED] =
- g_signal_new("speaker-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_SPEAKER_REMOVED] =
- g_signal_new("speaker-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_STREAM_ADDED] =
- g_signal_new("stream-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_STREAM_REMOVED] =
- g_signal_new("stream-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_RECORDER_ADDED] =
- g_signal_new("recorder-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_RECORDER_REMOVED] =
- g_signal_new("recorder-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_DEVICE_ADDED] =
- g_signal_new("device-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
- astal_wp_audio_signals[ASTAL_WP_AUDIO_SIGNAL_MICROPHONE_REMOVED] =
- g_signal_new("device-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
-}
diff --git a/wireplumber/src/device.c b/wireplumber/src/device.c
deleted file mode 100644
index af0760c..0000000
--- a/wireplumber/src/device.c
+++ /dev/null
@@ -1,371 +0,0 @@
-#include <wp/wp.h>
-
-#include "device-private.h"
-#include "profile.h"
-
-struct _AstalWpDevice {
- GObject parent_instance;
-
- guint id;
- gchar *description;
- gchar *icon;
- gint active_profile;
- AstalWpDeviceType type;
-};
-
-typedef struct {
- WpDevice *device;
- GHashTable *profiles;
-} AstalWpDevicePrivate;
-
-G_DEFINE_FINAL_TYPE_WITH_PRIVATE(AstalWpDevice, astal_wp_device, G_TYPE_OBJECT);
-
-G_DEFINE_ENUM_TYPE(AstalWpDeviceType, astal_wp_device_type,
- G_DEFINE_ENUM_VALUE(ASTAL_WP_DEVICE_TYPE_AUDIO, "Audio/Device"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_DEVICE_TYPE_VIDEO, "Video/Device"));
-
-typedef enum {
- ASTAL_WP_DEVICE_PROP_ID = 1,
- ASTAL_WP_DEVICE_PROP_DESCRIPTION,
- ASTAL_WP_DEVICE_PROP_ICON,
- ASTAL_WP_DEVICE_PROP_PROFILES,
- ASTAL_WP_DEVICE_PROP_ACTIVE_PROFILE,
- ASTAL_WP_DEVICE_PROP_DEVICE_TYPE,
- ASTAL_WP_DEVICE_N_PROPERTIES,
-} AstalWpDeviceProperties;
-
-static GParamSpec *astal_wp_device_properties[ASTAL_WP_DEVICE_N_PROPERTIES] = {
- NULL,
-};
-
-/**
- * astal_wp_device_get_id
- * @self: the AstalWpDevice object
- *
- * gets the id of this device
- *
- */
-guint astal_wp_device_get_id(AstalWpDevice *self) { return self->id; }
-
-/**
- * astal_wp_device_get_description
- * @self: the AstalWpDevice object
- *
- * gets the description of this device
- *
- */
-const gchar *astal_wp_device_get_description(AstalWpDevice *self) { return self->description; }
-
-/**
- * astal_wp_device_get_icon
- * @self: the AstalWpDevice object
- *
- * gets the icon of this device
- *
- */
-const gchar *astal_wp_device_get_icon(AstalWpDevice *self) {
- g_return_val_if_fail(self != NULL, "audio-card-symbolic");
- return self->icon;
-}
-
-/**
- * astal_wp_device_get_device_type
- * @self: the AstalWpDevice object
- *
- * gets the type of this device
- *
- */
-AstalWpDeviceType astal_wp_device_get_device_type(AstalWpDevice *self) { return self->type; }
-
-/**
- * astal_wp_device_get_active_profile
- * @self: the AstalWpDevice object
- *
- * gets the currently active profile of this device
- *
- */
-gint astal_wp_device_get_active_profile(AstalWpDevice *self) { return self->active_profile; }
-
-/**
- * astal_wp_device_set_active_profile
- * @self: the AstalWpDevice object
- * @profile_id: the id of the profile
- *
- * sets the profile for this device
- *
- */
-void astal_wp_device_set_active_profile(AstalWpDevice *self, int profile_id) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
-
- WpSpaPodBuilder *builder =
- wp_spa_pod_builder_new_object("Spa:Pod:Object:Param:Profile", "Profile");
- wp_spa_pod_builder_add_property(builder, "index");
- wp_spa_pod_builder_add_int(builder, profile_id);
- WpSpaPod *pod = wp_spa_pod_builder_end(builder);
- wp_pipewire_object_set_param(WP_PIPEWIRE_OBJECT(priv->device), "Profile", 0, pod);
-
- wp_spa_pod_builder_unref(builder);
-}
-
-/**
- * astal_wp_device_get_profile:
- * @self: the AstalWpDevice object
- * @id: the id of the profile
- *
- * gets the profile with the given id
- *
- * Returns: (transfer none) (nullable)
- */
-AstalWpProfile *astal_wp_device_get_profile(AstalWpDevice *self, gint id) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
-
- return g_hash_table_lookup(priv->profiles, GINT_TO_POINTER(id));
-}
-
-/**
- * astal_wp_device_get_profiles:
- * @self: the AstalWpDevice object
- *
- * gets a GList containing the profiles
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpProfile))
- */
-GList *astal_wp_device_get_profiles(AstalWpDevice *self) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
- return g_hash_table_get_values(priv->profiles);
-}
-
-static void astal_wp_device_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpDevice *self = ASTAL_WP_DEVICE(object);
-
- switch (property_id) {
- case ASTAL_WP_DEVICE_PROP_ID:
- g_value_set_uint(value, self->id);
- break;
- case ASTAL_WP_DEVICE_PROP_DESCRIPTION:
- g_value_set_string(value, self->description);
- break;
- case ASTAL_WP_DEVICE_PROP_ICON:
- g_value_set_string(value, self->icon);
- break;
- case ASTAL_WP_DEVICE_PROP_PROFILES:
- g_value_set_pointer(value, astal_wp_device_get_profiles(self));
- break;
- case ASTAL_WP_DEVICE_PROP_DEVICE_TYPE:
- g_value_set_enum(value, astal_wp_device_get_device_type(self));
- break;
- case ASTAL_WP_DEVICE_PROP_ACTIVE_PROFILE:
- g_value_set_int(value, self->active_profile);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_device_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec) {
- AstalWpDevice *self = ASTAL_WP_DEVICE(object);
-
- switch (property_id) {
- case ASTAL_WP_DEVICE_PROP_ACTIVE_PROFILE:
- astal_wp_device_set_active_profile(self, g_value_get_int(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_device_update_profiles(AstalWpDevice *self) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
- g_hash_table_remove_all(priv->profiles);
-
- WpIterator *iter =
- wp_pipewire_object_enum_params_sync(WP_PIPEWIRE_OBJECT(priv->device), "EnumProfile", NULL);
- if (iter == NULL) return;
- GValue profile = G_VALUE_INIT;
- while (wp_iterator_next(iter, &profile)) {
- WpSpaPod *pod = g_value_get_boxed(&profile);
-
- gint index;
- gchar *description;
- wp_spa_pod_get_object(pod, NULL, "index", "i", &index, "description", "s", &description,
- NULL);
-
- g_hash_table_insert(
- priv->profiles, GINT_TO_POINTER(index),
- g_object_new(ASTAL_WP_TYPE_PROFILE, "index", index, "description", description, NULL));
- g_value_unset(&profile);
- }
- wp_iterator_unref(iter);
-
- g_object_notify(G_OBJECT(self), "profiles");
-}
-
-static void astal_wp_device_update_active_profile(AstalWpDevice *self) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
-
- WpIterator *iter =
- wp_pipewire_object_enum_params_sync(WP_PIPEWIRE_OBJECT(priv->device), "Profile", NULL);
- if (iter == NULL) return;
- GValue profile = G_VALUE_INIT;
- while (wp_iterator_next(iter, &profile)) {
- WpSpaPod *pod = g_value_get_boxed(&profile);
-
- gint index;
- gchar *description;
- wp_spa_pod_get_object(pod, NULL, "index", "i", &index, "description", "s", &description,
- NULL);
-
- g_hash_table_insert(
- priv->profiles, GINT_TO_POINTER(index),
- g_object_new(ASTAL_WP_TYPE_PROFILE, "index", index, "description", description, NULL));
-
- self->active_profile = index;
- g_value_unset(&profile);
- }
- wp_iterator_unref(iter);
-
- g_object_notify(G_OBJECT(self), "active-profile-id");
-}
-
-static void astal_wp_device_params_changed(AstalWpDevice *self, const gchar *prop) {
- if (g_strcmp0(prop, "EnumProfile") == 0) {
- astal_wp_device_update_profiles(self);
- } else if (g_strcmp0(prop, "Profile") == 0) {
- astal_wp_device_update_active_profile(self);
- }
-}
-
-static void astal_wp_device_update_properties(AstalWpDevice *self) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
- if (priv->device == NULL) return;
- self->id = wp_proxy_get_bound_id(WP_PROXY(priv->device));
- const gchar *description =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->device), "device.description");
- if (description == NULL) {
- description =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->device), "device.name");
- }
- if (description == NULL) {
- description = "unknown";
- }
- g_free(self->description);
- self->description = g_strdup(description);
-
- const gchar *icon =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->device), "device.icon-name");
- if (icon == NULL) {
- icon = "audio-card-symbolic";
- }
- g_free(self->icon);
- self->icon = g_strdup(icon);
-
- const gchar *type =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->device), "media.class");
- GEnumClass *enum_class = g_type_class_ref(ASTAL_WP_TYPE_DEVICE_TYPE);
- if (g_enum_get_value_by_nick(enum_class, type) != NULL)
- self->type = g_enum_get_value_by_nick(enum_class, type)->value;
- g_type_class_unref(enum_class);
-
- astal_wp_device_update_profiles(self);
- astal_wp_device_update_active_profile(self);
-
- g_object_notify(G_OBJECT(self), "id");
- g_object_notify(G_OBJECT(self), "device-type");
- g_object_notify(G_OBJECT(self), "icon");
- g_object_notify(G_OBJECT(self), "description");
-}
-
-AstalWpDevice *astal_wp_device_create(WpDevice *device) {
- AstalWpDevice *self = g_object_new(ASTAL_WP_TYPE_DEVICE, NULL);
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
-
- priv->device = g_object_ref(device);
-
- g_signal_connect_swapped(priv->device, "params-changed",
- G_CALLBACK(astal_wp_device_params_changed), self);
-
- astal_wp_device_update_properties(self);
- return self;
-}
-
-static void astal_wp_device_init(AstalWpDevice *self) {
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
- priv->device = NULL;
-
- priv->profiles = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
-
- self->description = NULL;
- self->icon = NULL;
-}
-
-static void astal_wp_device_dispose(GObject *object) {
- AstalWpDevice *self = ASTAL_WP_DEVICE(object);
- AstalWpDevicePrivate *priv = astal_wp_device_get_instance_private(self);
-
- g_clear_object(&priv->device);
-}
-
-static void astal_wp_device_finalize(GObject *object) {
- AstalWpDevice *self = ASTAL_WP_DEVICE(object);
- g_free(self->description);
- g_free(self->icon);
-}
-
-static void astal_wp_device_class_init(AstalWpDeviceClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->dispose = astal_wp_device_dispose;
- object_class->finalize = astal_wp_device_finalize;
- object_class->get_property = astal_wp_device_get_property;
- object_class->set_property = astal_wp_device_set_property;
- /**
- * AstalWpDevice:id
- *
- * The id of this device.
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_ID] =
- g_param_spec_uint("id", "id", "id", 0, UINT_MAX, 0, G_PARAM_READABLE);
- /**
- * AstalWpDevice:description
- *
- * The description of this device.
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_DESCRIPTION] =
- g_param_spec_string("description", "description", "description", NULL, G_PARAM_READABLE);
- /**
- * AstalWpDevice:icon
- *
- * The icon name for this device.
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_ICON] =
- g_param_spec_string("icon", "icon", "icon", NULL, G_PARAM_READABLE);
- /**
- * AstalWpDevice:device-type: (type AstalWpDeviceType)
- *
- * The type of this device
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_DEVICE_TYPE] =
- g_param_spec_enum("device-type", "device-type", "device-type", ASTAL_WP_TYPE_DEVICE_TYPE, 1,
- G_PARAM_READABLE);
- /**
- * AstalWpDevice:profiles: (type GList(AstalWpProfile)) (transfer container)
- *
- * A list of available profiles
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_PROFILES] =
- g_param_spec_pointer("profiles", "profiles", "profiles", G_PARAM_READABLE);
- /**
- * AstalWpDevice:active-profile-id
- *
- * The id of the currently active profile.
- */
- astal_wp_device_properties[ASTAL_WP_DEVICE_PROP_ACTIVE_PROFILE] =
- g_param_spec_int("active-profile-id", "active-profile-id", "active-profile-id", G_MININT,
- G_MAXINT, 0, G_PARAM_READWRITE);
-
- g_object_class_install_properties(object_class, ASTAL_WP_DEVICE_N_PROPERTIES,
- astal_wp_device_properties);
-}
diff --git a/wireplumber/src/endpoint.c b/wireplumber/src/endpoint.c
deleted file mode 100644
index 13979d1..0000000
--- a/wireplumber/src/endpoint.c
+++ /dev/null
@@ -1,554 +0,0 @@
-#include "endpoint.h"
-
-#include <wp/wp.h>
-
-#include "device.h"
-#include "endpoint-private.h"
-#include "glib.h"
-#include "wp.h"
-
-struct _AstalWpEndpoint {
- GObject parent_instance;
-
- guint id;
- gdouble volume;
- gboolean mute;
- gchar *description;
- gchar *name;
- AstalWpMediaClass type;
- gboolean is_default;
- gboolean lock_channels;
-
- gchar *icon;
-};
-
-typedef struct {
- WpNode *node;
- WpPlugin *mixer;
- WpPlugin *defaults;
- AstalWpWp *wp;
-
- gboolean is_default_node;
- AstalWpMediaClass media_class;
-
- gulong default_signal_handler_id;
- gulong mixer_signal_handler_id;
-
-} AstalWpEndpointPrivate;
-
-G_DEFINE_FINAL_TYPE_WITH_PRIVATE(AstalWpEndpoint, astal_wp_endpoint, G_TYPE_OBJECT);
-
-G_DEFINE_ENUM_TYPE(AstalWpMediaClass, astal_wp_media_class,
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE, "Audio/Source"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER, "Audio/Sink"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER, "Stream/Input/Audio"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM, "Stream/Output/Audio"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE, "Video/Source"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_VIDEO_SINK, "Video/Sink"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER, "Stream/Input/Video"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM, "Stream/Output/Video"));
-
-typedef enum {
- ASTAL_WP_ENDPOINT_PROP_ID = 1,
- ASTAL_WP_ENDPOINT_PROP_VOLUME,
- ASTAL_WP_ENDPOINT_PROP_MUTE,
- ASTAL_WP_ENDPOINT_PROP_DESCRIPTION,
- ASTAL_WP_ENDPOINT_PROP_NAME,
- ASTAL_WP_ENDPOINT_PROP_MEDIA_CLASS,
- ASTAL_WP_ENDPOINT_PROP_DEFAULT,
- ASTAL_WP_ENDPOINT_PROP_ICON,
- ASTAL_WP_ENDPOINT_PROP_VOLUME_ICON,
- ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS,
- ASTAL_WP_ENDPOINT_N_PROPERTIES,
-} AstalWpEndpointProperties;
-
-static GParamSpec *astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_N_PROPERTIES] = {
- NULL,
-};
-
-void astal_wp_endpoint_update_volume(AstalWpEndpoint *self) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- gdouble volume = 0;
- gboolean mute;
- GVariant *variant = NULL;
- GVariantIter *channels = NULL;
-
- g_signal_emit_by_name(priv->mixer, "get-volume", self->id, &variant);
-
- if (variant == NULL) return;
-
- g_variant_lookup(variant, "volume", "d", &volume);
- g_variant_lookup(variant, "mute", "b", &mute);
- g_variant_lookup(variant, "channelVolumes", "a{sv}", &channels);
-
- if (channels != NULL) {
- const gchar *key;
- const gchar *channel_str;
- gdouble channel_volume;
- GVariant *varvol;
-
- while (g_variant_iter_loop(channels, "{&sv}", &key, &varvol)) {
- g_variant_lookup(varvol, "volume", "d", &channel_volume);
- g_variant_lookup(varvol, "channel", "&s", &channel_str);
- if (channel_volume > volume) volume = channel_volume;
- }
- }
-
- if (mute != self->mute) {
- self->mute = mute;
- g_object_notify(G_OBJECT(self), "mute");
- }
-
- if (volume != self->volume) {
- self->volume = volume;
- g_object_notify(G_OBJECT(self), "volume");
- }
-
- g_object_notify(G_OBJECT(self), "volume-icon");
-}
-
-/**
- * astal_wp_endpoint_set_volume:
- * @self: the AstalWpEndpoint object
- * @volume: The new volume level to set.
- *
- * Sets the volume level for this endpoint. The volume is clamped to be between
- * 0 and 1.5.
- */
-void astal_wp_endpoint_set_volume(AstalWpEndpoint *self, gdouble volume) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- gboolean ret;
- if (volume >= 1.5) volume = 1.5;
- if (volume <= 0) volume = 0;
-
- gboolean mute;
- GVariant *variant = NULL;
- GVariantIter *channels = NULL;
-
- g_auto(GVariantBuilder) vol_b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT);
- g_signal_emit_by_name(priv->mixer, "get-volume", self->id, &variant);
-
- if (variant == NULL) return;
-
- g_variant_lookup(variant, "mute", "b", &mute);
- g_variant_lookup(variant, "channelVolumes", "a{sv}", &channels);
-
- if (channels != NULL && !self->lock_channels) {
- g_auto(GVariantBuilder) channel_volumes_b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT);
-
- const gchar *key;
- const gchar *channel_str;
- gdouble channel_volume;
- GVariant *varvol;
-
- while (g_variant_iter_loop(channels, "{&sv}", &key, &varvol)) {
- g_auto(GVariantBuilder) channel_b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT);
- g_variant_lookup(varvol, "volume", "d", &channel_volume);
- g_variant_lookup(varvol, "channel", "&s", &channel_str);
- gdouble vol = self->volume == 0 ? volume : channel_volume * volume / self->volume;
- g_variant_builder_add(&channel_b, "{sv}", "volume", g_variant_new_double(vol));
- g_variant_builder_add(&channel_volumes_b, "{sv}", key,
- g_variant_builder_end(&channel_b));
- }
-
- g_variant_builder_add(&vol_b, "{sv}", "channelVolumes",
- g_variant_builder_end(&channel_volumes_b));
- } else {
- GVariant *volume_variant = g_variant_new_double(volume);
- g_variant_builder_add(&vol_b, "{sv}", "volume", volume_variant);
- }
-
- g_signal_emit_by_name(priv->mixer, "set-volume", self->id, g_variant_builder_end(&vol_b), &ret);
-}
-
-/**
- * astal_wp_endpoint_set_mute:
- * @self: the AstalWpEndpoint instance.
- * @mute: A boolean indicating whether to mute the endpoint.
- *
- * Sets the mute status for the endpoint.
- */
-void astal_wp_endpoint_set_mute(AstalWpEndpoint *self, gboolean mute) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- gboolean ret;
- GVariant *variant = NULL;
- GVariantBuilder b = G_VARIANT_BUILDER_INIT(G_VARIANT_TYPE_VARDICT);
- g_variant_builder_add(&b, "{sv}", "mute", g_variant_new_boolean(mute));
- variant = g_variant_builder_end(&b);
-
- g_signal_emit_by_name(priv->mixer, "set-volume", self->id, variant, &ret);
-}
-
-/**
- * astal_wp_endpoint_get_media_class:
- * @self: the AstalWpEndpoint instance.
- *
- * gets the media class of the endpoint.
- */
-AstalWpMediaClass astal_wp_endpoint_get_media_class(AstalWpEndpoint *self) { return self->type; }
-
-/**
- * astal_wp_endpoint_get_id:
- * @self: the AstalWpEndpoint instance.
- *
- * gets the id of the endpoint.
- */
-guint astal_wp_endpoint_get_id(AstalWpEndpoint *self) { return self->id; }
-
-/**
- * astal_wp_endpoint_get_mute:
- * @self: the AstalWpEndpoint instance.
- *
- * gets the mute status of the endpoint.
- */
-gboolean astal_wp_endpoint_get_mute(AstalWpEndpoint *self) { return self->mute; }
-
-/**
- * astal_wp_endpoint_get_volume:
- * @self: the AstalWpEndpoint instance.
- *
- * gets the volume
- */
-gdouble astal_wp_endpoint_get_volume(AstalWpEndpoint *self) { return self->volume; }
-
-const gchar *astal_wp_endpoint_get_description(AstalWpEndpoint *self) { return self->description; }
-
-const gchar *astal_wp_endpoint_get_name(AstalWpEndpoint *self) { return self->name; }
-
-const gchar *astal_wp_endpoint_get_icon(AstalWpEndpoint *self) { return self->icon; }
-
-gboolean astal_wp_endpoint_get_is_default(AstalWpEndpoint *self) { return self->is_default; }
-
-void astal_wp_endpoint_set_is_default(AstalWpEndpoint *self, gboolean is_default) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- if (!is_default) return;
- gboolean ret;
- const gchar *name =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "node.name");
- const gchar *media_class =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "media.class");
- g_signal_emit_by_name(priv->defaults, "set-default-configured-node-name", media_class, name,
- &ret);
-}
-
-gboolean astal_wp_endpoint_get_lock_channels(AstalWpEndpoint *self) { return self->lock_channels; }
-
-void astal_wp_endpoint_set_lock_channels(AstalWpEndpoint *self, gboolean lock_channels) {
- self->lock_channels = lock_channels;
- astal_wp_endpoint_set_volume(self, self->volume);
-}
-
-const gchar *astal_wp_endpoint_get_volume_icon(AstalWpEndpoint *self) {
- if (self->type == ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE) {
- if (self->mute) return "microphone-sensitivity-muted-symbolic";
- if (self->volume <= 0.33) return "microphone-sensitivity-low-symbolic";
- if (self->volume <= 0.66) return "microphone-sensitivity-medium-symbolic";
- return "microphone-sensitivity-high-symbolic";
-
- } else {
- if (self->mute) return "audio-volume-muted-symbolic";
- if (self->volume <= 0.33) return "audio-volume-low-symbolic";
- if (self->volume <= 0.66) return "audio-volume-medium-symbolic";
- if (self->volume <= 1) return "audio-volume-high-symbolic";
- return "audio-volume-overamplified-symbolic";
- }
-}
-
-static void astal_wp_endpoint_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpEndpoint *self = ASTAL_WP_ENDPOINT(object);
-
- switch (property_id) {
- case ASTAL_WP_ENDPOINT_PROP_ID:
- g_value_set_uint(value, self->id);
- break;
- case ASTAL_WP_ENDPOINT_PROP_MUTE:
- g_value_set_boolean(value, self->mute);
- break;
- case ASTAL_WP_ENDPOINT_PROP_VOLUME:
- g_value_set_double(value, self->volume);
- break;
- case ASTAL_WP_ENDPOINT_PROP_DESCRIPTION:
- g_value_set_string(value, self->description);
- break;
- case ASTAL_WP_ENDPOINT_PROP_NAME:
- g_value_set_string(value, self->name);
- break;
- case ASTAL_WP_ENDPOINT_PROP_ICON:
- g_value_set_string(value, self->icon);
- break;
- case ASTAL_WP_ENDPOINT_PROP_VOLUME_ICON:
- g_value_set_string(value, astal_wp_endpoint_get_volume_icon(self));
- break;
- case ASTAL_WP_ENDPOINT_PROP_MEDIA_CLASS:
- g_value_set_enum(value, self->type);
- break;
- case ASTAL_WP_ENDPOINT_PROP_DEFAULT:
- g_value_set_boolean(value, self->is_default);
- break;
- case ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS:
- g_value_set_boolean(value, self->lock_channels);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_endpoint_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec) {
- AstalWpEndpoint *self = ASTAL_WP_ENDPOINT(object);
-
- switch (property_id) {
- case ASTAL_WP_ENDPOINT_PROP_MUTE:
- astal_wp_endpoint_set_mute(self, g_value_get_boolean(value));
- break;
- case ASTAL_WP_ENDPOINT_PROP_VOLUME:
- astal_wp_endpoint_set_volume(self, g_value_get_double(value));
- break;
- case ASTAL_WP_ENDPOINT_PROP_DEFAULT:
- astal_wp_endpoint_set_is_default(self, g_value_get_boolean(value));
- break;
- case ASTAL_WP_ENDPOINT_PROP_ICON:
- g_free(self->icon);
- self->icon = g_strdup(g_value_get_string(value));
- break;
- case ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS:
- astal_wp_endpoint_set_lock_channels(self, g_value_get_boolean(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_endpoint_update_properties(AstalWpEndpoint *self) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
- if (priv->node == NULL) return;
- self->id = wp_proxy_get_bound_id(WP_PROXY(priv->node));
- astal_wp_endpoint_update_volume(self);
-
- const gchar *description =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "node.description");
- if (description == NULL) {
- description = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "node.nick");
- }
- if (description == NULL) {
- description = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "node.name");
- }
- g_free(self->description);
- self->description = g_strdup(description);
-
- const gchar *name =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "media.name");
- g_free(self->name);
- self->name = g_strdup(name);
-
- const gchar *type =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "media.class");
- GEnumClass *enum_class = g_type_class_ref(ASTAL_WP_TYPE_MEDIA_CLASS);
- if (g_enum_get_value_by_nick(enum_class, type) != NULL)
- self->type = g_enum_get_value_by_nick(enum_class, type)->value;
- g_type_class_unref(enum_class);
-
- const gchar *icon = NULL;
- switch (self->type) {
- case ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER:
- case ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE:
- const gchar *dev =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "device.id");
- guint device_id = g_ascii_strtoull(dev, NULL, 10);
- AstalWpDevice *device = astal_wp_wp_get_device(priv->wp, device_id);
- icon = astal_wp_device_get_icon(device);
- if (icon == NULL) {
- icon = self->type == ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER
- ? "audio-card-symbolic"
- : "audio-input-microphone-symbolic";
- }
- break;
- case ASTAL_WP_MEDIA_CLASS_AUDIO_STREAM:
- case ASTAL_WP_MEDIA_CLASS_AUDIO_RECORDER:
- icon =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "media.icon-name");
- if (icon == NULL)
- icon = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node),
- "window.icon-name");
- if (icon == NULL)
- icon = wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node),
- "application.icon-name");
- if (icon == NULL) icon = "application-x-executable-symbolic";
- break;
- default:
- icon = "audio-card-symbolic";
- }
- g_free(self->icon);
- self->icon = g_strdup(icon);
-
- g_object_notify(G_OBJECT(self), "id");
- g_object_notify(G_OBJECT(self), "description");
- g_object_notify(G_OBJECT(self), "name");
- g_object_notify(G_OBJECT(self), "icon");
- g_object_notify(G_OBJECT(self), "media-class");
-}
-
-static void astal_wp_endpoint_default_changed_as_default(AstalWpEndpoint *self) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- GEnumClass *enum_class = g_type_class_ref(ASTAL_WP_TYPE_MEDIA_CLASS);
- const gchar *media_class = g_enum_get_value(enum_class, priv->media_class)->value_nick;
- guint defaultId;
- g_signal_emit_by_name(priv->defaults, "get-default-node", media_class, &defaultId);
- g_type_class_unref(enum_class);
-
- if (defaultId != self->id) {
- if (priv->node != NULL) g_object_unref(priv->node);
- AstalWpEndpoint *default_endpoint = astal_wp_wp_get_endpoint(priv->wp, defaultId);
- if (default_endpoint != NULL &&
- astal_wp_endpoint_get_media_class(default_endpoint) == priv->media_class) {
- AstalWpEndpointPrivate *default_endpoint_priv =
- astal_wp_endpoint_get_instance_private(default_endpoint);
- priv->node = g_object_ref(default_endpoint_priv->node);
- astal_wp_endpoint_update_properties(self);
- }
- }
-}
-
-static void astal_wp_endpoint_default_changed(AstalWpEndpoint *self) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- guint defaultId;
- const gchar *media_class =
- wp_pipewire_object_get_property(WP_PIPEWIRE_OBJECT(priv->node), "media.class");
- g_signal_emit_by_name(priv->defaults, "get-default-node", media_class, &defaultId);
-
- if (self->is_default && defaultId != self->id) {
- self->is_default = FALSE;
- g_object_notify(G_OBJECT(self), "is-default");
- } else if (!self->is_default && defaultId == self->id) {
- self->is_default = TRUE;
- g_object_notify(G_OBJECT(self), "is-default");
- }
-}
-
-static void astal_wp_endpoint_mixer_changed(AstalWpEndpoint *self, guint node_id) {
- if (self->id != node_id) return;
- astal_wp_endpoint_update_volume(self);
-}
-
-AstalWpEndpoint *astal_wp_endpoint_init_as_default(AstalWpEndpoint *self, WpPlugin *mixer,
- WpPlugin *defaults, AstalWpMediaClass type,
- AstalWpWp *wp) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- priv->mixer = g_object_ref(mixer);
- priv->defaults = g_object_ref(defaults);
-
- priv->media_class = type;
- priv->is_default_node = TRUE;
- self->is_default = TRUE;
- priv->wp = g_object_ref(wp);
-
- priv->default_signal_handler_id = g_signal_connect_swapped(
- priv->defaults, "changed", G_CALLBACK(astal_wp_endpoint_default_changed_as_default), self);
- priv->mixer_signal_handler_id = g_signal_connect_swapped(
- priv->mixer, "changed", G_CALLBACK(astal_wp_endpoint_mixer_changed), self);
-
- astal_wp_endpoint_default_changed_as_default(self);
- astal_wp_endpoint_update_properties(self);
- return self;
-}
-
-AstalWpEndpoint *astal_wp_endpoint_create(WpNode *node, WpPlugin *mixer, WpPlugin *defaults,
- AstalWpWp *wp) {
- AstalWpEndpoint *self = g_object_new(ASTAL_WP_TYPE_ENDPOINT, NULL);
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- priv->mixer = g_object_ref(mixer);
- priv->defaults = g_object_ref(defaults);
- priv->node = g_object_ref(node);
- priv->is_default_node = FALSE;
- priv->wp = g_object_ref(wp);
-
- priv->default_signal_handler_id = g_signal_connect_swapped(
- priv->defaults, "changed", G_CALLBACK(astal_wp_endpoint_default_changed), self);
- priv->mixer_signal_handler_id = g_signal_connect_swapped(
- priv->mixer, "changed", G_CALLBACK(astal_wp_endpoint_mixer_changed), self);
-
- astal_wp_endpoint_update_properties(self);
- astal_wp_endpoint_default_changed(self);
- return self;
-}
-
-static void astal_wp_endpoint_init(AstalWpEndpoint *self) {
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
- priv->node = NULL;
- priv->mixer = NULL;
- priv->defaults = NULL;
- priv->wp = NULL;
-
- self->volume = 0;
- self->mute = TRUE;
- self->description = NULL;
- self->name = NULL;
-}
-
-static void astal_wp_endpoint_dispose(GObject *object) {
- AstalWpEndpoint *self = ASTAL_WP_ENDPOINT(object);
- AstalWpEndpointPrivate *priv = astal_wp_endpoint_get_instance_private(self);
-
- g_signal_handler_disconnect(priv->defaults, priv->default_signal_handler_id);
- g_signal_handler_disconnect(priv->mixer, priv->mixer_signal_handler_id);
-
- g_clear_object(&priv->node);
- g_clear_object(&priv->mixer);
- g_clear_object(&priv->defaults);
- g_clear_object(&priv->wp);
-}
-
-static void astal_wp_endpoint_finalize(GObject *object) {
- AstalWpEndpoint *self = ASTAL_WP_ENDPOINT(object);
- g_free(self->description);
- g_free(self->name);
-}
-
-static void astal_wp_endpoint_class_init(AstalWpEndpointClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->dispose = astal_wp_endpoint_dispose;
- object_class->finalize = astal_wp_endpoint_finalize;
- object_class->get_property = astal_wp_endpoint_get_property;
- object_class->set_property = astal_wp_endpoint_set_property;
-
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_ID] =
- g_param_spec_uint("id", "id", "id", 0, UINT_MAX, 0, G_PARAM_READABLE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_VOLUME] =
- g_param_spec_double("volume", "volume", "volume", 0, G_MAXFLOAT, 0, G_PARAM_READWRITE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_MUTE] =
- g_param_spec_boolean("mute", "mute", "mute", TRUE, G_PARAM_READWRITE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_DESCRIPTION] =
- g_param_spec_string("description", "description", "description", NULL, G_PARAM_READABLE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_NAME] =
- g_param_spec_string("name", "name", "name", NULL, G_PARAM_READABLE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_ICON] = g_param_spec_string(
- "icon", "icon", "icon", "audio-card-symbolic", G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_VOLUME_ICON] = g_param_spec_string(
- "volume-icon", "volume-icon", "volume-icon", "audio-volume-muted", G_PARAM_READABLE);
- /**
- * AstalWpEndpoint:media-class: (type AstalWpMediaClass)
- *
- * The media class of this endpoint
- */
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_MEDIA_CLASS] =
- g_param_spec_enum("media-class", "media-class", "media-class", ASTAL_WP_TYPE_MEDIA_CLASS, 1,
- G_PARAM_READABLE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_DEFAULT] =
- g_param_spec_boolean("is_default", "is_default", "is_default", FALSE, G_PARAM_READWRITE);
- astal_wp_endpoint_properties[ASTAL_WP_ENDPOINT_PROP_LOCK_CHANNELS] = g_param_spec_boolean(
- "lock_channels", "lock_channels", "lock channels", FALSE, G_PARAM_READWRITE);
-
- g_object_class_install_properties(object_class, ASTAL_WP_ENDPOINT_N_PROPERTIES,
- astal_wp_endpoint_properties);
-}
diff --git a/wireplumber/src/meson.build b/wireplumber/src/meson.build
deleted file mode 100644
index 87a5ae8..0000000
--- a/wireplumber/src/meson.build
+++ /dev/null
@@ -1,73 +0,0 @@
-srcs = files(
- 'wireplumber.c',
- 'endpoint.c',
- 'device.c',
- 'video.c',
- 'profile.c',
- 'audio.c',
-)
-
-deps = [
- dependency('gobject-2.0'),
- dependency('gio-2.0'),
- dependency('wireplumber-0.5'),
- # dependency('json-glib-1.0'),
-]
-
-astal_wireplumber_lib = library(
- 'astal-wireplumber',
- sources : srcs,
- include_directories : astal_wireplumber_inc,
- dependencies : deps,
- version : meson.project_version(),
- install : true
-)
-
-libastal_wireplumber = declare_dependency(
- link_with : astal_wireplumber_lib,
- include_directories : astal_wireplumber_inc)
-
-# astal_wireplumber_executable = executable(
-# 'astal-wireplumber',
-# files('astal-wireplumber.c'),
-# dependencies : [
-# dependency('gobject-2.0'),
-# dependency('gio-2.0'),
-# dependency('json-glib-1.0'),
-# libastal_wireplumber
-# ],
-# install : true)
-
-pkg_config_name = 'astal-wireplumber-' + lib_so_version
-
-if get_option('introspection')
- gir = gnome.generate_gir(
- astal_wireplumber_lib,
- sources : srcs + astal_wireplumber_headers + astal_wireplumber_subheaders,
- nsversion : '0.1',
- namespace : 'AstalWp',
- symbol_prefix : 'astal_wp',
- identifier_prefix : 'AstalWp',
- includes : ['GObject-2.0', 'Gio-2.0'],
- header : 'astal-wp.h',
- export_packages : pkg_config_name,
- install : true
- )
-
- if get_option('vapi')
- gnome.generate_vapi(
- pkg_config_name,
- sources : [gir[0]],
- packages : ['gobject-2.0', 'gio-2.0'],
- install : true)
- endif
-endif
-
-pkg_config.generate(
- name : 'astal-wireplumber',
- version : meson.project_version(),
- libraries : [astal_wireplumber_lib],
- filebase : pkg_config_name,
- subdirs : 'astal',
- description : 'astal wireplumber module',
- url : 'https://github.com/astal-sh/wireplumber')
diff --git a/wireplumber/src/profile.c b/wireplumber/src/profile.c
deleted file mode 100644
index 291dc7f..0000000
--- a/wireplumber/src/profile.c
+++ /dev/null
@@ -1,84 +0,0 @@
-#include "profile.h"
-
-#include <wp/wp.h>
-
-struct _AstalWpProfile {
- GObject parent_instance;
-
- gint index;
- gchar *description;
-};
-
-G_DEFINE_FINAL_TYPE(AstalWpProfile, astal_wp_profile, G_TYPE_OBJECT);
-
-typedef enum {
- ASTAL_WP_PROFILE_PROP_INDEX = 1,
- ASTAL_WP_PROFILE_PROP_DESCRIPTION,
- ASTAL_WP_PROFILE_N_PROPERTIES,
-} AstalWpProfileProperties;
-
-static GParamSpec *astal_wp_profile_properties[ASTAL_WP_PROFILE_N_PROPERTIES] = {
- NULL,
-};
-
-gint astal_wp_profile_get_index(AstalWpProfile *self) { return self->index; }
-
-const gchar *astal_wp_profile_get_description(AstalWpProfile *self) { return self->description; }
-
-static void astal_wp_profile_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpProfile *self = ASTAL_WP_PROFILE(object);
-
- switch (property_id) {
- case ASTAL_WP_PROFILE_PROP_INDEX:
- g_value_set_int(value, self->index);
- break;
- case ASTAL_WP_PROFILE_PROP_DESCRIPTION:
- g_value_set_string(value, self->description);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_profile_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec) {
- AstalWpProfile *self = ASTAL_WP_PROFILE(object);
-
- switch (property_id) {
- case ASTAL_WP_PROFILE_PROP_INDEX:
- self->index = g_value_get_int(value);
- break;
- case ASTAL_WP_PROFILE_PROP_DESCRIPTION:
- g_free(self->description);
- self->description = g_strdup(g_value_get_string(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_profile_init(AstalWpProfile *self) { self->description = NULL; }
-
-static void astal_wp_profile_finalize(GObject *object) {
- AstalWpProfile *self = ASTAL_WP_PROFILE(object);
- g_free(self->description);
-}
-
-static void astal_wp_profile_class_init(AstalWpProfileClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->finalize = astal_wp_profile_finalize;
- object_class->get_property = astal_wp_profile_get_property;
- object_class->set_property = astal_wp_profile_set_property;
-
- astal_wp_profile_properties[ASTAL_WP_PROFILE_PROP_DESCRIPTION] =
- g_param_spec_string("description", "description", "description", NULL,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- astal_wp_profile_properties[ASTAL_WP_PROFILE_PROP_INDEX] =
- g_param_spec_int("index", "index", "index", G_MININT, G_MAXINT, 0,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY);
- g_object_class_install_properties(object_class, ASTAL_WP_PROFILE_N_PROPERTIES,
- astal_wp_profile_properties);
-}
diff --git a/wireplumber/src/video.c b/wireplumber/src/video.c
deleted file mode 100644
index 00cdd82..0000000
--- a/wireplumber/src/video.c
+++ /dev/null
@@ -1,428 +0,0 @@
-#include "video.h"
-
-#include <wp/wp.h>
-
-#include "device.h"
-#include "endpoint.h"
-#include "wp.h"
-
-struct _AstalWpVideo {
- GObject parent_instance;
-};
-
-typedef struct {
- AstalWpWp *wp;
-} AstalWpVideoPrivate;
-
-G_DEFINE_FINAL_TYPE_WITH_PRIVATE(AstalWpVideo, astal_wp_video, G_TYPE_OBJECT);
-
-typedef enum {
- ASTAL_WP_VIDEO_SIGNAL_SOURCE_ADDED,
- ASTAL_WP_VIDEO_SIGNAL_SOURCE_REMOVED,
- ASTAL_WP_VIDEO_SIGNAL_SINK_ADDED,
- ASTAL_WP_VIDEO_SIGNAL_SINK_REMOVED,
- ASTAL_WP_VIDEO_SIGNAL_STREAM_ADDED,
- ASTAL_WP_VIDEO_SIGNAL_STREAM_REMOVED,
- ASTAL_WP_VIDEO_SIGNAL_RECORDER_ADDED,
- ASTAL_WP_VIDEO_SIGNAL_RECORDER_REMOVED,
- ASTAL_WP_VIDEO_SIGNAL_DEVICE_ADDED,
- ASTAL_WP_VIDEO_SIGNAL_DEVICE_REMOVED,
- ASTAL_WP_VIDEO_N_SIGNALS
-} AstalWpWpSignals;
-
-static guint astal_wp_video_signals[ASTAL_WP_VIDEO_N_SIGNALS] = {
- 0,
-};
-
-typedef enum {
- ASTAL_WP_VIDEO_PROP_SOURCE = 1,
- ASTAL_WP_VIDEO_PROP_SINK,
- ASTAL_WP_VIDEO_PROP_STREAMS,
- ASTAL_WP_VIDEO_PROP_RECORDERS,
- ASTAL_WP_VIDEO_PROP_DEVICES,
- ASTAL_WP_VIDEO_N_PROPERTIES,
-} AstalWpVideoProperties;
-
-static GParamSpec *astal_wp_video_properties[ASTAL_WP_VIDEO_N_PROPERTIES] = {
- NULL,
-};
-
-/**
- * astal_wp_video_get_source:
- * @self: the AstalWpVideo object
- * @id: the id of the endpoint
- *
- * Returns: (transfer none) (nullable): the source with the given id
- */
-AstalWpEndpoint *astal_wp_video_get_speaker(AstalWpVideo *self, guint id) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_video_get_sink:
- * @self: the AstalWpVideo object
- * @id: the id of the endpoint
- *
- * Returns: (transfer none) (nullable): the sink with the given id
- */
-AstalWpEndpoint *astal_wp_video_get_sink(AstalWpVideo *self, guint id) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_VIDEO_SINK)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_video_get_stream:
- * @self: the AstalWpVideo object
- * @id: the id of the endpoint
- *
- * Returns: (transfer none) (nullable): the stream with the given id
- */
-AstalWpEndpoint *astal_wp_video_get_stream(AstalWpVideo *self, guint id) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_video_get_recorder:
- * @self: the AstalWpVideo object
- * @id: the id of the endpoint
- *
- * Returns: (transfer none) (nullable): the recorder with the given id
- */
-AstalWpEndpoint *astal_wp_video_get_recorder(AstalWpVideo *self, guint id) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = astal_wp_wp_get_endpoint(priv->wp, id);
- if (astal_wp_endpoint_get_media_class(endpoint) == ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER)
- return endpoint;
- return NULL;
-}
-
-/**
- * astal_wp_video_get_device:
- * @self: the AstalWpVideo object
- * @id: the id of the device
- *
- * Returns: (transfer none) (nullable): the device with the given id
- */
-AstalWpDevice *astal_wp_video_get_device(AstalWpVideo *self, guint id) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-
- AstalWpDevice *device = astal_wp_wp_get_device(priv->wp, id);
- if (astal_wp_device_get_device_type(device) == ASTAL_WP_DEVICE_TYPE_VIDEO) return device;
- return NULL;
-}
-
-/**
- * astal_wp_video_get_sources:
- * @self: the AstalWpVideo object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint)): a GList containing the
- * video sources
- */
-GList *astal_wp_video_get_sources(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-/**
- * astal_wp_video_get_sinks
- * @self: the AstalWpVideo object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint)): a GList containing the
- * video sinks
- */
-GList *astal_wp_video_get_sinks(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_VIDEO_SINK) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-/**
- * astal_wp_video_get_recorders:
- * @self: the AstalWpVideo object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint)): a GList containing the
- * video recorders
- */
-GList *astal_wp_video_get_recorders(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-/**
- * astal_wp_video_get_streams:
- * @self: the AstalWpVideo object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint)): a GList containing the
- * video streams
- */
-GList *astal_wp_video_get_streams(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- GList *eps = astal_wp_wp_get_endpoints(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_endpoint_get_media_class(l->data) == ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-/**
- * astal_wp_video_get_devices:
- * @self: the AstalWpAudio object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpVideo)): a GList containing the
- * devices
- */
-GList *astal_wp_video_get_devices(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- GList *eps = astal_wp_wp_get_devices(priv->wp);
- GList *list = NULL;
-
- for (GList *l = eps; l != NULL; l = l->next) {
- if (astal_wp_device_get_device_type(l->data) == ASTAL_WP_DEVICE_TYPE_VIDEO) {
- list = g_list_append(list, l->data);
- }
- }
- g_list_free(eps);
- return list;
-}
-
-static void astal_wp_video_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpVideo *self = ASTAL_WP_VIDEO(object);
-
- switch (property_id) {
- case ASTAL_WP_VIDEO_PROP_SOURCE:
- g_value_set_pointer(value, astal_wp_video_get_sources(self));
- break;
- case ASTAL_WP_VIDEO_PROP_SINK:
- g_value_set_pointer(value, astal_wp_video_get_sinks(self));
- break;
- case ASTAL_WP_VIDEO_PROP_RECORDERS:
- g_value_set_pointer(value, astal_wp_video_get_recorders(self));
- break;
- case ASTAL_WP_VIDEO_PROP_STREAMS:
- g_value_set_pointer(value, astal_wp_video_get_streams(self));
- break;
- case ASTAL_WP_VIDEO_PROP_DEVICES:
- g_value_set_pointer(value, astal_wp_video_get_devices(self));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-void astal_wp_video_device_added(AstalWpVideo *self, gpointer object) {
- AstalWpDevice *device = ASTAL_WP_DEVICE(object);
- if (astal_wp_device_get_device_type(device) == ASTAL_WP_DEVICE_TYPE_VIDEO) {
- g_signal_emit_by_name(self, "device-added", device);
- g_object_notify(G_OBJECT(self), "devices");
- }
-}
-
-static void astal_wp_video_device_removed(AstalWpVideo *self, gpointer object) {
- AstalWpDevice *device = ASTAL_WP_DEVICE(object);
- if (astal_wp_device_get_device_type(device) == ASTAL_WP_DEVICE_TYPE_VIDEO) {
- g_signal_emit_by_name(self, "device-removed", device);
- g_object_notify(G_OBJECT(self), "devices");
- }
-}
-
-static void astal_wp_video_object_added(AstalWpVideo *self, gpointer object) {
- AstalWpEndpoint *endpoint = ASTAL_WP_ENDPOINT(object);
- switch (astal_wp_endpoint_get_media_class(endpoint)) {
- case ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE:
- g_signal_emit_by_name(self, "source-added", endpoint);
- g_object_notify(G_OBJECT(self), "sources");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_SINK:
- g_signal_emit_by_name(self, "sink-added", endpoint);
- g_object_notify(G_OBJECT(self), "sinks");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM:
- g_signal_emit_by_name(self, "stream-added", endpoint);
- g_object_notify(G_OBJECT(self), "streams");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER:
- g_signal_emit_by_name(self, "recorder-added", endpoint);
- g_object_notify(G_OBJECT(self), "recorders");
- break;
- default:
- break;
- }
-}
-
-static void astal_wp_video_object_removed(AstalWpAudio *self, gpointer object) {
- AstalWpEndpoint *endpoint = ASTAL_WP_ENDPOINT(object);
- switch (astal_wp_endpoint_get_media_class(endpoint)) {
- case ASTAL_WP_MEDIA_CLASS_VIDEO_SOURCE:
- g_signal_emit_by_name(self, "source-removed", endpoint);
- g_object_notify(G_OBJECT(self), "sources");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_SINK:
- g_signal_emit_by_name(self, "sink-removed", endpoint);
- g_object_notify(G_OBJECT(self), "sinks");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_STREAM:
- g_signal_emit_by_name(self, "stream-removed", endpoint);
- g_object_notify(G_OBJECT(self), "streams");
- break;
- case ASTAL_WP_MEDIA_CLASS_VIDEO_RECORDER:
- g_signal_emit_by_name(self, "recorder-removed", endpoint);
- g_object_notify(G_OBJECT(self), "recorders");
- break;
- default:
- break;
- }
-}
-
-AstalWpVideo *astal_wp_video_new(AstalWpWp *wp) {
- AstalWpVideo *self = g_object_new(ASTAL_WP_TYPE_VIDEO, NULL);
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- priv->wp = g_object_ref(wp);
- g_signal_connect_swapped(priv->wp, "endpoint-added", G_CALLBACK(astal_wp_video_object_added),
- self);
- g_signal_connect_swapped(priv->wp, "endpoint-removed",
- G_CALLBACK(astal_wp_video_object_removed), self);
- g_signal_connect_swapped(priv->wp, "device-added", G_CALLBACK(astal_wp_video_device_added),
- self);
- g_signal_connect_swapped(priv->wp, "device-removed", G_CALLBACK(astal_wp_video_device_removed),
- self);
-
- return self;
-}
-
-static void astal_wp_video_dispose(GObject *object) {
- AstalWpVideo *self = ASTAL_WP_VIDEO(object);
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
- g_clear_object(&priv->wp);
-}
-
-static void astal_wp_video_init(AstalWpVideo *self) {
- AstalWpVideoPrivate *priv = astal_wp_video_get_instance_private(self);
-}
-
-static void astal_wp_video_class_init(AstalWpVideoClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->get_property = astal_wp_video_get_property;
- object_class->dispose = astal_wp_video_dispose;
-
- /**
- * AstalWpVideo:sources: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_video_properties[ASTAL_WP_VIDEO_PROP_SOURCE] =
- g_param_spec_pointer("sources", "sources", "sources", G_PARAM_READABLE);
-
- /**
- * AstalWpVideo:sinks: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_video_properties[ASTAL_WP_VIDEO_PROP_SINK] =
- g_param_spec_pointer("sinks", "sinks", "sinks", G_PARAM_READABLE);
-
- /**
- * AstalWpVideo:recorder: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_video_properties[ASTAL_WP_VIDEO_PROP_RECORDERS] =
- g_param_spec_pointer("recorders", "recorders", "recorders", G_PARAM_READABLE);
-
- /**
- * AstalWpVideo:streams: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_video_properties[ASTAL_WP_VIDEO_PROP_STREAMS] =
- g_param_spec_pointer("streams", "streams", "streams", G_PARAM_READABLE);
-
- /**
- * AstalWpVideo:devices: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_video_properties[ASTAL_WP_VIDEO_PROP_DEVICES] =
- g_param_spec_pointer("devices", "devices", "devices", G_PARAM_READABLE);
-
- g_object_class_install_properties(object_class, ASTAL_WP_VIDEO_N_PROPERTIES,
- astal_wp_video_properties);
-
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_SOURCE_ADDED] =
- g_signal_new("source-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_SOURCE_REMOVED] =
- g_signal_new("source-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_SINK_ADDED] =
- g_signal_new("sink-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_SINK_REMOVED] =
- g_signal_new("sink-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_STREAM_ADDED] =
- g_signal_new("stream-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_SOURCE_REMOVED] =
- g_signal_new("stream-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_RECORDER_ADDED] =
- g_signal_new("recorder-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_RECORDER_REMOVED] =
- g_signal_new("recorder-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_DEVICE_ADDED] =
- g_signal_new("device-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
- astal_wp_video_signals[ASTAL_WP_VIDEO_SIGNAL_DEVICE_REMOVED] =
- g_signal_new("device-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
-}
diff --git a/wireplumber/src/wireplumber.c b/wireplumber/src/wireplumber.c
deleted file mode 100644
index f1fa516..0000000
--- a/wireplumber/src/wireplumber.c
+++ /dev/null
@@ -1,503 +0,0 @@
-#include <wp/wp.h>
-
-#include "audio.h"
-#include "device-private.h"
-#include "endpoint-private.h"
-#include "glib-object.h"
-#include "glib.h"
-#include "video.h"
-#include "wp.h"
-
-struct _AstalWpWp {
- GObject parent_instance;
-
- AstalWpEndpoint *default_speaker;
- AstalWpEndpoint *default_microphone;
-
- AstalWpAudio *audio;
- AstalWpVideo *video;
-
- AstalWpScale scale;
-};
-
-typedef struct {
- WpCore *core;
- WpObjectManager *obj_manager;
-
- WpPlugin *mixer;
- WpPlugin *defaults;
- gint pending_plugins;
-
- GHashTable *endpoints;
- GHashTable *devices;
-} AstalWpWpPrivate;
-
-G_DEFINE_FINAL_TYPE_WITH_PRIVATE(AstalWpWp, astal_wp_wp, G_TYPE_OBJECT);
-
-G_DEFINE_ENUM_TYPE(AstalWpScale, astal_wp_scale,
- G_DEFINE_ENUM_VALUE(ASTAL_WP_SCALE_LINEAR, "linear"),
- G_DEFINE_ENUM_VALUE(ASTAL_WP_SCALE_CUBIC, "cubic"));
-
-typedef enum {
- ASTAL_WP_WP_SIGNAL_ENDPOINT_ADDED,
- ASTAL_WP_WP_SIGNAL_ENDPOINT_REMOVED,
- ASTAL_WP_WP_SIGNAL_DEVICE_ADDED,
- ASTAL_WP_WP_SIGNAL_DEVICE_REMOVED,
- ASTAL_WP_WP_N_SIGNALS
-} AstalWpWpSignals;
-
-static guint astal_wp_wp_signals[ASTAL_WP_WP_N_SIGNALS] = {
- 0,
-};
-
-typedef enum {
- ASTAL_WP_WP_PROP_AUDIO = 1,
- ASTAL_WP_WP_PROP_VIDEO,
- ASTAL_WP_WP_PROP_ENDPOINTS,
- ASTAL_WP_WP_PROP_DEVICES,
- ASTAL_WP_WP_PROP_DEFAULT_SPEAKER,
- ASTAL_WP_WP_PROP_DEFAULT_MICROPHONE,
- ASTAL_WP_WP_PROP_SCALE,
- ASTAL_WP_WP_N_PROPERTIES,
-} AstalWpWpProperties;
-
-static GParamSpec *astal_wp_wp_properties[ASTAL_WP_WP_N_PROPERTIES] = {
- NULL,
-};
-
-/**
- * astal_wp_wp_get_endpoint:
- * @self: the AstalWpWp object
- * @id: the id of the endpoint
- *
- * Returns: (transfer none) (nullable): the endpoint with the given id
- */
-AstalWpEndpoint *astal_wp_wp_get_endpoint(AstalWpWp *self, guint id) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- AstalWpEndpoint *endpoint = g_hash_table_lookup(priv->endpoints, GUINT_TO_POINTER(id));
- return endpoint;
-}
-
-/**
- * astal_wp_wp_get_endpoints:
- * @self: the AstalWpWp object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpEndpoint)): a GList containing the
- * endpoints
- */
-GList *astal_wp_wp_get_endpoints(AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
- return g_hash_table_get_values(priv->endpoints);
-}
-
-/**
- * astal_wp_wp_get_device:
- * @self: the AstalWpWp object
- * @id: the id of the device
- *
- * Returns: (transfer none) (nullable): the device with the given id
- */
-AstalWpDevice *astal_wp_wp_get_device(AstalWpWp *self, guint id) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- AstalWpDevice *device = g_hash_table_lookup(priv->devices, GUINT_TO_POINTER(id));
- return device;
-}
-
-/**
- * astal_wp_wp_get_devices:
- * @self: the AstalWpWp object
- *
- * Returns: (transfer container) (nullable) (type GList(AstalWpDevice)): a GList containing the
- * devices
- */
-GList *astal_wp_wp_get_devices(AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
- return g_hash_table_get_values(priv->devices);
-}
-
-/**
- * astal_wp_wp_get_audio
- *
- * Returns: (nullable) (transfer none): gets the audio object
- */
-AstalWpAudio *astal_wp_wp_get_audio(AstalWpWp *self) { return self->audio; }
-
-/**
- * astal_wp_wp_get_video
- *
- * Returns: (nullable) (transfer none): gets the video object
- */
-AstalWpVideo *astal_wp_wp_get_video(AstalWpWp *self) { return self->video; }
-
-/**
- * astal_wp_wp_get_default_speaker
- *
- * Returns: (nullable) (transfer none): gets the default speaker object
- */
-AstalWpEndpoint *astal_wp_wp_get_default_speaker(AstalWpWp *self) { return self->default_speaker; }
-
-/**
- * astal_wp_wp_get_default_microphone
- *
- * Returns: (nullable) (transfer none): gets the default microphone object
- */
-AstalWpEndpoint *astal_wp_wp_get_default_microphone(AstalWpWp *self) {
- return self->default_microphone;
-}
-
-AstalWpScale astal_wp_wp_get_scale(AstalWpWp *self) { return self->scale; }
-
-void astal_wp_wp_set_scale(AstalWpWp *self, AstalWpScale scale) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
- self->scale = scale;
-
- if (priv->mixer == NULL) return;
-
- g_object_set(priv->mixer, "scale", self->scale, NULL);
-
- GHashTableIter iter;
- gpointer key, value;
-
- g_hash_table_iter_init(&iter, priv->endpoints);
- while (g_hash_table_iter_next(&iter, &key, &value)) {
- AstalWpEndpoint *ep = ASTAL_WP_ENDPOINT(value);
- astal_wp_endpoint_update_volume(ep);
- }
-
- astal_wp_endpoint_update_volume(self->default_speaker);
- astal_wp_endpoint_update_volume(self->default_microphone);
-}
-
-static void astal_wp_wp_get_property(GObject *object, guint property_id, GValue *value,
- GParamSpec *pspec) {
- AstalWpWp *self = ASTAL_WP_WP(object);
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- switch (property_id) {
- case ASTAL_WP_WP_PROP_AUDIO:
- g_value_set_object(value, astal_wp_wp_get_audio(self));
- break;
- case ASTAL_WP_WP_PROP_VIDEO:
- g_value_set_object(value, astal_wp_wp_get_video(self));
- break;
- case ASTAL_WP_WP_PROP_ENDPOINTS:
- g_value_set_pointer(value, g_hash_table_get_values(priv->endpoints));
- break;
- case ASTAL_WP_WP_PROP_DEVICES:
- g_value_set_pointer(value, g_hash_table_get_values(priv->devices));
- break;
- case ASTAL_WP_WP_PROP_DEFAULT_SPEAKER:
- g_value_set_object(value, self->default_speaker);
- break;
- case ASTAL_WP_WP_PROP_DEFAULT_MICROPHONE:
- g_value_set_object(value, self->default_microphone);
- break;
- case ASTAL_WP_WP_PROP_SCALE:
- g_value_set_enum(value, self->scale);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_wp_set_property(GObject *object, guint property_id, const GValue *value,
- GParamSpec *pspec) {
- AstalWpWp *self = ASTAL_WP_WP(object);
-
- switch (property_id) {
- case ASTAL_WP_WP_PROP_SCALE:
- astal_wp_wp_set_scale(self, g_value_get_enum(value));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
- break;
- }
-}
-
-static void astal_wp_wp_object_added(AstalWpWp *self, gpointer object) {
- // print pipewire properties
- // WpIterator *iter = wp_pipewire_object_new_properties_iterator(WP_PIPEWIRE_OBJECT(object));
- // GValue item = G_VALUE_INIT;
- // const gchar *key, *value;
- //
- // g_print("\n\n");
- // while (wp_iterator_next (iter, &item)) {
- // WpPropertiesItem *pi = g_value_get_boxed (&item);
- // key = wp_properties_item_get_key (pi);
- // value = wp_properties_item_get_value (pi);
- // g_print("%s: %s\n", key, value);
- // g_value_unset(&item);
- // }
-
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- if (WP_IS_NODE(object)) {
- WpNode *node = WP_NODE(object);
- AstalWpEndpoint *endpoint =
- astal_wp_endpoint_create(node, priv->mixer, priv->defaults, self);
-
- g_hash_table_insert(priv->endpoints,
- GUINT_TO_POINTER(wp_proxy_get_bound_id(WP_PROXY(node))), endpoint);
-
- g_signal_emit_by_name(self, "endpoint-added", endpoint);
- g_object_notify(G_OBJECT(self), "endpoints");
- } else if (WP_IS_DEVICE(object)) {
- WpDevice *node = WP_DEVICE(object);
- AstalWpDevice *device = astal_wp_device_create(node);
- g_hash_table_insert(priv->devices, GUINT_TO_POINTER(wp_proxy_get_bound_id(WP_PROXY(node))),
- device);
- g_signal_emit_by_name(self, "device-added", device);
- g_object_notify(G_OBJECT(self), "devices");
- }
-}
-
-static void astal_wp_wp_object_removed(AstalWpWp *self, gpointer object) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- if (WP_IS_NODE(object)) {
- guint id = wp_proxy_get_bound_id(WP_PROXY(object));
- AstalWpEndpoint *endpoint =
- g_object_ref(g_hash_table_lookup(priv->endpoints, GUINT_TO_POINTER(id)));
-
- g_hash_table_remove(priv->endpoints, GUINT_TO_POINTER(id));
-
- g_signal_emit_by_name(self, "endpoint-removed", endpoint);
- g_object_notify(G_OBJECT(self), "endpoints");
- g_object_unref(endpoint);
- } else if (WP_IS_DEVICE(object)) {
- guint id = wp_proxy_get_bound_id(WP_PROXY(object));
- AstalWpDevice *device =
- g_object_ref(g_hash_table_lookup(priv->devices, GUINT_TO_POINTER(id)));
- g_hash_table_remove(priv->devices, GUINT_TO_POINTER(id));
-
- g_signal_emit_by_name(self, "device-removed", device);
- g_object_notify(G_OBJECT(self), "devices");
- g_object_unref(device);
- }
-}
-
-static void astal_wp_wp_objm_installed(AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- astal_wp_endpoint_init_as_default(self->default_speaker, priv->mixer, priv->defaults,
- ASTAL_WP_MEDIA_CLASS_AUDIO_SPEAKER, self);
- astal_wp_endpoint_init_as_default(self->default_microphone, priv->mixer, priv->defaults,
- ASTAL_WP_MEDIA_CLASS_AUDIO_MICROPHONE, self);
-}
-
-static void astal_wp_wp_plugin_activated(WpObject *obj, GAsyncResult *result, AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- GError *error = NULL;
- wp_object_activate_finish(obj, result, &error);
- if (error) {
- g_critical("Failed to activate component: %s\n", error->message);
- return;
- }
-
- if (--priv->pending_plugins == 0) {
- priv->defaults = wp_plugin_find(priv->core, "default-nodes-api");
- priv->mixer = wp_plugin_find(priv->core, "mixer-api");
- g_object_set(priv->mixer, "scale", self->scale, NULL);
-
- g_signal_connect_swapped(priv->obj_manager, "object-added",
- G_CALLBACK(astal_wp_wp_object_added), self);
- g_signal_connect_swapped(priv->obj_manager, "object-removed",
- G_CALLBACK(astal_wp_wp_object_removed), self);
-
- wp_core_install_object_manager(priv->core, priv->obj_manager);
- }
-}
-
-static void astal_wp_wp_plugin_loaded(WpObject *obj, GAsyncResult *result, AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- GError *error = NULL;
- wp_core_load_component_finish(priv->core, result, &error);
- if (error) {
- g_critical("Failed to load component: %s\n", error->message);
- return;
- }
-
- wp_object_activate(obj, WP_PLUGIN_FEATURE_ENABLED, NULL,
- (GAsyncReadyCallback)astal_wp_wp_plugin_activated, self);
-}
-
-/**
- * astal_wp_wp_get_default
- *
- * Returns: (nullable) (transfer none): gets the default wireplumber object.
- */
-AstalWpWp *astal_wp_wp_get_default() {
- static AstalWpWp *self = NULL;
-
- if (self == NULL) self = g_object_new(ASTAL_WP_TYPE_WP, NULL);
-
- return self;
-}
-
-/**
- * astal_wp_get_default_wp
- *
- * Returns: (nullable) (transfer none): gets the default wireplumber object.
- */
-AstalWpWp *astal_wp_get_default_wp() { return astal_wp_wp_get_default(); }
-
-static void astal_wp_wp_dispose(GObject *object) {
- AstalWpWp *self = ASTAL_WP_WP(object);
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- g_clear_object(&self->video);
- g_clear_object(&self->audio);
-
- wp_core_disconnect(priv->core);
- g_clear_object(&self->default_speaker);
- g_clear_object(&self->default_microphone);
- g_clear_object(&priv->mixer);
- g_clear_object(&priv->defaults);
- g_clear_object(&priv->obj_manager);
- g_clear_object(&priv->core);
-
- if (priv->endpoints != NULL) {
- g_hash_table_destroy(priv->endpoints);
- priv->endpoints = NULL;
- }
-}
-
-static void astal_wp_wp_finalize(GObject *object) {
- AstalWpWp *self = ASTAL_WP_WP(object);
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-}
-
-static void astal_wp_wp_init(AstalWpWp *self) {
- AstalWpWpPrivate *priv = astal_wp_wp_get_instance_private(self);
-
- priv->endpoints = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
- priv->devices = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_object_unref);
-
- wp_init(7);
- priv->core = wp_core_new(NULL, NULL, NULL);
-
- if (!wp_core_connect(priv->core)) {
- g_critical("could not connect to PipeWire\n");
- return;
- }
-
- priv->obj_manager = wp_object_manager_new();
- wp_object_manager_request_object_features(priv->obj_manager, WP_TYPE_NODE,
- WP_OBJECT_FEATURES_ALL);
- wp_object_manager_request_object_features(priv->obj_manager, WP_TYPE_GLOBAL_PROXY,
- WP_OBJECT_FEATURES_ALL);
-
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Audio/Sink", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Audio/Source", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Stream/Output/Audio", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Stream/Input/Audio", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_DEVICE,
- WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "media.class", "=s",
- "Audio/Device", NULL);
-
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Video/Sink", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Video/Source", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Stream/Output/Video", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_NODE, WP_CONSTRAINT_TYPE_PW_PROPERTY,
- "media.class", "=s", "Stream/Input/Video", NULL);
- wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_DEVICE,
- WP_CONSTRAINT_TYPE_PW_GLOBAL_PROPERTY, "media.class", "=s",
- "Video/Device", NULL);
- // wp_object_manager_add_interest(priv->obj_manager, WP_TYPE_CLIENT, NULL);
-
- g_signal_connect_swapped(priv->obj_manager, "installed", (GCallback)astal_wp_wp_objm_installed,
- self);
-
- self->default_speaker = g_object_new(ASTAL_WP_TYPE_ENDPOINT, NULL);
- self->default_microphone = g_object_new(ASTAL_WP_TYPE_ENDPOINT, NULL);
-
- self->audio = astal_wp_audio_new(self);
- self->video = astal_wp_video_new(self);
-
- priv->pending_plugins = 2;
- wp_core_load_component(priv->core, "libwireplumber-module-default-nodes-api", "module", NULL,
- "default-nodes-api", NULL,
- (GAsyncReadyCallback)astal_wp_wp_plugin_loaded, self);
- wp_core_load_component(priv->core, "libwireplumber-module-mixer-api", "module", NULL,
- "mixer-api", NULL, (GAsyncReadyCallback)astal_wp_wp_plugin_loaded, self);
-}
-
-static void astal_wp_wp_class_init(AstalWpWpClass *class) {
- GObjectClass *object_class = G_OBJECT_CLASS(class);
- object_class->finalize = astal_wp_wp_finalize;
- object_class->dispose = astal_wp_wp_dispose;
- object_class->get_property = astal_wp_wp_get_property;
- object_class->set_property = astal_wp_wp_set_property;
-
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_AUDIO] =
- g_param_spec_object("audio", "audio", "audio", ASTAL_WP_TYPE_AUDIO, G_PARAM_READABLE);
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_VIDEO] =
- g_param_spec_object("video", "video", "video", ASTAL_WP_TYPE_VIDEO, G_PARAM_READABLE);
- /**
- * AstalWpWp:scale: (type AstalWpScale)
- *
- * The scale used for the volume
- */
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_SCALE] =
- g_param_spec_enum("scale", "scale", "scale", ASTAL_WP_TYPE_SCALE, ASTAL_WP_SCALE_CUBIC,
- G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
-
- /**
- * AstalWpWp:endpoints: (type GList(AstalWpEndpoint)) (transfer container)
- *
- * A list of AstalWpEndpoint objects
- */
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_ENDPOINTS] =
- g_param_spec_pointer("endpoints", "endpoints", "endpoints", G_PARAM_READABLE);
- /**
- * AstalWpWp:devices: (type GList(AstalWpDevice)) (transfer container)
- *
- * A list of AstalWpDevice objects
- */
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_DEVICES] =
- g_param_spec_pointer("devices", "devices", "devices", G_PARAM_READABLE);
- /**
- * AstalWpWp:default-speaker:
- *
- * The AstalWndpoint object representing the default speaker
- */
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_DEFAULT_SPEAKER] =
- g_param_spec_object("default-speaker", "default-speaker", "default-speaker",
- ASTAL_WP_TYPE_ENDPOINT, G_PARAM_READABLE);
- /**
- * AstalWpWp:default-microphone:
- *
- * The AstalWndpoint object representing the default speaker
- */
- astal_wp_wp_properties[ASTAL_WP_WP_PROP_DEFAULT_MICROPHONE] =
- g_param_spec_object("default-microphone", "default-microphone", "default-microphone",
- ASTAL_WP_TYPE_ENDPOINT, G_PARAM_READABLE);
-
- g_object_class_install_properties(object_class, ASTAL_WP_WP_N_PROPERTIES,
- astal_wp_wp_properties);
-
- astal_wp_wp_signals[ASTAL_WP_WP_SIGNAL_ENDPOINT_ADDED] =
- g_signal_new("endpoint-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_wp_signals[ASTAL_WP_WP_SIGNAL_ENDPOINT_REMOVED] =
- g_signal_new("endpoint-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL,
- NULL, NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_ENDPOINT);
- astal_wp_wp_signals[ASTAL_WP_WP_SIGNAL_DEVICE_ADDED] =
- g_signal_new("device-added", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
- astal_wp_wp_signals[ASTAL_WP_WP_SIGNAL_DEVICE_REMOVED] =
- g_signal_new("device-removed", G_TYPE_FROM_CLASS(class), G_SIGNAL_RUN_FIRST, 0, NULL, NULL,
- NULL, G_TYPE_NONE, 1, ASTAL_WP_TYPE_DEVICE);
-}
diff --git a/wireplumber/version b/wireplumber/version
deleted file mode 100644
index 6e8bf73..0000000
--- a/wireplumber/version
+++ /dev/null
@@ -1 +0,0 @@
-0.1.0