# HG changeset patch
# User Diego 'Flameeyes' Pettenò <[EMAIL PROTECTED]>
# Date 1181498430 -7200
# Node ID 704a54db77e31bd575201468e766ac4ecb226da8
# Parent bba045e6805704542eb83c2c3f77d2cc195a4152
Backport last.fm support to 1.1 branch.
diff -r 704a54db77e31bd575201468e766ac4ecb226da8 -r
bba045e6805704542eb83c2c3f77d2cc195a4152 ChangeLog
--- a/ChangeLog Sun Jun 10 20:00:30 2007 +0200
+++ b/ChangeLog Sat Jun 09 20:16:48 2007 +0100
@@ -1,3 +1,7 @@ xine-lib (1.1.7)
+xine-lib (1.1.8) (Unreleased)
+ * 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.
* Add support for MDHD version 1 atom in demux_qt. [bug #1679398]
diff -r 704a54db77e31bd575201468e766ac4ecb226da8 -r
bba045e6805704542eb83c2c3f77d2cc195a4152 src/input/input_http.c
--- a/src/input/input_http.c Sun Jun 10 20:00:30 2007 +0200
+++ b/src/input/input_http.c Sat Jun 09 20:16:48 2007 +0100
@@ -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;
@@ -94,6 +95,9 @@ typedef struct {
char preview[MAX_PREVIEW_SIZE];
off_t preview_size;
+ /* Last.FM streaming server */
+ unsigned char is_lastfm;
+
/* ShoutCast */
int shoutcast_mode;
int shoutcast_metaint;
@@ -382,6 +386,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;
}
@@ -907,6 +930,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)
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Xine-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xine-cvslog