的Icecast 2:协议说明,使用C#的流吧 [英] Icecast 2: protocol description, streaming to it using C#

查看:362
本文介绍了的Icecast 2:协议说明,使用C#的流吧的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要编写一个的Icecast 2客户端,将能够以流从计算机(的mp3文件,声卡记录等等)到服务器音频。我决定写这样的客户端上的C#。

I need to write an Icecast 2 client that will be able to stream audio from the computer (mp3-files, soundcard recording and so forth) to the server. I decided to write such a client on C#.

两个问题:

1),这将是知道的共同准则(最佳做法,也许招数)我可以/应该/必须使用与音频流(流当然是通过网络,)在C#无缝工作非常有用。关于流通过TCP / IP的共同点和结冰尤其是一些一般性的技术文件,建议和注意事项上的应用程序的整体架构将是非常美联社preciated。

1) It will be very useful to know common guidelines (best practices, maybe tricks) I may/should/must use to seamlessly work with streamed audio (streamed over network, of course) in C#. Some general technical documentation about streaming over TCP/IP in common and ICY in particular, advices and notes on the overall architecture of the application will be very appreciated.

2)是否有有关的Icecast 2流协议的任何好的文档?我无法找到的Icecast的官方网站的文档。我不想直接从它的源$ C ​​$ C提取协议描述。如果协议是非常简洁明快,可能有人提供了一个总结吧就在这里?

2) Is there any good documentation regarding the Icecast 2 streaming protocol? I couldn't find those docs on the official site of Icecast. I don't want to extract the protocol description directly from the source code of it. If the protocol is really simple and neat, could anybody provide a summary of it right here?

推荐答案

据我所知,目前还没有协议规范的任何地方,的的Icecast源$ C ​​$ C之外。下面是我发现从数据包嗅探什么:

As far as I know, there is no protocol spec anywhere, outside of the Icecast source code. Here's what I've found from packet sniffing:

该协议类似于HTTP。源客户端将连接到服务器,请与挂载点的请求,并通过一些头用的流的信息:

The protocol is similar to HTTP. The source client will connect to the server make a request with the mountpoint, and pass some headers with information about the stream:

SOURCE /mp3test ICE/1.0
content-type: audio/mpeg
Authorization: Basic c291cmNlOmhhY2ttZQ==
ice-name: This is my server name
ice-url: http://www.google.com
ice-genre: Rock
ice-bitrate: 128
ice-private: 0
ice-public: 1
ice-description: This is my server description
ice-audio-info: ice-samplerate=44100;ice-bitrate=128;ice-channels=2

如果一切都很好,服务器响应:

If all is good, the server responds with:

HTTP/1.0 200 OK

源客户机然后继续发送二进制流数据。请注意,似乎有些EN codeRS甚至不等待服务器与 200 OK响应他们开始发送数据流之前。就在头,一个空行,然后流数据。

The source client then proceeds to send the binary stream data. Note that it seems some encoders don't even wait for the server to respond with 200 OK before they start sending stream data. Just headers, an empty line, and then stream data.

元数据是使用带外的HTTP请求发送。源客户端发送:

Meta data is sent using an out-of-band HTTP request. The source client sends:

GET /admin/metadata?pass=hackme&mode=updinfo&mount=/mp3test&song=Even%20more%20meta%21%21 HTTP/1.0
Authorization: Basic c291cmNlOmhhY2ttZQ==
User-Agent: (Mozilla Compatible)

服务器响应:

The server responds with:

HTTP/1.0 200 OK
Content-Type: text/xml
Content-Length: 113

<?xml version="1.0"?>
<iceresponse><message>Metadata update successful</message><return>1</return></iceresponse>

另外请注意,两个音频流和元数据请求被发送相同的端口上。不同于Shoutcast一样,这是在服务器上运行的基本端口。

Also note that both the audio stream and meta data requests are sent on the same port. Unlike SHOUTcast, this is the base port that the server is running on.

这篇关于的Icecast 2:协议说明,使用C#的流吧的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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