如何在从Shoutcast的流检索元数据得到信息的新歌曲信息 [英] how to get informed of new song info while retrieving metadata from shoutcast stream

查看:198
本文介绍了如何在从Shoutcast的流检索元数据得到信息的新歌曲信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景:
我使用HTML Shoutcast的双缓冲的方式流媒体广播。我得到利用流的元数据信息 http://www.smackfu.com/stuff/programming/ shoutcast.html

问题
我有三个问题。结果
1 - 我已经使用一个URLConnection的InputStream和听收音机。我不想打开一个新的连接来检索元数据。但是,当我试图从同一个输入流两全,我不能再收听收音机。我想这是不可能的,我必须使用两个单独的连接?是不是很糟糕的表现?

Problem I have three problems.
1- I already use a urlconnection and inputstream for listening radio. I don't want to open a new connection to retrieve metadata. But when I tried to get both from same inputstream, I couldn't listen radio anymore. I guess this is not possible and I have to use two seperate connection? Isn't it bad for performance?

2 - 当应用程序启动,我检索当前歌曲的信息。没问题。可是我怎么通知歌曲更改时。据说,服务器将信息发送歌曲更改时。但我开始的URLConnection,得到输入流,检索元数据并关闭连接。我不明白我怎么会被服务器通知?我应该保持连接打开?

2- When the application started, I retrieve the info of the current song. No problem. However how do I get informed when the song changes. It is said that server will send information when the song changes. But I'm starting the URLconnection, get the input stream, retrieve the metadata and close the connection. I couldn't understand how should I informed by the server? Should I keep the connection open?

3和最后一个问题。据我所知渐进式流之前的Andr​​oid 2.2是不可能的。这是真的只为HTTP?如果协议是RTSP,我可以让之前的Andr​​oid 2.2渐进式流?任何人都请让某些疏通?

3- And last question. AFAIK progressive streaming isn't possible before android 2.2. Is this true just for http? If the protocol was rtsp, could I make progressive streaming before android 2.2? Anyone please make it certain and clear?

非常感谢,

推荐答案

您必须从冰冷的-metaint头字段记得数。

You must remember number from icy-metaint header field.

接收来自流多少字节(您发送到音频解codeR),你必须想到的元数据的一部分,阅读(也没有这些数据发送到音频解codeR)后。
然后你再次收到途中从流codeD音频,并不断的冰冷,metaint字节后,定期读取元数据的过程。

After receiving that many bytes from stream (which you send to audio decoder), you must expect metadata part, and read this (also not sending these data to audio decoder). Then you again receive encoded audio from stream, and continue the process of periodically reading metadata after icy-metaint bytes.

这意味着,服务器会发送元数据(关于歌手/歌曲标题信息)定期,和你的code必须输入流分割音频和元数据。

This means that server sends metadata (info about artist / song title) periodically, and your code must split the input stream to audio and metadata.

这篇关于如何在从Shoutcast的流检索元数据得到信息的新歌曲信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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