Lines Matching full:box
35 // Uuid of uuid box under the moov box.
39 // Uuid of uuid box containing PRVW box.
62 // Convenience class for a box.
63 class Box { class
65 Box() in Box() function in piex::__anon2af2df940111::Box
71 Box(const BoxTag& tag, size_t offset, size_t header_length, size_t length) in Box() function in piex::__anon2af2df940111::Box
83 // Returns offset from start of file, including box's header.
85 // Returns offset from start of file of the next box, accounting for size of
86 // this box.
104 // ISO/IEC 14496-12 specification that all box fields are big endian.
110 // ISO/IEC 14496-12 specification that all box fields are big endian.
115 // Always big endian, based on ISO/IEC 14496-12 specification that all box
131 // Jpeg box offsets based on the box tag. The expected layout is as follows:
133 // 0 [long] size of box
134 // 4 [char[]] box tag
146 // Processes box w/ JPEG data. Box must be PRVW and THMB boxes.
147 bool ProcessJpegBox(StreamInterface* stream, const Box& box, Image* image) { in ProcessJpegBox() argument
150 if (box.tag() != kPrvwTag && box.tag() != kThmbTag) { in ProcessJpegBox()
154 box.tag() == kPrvwTag ? kPrvwJpegOffsets : kThmbJpegOffsets; in ProcessJpegBox()
157 if (!Get16u(stream, box.offset() + offsets.width, &width)) { in ProcessJpegBox()
160 if (!Get16u(stream, box.offset() + offsets.height, &height)) { in ProcessJpegBox()
163 if (!Get32u(stream, box.offset() + offsets.jpeg_size, &jpeg_size)) { in ProcessJpegBox()
169 image->offset = box.offset() + offsets.jpeg_data; in ProcessJpegBox()
221 // Returns the next box or an invalid box.
224 // can be compact (32-bits) or extended (64-bit, e.g. mdat box).
228 // Fields in a box are big-endian.
229 Box GetNextBox(StreamInterface* stream, size_t offset) { in GetNextBox()
232 return Box(); in GetNextBox()
238 return Box(); in GetNextBox()
246 return Box(); in GetNextBox()
254 return Box(tag, offset, header_offset, length); in GetNextBox()
257 // Searches for the next box with the given tag.
258 Box GetNextBoxWithTag(StreamInterface* stream, size_t offset, in GetNextBoxWithTag()
261 Box box = GetNextBox(stream, offset); in GetNextBoxWithTag() local
262 if (!box.IsValid() || box.tag() == expected_tag) { in GetNextBoxWithTag()
263 return box; in GetNextBoxWithTag()
265 offset = box.next_box_offset(); in GetNextBoxWithTag()
269 // Returns the width, height, and content type from the CRAW box.
270 bool ProcessCrawBox(StreamInterface* stream, const Box& craw_box, in ProcessCrawBox()
289 // stsz box offset:
291 // 0 [long] size of box
292 // 4 [char[]] box tag
297 bool ProcessStszBox(StreamInterface* stream, const Box& stsz_box, in ProcessStszBox()
320 // co64 box offsets:
322 // 0 [long] size of box
323 // 4 [char[]] box tag
327 bool ProcessCo64(StreamInterface* stream, const Box& co64_box, in ProcessCo64()
339 // Process the stbl box. Expected box layout:
346 // co64 (offset of embedded image, relative to mdat box)
347 bool ProcessStblBox(StreamInterface* stream, const Box& stbl_box, in ProcessStblBox()
349 Box stsd_box = GetNextBoxWithTag(stream, stbl_box.header_offset(), kStsdTag); in ProcessStblBox()
354 Box craw_box = GetNextBox(stream, stsd_box.header_offset() + 8); in ProcessStblBox()
361 // CRAW contains info about the full-size image embedded in the mdat box. in ProcessStblBox()
378 Box stsz_box = in ProcessStblBox()
389 Box co64_box = in ProcessStblBox()
406 // This offset is relative to the position of the mdat box. The value will in ProcessStblBox()
412 // Returns true if we should parse the children of the box.
419 // Processes box and returns offset of the next box to process.
430 // THMB (160x120 JPEG thumbnail, embedded in this box)
440 // image data is found in mdat box, below.)
447 // PRVW (1620x1080 JPEG preview, embedded in this box)
451 size_t ProcessBox(StreamInterface* stream, const Box& box, ProcessData* data) { in ProcessBox() argument
453 if (box.tag() == kUuidTag) { in ProcessBox()
454 // Uuid box have extended box types. in ProcessBox()
456 if (stream->GetData(box.header_offset(), uuid.size(), uuid.data()) != kOk) { in ProcessBox()
460 return box.header_offset() + uuid.size() + 8; in ProcessBox()
462 return box.header_offset() + uuid.size(); in ProcessBox()
463 } // else skip the box, below. in ProcessBox()
464 } else if (DoProcessChildren(box.tag())) { in ProcessBox()
465 return box.header_offset(); in ProcessBox()
468 // Potentially process the data contained in the box. in ProcessBox()
470 if (box.tag() == kMdatTag) { in ProcessBox()
473 data->mdat_image.offset += box.header_offset(); in ProcessBox()
475 } else if (box.tag() == kStblTag) { in ProcessBox()
476 success = ProcessStblBox(stream, box, data); in ProcessBox()
477 } else if (box.tag() == kPrvwTag) { in ProcessBox()
479 success = ProcessJpegBox(stream, box, &data->prvw_image); in ProcessBox()
480 } else if (box.tag() == kThmbTag) { in ProcessBox()
482 success = ProcessJpegBox(stream, box, &data->preview_image_data->thumbnail); in ProcessBox()
483 } else if (box.tag() == kCmt1Tag) { in ProcessBox()
485 ParseExifIfd0(stream, box.header_offset(), data->preview_image_data); in ProcessBox()
486 } else if (box.tag() == kCmt2Tag) { in ProcessBox()
488 ParseExifExifIfd(stream, box.header_offset(), data->preview_image_data); in ProcessBox()
490 // This box isn't interesting, skip it. in ProcessBox()
493 return success ? box.next_box_offset() : 0; in ProcessBox()
500 Box box = GetNextBox(stream, offset); in ProcessStream() local
501 if (!box.IsValid()) { in ProcessStream()
504 size_t new_offset = ProcessBox(stream, box, data); in ProcessStream()
508 if (box.tag() == last_chunk) { in ProcessStream()
538 // Prefer image in mdata box, as spec ensures it is the largest image. in Cr3GetPreviewData()