Android 带 Glibc 堆栈,如何使用 nvlc 设置音频? ALSA(Debian)可以吗?

Android 带 Glibc 堆栈,如何使用 nvlc 设置音频? ALSA(Debian)可以吗?

去年秋天,在 Karim Yaghmour 所著的《Embedded Android》一书的帮助下,我对 Android 的构建过程有了足够的了解。经过足够多的摆弄和谷歌搜索,我学会了足够多的 *nix 命令和足够的 Bash 脚本,让我自己制作了一个小 CM-10.1 ROM,它.img在启动时安装了一个 Linux 文件。

我的笔记本电脑最近在批量安装 Windows 后变得无法操作,因此这个小 ROM 成为我足够计算能力的唯一来源。

抛开历史不谈,我一直在摆弄一些命令行实用程序,例如nvlcstagefrightstagefright工作起来并不奇怪,因为它是一个“原生”Android 应用程序。

使用以下命令:

stagefright -ao test.mp3

ssh我可以启动一首歌曲并在插入我的设备时收听它。我通常使用终端模拟器来使用 CMsu来让 glibcsshd运行,如下所示:

su -c '/bin/su'
service ssh start

然后我ssh从我的古老的塔楼,有键盘和大屏幕。由于我正在ssh进入基于 glibc 的ssh服务器,因此它使用 PAM 的 unix2 模块通过/etc/passwd和进行身份验证/etc/shadow。这很好,因为我可以像以前一样配置它。

但从那里开始,说我想发射nvlc出去,这是行不通的。嗯,stagefright并不像nvlc我认为的那么好。

这是我迄今为止所做的一些输出:

root@Flubber:/sdcard/Music$ lspci
pcilib: Cannot open /proc/bus/pci
lspci: Cannot find any working access method.

root@Flubber:/etc/init.d# aplay --list-devices
**** List of PLAYBACK Hardware Devices ****
card 0: msm8960sndcard [msm8960-snd-card], device 0: MultiMedia1 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 1: MultiMedia2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 2: CS-Voice (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 3: VoIP (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 4: LPA (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 5: SLIMBUS_0 Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 6: INT_FM Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 7: AFE-PROXY RX msm-stub-rx-7 []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 9: COMPR (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 10: AUXPCM Hostless (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 11: HDMI_RX_HOSTLESS (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 12: VoLTE (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 13: Voice2 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 14: MultiMedia5 (*) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 15: (Internal BT-SCO Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 17: (Internal FM Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 19: (HDMI Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 20: (AFE Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 22: (AUX PCM Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 24: (Voice Farend Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0
card 0: msm8960sndcard [msm8960-snd-card], device 27: (Primary I2S Playback) []
  Subdevices: 1/1
  Subdevice #0: subdevice #0

root@Flubber:/etc/init.d# ./alsa-utils start 0
[ ok ] Setting up ALSA card 0...done.

brainard@Flubber:/sdcard/Music$ cvlc SlipKnoT\ -\ Spit\ It\ Out\ \[DUBSTEP\ REMIX\ by\ Elysium\]\ \*with\ musicvideo\*\ \[HD\ \].mp3 
VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x92c0c8] inhibit interface error: Failed to connect to the D-Bus session daemon: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
[0x92c0c8] main interface error: no suitable interface module
[0x8b4b80] main interface error: no suitable interface module
[0x8943e8] main libvlc error: interface "globalhotkeys,none" initialization failed
[0x8b4b80] dummy interface: using the dummy interface module...
shm_open() failed: Permission denied
[0x8b5448] pulse audio output error: PulseAudio server connection failure: Connection refused
shm_open() failed: Permission denied
[0x8b5448] alsa audio output error: cannot open ALSA device "default": Invalid argument
[0x8b5448] main audio output error: Audio output failed
[0x8b5448] main audio output error: The audio device "default" could not be used:
Invalid argument.
[0x8b5448] oss audio output error: cannot open audio device (/dev/dsp)
[0x8b5448] main audio output error: no suitable audio output module
[0x8b7f80] main decoder error: failed to create audio output
[0x9200b0] main input error: ES_OUT_SET_(GROUP_)PCR  is called too late (pts_delay increased to 300 ms)
[0x9200b0] main input error: ES_OUT_RESET_PCR called
^C

alsa-utils如您所见,我已经安装了,pulseaudio并将我的用户分配到 的音频组GID 1005,因为这是 Android 上音频的 GID。

我不确定这是配置问题、驱动程序问题还是其他问题。我以前从未需要配置音频,它总是在 Linux 上工作。

由于这是在 Android 设备上,我没想到它能工作,但其他事情也能工作,比如网络访问和写入 SD 卡。我必须创建组并将我的用户添加到其中才能获得 Android 的许可。

  • 有什么我可以做的吗?
  • Android 上的音频工作方式是否太不同了?

据我所知,Android 有时会使用tiny-alsa,并且可能会使用HAL,但在这一点上,它有点超出了我的理解范围。

什么是好的信息来源?

我真的不想花很多时间在这上面,一两个星期,坏信息过去浪费了我很多时间,这真的很令人沮丧。


更新

当我用 Google 搜索我遇到的一些错误时,我在 Gentoo 论坛上偶然发现了一个帖子,结果发现 tmpfs 实际上必须安装到/run/shm.

所以我将其放入我的/etc/fstab文件中,按照 Gentoo 论坛的主题:

none    /dev/shm        tmpfs   nodev,nosuid,noexec     0       0

然后执行sudo mount /dev/shm。然后我做了:

brainard@Flubber:/sdcard/Music$ aplay -vv Track_1.wav 
**aplay: main:682: audio open error: Invalid argument**

并得到输出:no failure to open shared memory

另外,在/proc/asound

brainard@Flubber:/proc/asound$ ls
card0  cards  devices  hwdep  msm8960sndcard  pcm  timers  version

brainard@Flubber:/proc/asound$ cat version 
Advanced Linux Sound Architecture Driver Version 1.0.25.

还有speaker-test

brainard@Flubber:/proc/asound/card0$ speaker-test -Ddefault:0 -twav
speaker-test 1.0.25

Playback device is default:0
Stream parameters are 48000Hz, S16_LE, 1 channels
WAV file(s)
Playback open error: -22,Invalid argument

希望这可以帮助有人帮助我,并提前感谢您。如果您需要更多信息,请尽管询问,我很乐意为您服务。

更新2

我突然打开alsamixer,发现了超过 300 个不同的“物品”(更像是 400 多个,我数到 300 就停止了)与这张卡片相关。其中一些与 HDMI 有关,另一些与 VoIP 有关,一些与 VoLTE 有关,大多数都是静音、关闭或为零,我不知道它们的用途。我想如果有人知道他们在做什么并让它发挥作用,它可能会非常强大。

我跑了这个:alsactl init

root@Flubber:/etc/init.d# alsactl init
Found hardware: "msm8960-snd-car" "" "" "" ""
Hardware is initialized using a generic method

而这一切似乎stagefright都不再起作用了。它只是返回,segfault我想那是我的错;)希望重新启动可以修复它。

相关内容