diff options
author | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-01-14 16:02:22 +0000 |
---|---|---|
committer | Reimar Döffinger <Reimar.Doeffinger@gmx.de> | 2007-01-14 16:02:22 +0000 |
commit | 1fe68f0e7c461d42afeb405e93508a8ae97f818a (patch) | |
tree | 9554999f7aedab621c2abb5d9c7dcf2d8cc970ea | |
parent | 28221dd0fb7b06fe93327cc1bdd477d315ee06f3 (diff) | |
download | ffmpeg-1fe68f0e7c461d42afeb405e93508a8ae97f818a.tar.gz |
Simplify klv_decode_ber_length
Originally committed as revision 7475 to svn://svn.ffmpeg.org/ffmpeg/trunk
-rw-r--r-- | libavformat/mxf.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/libavformat/mxf.c b/libavformat/mxf.c index 5a047b3a7c..d105af26ce 100644 --- a/libavformat/mxf.c +++ b/libavformat/mxf.c @@ -182,19 +182,15 @@ static const uint8_t mxf_essence_element_key[] = { 0x06,0x0e,0x2b,0x static int64_t klv_decode_ber_length(ByteIOContext *pb) { - int64_t size = 0; - uint8_t length = get_byte(pb); - int type = length >> 7; - - if (type) { /* long form */ - int bytes_num = length & 0x7f; + uint64_t size = get_byte(pb); + if (size & 0x80) { /* long form */ + int bytes_num = size & 0x7f; /* SMPTE 379M 5.3.4 guarantee that bytes_num must not exceed 8 bytes */ if (bytes_num > 8) return -1; + size = 0; while (bytes_num--) size = size << 8 | get_byte(pb); - } else { - size = length & 0x7f; } return size; } |