aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2010-03-25 07:13:20 +0000
committerMartin Storsjö <martin@martin.st>2010-03-25 07:13:20 +0000
commitddbeb95447d237bd82a2234d15561ae2eeb88a4c (patch)
treebbaa9247dd0c8094b6489cd3b09cf7964d521ec3
parentbd01c39330280313eebab7594168cae6180a6aef (diff)
downloadffmpeg-ddbeb95447d237bd82a2234d15561ae2eeb88a4c.tar.gz
Add a lowercase parameter to ff_data_to_hex
Originally committed as revision 22665 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r--libavformat/internal.h2
-rw-r--r--libavformat/rdt.c3
-rw-r--r--libavformat/sdp.c2
-rw-r--r--libavformat/utils.c9
4 files changed, 10 insertions, 6 deletions
diff --git a/libavformat/internal.h b/libavformat/internal.h
index 1110ce8312..822b7c6eba 100644
--- a/libavformat/internal.h
+++ b/libavformat/internal.h
@@ -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);
diff --git a/libavformat/rdt.c b/libavformat/rdt.c
index fa909e6023..0a390614c2 100644
--- a/libavformat/rdt.c
+++ b/libavformat/rdt.c
@@ -120,8 +120,7 @@ ff_rdt_calc_response_and_checksum(char response[41], char chksum[9],
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");
diff --git a/libavformat/sdp.c b/libavformat/sdp.c
index 37f92ff316..d48a5df950 100644
--- a/libavformat/sdp.c
+++ b/libavformat/sdp.c
@@ -201,7 +201,7 @@ static char *extradata2config(AVCodecContext *c)
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;
diff --git a/libavformat/utils.c b/libavformat/utils.c
index db1dc14bb6..dbcdab18c3 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -3464,13 +3464,18 @@ void ff_url_split(char *proto, int proto_size,
}
}
-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];