[xiph-commits] r8160 - icecast/trunk/icecast/src
oddsock at motherfish-iii.xiph.org
oddsock at motherfish-iii.xiph.org
Thu Nov 4 07:55:13 PST 2004
Author: oddsock
Date: 2004-11-04 07:55:13 -0800 (Thu, 04 Nov 2004)
New Revision: 8160
Modified:
icecast/trunk/icecast/src/format_mp3.c
Log:
added a content-length for flash-based players. This will allow for them to stream mp3 from icecast.
Modified: icecast/trunk/icecast/src/format_mp3.c
===================================================================
--- icecast/trunk/icecast/src/format_mp3.c 2004-11-02 22:02:11 UTC (rev 8159)
+++ icecast/trunk/icecast/src/format_mp3.c 2004-11-04 15:55:13 UTC (rev 8160)
@@ -586,14 +586,35 @@
source_t *source, client_t *client)
{
int bytes;
+ char *content_length;
+
mp3_client_data *mp3data = client->format_data;
client->respcode = 200;
+
+ /* This little bit of code is for compatability with
+ flash mp3 streaming. Flash requires a content-length
+ in order for it to stream mp3s, and so based off a
+ trial and error effort, the following number was derived.
+ It is the largest content-length that we can send, anything
+ larger causes flash streaming not to work. Note that it
+ is also possible that other flash-based players may not
+ send this request header (x-flash-version), but given the
+ sampleset I had access to, this should suffice. */
+ if (httpp_getvar(client->parser, "x-flash-version")) {
+ content_length = "Content-Length: 347122319\r\n";
+ }
+ else {
+ content_length = "";
+ }
+
/* TODO: This may need to be ICY/1.0 for shoutcast-compatibility? */
bytes = sock_write(client->con->sock,
"HTTP/1.0 200 OK\r\n"
- "Content-Type: %s\r\n",
- format_get_mimetype(source->format->type));
+ "Content-Type: %s\r\n"
+ "%s",
+ format_get_mimetype(source->format->type),
+ content_length);
if (bytes > 0)
client->con->sent_bytes += bytes;
More information about the commits
mailing list