1 diff -ruP src/ao.h libshairport.new/src/ao.h
2 --- src/ao.h 2012-05-07 22:26:53.000000000 +0200
3 +++ src/ao.h 2012-05-08 18:46:42.000000000 +0200
5 /* -- Device Setup/Playback/Teardown -- */
6 int (*ao_append_option)(ao_option **, const char *, const char *);
7 void (*ao_free_options)(ao_option *);
8 - char* (*ao_get_option)(ao_option *, const char* );
9 + char* (*ao_get_option)(ao_option *, const char* );
10 + void (*ao_set_metadata)(const char *buffer, unsigned int size);
11 + void (*ao_set_metadata_coverart)(const char *buffer, unsigned int size);
13 diff -ruP src/hairtunes.c src/hairtunes.c
14 --- src/hairtunes.c 2012-05-07 22:26:53.000000000 +0200
15 +++ src/hairtunes.c 2012-05-08 18:45:51.000000000 +0200
17 fix_volume = 65536.0 * volume;
20 +void hairtunes_set_metadata(const char *buffer, unsigned int size)
22 + g_ao.ao_set_metadata(buffer, size);
25 +void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size)
27 + g_ao.ao_set_metadata_coverart(buffer, size);
30 void hairtunes_flush(void)
32 pthread_mutex_lock(&ab_mutex);
33 diff -ruP src/hairtunes.h src/hairtunes.h
34 --- src/hairtunes.h 2011-08-21 00:06:21.000000000 +0200
35 +++ src/hairtunes.h 2012-05-08 18:46:00.000000000 +0200
37 int hairtunes_init(char *pAeskey, char *pAesiv, char *pFmtpstr, int pCtrlPort, int pTimingPort,
38 int pDataPort, char *pRtpHost, char*pPipeName, char *pLibaoDriver, char *pLibaoDeviceName, char *pLibaoDeviceId);
39 void hairtunes_setvolume(float vol);
40 +void hairtunes_set_metadata(const char *buffer, unsigned int size);
41 +void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size);
42 void hairtunes_flush(void);
43 void hairtunes_cleanup(void);
45 diff -ruP src/shairport.c src/shairport.c
46 --- src/shairport.c 2012-05-07 22:26:53.000000000 +0200
47 +++ src/shairport.c 2012-05-08 18:45:30.000000000 +0200
49 while(1 == tMoreDataNeeded)
51 tError = readDataFromClient(pSock, &(tConn.recv));
52 - if(!tError && strlen(tConn.recv.data) > 0)
53 + //if(!tError && strlen(tConn.recv.data) > 0)
54 + if(!tError && tConn.recv.current > 0)
56 xprintf("Finished Reading some data from client\n");
57 // parse client request
61 tSize = (int) (tShortest - tFound);
62 - xprintf("Found %.*s length: %d\n", tSize, tFound, tSize);
63 + xprintf("Found %s length: %d\n",tFound, tSize);
64 if(pReturnSize != NULL)
70 int tContentSize = atoi(tContent);
71 - if(pConn->recv.marker == 0 || strlen(pConn->recv.data+pConn->recv.marker) != tContentSize)
72 + if(pConn->recv.marker == 0 || pConn->recv.current-pConn->recv.marker != tContentSize)
74 if(isLogEnabledFor(HEADER_LOG_LEVEL))
77 if(pConn->recv.marker != 0)
79 xprintf("ContentPtr has %d, but needs %d\n",
80 - strlen(pConn->recv.data+pConn->recv.marker), tContentSize);
81 + (pConn->recv.current-pConn->recv.marker), tContentSize);
84 // check if value in tContent > 2nd read from client.
89 + char *buffer = NULL;
90 + char *contentType = getFromHeader(pConn->recv.data, "Content-Type", &tSize);
91 + char *tContent = getFromHeader(pConn->recv.data, "Content-Length", NULL);
92 + int iContentSize = 0;
95 + if(tContent != NULL)
97 + iContentSize = atoi(tContent);
101 + (strncmp(contentType, "application/x-dmap-tagged", tSize) == 0) ||
102 + (strncmp(contentType, "image/jpeg", tSize) == 0) )
104 + if( (pConn->recv.current - pConn->recv.marker) == iContentSize && pConn->recv.marker != 0)
106 + if(strncmp(contentType, "image/jpeg", tSize) == 0)
110 + buffer = (char *)malloc(iContentSize * sizeof(char));
111 + memcpy(buffer, pConn->recv.data + pConn->recv.marker, iContentSize);
122 char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize);
123 - xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
126 + xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
130 write(pConn->hairtunes->in[1], "vol: ", 5);
131 write(pConn->hairtunes->in[1], tVol, tSize);
132 write(pConn->hairtunes->in[1], "\n", 1);
134 - hairtunes_setvolume(atof(tVol));
137 + hairtunes_setvolume(atof(tVol));
144 + hairtunes_set_metadata_coverart(buffer, iContentSize);
148 + hairtunes_set_metadata(buffer, iContentSize);
153 xprintf("Finished writing data write data to hairtunes\n");