✘✘ GRAYBYTE WORDPRESS FILE MANAGER ✘✘

​🇳​​🇦​​🇲​​🇪♯➤ server.blackpussy.asia ​🇻​♯➤ 5.14.0-611.20.1.el9_7.x86_64 #1 SMP 🇾​♯➤ 2026

𝗛𝗢𝗠𝗘 𝗜𝗗 ♯➤ 163.245.207.76 ♯➤ 𝗔𝗗𝗠𝗜𝗡 𝗜𝗗 216.73.216.243
𝗢𝗣𝗧𝗜𝗢𝗡𝗦 ♯ CRL ♯➤ 𝗢𝗞 ┃ WGT ♯➤ 𝗢𝗞 ┃ SDO ♯➤ 𝗢𝗞 ┃ PKEX ♯➤ 𝗢𝗙𝗙
𝗗𝗘𝗔𝗖𝗧𝗜𝗩𝗔𝗧𝗘𝗗 ♯➤ mail,mb_send_mail
𝗖𝗨𝗥𝗥𝗘𝗡𝗧 𝗙𝗜𝗟𝗘 : /usr/share/wireplumber/scripts/linking//find-best-target.lua
-- WirePlumber
--
-- Copyright © 2022 Collabora Ltd.
--
-- SPDX-License-Identifier: MIT
--
-- Traverse through all the possible targets to pick up target node.

lutils = require ("linking-utils")
cutils = require ("common-utils")
futils = require ("filter-utils")
log = Log.open_topic ("s-linking")

SimpleEventHook {
  name = "linking/find-best-target",
  after = { "linking/find-defined-target",
            "linking/find-filter-target",
            "linking/find-media-role-target",
            "linking/find-default-target" },
  before = "linking/prepare-link",
  interests = {
    EventInterest {
      Constraint { "event.type", "=", "select-target" },
    },
  },
  execute = function (event)
    local source, om, si, si_props, si_flags, target =
        lutils:unwrap_select_target_event (event)

    -- bypass the hook if the target is already picked up
    if target then
      return
    end

    local target_direction = cutils.getTargetDirection (si_props)
    local target_picked = nil
    local target_can_passthrough = false
    local target_priority = 0
    local target_plugged = 0

    log:info (si, string.format ("handling item: %s (%s)",
        tostring (si_props ["node.name"]), tostring (si_props ["node.id"])))

    for target in om:iterate {
      type = "SiLinkable",
      Constraint { "item.node.type", "=", "device" },
      Constraint { "item.node.direction", "=", target_direction },
      Constraint { "media.type", "=", si_props ["media.type"] },
    } do
      local target_props = target.properties
      local target_node_id = target_props ["node.id"]
      local si_target_node = target:get_associated_proxy ("node")
      local si_target_link_group = si_target_node.properties ["node.link-group"]
      local priority = tonumber (target_props ["priority.session"]) or 0

      log:debug (string.format ("Looking at: %s (%s)",
        tostring (target_props ["node.name"]),
        tostring (target_node_id)))

      -- Skip smart filters as best target
      if si_target_link_group ~= nil and
          futils.is_filter_smart (target_direction, si_target_link_group) then
        Log.debug ("... ignoring smart filter as best target")
        goto skip_linkable
      end

      if not lutils.canLink (si_props, target) then
        log:debug ("... cannot link, skip linkable")
        goto skip_linkable
      end

      if not lutils.haveAvailableRoutes (target_props) then
        log:debug ("... does not have routes, skip linkable")
        goto skip_linkable
      end

      local passthrough_compatible, can_passthrough =
      lutils.checkPassthroughCompatibility (si, target)
      if not passthrough_compatible then
        log:debug ("... passthrough is not compatible, skip linkable")
        goto skip_linkable
      end

      local plugged = tonumber (target_props ["item.plugged.usec"]) or 0

      log:debug ("... priority:" .. tostring (priority) .. ", plugged:" .. tostring (plugged))

      -- (target_picked == NULL) --> make sure at least one target is picked.
      -- (priority > target_priority) --> pick the highest priority linkable(node)
      -- target.
      -- (priority == target_priority and plugged > target_plugged) --> pick the
      -- latest connected/plugged(in time) linkable(node) target.
      if (target_picked == nil or
          priority > target_priority or
          (priority == target_priority and plugged > target_plugged)) then
        log:debug ("... picked")
        target_picked = target
        target_can_passthrough = can_passthrough
        target_priority = priority
        target_plugged = plugged
      end
      ::skip_linkable::
    end

    if target_picked then
      log:info (si,
        string.format ("... best target picked: %s (%s), can_passthrough:%s",
          tostring (target_picked.properties ["node.name"]),
          tostring (target_picked.properties ["node.id"]),
          tostring (target_can_passthrough)))
      si_flags.can_passthrough = target_can_passthrough
      event:set_data ("target", target_picked)
    end
  end
}:register ()

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]

Current_dir [ 𝗡𝗢𝗧 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ] Document_root [ 𝗪𝗥𝗜𝗧𝗘𝗔𝗕𝗟𝗘 ]


[ Back ]
𝗡𝗔𝗠𝗘
𝗦𝗜𝗭𝗘
𝗟𝗔𝗦𝗧 𝗧𝗢𝗨𝗖𝗛
𝗨𝗦𝗘𝗥
𝗦𝗧𝗔𝗧𝗨𝗦
𝗙𝗨𝗡𝗖𝗧𝗜𝗢𝗡𝗦
..
--
27 May 2026 4.58 AM
root / root
0755
find-audio-group-target.lua
2.714 KB
10 Oct 2025 2.43 PM
root / root
0644
find-best-target.lua
3.973 KB
10 Oct 2025 2.43 PM
root / root
0644
find-default-target.lua
1.65 KB
10 Oct 2025 2.43 PM
root / root
0644
find-defined-target.lua
4.251 KB
10 Oct 2025 2.43 PM
root / root
0644
find-filter-target.lua
2.901 KB
10 Oct 2025 2.43 PM
root / root
0644
find-media-role-target.lua
1.919 KB
10 Oct 2025 2.43 PM
root / root
0644
find-user-target.lua.example
0.903 KB
10 Oct 2025 2.43 PM
root / root
0644
get-filter-from-target.lua
3.514 KB
10 Oct 2025 2.43 PM
root / root
0644
link-target.lua
5.227 KB
10 Oct 2025 2.43 PM
root / root
0644
mpris-pause.lua
10.016 KB
10 Oct 2025 2.43 PM
root / root
0644
prepare-link.lua
3.787 KB
10 Oct 2025 2.43 PM
root / root
0644
rescan-media-role-links.lua
6.462 KB
10 Oct 2025 2.43 PM
root / root
0644
rescan.lua
8.35 KB
10 Oct 2025 2.43 PM
root / root
0644

✘✘ GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME ✘✘
Static GIF Static GIF