广播与Objective-C的,C或C的Icecast / Shoutcast一样++ [英] Broadcast to Icecast / SHOUTcast with Objective-C, C, or C++

查看:344
本文介绍了广播与Objective-C的,C或C的Icecast / Shoutcast一样++的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想提供音频数据转换成Shoutcast一样的Icecast或服务器,而不使用自己的广播,因为我将使用这种在各种平台上,包括手机。

我需要的协议说明,开源项目,来样能够使用Objective-C,C或C ++来Shoutcast一样的Icecast和服务器(从麦克风或文件)发送音频数据。

我在哪里可以找到构建一个适当的Shoutcast一样/的Icecast源客户端所需要的信息?


解决方案

注释:这是关于时间,有人发出Shoutcast一样源客户端的移动。我一直需要这一段时间,但没有时间来建立它,这样的荣誉给你。请在某个时候做出的Andr​​oid版本。

你应该做的第一件事是下载Wireshark的

开始抓包,火了一个SHOUTcast服务器,然后启动一个源客户端,并将其连接到服务器。被prepared此协议的可怕的简洁性。

主音频协议


  1. 源客户端连接使用TCP来Shoutcast的。从基本端口使用的端口一个。举例来说,如果你的基本端口是8000,你的听众连接上8000,你将连接8001。

  2. 连接之后,SHOUTcast服务器不会说什么。只需发送广播密码,随后是新的 CRLF (或 \\ r \\ n )。

  3. 如果密码是错误的,它会说密码无效或类似的东西。如果它是正确的,你要得到的东西是这样的:

    OK2

    冰冷帽:11

    请注意,每行有 CRLF 后,这两个头被发出后,有一对 CRLF


  4. 现在,它是由源端发送一系列的头:冰名冰冷的流派冰-酒馆冰-BR 冰冷的URL 冰-IRC 冰-ICQ 冰瞄准内容类型。给他们这样的:

    冰冷的名称:我真棒站

    每个行应遵循 CRLF ,就大功告成了发送所有的头后,送一对 CRLF


  5. 在这全部完成,开始发送你的数据流!无需任何特定点开始,只发送数据。它是由在接收端的客户端同步到该帧。 SHOUTcast服务器完全是哑巴,以流经它的流量。您可以使用Telnet客户端连接,如果你想送一串文字。


更新元数据

所以,你可能想知道如何在接下来的跟踪和什么不能发送信息。有趣的是,这是从那里你发送音频数据的连接完全摆脱了带外。

所有你所要做的就是(在我们的例子8000)的Web请求到港口基地:

<$p$p><$c$c>http://yourserver:8000/admin.cgi?pass=yourpassword&mode=updinfo&song=your%20song&url=some_url_goes_here_but_hardly_any_clients_use_it

在就是难以阅读的情况下,这些是参数:



  • 模式

  • 歌曲

  • 网址

您会注意到,这些相同的参数等,都可以在Shoutcast一样管理面板中找到。

I want to provide audio data into SHOUTcast or Icecast servers without using their own broadcaster, since i will be using this on various platforms including mobile.

I need protocol descriptions, open source projects, or samples to be able to send audio data (from mic or file) using Objective-C, C or C++ to SHOUTcast and Icecast servers.

Where can I find the information needed to build a proper SHOUTcast/Icecast source client?

解决方案

Comment: It's about time someone makes a SHOUTcast source client for mobile. I've been needing this for a while, but don't have time to build it, so kudos to you. Please make an Android version at some point.

The first thing you should do is download Wireshark.

Start the packet capture, fire up a SHOUTcast server, then fire up a source client, and connect it to the server. Be prepared for the horrifying simplicity of this protocol.

Primary Audio Protocol

  1. Source client connects to SHOUTcast with TCP. Use the port one up from the base port. For instance, if your base port is 8000, your listeners connect on 8000 and you will connect on 8001.
  2. Once connected, the SHOUTcast server won't say anything. Just send the broadcast password, followed by a new CrLf (or \r\n).
  3. If the password is wrong, it will say invalid password or something like that. If it is correct, you're going to get something like this:

    OK2

    icy-caps:11

    Note that each line has CrLf after it, and after these two headers are sent, there are a pair of CrLf.

  4. Now, it is up to the source client to send a bunch of headers: icy-name, icy-genre, icy-pub, icy-br, icy-url, icy-irc, icy-icq, icy-aim, content-type. Send them like this:

    icy-name:My Awesome Station

    Each line should be followed by CrLf, and after you're done sending all of the headers, send a pair of CrLf.

  5. Once this is all done, start sending your stream data! No need to start in any particular spot, just send data. It is up to the clients on the receiving end to sync to the frame. The SHOUTcast server is completely "dumb" to the traffic flowing through it. You can connect with a Telnet client and send a bunch of text if you wanted to.

Updating Metadata

So, you're probably wondering how you send information for the next track and what not. The funny thing is, this is completely out-of-band from the connection where you send audio data.

All you have to do is make a web request to the port base (8000 in our example):

http://yourserver:8000/admin.cgi?pass=yourpassword&mode=updinfo&song=your%20song&url=some_url_goes_here_but_hardly_any_clients_use_it

In case that is difficult to read, these are the parameters:

  • pass
  • mode
  • song
  • url

You'll note that these same parameters, and others, can all be found in the SHOUTcast admin panel.

这篇关于广播与Objective-C的,C或C的Icecast / Shoutcast一样++的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆