[xiph-cvs] cvs commit: libshout/src shout.c util.c util.h

Brendan brendan at xiph.org
Sat Feb 22 16:11:32 PST 2003



brendan     03/02/22 19:11:32

  Modified:    src      shout.c util.c util.h
  Log:
  Make new ice-audio-info header use ; instead of & as delimiter, like RTSP headers
  sometimes do. Compare:
  
  ice-audio-header: bitrate=128;samplerate=44100;channels=2
  to
  Transport: RTP/AVP/UDP;unicast;client_port=3058-3059;server_port=5002-5003
  
  Isn't it pretty?
  
  This one's for you, Jack.

Revision  Changes    Path
1.27      +2 -2      libshout/src/shout.c

Index: shout.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/shout.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- shout.c	22 Feb 2003 22:32:47 -0000	1.26
+++ shout.c	23 Feb 2003 00:11:32 -0000	1.27
@@ -240,7 +240,7 @@
         if (!self || !metadata)
                 return SHOUTERR_INSANE;
 
-	if (!(encvalue = util_dict_urlencode(metadata)))
+	if (!(encvalue = util_dict_urlencode(metadata, '&')))
                 return SHOUTERR_MALLOC;
 
         if (!self->connected)
@@ -712,7 +712,7 @@
         if (bitrate && !sock_write(self->socket, "ice-bitrate: %s\r\n", bitrate))
                 return SHOUTERR_SOCKET;
 #else
-	if (ai = util_dict_urlencode(self->audio_info)) {
+	if (ai = util_dict_urlencode(self->audio_info, ';')) {
                 if (!sock_write(self->socket, "ice-audio-info: %s\r\n", ai)) {
                         free(ai);
                         return SHOUTERR_SOCKET;

<p><p>1.8       +2 -2      libshout/src/util.c

Index: util.c
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/util.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- util.c	22 Feb 2003 22:32:47 -0000	1.7
+++ util.c	23 Feb 2003 00:11:32 -0000	1.8
@@ -199,7 +199,7 @@
 /* given a dictionary, URL-encode each key and val and stringify them in order as
   key=val&key=val... if val is set, or just key&key if val is NULL.
   TODO: Memory management needs overhaul. */
-char *util_dict_urlencode(util_dict *dict)
+char *util_dict_urlencode(util_dict *dict, char delim)
 {
         char *res, *tmp;
         char *enc;
@@ -229,7 +229,7 @@
                                 return NULL;
                         } else
                                 res = tmp;
-			sprintf(res + strlen(res), "&%s", enc);
+			sprintf(res + strlen(res), "%c%s", delim, enc);
                         free(enc);
                 }
 

<p><p>1.7       +1 -1      libshout/src/util.h

Index: util.h
===================================================================
RCS file: /usr/local/cvsroot/libshout/src/util.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- util.h	22 Feb 2003 22:32:47 -0000	1.6
+++ util.h	23 Feb 2003 00:11:32 -0000	1.7
@@ -18,7 +18,7 @@
 /* dict, key must not be NULL. */
 int util_dict_set(util_dict *dict, const char *key, const char *val);
 const char *util_dict_get(util_dict *dict, const char *key);
-char *util_dict_urlencode(util_dict *dict);
+char *util_dict_urlencode(util_dict *dict, char delim);
 
 char *util_base64_encode(char *data);
 char *util_url_encode(const char *data);

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list