# HG changeset patch # User Diego 'Flameeyes' Pettenò <fla...@gm...> # Date 1181484228 -7200 # Node ID c7d15cd83949f38ea5630e09587a9aa335907517 # Parent fa7a6672ad4dcb7311a3662069c70ccf48eadad0 Check for last.fm streaming server, and if that's the case, check for the SYNC string in the read data; if found, send a XINE_EVENT_UI_CHANNELS_CHANGED event, so that the frontend can go read the new metadata. diff -r c7d15cd83949f38ea5630e09587a9aa335907517 -r fa7a6672ad4dcb7311a3662069c70ccf48eadad0 ChangeLog --- a/ChangeLog Sun Jun 10 16:03:48 2007 +0200 +++ b/ChangeLog Sun Jun 10 16:01:48 2007 +0200 @@ -34,6 +34,8 @@ xine-lib (1.1.90) (Unreleased) will not be present in KDE 4. * Convert the FAQ and the Hacker's Guide from DocBook SGML to DocBook 4.4 XML, and the figures from fig files to SVG files. + * Send a channel changed event to the frontend when receiving the SYNC + string from last.fm streaming server. xine-lib (1.1.7) * Support libdca (new name for libdts) by shuffling around the dts.h file. diff -r c7d15cd83949f38ea5630e09587a9aa335907517 -r fa7a6672ad4dcb7311a3662069c70ccf48eadad0 src/input/input_http.c --- a/src/input/input_http.c Sun Jun 10 16:03:48 2007 +0200 +++ b/src/input/input_http.c Sun Jun 10 16:01:48 2007 +0200 @@ -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; @@ -98,6 +99,9 @@ typedef struct { /* NSV */ unsigned char is_nsv; /* bool */ + + /* Last.FM streaming server */ + unsigned char is_lastfm; /* ShoutCast */ unsigned char shoutcast_mode; /* bool */ @@ -384,6 +388,25 @@ static off_t http_plugin_read_int (http_ nlen = _x_io_tcp_read (this->stream, this->fh, &buf[read_bytes], nlen); 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_plugi 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) |