从Android设备流Shoutcast的(上游化)设备、Android、Shoutcast

2023-09-07 08:45:48 作者:骄傲菇凉霸气外露

感谢大家提前:)

我要清楚你开始阅读,我想开发一个基于Android的应用程序使用Android设备作为一个广播机构,利用其麦克风用来录音之前,发送给SHOUTcast服务器是这样的:

Android设备的与互联网连接的 - > SHOUTcast服务器 - >听众

所以,请不要混淆与Android设备上玩的Shoutcast流,因为我不希望建立一个播放器播放的流。如果您正在寻找开发一个球员然后从给定链路下载源$ C ​​$ C,它为我工作得很好。 点击下载来源$ C ​​$ C。

现在回到我的问题,我在过去的两个星期GOOGLE了一番,发现这文章,这让我使用Android设备的内置麦克风和流通过本地网络。人们可以使用VLC收听流。

但我想上游发送到我的SHOUTcast服务器一样可以用Winamp与DSP插件和问题是:

如果我用code从上面这链接,它适用于本地N / W,但是当我试图用我的SHOUTcast服务器配置,它给人错误罚款:! [UnknownHostException异常] 日志月食

关于Android设计及其意义

有SHOUTcast服务器上的任何URL为基础的系统,对此,如果我会送一个流那么它将获得流和广播我的听众?例如如果我要听流(流下来),我可以使用 http://xx.example.com:1234;stream.mp3 ,我询问了流媒体

我怎样才能建立一个由登录/密码到服务器的连接。我想做类似DSP插件,如图附加的图像。

解决方案

您链接到code不是在这种情况下适当的。这似乎是,用于发送通过UDP原始音频数据,这并不是在所有什么Shoutcast一样使用。

Shoutcast一样的服务器没有一个HTTP接口传输到。他们使用一个完全独立的协议,如果你需要使用Shoutcast一样的服务器必须使用。 (我要指出的Icecast只是增加了在过去一年左右的时间内HTTP PUT支持)。

幸运的是,Shoutcast一样源协议相当简单。所有你需要做的是把你的密码,然后换行。如果你从服务器获得一个良好的反应,然后发送冰冷 - 跟着两个换行* 头,跟着你的EN codeD音频数据。我已经详细介绍这个时候,这一问题被一对夫妇几年前问的iOS: http://stackoverflow.com/a/9241620/ 362536 你可以通过使用数据包嗅探器如 Wireshark的并运行它看到自己的协议而你Winamp的Shoutcast一样DSP(或其他Shoutcast一样源客户端)连接到服务器。

最后,不要忘记使用合适的codeC。随着Shoutcast一样,最好以使用MP3(原样),或包裹在一个ADTS AAC流。当我试图这个项目一段时间回来,我有一个很难搞清楚如何让音频连接codeD正确,至少是Android 2.1似乎没有有办法en$c$c到一个流,而不是一个文件。我不是Android开发的,所以也许你会找到一个更好的办法!

Thanks to all of you in advance :)

I want to make it clear before you start reading that I want to develop an android based app to use android device as a broadcaster, which records sound using its mic and sent it to shoutcast server something like this:

Android Device with internet connection -> Shoutcast Server -> listeners.

So please do not get confused with playing shoutcast streams on android, because I do not want to develop a player to play an stream. If you are looking for developing a player then download source code from given link, it worked fine for me. Click to download Source code.

Now back to my question, I googled a lot in last two weeks and found This article, which helped me to use builtin mic of android device and stream over a local network. One can listen the stream using VLC.

But I want to send up-stream to my shoutcast server same as one can use winamp with DSP plugin and the problems are:

If I use the code from above This link, it works fine on local n/w but when I try to configure it with my shoutcast server, it gives error : ![UnknownHostException] in log of eclipse.

Is there any url based system on shoutcast server, to which if I will send a stream then it will get the stream and broadcast to my listeners? e.g. if I want to listen stream (down streaming), i can use http://xx.example.com:1234;stream.mp3 and I am asking for up-streaming.

How I can establish a connection to server by login/password. I want to do similar to DSP Plugin as shown in image attached.

解决方案

The code you linked to is not appropriate in this case. It appears to be for sending raw audio data over UDP, which is not at all what SHOUTcast uses.

SHOUTcast servers do not have an HTTP interface to stream to. They use a completely separate protocol which you must use if you need to use SHOUTcast servers. (I should note that Icecast just added HTTP PUT support within the last year or so.)

Fortunately, the SHOUTcast source protocol is quite simple. All you need to do is send your password, followed by a line break. If you get a favorable response from the server, then send your icy-* headers followed by two line breaks, and followed by your encoded audio data. I have outlined this in detail when this question was asked for iOS a couple years ago: http://stackoverflow.com/a/9241620/362536 You can see the protocol yourself by using a packet sniffer like Wireshark and running it while you connect the Winamp SHOUTcast DSP (or other SHOUTcast source client) to your server.

Finally, don't forget to use an appropriate codec. With SHOUTcast, it's best to use either MP3 (as-is), or an AAC stream wrapped in ADTS. When I tried this project awhile back, I had a hard time figuring out how to get the audio encoded properly, as at least Android 2.1 didn't seem to have a way to encode to a stream and not to a file. I'm no Android dev though, so maybe you will find a better way!