summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/input/input_http.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/input/input_http.c b/src/input/input_http.c
index 3db5af002..ea1f93347 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -64,6 +64,7 @@
#define TAG_ICY_NOTICE2 "icy-notice2:"
#define TAG_ICY_METAINT "icy-metaint:"
#define TAG_CONTENT_TYPE "Content-Type:"
+#define TAG_LASTFM_SERVER "Server: last.fm Streaming Server"
typedef struct {
input_plugin_t input_plugin;
@@ -99,6 +100,9 @@ typedef struct {
/* NSV */
unsigned char is_nsv; /* bool */
+ /* Last.FM streaming server */
+ unsigned char is_lastfm;
+
/* ShoutCast */
unsigned char shoutcast_mode; /* bool */
int shoutcast_metaint;
@@ -385,6 +389,25 @@ static off_t http_plugin_read_int (http_input_plugin_t *this,
if (nlen < 0)
goto error;
+ /* Identify SYNC string for last.fm, this is limited to last.fm
+ * streaming servers to avoid hitting on tracks metadata for other
+ * servers.
+ */
+ if ( this->is_lastfm &&
+ memmem(&buf[read_bytes], nlen, "SYNC", 4) != NULL ) {
+ /* Tell frontend to update the UI */
+ const xine_event_t event = {
+ .type = XINE_EVENT_UI_CHANNELS_CHANGED,
+ .stream = this->stream,
+ .data = NULL,
+ .data_length = 0
+ };
+
+ lprintf("SYNC from last.fm server received\n");
+
+ xine_event_send(this->stream, &event);
+ }
+
this->shoutcast_pos += nlen;
}
@@ -919,6 +942,10 @@ static int http_plugin_open (input_plugin_t *this_gen ) {
this->is_nsv = 1;
}
}
+ if ( !strncasecmp(this->buf, TAG_LASTFM_SERVER, sizeof(TAG_LASTFM_SERVER)-1) ) {
+ lprintf("last.fm streaming server detected\n");
+ this->is_lastfm = 1;
+ }
}
if (len == -1)