Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 386909 | Differences between
and this patch

Collapse All | Expand All

(-)src/ao.h (-1 / +3 lines)
Lines 152-156 Link Here
152
      /* -- Device Setup/Playback/Teardown -- */                                                                                                                                                                 
152
      /* -- Device Setup/Playback/Teardown -- */                                                                                                                                                                 
153
      int (*ao_append_option)(ao_option **, const char *, const char *);                                                                                                                                         
153
      int (*ao_append_option)(ao_option **, const char *, const char *);                                                                                                                                         
154
      void (*ao_free_options)(ao_option *);                                                                                                                                                                      
154
      void (*ao_free_options)(ao_option *);                                                                                                                                                                      
155
      char* (*ao_get_option)(ao_option *, const char* );                                                                                                                                                         
155
      char* (*ao_get_option)(ao_option *, const char* );
156
      void (*ao_set_metadata)(const char *buffer, unsigned int size);                                                                                                                                                         
157
      void (*ao_set_metadata_coverart)(const char *buffer, unsigned int size);
156
  }; 
158
  }; 
(-)src/hairtunes.c (+10 lines)
Lines 267-272 Link Here
267
  fix_volume = 65536.0 * volume;
267
  fix_volume = 65536.0 * volume;
268
}
268
}
269
269
270
void hairtunes_set_metadata(const char *buffer, unsigned int size)
271
{
272
  g_ao.ao_set_metadata(buffer, size);
273
}
274
275
void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size)
276
{
277
  g_ao.ao_set_metadata_coverart(buffer, size);
278
}
279
270
void hairtunes_flush(void)
280
void hairtunes_flush(void)
271
{
281
{
272
  pthread_mutex_lock(&ab_mutex);
282
  pthread_mutex_lock(&ab_mutex);
(-)src/hairtunes.h (+2 lines)
Lines 4-9 Link Here
4
int hairtunes_init(char *pAeskey, char *pAesiv, char *pFmtpstr, int pCtrlPort, int pTimingPort,
4
int hairtunes_init(char *pAeskey, char *pAesiv, char *pFmtpstr, int pCtrlPort, int pTimingPort,
5
         int pDataPort, char *pRtpHost, char*pPipeName, char *pLibaoDriver, char *pLibaoDeviceName, char *pLibaoDeviceId);
5
         int pDataPort, char *pRtpHost, char*pPipeName, char *pLibaoDriver, char *pLibaoDeviceName, char *pLibaoDeviceId);
6
void hairtunes_setvolume(float vol);
6
void hairtunes_setvolume(float vol);
7
void hairtunes_set_metadata(const char *buffer, unsigned int size);
8
void hairtunes_set_metadata_coverart(const char *buffer, unsigned int size);
7
void hairtunes_flush(void);
9
void hairtunes_flush(void);
8
void hairtunes_cleanup(void);
10
void hairtunes_cleanup(void);
9
11
(-)src/shairport.c (-6 / +59 lines)
Lines 513-519 Link Here
513
    while(1 == tMoreDataNeeded)
513
    while(1 == tMoreDataNeeded)
514
    {
514
    {
515
      tError = readDataFromClient(pSock, &(tConn.recv));
515
      tError = readDataFromClient(pSock, &(tConn.recv));
516
      if(!tError && strlen(tConn.recv.data) > 0)
516
      //if(!tError && strlen(tConn.recv.data) > 0)
517
      if(!tError && tConn.recv.current > 0)
517
      {
518
      {
518
        xprintf("Finished Reading some data from client\n");
519
        xprintf("Finished Reading some data from client\n");
519
        // parse client request
520
        // parse client request
Lines 632-638 Link Here
632
    }
633
    }
633
    
634
    
634
    tSize = (int) (tShortest - tFound);
635
    tSize = (int) (tShortest - tFound);
635
    xprintf("Found %.*s  length: %d\n", tSize, tFound, tSize);
636
    xprintf("Found %s  length: %d\n",tFound, tSize);
636
    if(pReturnSize != NULL)
637
    if(pReturnSize != NULL)
637
    {
638
    {
638
      *pReturnSize = tSize;
639
      *pReturnSize = tSize;
Lines 744-750 Link Here
744
  if(tContent != NULL)
745
  if(tContent != NULL)
745
  {
746
  {
746
    int tContentSize = atoi(tContent);
747
    int tContentSize = atoi(tContent);
747
    if(pConn->recv.marker == 0 || strlen(pConn->recv.data+pConn->recv.marker) != tContentSize)
748
    if(pConn->recv.marker == 0 || pConn->recv.current-pConn->recv.marker != tContentSize)
748
    {
749
    {
749
      if(isLogEnabledFor(HEADER_LOG_LEVEL))
750
      if(isLogEnabledFor(HEADER_LOG_LEVEL))
750
      {
751
      {
Lines 752-758 Link Here
752
        if(pConn->recv.marker != 0)
753
        if(pConn->recv.marker != 0)
753
        {
754
        {
754
          xprintf("ContentPtr has %d, but needs %d\n", 
755
          xprintf("ContentPtr has %d, but needs %d\n", 
755
                  strlen(pConn->recv.data+pConn->recv.marker), tContentSize);
756
                  (pConn->recv.current-pConn->recv.marker), tContentSize);
756
        }
757
        }
757
      }
758
      }
758
      // check if value in tContent > 2nd read from client.
759
      // check if value in tContent > 2nd read from client.
Lines 989-1003 Link Here
989
  {
990
  {
990
    propogateCSeq(pConn);
991
    propogateCSeq(pConn);
991
    int tSize = 0;
992
    int tSize = 0;
993
    char *buffer = NULL;
994
    char *contentType = getFromHeader(pConn->recv.data, "Content-Type", &tSize);
995
    char *tContent = getFromHeader(pConn->recv.data, "Content-Length", NULL);
996
    int iContentSize = 0;
997
    int isJpg = 0;
998
    
999
    if(tContent != NULL)
1000
    {
1001
      iContentSize = atoi(tContent);
1002
    }
1003
1004
    if( tSize > 1 && 
1005
        (strncmp(contentType, "application/x-dmap-tagged", tSize) == 0) ||
1006
        (strncmp(contentType, "image/jpeg", tSize) == 0)                 )
1007
    {
1008
      if( (pConn->recv.current - pConn->recv.marker) == iContentSize && pConn->recv.marker != 0)
1009
      {
1010
        if(strncmp(contentType, "image/jpeg", tSize) == 0)
1011
        {
1012
          isJpg = 1;
1013
        }
1014
        buffer = (char *)malloc(iContentSize * sizeof(char));
1015
        memcpy(buffer, pConn->recv.data + pConn->recv.marker, iContentSize);                                                                                                                                     
1016
      }
1017
      else
1018
      {
1019
        iContentSize = 0;
1020
      }
1021
    }
1022
    else
1023
    {
1024
      iContentSize = 0;
1025
    }
992
    char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize);
1026
    char *tVol = getFromHeader(pConn->recv.data, "volume", &tSize);
993
    xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
1027
    if( tVol)
1028
    {
1029
      xprintf("About to write [vol: %.*s] data to hairtunes\n", tSize, tVol);
1030
    }
994
    // TBD VOLUME
1031
    // TBD VOLUME
995
#ifndef XBMC
1032
#ifndef XBMC
996
    write(pConn->hairtunes->in[1], "vol: ", 5);
1033
    write(pConn->hairtunes->in[1], "vol: ", 5);
997
    write(pConn->hairtunes->in[1], tVol, tSize);
1034
    write(pConn->hairtunes->in[1], tVol, tSize);
998
    write(pConn->hairtunes->in[1], "\n", 1);
1035
    write(pConn->hairtunes->in[1], "\n", 1);
999
#else
1036
#else
1000
    hairtunes_setvolume(atof(tVol));
1037
    if(tVol)
1038
    {
1039
      hairtunes_setvolume(atof(tVol));
1040
    }
1041
    
1042
    if(iContentSize)
1043
    {
1044
      if(isJpg)
1045
      {
1046
        hairtunes_set_metadata_coverart(buffer, iContentSize);      
1047
      }
1048
      else
1049
      {
1050
        hairtunes_set_metadata(buffer, iContentSize);
1051
      }
1052
      free(buffer);
1053
    }
1001
#endif
1054
#endif
1002
    xprintf("Finished writing data write data to hairtunes\n");
1055
    xprintf("Finished writing data write data to hairtunes\n");
1003
  }
1056
  }

Return to bug 386909