[FFmpeg-cvslog] r22665 - in trunk/libavformat: internal.h rdt.c sdp.c utils.c

mstorsjo subversion
Thu Mar 25 08:13:20 CET 2010


Author: mstorsjo
Date: Thu Mar 25 08:13:20 2010
New Revision: 22665

Log:
Add a lowercase parameter to ff_data_to_hex

Modified:
   trunk/libavformat/internal.h
   trunk/libavformat/rdt.c
   trunk/libavformat/sdp.c
   trunk/libavformat/utils.c

Modified: trunk/libavformat/internal.h
==============================================================================
--- trunk/libavformat/internal.h	Thu Mar 25 01:41:54 2010	(r22664)
+++ trunk/libavformat/internal.h	Thu Mar 25 08:13:20 2010	(r22665)
@@ -24,7 +24,7 @@
 #include <stdint.h>
 #include "avformat.h"
 
-char *ff_data_to_hex(char *buf, const uint8_t *src, int size);
+char *ff_data_to_hex(char *buf, const uint8_t *src, int size, int lowercase);
 
 void ff_program_add_stream_index(AVFormatContext *ac, int progid, unsigned int idx);
 

Modified: trunk/libavformat/rdt.c
==============================================================================
--- trunk/libavformat/rdt.c	Thu Mar 25 01:41:54 2010	(r22664)
+++ trunk/libavformat/rdt.c	Thu Mar 25 08:13:20 2010	(r22665)
@@ -120,8 +120,7 @@ ff_rdt_calc_response_and_checksum(char r
         buf[8 + i] ^= xor_table[i];
 
     av_md5_sum(zres, buf, 64);
-    ff_data_to_hex(response, zres, 16);
-    for (i=0;i<32;i++) response[i] = tolower(response[i]);
+    ff_data_to_hex(response, zres, 16, 1);
 
     /* add tail */
     strcpy (response + 32, "01d0a8e3");

Modified: trunk/libavformat/sdp.c
==============================================================================
--- trunk/libavformat/sdp.c	Thu Mar 25 01:41:54 2010	(r22664)
+++ trunk/libavformat/sdp.c	Thu Mar 25 08:13:20 2010	(r22665)
@@ -201,7 +201,7 @@ static char *extradata2config(AVCodecCon
         return NULL;
     }
     memcpy(config, "; config=", 9);
-    ff_data_to_hex(config + 9, c->extradata, c->extradata_size);
+    ff_data_to_hex(config + 9, c->extradata, c->extradata_size, 0);
     config[9 + c->extradata_size * 2] = 0;
 
     return config;

Modified: trunk/libavformat/utils.c
==============================================================================
--- trunk/libavformat/utils.c	Thu Mar 25 01:41:54 2010	(r22664)
+++ trunk/libavformat/utils.c	Thu Mar 25 08:13:20 2010	(r22665)
@@ -3464,13 +3464,18 @@ void ff_url_split(char *proto, int proto
     }
 }
 
-char *ff_data_to_hex(char *buff, const uint8_t *src, int s)
+char *ff_data_to_hex(char *buff, const uint8_t *src, int s, int lowercase)
 {
     int i;
-    static const char hex_table[16] = { '0', '1', '2', '3',
+    static const char hex_table_uc[16] = { '0', '1', '2', '3',
                                         '4', '5', '6', '7',
                                         '8', '9', 'A', 'B',
                                         'C', 'D', 'E', 'F' };
+    static const char hex_table_lc[16] = { '0', '1', '2', '3',
+                                           '4', '5', '6', '7',
+                                           '8', '9', 'a', 'b',
+                                           'c', 'd', 'e', 'f' };
+    const char *hex_table = lowercase ? hex_table_lc : hex_table_uc;
 
     for(i = 0; i < s; i++) {
         buff[i * 2]     = hex_table[src[i] >> 4];



More information about the ffmpeg-cvslog mailing list