diff options
author | Martin Storsjö <martin@martin.st> | 2010-08-09 10:05:33 +0000 |
---|---|---|
committer | Martin Storsjö <martin@martin.st> | 2010-08-09 10:05:33 +0000 |
commit | 311baee795009809daff8a0dd0b27225dcf819ae (patch) | |
tree | 79ea97f836fd4a61ec56bb00a52836a6d1eef033 /libavformat/utils.c | |
parent | f240ed18efd80abc6df0bdce13cf0ca708f283ae (diff) | |
download | ffmpeg-311baee795009809daff8a0dd0b27225dcf819ae.tar.gz |
Make hex_to_data a lavf internal function
This is useful for other future RTP depacketizers
Originally committed as revision 24747 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/utils.c')
-rw-r--r-- | libavformat/utils.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/libavformat/utils.c b/libavformat/utils.c index 1aa965c59b..2f59c263fe 100644 --- a/libavformat/utils.c +++ b/libavformat/utils.c @@ -3600,6 +3600,34 @@ char *ff_data_to_hex(char *buff, const uint8_t *src, int s, int lowercase) return buff; } +int ff_hex_to_data(uint8_t *data, const char *p) +{ + int c, len, v; + + len = 0; + v = 1; + for (;;) { + p += strspn(p, SPACE_CHARS); + if (*p == '\0') + break; + c = toupper((unsigned char) *p++); + if (c >= '0' && c <= '9') + c = c - '0'; + else if (c >= 'A' && c <= 'F') + c = c - 'A' + 10; + else + break; + v = (v << 4) | c; + if (v & 0x100) { + if (data) + data[len] = v; + len++; + v = 1; + } + } + return len; +} + void av_set_pts_info(AVStream *s, int pts_wrap_bits, unsigned int pts_num, unsigned int pts_den) { |