首页 > 其他分享 >接HDMI同时输出喇叭spker声音

接HDMI同时输出喇叭spker声音

时间:2024-09-06 14:46:37浏览次数:9  
标签:devices2 HDMI spker strategy DEVICE 喇叭 AUDIO OUT

OS:Android13

背景:设备接HDMI,声音通道会优先从HDMI输出,喇叭是是没有声音的

 

修改如下:

1.

frameworks/base

diff --git a/services/core/java/com/android/server/WiredAccessoryManager.java b/services/core/java/com/android/server/WiredAccessoryManager.java
index 6162ad36009c..c71254e755b2 100644
--- a/services/core/java/com/android/server/WiredAccessoryManager.java
+++ b/services/core/java/com/android/server/WiredAccessoryManager.java
@@ -565,8 +565,8 @@ final class WiredAccessoryManager implements WiredAccessoryCallbacks {
                 updateBit(maskAndState, BIT_LINEOUT, status, ExtconInfo.EXTCON_LINE_OUT);
             }
 
-            updateBit(maskAndState, BIT_HDMI_AUDIO,     status, "hdmi0");
-            updateBit(maskAndState, BIT_HDMI_AUDIO_1,   status, "hdmi1");
+            // updateBit(maskAndState, BIT_HDMI_AUDIO,     status, "hdmi0");
+            // updateBit(maskAndState, BIT_HDMI_AUDIO_1,   status, "hdmi1");
             updateBit(maskAndState, BIT_DP_AUDIO,       status, "dp0");
             updateBit(maskAndState, BIT_DP_AUDIO_1,     status, "dp1");
             updateBit(maskAndState, BIT_HDMIIN_AUDIO,   status, "hdmirx0");

 

2.

frameworks/av

diff --git a/services/audiopolicy/enginedefault/src/Engine.cpp b/services/audiopolicy/enginedefault/src/Engine.cpp
index 9626483fd4..f28ca9a1ac 100644
--- a/services/audiopolicy/enginedefault/src/Engine.cpp
+++ b/services/audiopolicy/enginedefault/src/Engine.cpp
@@ -393,20 +393,20 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
                         getLastRemovableMediaDevices(GROUP_WIRED));
             }
         }
-        if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
-            // no sonification on aux digital (e.g. HDMI)
-            devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_AUX_DIGITAL);
-        }
-        //priority Wired > a2dp > hdmi > hdmi 1 > spdif > spdif 1
-        if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
-            devices2 = availableOutputDevices.getDevicesFromType(VX_ROCKCHIP_OUT_HDMI0);
-        }
-        if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
-            devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPDIF);
-        }
-        if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
-            devices2 = availableOutputDevices.getDevicesFromType(VX_ROCKCHIP_OUT_SPDIF0);
-        }
+        // if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
+        //     // no sonification on aux digital (e.g. HDMI)
+        //     devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_AUX_DIGITAL);
+        // }
+        // // priority Wired > a2dp > hdmi > hdmi 1 > spdif > spdif 1
+        // if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
+        //     devices2 = availableOutputDevices.getDevicesFromType(VX_ROCKCHIP_OUT_HDMI0);
+        // }
+        // if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
+        //     devices2 = availableOutputDevices.getDevicesFromType(AUDIO_DEVICE_OUT_SPDIF);
+        // }
+        // if ((devices2.isEmpty()) && (strategy != STRATEGY_SONIFICATION)) {
+        //     devices2 = availableOutputDevices.getDevicesFromType(VX_ROCKCHIP_OUT_SPDIF0);
+        // }
         if ((devices2.isEmpty()) &&
                 (getForceUse(AUDIO_POLICY_FORCE_FOR_DOCK) == AUDIO_POLICY_FORCE_ANALOG_DOCK)) {
             devices2 = availableOutputDevices.getDevicesFromType(
@@ -419,9 +419,10 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
         DeviceVector devices3;
         if (strategy == STRATEGY_MEDIA) {
             // ARC and AUX_LINE can co-exist with others.
-            devices3 = availableOutputDevices.getDevicesFromTypes({
-                    AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
-                    AUDIO_DEVICE_OUT_AUX_LINE, });
+            // devices3 = availableOutputDevices.getDevicesFromTypes({
+            //         AUDIO_DEVICE_OUT_HDMI_ARC, AUDIO_DEVICE_OUT_HDMI_EARC,
+            //         AUDIO_DEVICE_OUT_AUX_LINE, });
+            devices3 = availableOutputDevices.getDevicesFromTypes({ AUDIO_DEVICE_OUT_AUX_DIGITAL});
         }
 
         devices2.add(devices3);
@@ -430,11 +431,11 @@ DeviceVector Engine::getDevicesForStrategyInt(legacy_strategy strategy,
         devices.add(devices2);
 
         // If hdmi system audio mode is on, remove speaker out of output list.
-        if ((strategy == STRATEGY_MEDIA) &&
-            (getForceUse(AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO) ==
-                AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED)) {
-            devices.remove(devices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER));
-        }
+        // if ((strategy == STRATEGY_MEDIA) &&
+        //     (getForceUse(AUDIO_POLICY_FORCE_FOR_HDMI_SYSTEM_AUDIO) ==
+        //         AUDIO_POLICY_FORCE_HDMI_SYSTEM_AUDIO_ENFORCED)) {
+        //     devices.remove(devices.getDevicesFromType(AUDIO_DEVICE_OUT_SPEAKER));
+        // }
 
         bool mediaActiveLocally =
                 outputs.isActiveLocally(toVolumeSource(AUDIO_STREAM_MUSIC),

 

标签:devices2,HDMI,spker,strategy,DEVICE,喇叭,AUDIO,OUT
From: https://www.cnblogs.com/wmc245376374/p/18400220

相关文章

  • HDMI显卡欺骗器软件版,ToDesk虚拟屏,远控技术新发展
    虚拟屏作为一种先进的屏幕技术,凭借其独特的优势,正在逐渐改变我们的工作方式。现代办公人不再局限于单个平面工作,转而更加倾向使用多个屏幕进行多线程任务,提高工作效率,因此虚拟屏也成为众多办公人的远程产品新宠儿。所谓虚拟屏,顾名思义即虚拟桌面,它允许用户在同一台远程电脑上创......
  • 龙讯LT8618SXB TTL/RGB/BT656/BT1120转HDMI 1.4,成熟批量产品
      LT8618SXB描述:LT8618SXB是Lontium基于ClearEdgeTM技术的低功耗版本HDMI发射机。它支持24位颜色深度HDMI1.4(高清多媒体接口)规范。它们完全向后兼容Lontium的第一代HDMI发射机LT8618EX。LT8618SX是一款高性能、低功耗的部件,专为高清-数码相机、高清-数码摄像机、高清-PMP/MP......
  • 13、STM32MP157A-HDMI移植
    1、介绍​STM32MP157A系列SoC中默认没有HDMI相关控制器,FS-MP1A使用SiI9022芯片将RGB信号转化为HDMI信号。STM32MP157A集成LTDC(LCD-TFTDisplayController),提供一个24bitRGB并行接口用于连接到各种LCD和TFT面板​SiI9022A是一款HDMI传输芯片,......
  • 软件解决显卡欺骗器,HDMI欺骗器,如何使用ToDesk免费功能
    大家遇到电脑没有显示屏,或者显示屏的显卡太老,无法正常打开时,常常会给自己备上一个显卡欺骗器和HDMI欺骗器,虽说它们都能模拟显示屏正常使用环境,但这种方法通常需要额外的硬件支持,对于急用的小伙伴来说,这个方法很难快速解决显示屏难题。小社长最近发现ToDesk远程控制软件的虚拟屏......
  • HDMI详解
    HDMI详解摘要本文详细介绍了HDMI接口的定义、不同类型的接口、HDMI脚位功能、版本间的区别,重点探讨了电路设计,包括电源、HPD检测、I2C通信、数据时钟、ARC/eARC音频回传以及CEC消费电子控制等内容,为HDMI产品设计者提供了实用指南。HDMI的定义HDMI是高清多媒体接口(HighDefini......
  • 同三维S20K-HS 4K超高清多接口摄像机视频详情介绍:高清HDMI摄像机,高清SDI摄像机,4K超清H
    同三维S20K-HS 4K超高清多接口摄像机 4K30, USB3.0+HDMI+IP+3G-SDI同时输出,12/20 倍光学变焦,RS232/RS485,1个LINEIN,1个USB扩展口,可加POE,不可加NDI两款:S20K-12HS(12倍光学变焦) 价格是7299元S20K-20HS(20倍光学变焦) 价格是7299元  12/20倍超高清PTZ摄......
  • RK3588 HDMI IN调试
    HDMIRX控制器配置:/*Shouldworkwithatleast128MBcmareservedabove.*/&hdmirx_ctrler{status="okay";/*EffectivelevelusedtotriggerHPD:0-low,1-high*/hpd-trigger-level=<1>;hdmir......
  • IT6635:HDMI2.0 4进1出的信号切换IC
    IT6635是一款HDMI2.0 4输入至1输出重定时器开关,支持高达6Gbps/通道的最大信令速率。它符合最新的HDMI2.0b规范,并向后兼容HDMI1.4和DVI规范。凭借6Gbps/通道功能,IT6635可以支持超高分辨率内容流,例如4Kx2K@50/60Hz视频格式。凭借重定时器结构,IT6635可以支持长电......
  • HDMI切换器(2进1,1进2,三切1)介绍
    目录HDMI介绍:二进一出HDMI切换器:通俗的解释:一进二出HDMI切换器:通俗解释:HDMI1进2和2进1的区别:三进1出HDMI切换器:通俗的解释:HDMI介绍:HDMI描述全称高清多媒体接口(HighDefinitionMultimediaInterface)类型全数字化视频和声音发送或接收接口主要功能发送未压......
  • D1-H 哪吒 HDMI测试
    使用镜像D1-H哪吒HDMI测试固件https://www.aw-ol.com/downloads/resources/22输入命令切换到HDMI输出:cd/sys/kernel/debug/dispdbgechodisp0>name;echoswitch1>command;echo410000x40x1010008>param;echo1>start;测试显示colorbar:echo1>/sys/cl......