1
0
mirror of https://gitlab.xiph.org/xiph/icecast-server.git synced 2025-02-02 15:07:36 -05:00

mp3 metadata relaying now works (lots of bugs fixed)

svn path=/trunk/icecast/; revision=4366
This commit is contained in:
Michael Smith 2003-02-25 09:40:34 +00:00
parent 47b1d160ae
commit 680e56bf7b
4 changed files with 20 additions and 10 deletions

View File

@ -132,7 +132,6 @@ static int send_metadata(client_t *client, mp3_client_data *client_state,
if (len > 1) {
strncpy(buf+1, fullmetadata + client_state->metadata_offset, len-2);
DEBUG1("Sending metadata (%s)", buf+1);
}
thread_mutex_unlock(&(source_state->lock));
@ -219,7 +218,7 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
if(!data)
return 0;
if(state->inline_metadata_interval) {
/* Source is sending metadata, handle it... */
@ -257,6 +256,7 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
/* According to the "spec"... this byte * 16 */
state->metadata_length = byte * 16;
if(state->metadata_length) {
state->metadata_buffer =
calloc(state->metadata_length + 1, 1);
@ -282,14 +282,13 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
memcpy(state->metadata_buffer + state->metadata_offset,
data, readable);
state->metadata_offset += readable;
data += readable;
len -= readable;
if(state->metadata_offset == state->metadata_length)
{
state->offset = 0;
state->metadata_length = 0;
if(state->metadata_length)
{
thread_mutex_lock(&(state->lock));
@ -300,6 +299,9 @@ static int format_mp3_get_buffer(format_plugin_t *self, char *data,
state->metadata_raw = 1;
thread_mutex_unlock(&(state->lock));
}
state->offset = 0;
state->metadata_length = 0;
}
}
}
@ -366,6 +368,3 @@ static void format_mp3_send_headers(format_plugin_t *self,
}
}

View File

@ -86,7 +86,13 @@ static void create_relay_stream(char *server, int port,
}
con = create_connection(streamsock, NULL);
if(mp3) {
sock_write(streamsock, "GET %s HTTP/1.0\r\nIcy-MetaData: 1\r\n",
/* Some mp3 servers are bitchy, send a user-agent string to make them
* send the right response.
*/
sock_write(streamsock, "GET %s HTTP/1.0\r\n"
"User-Agent: " ICECAST_VERSION_STRING "\r\n"
"Icy-MetaData: 1\r\n"
"\r\n",
remotemount);
}
else {
@ -94,6 +100,7 @@ static void create_relay_stream(char *server, int port,
}
memset(header, 0, sizeof(header));
if (util_read_header(con->sock, header, 4096) == 0) {
WARN0("Header read failed");
connection_close(con);
return;
}
@ -114,8 +121,10 @@ static void create_relay_stream(char *server, int port,
client = client_create(con, parser);
if (!connection_create_source(client, con, parser,
httpp_getvar(parser, HTTPP_VAR_URI))) {
DEBUG0("Failed to create source");
client_destroy(client);
}
return;
}

View File

@ -284,6 +284,8 @@ void *source_main(void *arg)
}
}
DEBUG0("Source creation complete");
while (global.running == ICE_RUNNING && source->running) {
if(!suppress_yp) {
current_time = time(NULL);

View File

@ -94,7 +94,7 @@ int util_read_header(int sock, char *buff, unsigned long len)
}
}
} else {
break;
break;
}
}