xref: /aosp_15_r20/external/webrtc/modules/portal/pipewire_utils.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright 2022 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef MODULES_PORTAL_PIPEWIRE_UTILS_H_
12 #define MODULES_PORTAL_PIPEWIRE_UTILS_H_
13 
14 struct pw_thread_loop;
15 
16 namespace webrtc {
17 
18 // Prepare PipeWire so that it is ready to be used. If it needs to be dlopen'd
19 // this will do so. Note that this does not guarantee a PipeWire server is
20 // running nor does it establish a connection to one.
21 bool InitializePipeWire();
22 
23 // Locks pw_thread_loop in the current scope
24 class PipeWireThreadLoopLock {
25  public:
26   explicit PipeWireThreadLoopLock(pw_thread_loop* loop);
27   ~PipeWireThreadLoopLock();
28 
29  private:
30   pw_thread_loop* const loop_;
31 };
32 
33 }  // namespace webrtc
34 
35 #endif  // MODULES_PORTAL_PIPEWIRE_UTILS_H_
36