comparison matroskaenc.c @ 2496:215eef1f3f37 libavformat

Simplify
author conrad
date Wed, 05 Sep 2007 00:25:20 +0000
parents 9c3067533891
children 5da824da8e3e
comparison
equal deleted inserted replaced
2495:9c3067533891 2496:215eef1f3f37
102 * 102 *
103 * @param bytes The number of bytes the size should occupy. Maximum of 8. 103 * @param bytes The number of bytes the size should occupy. Maximum of 8.
104 */ 104 */
105 static void put_ebml_size_unknown(ByteIOContext *pb, int bytes) 105 static void put_ebml_size_unknown(ByteIOContext *pb, int bytes)
106 { 106 {
107 uint64_t value = 0;
108 int i;
109
110 bytes = FFMIN(bytes, 8); 107 bytes = FFMIN(bytes, 8);
111 for (i = 0; i < bytes*7 + 1; i++) 108 put_byte(pb, 0x1ff >> bytes);
112 value |= 1ULL << i; 109 while (--bytes)
113 for (i = bytes-1; i >= 0; i--) 110 put_byte(pb, 0xff);
114 put_byte(pb, value >> i*8);
115 } 111 }
116 112
117 /** 113 /**
118 * Calculate how many bytes are needed to represent a given size in EBML. 114 * Calculate how many bytes are needed to represent a given size in EBML.
119 */ 115 */