| 571 | } |
| 572 | |
| 573 | void RiffVideo::readStreamFormat(uint64_t size_) { |
| 574 | // The structure of the strf chunk depends on the media type. Video streams use the BITMAPINFOHEADER structure, |
| 575 | // whereas audio streams use the WAVEFORMATEX structure. |
| 576 | |
| 577 | #ifdef EXIV2_DEBUG_MESSAGES |
| 578 | if (streamType_ == Audio) { |
| 579 | EXV_INFO << "--> wFormatTag = " << readWORDTag(io_) << std::endl; |
| 580 | EXV_INFO << "--> nChannels = " << readWORDTag(io_) << std::endl; |
| 581 | EXV_INFO << "--> nSamplesPerSec = " << readDWORDTag(io_) << std::endl; |
| 582 | EXV_INFO << "--> nAvgBytesPerSec = " << readDWORDTag(io_) << std::endl; |
| 583 | EXV_INFO << "--> nBlockAlign = " << readWORDTag(io_) << std::endl; |
| 584 | EXV_INFO << "--> wBitsPerSample = " << readWORDTag(io_) << std::endl; |
| 585 | if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) |
| 586 | io_->seekOrThrow(io_->tell() - DWORD * 4, BasicIo::beg, ErrorCode::kerFailedToReadImageData); |
| 587 | } else if (streamType_ == Video) { |
| 588 | EXV_INFO << "--> biSize = " << readDWORDTag(io_) << std::endl; |
| 589 | EXV_INFO << "--> biWidth = " << readDWORDTag(io_) << std::endl; |
| 590 | EXV_INFO << "--> biHeight = " << readDWORDTag(io_) << std::endl; |
| 591 | EXV_INFO << "--> biPlanes = " << readWORDTag(io_) << std::endl; |
| 592 | EXV_INFO << "--> biBitCount = " << readWORDTag(io_) << std::endl; |
| 593 | EXV_INFO << "--> biCompression = " << readDWORDTag(io_) << std::endl; |
| 594 | EXV_INFO << "--> biSizeImage = " << readDWORDTag(io_) << std::endl; |
| 595 | EXV_INFO << "--> biXPelsPerMeter = " << readDWORDTag(io_) << std::endl; |
| 596 | EXV_INFO << "--> biYPelsPerMeter = " << readDWORDTag(io_) << std::endl; |
| 597 | EXV_INFO << "--> biClrUsed = " << readDWORDTag(io_) << std::endl; |
| 598 | EXV_INFO << "--> biClrImportant = " << readDWORDTag(io_) << std::endl; |
| 599 | if (LogMsg::info >= LogMsg::level() && LogMsg::handler()) |
| 600 | io_->seekOrThrow(io_->tell() - DWORD * 10, BasicIo::beg, ErrorCode::kerFailedToReadImageData); |
| 601 | } |
| 602 | #endif |
| 603 | |
| 604 | if (streamType_ == Video) { |
| 605 | io_->seekOrThrow(io_->tell() + DWORD * 3, BasicIo::beg, |
| 606 | ErrorCode::kerFailedToReadImageData); // ignore biSize, biWidth, biHeight |
| 607 | xmpData_["Xmp.video.Planes"] = readWORDTag(io_); |
| 608 | xmpData_["Xmp.video.PixelDepth"] = readWORDTag(io_); |
| 609 | xmpData_["Xmp.video.Compressor"] = readStringTag(io_); |
| 610 | xmpData_["Xmp.video.ImageLength"] = readDWORDTag(io_); |
| 611 | xmpData_["Xmp.video.PixelPerMeterX"] = readQWORDTag(io_); |
| 612 | xmpData_["Xmp.video.PixelPerMeterY"] = readQWORDTag(io_); |
| 613 | if (uint32_t NumOfColours = readDWORDTag(io_)) |
| 614 | xmpData_["Xmp.video.NumOfColours"] = NumOfColours; |
| 615 | else |
| 616 | xmpData_["Xmp.video.NumOfColours"] = "Unspecified"; |
| 617 | if (uint32_t NumIfImpColours = readDWORDTag(io_)) |
| 618 | xmpData_["Xmp.video.NumIfImpColours"] = NumIfImpColours; |
| 619 | else |
| 620 | xmpData_["Xmp.video.NumIfImpColours"] = "All"; |
| 621 | } else if (streamType_ == Audio) { |
| 622 | uint16_t format_tag = readWORDTag(io_); |
| 623 | if (auto it = Internal::audioEncodingValues.find(format_tag); it != Internal::audioEncodingValues.end()) |
| 624 | xmpData_["Xmp.audio.Compressor"] = it->second; |
| 625 | else |
| 626 | xmpData_["Xmp.audio.Compressor"] = format_tag; |
| 627 | |
| 628 | xmpData_["Xmp.audio.ChannelType"] = getStreamType(readDWORDTag(io_)); |
| 629 | xmpData_["Xmp.audio.SampleRate"] = readDWORDTag(io_); // nSamplesPerSec |
| 630 | io_->seekOrThrow(io_->tell() + DWORD, BasicIo::beg, ErrorCode::kerFailedToReadImageData); // nAvgBytesPerSec |
nothing calls this directly
no test coverage detected