Mercurial > libavformat.hg
comparison matroskaenc.c @ 2477:d802e4390b2c libavformat
Doxygenize some comments
author | conrad |
---|---|
date | Wed, 05 Sep 2007 00:24:25 +0000 |
parents | 4121545128f3 |
children | b2dc0bc246f9 |
comparison
equal
deleted
inserted
replaced
2476:4121545128f3 | 2477:d802e4390b2c |
---|---|
128 static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str) | 128 static void put_ebml_string(ByteIOContext *pb, unsigned int elementid, const char *str) |
129 { | 129 { |
130 put_ebml_binary(pb, elementid, str, strlen(str)); | 130 put_ebml_binary(pb, elementid, str, strlen(str)); |
131 } | 131 } |
132 | 132 |
133 // this reserves exactly the amount of space specified by size, which must be at least 2 | 133 /** |
134 * Writes a void element of a given size. Useful for reserving space in the file to be | |
135 * written to later. | |
136 * | |
137 * @param size The amount of space to reserve, which must be at least 2. | |
138 */ | |
134 static void put_ebml_void(ByteIOContext *pb, uint64_t size) | 139 static void put_ebml_void(ByteIOContext *pb, uint64_t size) |
135 { | 140 { |
136 offset_t currentpos = url_ftell(pb); | 141 offset_t currentpos = url_ftell(pb); |
137 | 142 |
138 if (size < 2) | 143 if (size < 2) |
172 for (i = 0; i < size / 255; i++) | 177 for (i = 0; i < size / 255; i++) |
173 put_byte(pb, 255); | 178 put_byte(pb, 255); |
174 put_byte(pb, size % 255); | 179 put_byte(pb, size % 255); |
175 } | 180 } |
176 | 181 |
177 // initializes a mkv_seekhead element to be ready to index level 1 matroska elements | 182 /** |
178 // if numelements is greater than 0, it reserves enough space for that many elements | 183 * Initialize a mkv_seekhead element to be ready to index level 1 Matroska elements. |
179 // at the current file position and writes the seekhead there, otherwise the seekhead | 184 * If a maximum number of elements is specified, enough space will be reserved at |
180 // will be appended to the file when end_mkv_seekhead() is called | 185 * the current file location to write a seek head of that size. |
186 * | |
187 * @param segment_offset the absolute offset into the file that the segment begins | |
188 * @param numelements the maximum number of elements that will be indexed by this | |
189 * seek head, 0 if unlimited. | |
190 */ | |
181 static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, offset_t segment_offset, int numelements) | 191 static mkv_seekhead * mkv_start_seekhead(ByteIOContext *pb, offset_t segment_offset, int numelements) |
182 { | 192 { |
183 mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); | 193 mkv_seekhead *new_seekhead = av_mallocz(sizeof(mkv_seekhead)); |
184 if (new_seekhead == NULL) | 194 if (new_seekhead == NULL) |
185 return NULL; | 195 return NULL; |
218 seekhead->num_entries++; | 228 seekhead->num_entries++; |
219 | 229 |
220 return 0; | 230 return 0; |
221 } | 231 } |
222 | 232 |
223 // returns the file offset where the seekhead was written and frees the seekhead | 233 /** |
234 * Write the seek head to the file and free it. If a maximum number of elements was | |
235 * specified to mkv_start_seekhead(), the seek head will be written at the location | |
236 * reserved for it. Otherwise, it is written at the current location in the file. | |
237 * | |
238 * @return the file offset where the seekhead was written | |
239 */ | |
224 static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) | 240 static offset_t mkv_write_seekhead(ByteIOContext *pb, mkv_seekhead *seekhead) |
225 { | 241 { |
226 offset_t metaseek, seekentry, currentpos; | 242 offset_t metaseek, seekentry, currentpos; |
227 int i; | 243 int i; |
228 | 244 |