mirror of
https://gitlab.freedesktop.org/pipewire/wireplumber.git
synced 2026-05-08 15:08:04 +02:00
monitor-utils: introduce monitor utils lua library
This commit is contained in:
parent
27c1ea869b
commit
6596d71c4f
1 changed files with 24 additions and 0 deletions
24
src/scripts/lib/monitor-utils.lua
Normal file
24
src/scripts/lib/monitor-utils.lua
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
-- WirePlumber
|
||||
|
||||
-- Copyright © 2023 Collabora Ltd.
|
||||
-- @author Ashok Sidipotu <ashok.sidipotu@collabora.com>
|
||||
|
||||
-- SPDX-License-Identifier: MIT
|
||||
|
||||
-- Script is a Lua Module of monitor Lua utility functions
|
||||
|
||||
local mutils = {}
|
||||
|
||||
-- finds out if any of the managed objects(nodes of a device or devices of
|
||||
-- device enumerator) has duplicate values
|
||||
function mutils.findDuplicate (parent, id, property, value)
|
||||
for i = 0, id - 1, 1 do
|
||||
local obj = parent:get_managed_object (i)
|
||||
if obj and obj.properties[property] == value then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
return mutils
|
||||
Loading…
Add table
Reference in a new issue