vpxpes_parser: Read and store PTS when present.
Change-Id: I11acb45b26eeea6f5945c04bb447937ba2ffca9f
This commit is contained in:
parent
6cf0a0f400
commit
1b24a792e3
@ -83,4 +83,10 @@ bool WriteUint8(std::uint8_t val, std::FILE* fileptr) {
|
||||
return (std::fputc(val, fileptr) == val);
|
||||
}
|
||||
|
||||
std::uint16_t ReadUint16(const std::uint8_t* buf) {
|
||||
if (buf == nullptr)
|
||||
return 0;
|
||||
return ((buf[0] << 8) | buf[1]);
|
||||
}
|
||||
|
||||
} // namespace libwebm
|
||||
|
@ -54,6 +54,10 @@ bool ParseVP9SuperFrameIndex(const std::uint8_t* frame,
|
||||
// Writes |val| to |fileptr| and returns true upon success.
|
||||
bool WriteUint8(std::uint8_t val, std::FILE* fileptr);
|
||||
|
||||
// Reads 2 bytes from |buf| and returns them as a uint16_t. Returns 0 when |buf|
|
||||
// is a nullptr.
|
||||
std::uint16_t ReadUint16(const std::uint8_t* buf);
|
||||
|
||||
} // namespace libwebm
|
||||
|
||||
#endif // LIBWEBM_COMMON_LIBWEBM_UTIL_H_
|
||||
|
@ -189,6 +189,9 @@ bool VpxPesParser::ParsePesOptionalHeader(PesOptionalHeader* header) {
|
||||
return false;
|
||||
}
|
||||
|
||||
header->pts = (pes_file_data_[offset] & 0xe) << 29 |
|
||||
((ReadUint16(&pes_file_data_[offset + 1]) & ~1) << 14) |
|
||||
(ReadUint16(&pes_file_data_[offset + 3]) >> 1);
|
||||
offset += 5;
|
||||
bytes_left -= 5;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user