webm_parser: Convert style to match the rest of libwebm

Remove webm_parser/clang-format-style.
Run clang-format -style=file -i for each source file.

Change-Id: Ieaf44bd323375cbcfec67014e94b7742d6bda14a
This commit is contained in:
Tom Finegan 2016-07-22 15:18:02 -07:00
parent 24be76dcb2
commit 25d26028c1
53 changed files with 741 additions and 803 deletions

View File

@ -1,91 +0,0 @@
---
Language: Cpp
# BasedOnStyle: Google
AccessModifierOffset: -1
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: false
AlignConsecutiveDeclarations: false
AlignEscapedNewlinesLeft: true
AlignOperands: true
AlignTrailingComments: true
AllowAllParametersOfDeclarationOnNextLine: true
AllowShortBlocksOnASingleLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: All
AllowShortIfStatementsOnASingleLine: true
AllowShortLoopsOnASingleLine: true
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: true
AlwaysBreakTemplateDeclarations: false
BinPackArguments: true
BinPackParameters: true
BraceWrapping:
AfterClass: false
AfterControlStatement: false
AfterEnum: false
AfterFunction: false
AfterNamespace: false
AfterObjCDeclaration: false
AfterStruct: false
AfterUnion: false
BeforeCatch: false
BeforeElse: false
IndentBraces: false
BreakBeforeBinaryOperators: None
BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: true
BreakConstructorInitializersBeforeComma: false
BreakAfterJavaFieldAnnotations: false
BreakStringLiterals: true
ColumnLimit: 80
ConstructorInitializerAllOnOneLineOrOnePerLine: true
ConstructorInitializerIndentWidth: 4
ContinuationIndentWidth: 4
Cpp11BracedListStyle: true
DerivePointerAlignment: true
DisableFormat: false
ExperimentalAutoDetectBinPacking: false
ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ]
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^<.*'
Priority: 2
- Regex: '.*'
Priority: 3
IndentCaseLabels: true
IndentWidth: 2
IndentWrappedFunctionNames: false
KeepEmptyLinesAtTheStartOfBlocks: false
MacroBlockBegin: ''
MacroBlockEnd: ''
MaxEmptyLinesToKeep: 1
NamespaceIndentation: None
ObjCBlockIndentWidth: 2
ObjCSpaceAfterProperty: false
ObjCSpaceBeforeProtocolList: false
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyBreakComment: 300
PenaltyBreakFirstLessLess: 120
PenaltyBreakString: 1000
PenaltyExcessCharacter: 1000000
PenaltyReturnTypeOnItsOwnLine: 200
PointerAlignment: Left
ReflowComments: true
SortIncludes: true
SpaceAfterCStyleCast: false
SpaceBeforeAssignmentOperators: true
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: false
SpacesBeforeTrailingComments: 2
SpacesInAngles: false
SpacesInContainerLiterals: true
SpacesInCStyleCastParentheses: false
SpacesInParentheses: false
SpacesInSquareBrackets: false
Standard: Auto
TabWidth: 8
UseTab: Never
...

View File

@ -956,8 +956,10 @@ class DemoCallback : public Callback {
PrintValue("timecode", simple_block.timecode);
PrintValue("lacing", simple_block.lacing);
std::string flags = (simple_block.is_visible) ? "visible" : "invisible";
if (simple_block.is_key_frame) flags += ", key frame";
if (simple_block.is_discardable) flags += ", discardable";
if (simple_block.is_key_frame)
flags += ", key frame";
if (simple_block.is_discardable)
flags += ", discardable";
PrintValue("flags", flags);
*action = Action::kRead;
return Status(Status::kOkCompleted);
@ -1096,16 +1098,15 @@ class DemoCallback : public Callback {
int main(int argc, char* argv[]) {
if ((argc != 1 && argc != 2) ||
(argc == 2 && argv[1] == std::string("--help"))) {
std::cerr << "Usage:\n"
<< argv[0] << " [path-to-webm-file]\n\n"
std::cerr << "Usage:\n" << argv[0] << " [path-to-webm-file]\n\n"
<< "Prints info for the WebM file specified in the command line. "
"If no file is\n"
<< "specified, stdin is used as input.\n";
return EXIT_FAILURE;
}
FILE* file = (argc == 2) ? std::fopen(argv[1], "rb")
: std::freopen(nullptr, "rb", stdin);
FILE* file = (argc == 2) ? std::fopen(argv[1], "rb") :
std::freopen(nullptr, "rb", stdin);
if (!file) {
std::cerr << "File cannot be opened\n";
return EXIT_FAILURE;

View File

@ -63,8 +63,8 @@ extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t* data,
#if __AFL_COMPILER
int main(int argc, char* argv[]) {
FILE* file = (argc == 2) ? std::fopen(argv[1], "rb")
: std::freopen(nullptr, "rb", stdin);
FILE* file = (argc == 2) ? std::fopen(argv[1], "rb") :
std::freopen(nullptr, "rb", stdin);
if (!file) {
std::cerr << "File cannot be opened\n";
return EXIT_FAILURE;

View File

@ -36,7 +36,8 @@ namespace webm {
Otherwise it will return false since the element was ommitted or skipped when
parsing.
*/
template <typename T> class Element {
template <typename T>
class Element {
public:
/**
Value-initializes the element's value and makes `is_present()` false.

View File

@ -72,7 +72,8 @@ class FileReader : public Reader {
private:
struct FileCloseFunctor {
void operator()(FILE* file) const {
if (file) std::fclose(file);
if (file)
std::fclose(file);
}
};

View File

@ -45,7 +45,8 @@ class IstreamReader : public Reader {
reference derived from `std::istream`.
*/
template <typename T>
explicit IstreamReader(T&& istream) : istream_(new T(std::move(istream))) {}
explicit IstreamReader(T&& istream)
: istream_(new T(std::move(istream))) {}
/**
Constructs a new reader by moving the provided reader into the new reader.

View File

@ -60,7 +60,7 @@ class Ancestory {
// Constructs an Ancestory using the first count elements of ancestory.
// ancestory must have static storage duration.
template <std::size_t N>
Ancestory(const Id (&ancestory)[N], std::size_t count)
Ancestory(const Id(&ancestory)[N], std::size_t count)
: begin_(ancestory), end_(ancestory + count) {
assert(count <= N);
}

View File

@ -13,7 +13,8 @@ namespace webm {
std::uint8_t CountLeadingZeros(std::uint8_t value) {
// Special case for 0 since we can't shift by sizeof(T) * 8 bytes.
if (value == 0) return 8;
if (value == 0)
return 8;
std::uint8_t count = 0;
while (!(value & (0x80 >> count))) {

View File

@ -50,11 +50,13 @@ class BlockHeaderParser : public Parser {
int timecode_bytes_remaining_ = 2;
enum class State {
/* clang-format off */
// State Transitions to state When
kReadingTrackNumber, // kReadingTimecode track parsed
kReadingTimecode, // kReadingFlags timecode parsed
kReadingFlags, // kDone flags parsed
kDone, // No transitions from here (must call Init)
/* clang-format on */
} state_ = State::kReadingTrackNumber;
};

View File

@ -274,7 +274,8 @@ Status BasicBlockParser<T>::Feed(Callback* callback, Reader* reader,
}
}
template <typename T> bool BasicBlockParser<T>::WasSkipped() const {
template <typename T>
bool BasicBlockParser<T>::WasSkipped() const {
return state_ == State::kSkipping;
}

View File

@ -33,7 +33,8 @@ namespace webm {
// http://www.webmproject.org/docs/container/#Block
// http://matroska.org/technical/specs/index.html#block_structure
// http://matroska.org/technical/specs/index.html#simpleblock_structure
template <typename T> class BasicBlockParser : public ElementParser {
template <typename T>
class BasicBlockParser : public ElementParser {
static_assert(std::is_same<T, Block>::value ||
std::is_same<T, SimpleBlock>::value,
"T must be Block or SimpleBlock");
@ -89,6 +90,7 @@ template <typename T> class BasicBlockParser : public ElementParser {
// Parsing states for the finite-state machine.
enum class State {
/* clang-format off */
// State Transitions to state When
kReadingHeader, // kGettingAction no lacing
// kReadingLaceCount yes lacing
@ -106,6 +108,7 @@ template <typename T> class BasicBlockParser : public ElementParser {
kSkipping, // No transitions from here (must call Init)
kReadingFrames, // kDone all frames read
kDone, // No transitions from here (must call Init)
/* clang-format on */
};
// The current state of the parser.

View File

@ -26,7 +26,8 @@ namespace webm {
// Spec reference for string/binary elements:
// http://matroska.org/technical/specs/index.html#EBML_ex
// https://github.com/Matroska-Org/ebml-specification/blob/master/specification.markdown#ebml-element-types
template <typename T> class ByteParser : public ElementParser {
template <typename T>
class ByteParser : public ElementParser {
public:
static_assert(std::is_same<T, std::vector<std::uint8_t>>::value ||
std::is_same<T, std::string>::value,

View File

@ -135,7 +135,8 @@ Status Callback::Skip(Reader* reader, std::uint64_t* bytes_remaining) {
assert(reader != nullptr);
assert(bytes_remaining != nullptr);
if (*bytes_remaining == 0) return Status(Status::kOkCompleted);
if (*bytes_remaining == 0)
return Status(Status::kOkCompleted);
Status status;
do {

View File

@ -73,9 +73,9 @@ Status FileReader::Skip(std::uint64_t num_to_skip,
}
// Try seeking forward first.
long seek_offset = std::numeric_limits<long>::max(); // NOLINT
long seek_offset = std::numeric_limits<long>::max(); // NOLINT
if (num_to_skip < static_cast<unsigned long>(seek_offset)) { // NOLINT
seek_offset = static_cast<long>(num_to_skip); // NOLINT
seek_offset = static_cast<long>(num_to_skip); // NOLINT
}
// TODO(mjbshaw): Use fseeko64/_fseeki64 if available.
if (!std::fseek(file_.get(), seek_offset, SEEK_CUR)) {

View File

@ -27,7 +27,8 @@ namespace webm {
// http://matroska.org/technical/specs/index.html#EBML_ex
// https://github.com/Matroska-Org/ebml-specification/blob/master/specification.markdown#element-data-size
// https://github.com/Matroska-Org/ebml-specification/blob/master/specification.markdown#ebml-element-types
template <typename T> class IntParser : public ElementParser {
template <typename T>
class IntParser : public ElementParser {
public:
static_assert(
std::is_same<T, std::int64_t>::value ||

View File

@ -55,7 +55,8 @@ class MasterParser : public ElementParser {
//
// Initializer lists don't support move-only types (i.e. std::unique_ptr), so
// instead a variadic template is used.
template <typename... T> explicit MasterParser(T&&... parser_pairs) {
template <typename... T>
explicit MasterParser(T&&... parser_pairs) {
// Prefer an odd reserve size. This makes libc++ use a prime number for the
// bucket count. Otherwise, if it happens to be a power of 2, then libc++
// will use a power-of-2 bucket count (and since Matroska EBML IDs have low
@ -127,6 +128,7 @@ class MasterParser : public ElementParser {
private:
// Parsing states for the finite-state machine.
enum class State {
/* clang-format off */
// State Transitions to state When
kFirstReadOfChildId, // kFinishingReadingChildId size(id) > 1
// kReadingChildSize size(id) == 1
@ -142,6 +144,7 @@ class MasterParser : public ElementParser {
// kFirstReadOfChildId read < my_size_
// kEndReached read == my_size_
kEndReached, // No transitions from here (must call Init)
/* clang-format on */
};
using StdHashId = std::hash<std::underlying_type<Id>::type>;
@ -204,9 +207,10 @@ class MasterParser : public ElementParser {
// Inserts the parser into the parsers_ map and asserts it is the only parser
// registers to parse the corresponding Id.
template <typename T> void InsertParser(T&& parser) {
template <typename T>
void InsertParser(T&& parser) {
bool inserted = parsers_.insert(std::forward<T>(parser)).second;
(void)inserted; // Silence unused variable warning.
(void)inserted; // Silence unused variable warning.
assert(inserted); // Make sure there aren't duplicates.
}

View File

@ -58,7 +58,8 @@ namespace webm {
// : MasterValueParser(MakeChild<BoolParser>(Id::kBar, &Foo::bar),
// MakeChild<BoolParser>(Id::kBaz, &Foo::baz)) {}
// };
template <typename T> class MasterValueParser : public ElementParser {
template <typename T>
class MasterValueParser : public ElementParser {
public:
Status Init(const ElementMetadata& metadata,
std::uint64_t max_size) override {
@ -179,7 +180,7 @@ template <typename T> class MasterValueParser : public ElementParser {
// If called, OnParseStarted will be called on the parent element when this
// particular element is encountered.
constexpr SingleChildFactory<Parser, Value, TagUseAsStart, Tags...>
UseAsStartEvent() const {
UseAsStartEvent() const {
return {id_, member_};
}
@ -187,7 +188,7 @@ template <typename T> class MasterValueParser : public ElementParser {
// particular element is fully parsed.
constexpr SingleChildFactory<Parser, Value, TagNotifyOnParseComplete,
Tags...>
NotifyOnParseComplete() const {
NotifyOnParseComplete() const {
return {id_, member_};
}
@ -226,7 +227,7 @@ template <typename T> class MasterValueParser : public ElementParser {
// If called, OnParseStarted will be called on the parent element when this
// particular element is encountered.
constexpr RepeatedChildFactory<Parser, Value, TagUseAsStart, Tags...>
UseAsStartEvent() const {
UseAsStartEvent() const {
return {id_, member_};
}
@ -234,7 +235,7 @@ template <typename T> class MasterValueParser : public ElementParser {
// particular element is fully parsed.
constexpr RepeatedChildFactory<Parser, Value, TagNotifyOnParseComplete,
Tags...>
NotifyOnParseComplete() const {
NotifyOnParseComplete() const {
return {id_, member_};
}
@ -340,10 +341,12 @@ template <typename T> class MasterValueParser : public ElementParser {
// Helper struct that will be std::true_type if Tag is in Tags, or
// std::false_type otherwise.
template <typename Tag, typename... Tags> struct HasTag;
template <typename Tag, typename... Tags>
struct HasTag;
// Base condition: Tags is empty, so it trivially does not contain Tag.
template <typename Tag> struct HasTag<Tag> : std::false_type {};
template <typename Tag>
struct HasTag<Tag> : std::false_type {};
// If the head of the Tags list is a different tag, skip it and check the
// remaining tags.
@ -409,7 +412,8 @@ template <typename T> class MasterValueParser : public ElementParser {
return Status(Status::kOkCompleted);
}
template <typename Tag> constexpr static bool has_tag() {
template <typename Tag>
constexpr static bool has_tag() {
return HasTag<Tag, Tags...>::value;
}
};
@ -419,7 +423,7 @@ template <typename T> class MasterValueParser : public ElementParser {
template <typename Parser, typename Value, typename... Tags, typename F>
static typename std::enable_if<!std::is_constructible<Parser, Value>::value,
std::unique_ptr<ElementParser>>::type
MakeChildParser(MasterValueParser* parent, F consume_element_value, ...) {
MakeChildParser(MasterValueParser* parent, F consume_element_value, ...) {
return std::unique_ptr<ElementParser>(new ChildParser<Parser, F, Tags...>(
parent, std::move(consume_element_value)));
}
@ -429,8 +433,8 @@ template <typename T> class MasterValueParser : public ElementParser {
template <typename Parser, typename Value, typename... Tags, typename F>
static typename std::enable_if<std::is_constructible<Parser, Value>::value,
std::unique_ptr<ElementParser>>::type
MakeChildParser(MasterValueParser* parent, F consume_element_value,
const Element<Value>* default_value) {
MakeChildParser(MasterValueParser* parent, F consume_element_value,
const Element<Value>* default_value) {
return std::unique_ptr<ElementParser>(new ChildParser<Parser, F, Tags...>(
parent, std::move(consume_element_value), default_value->value()));
}
@ -440,8 +444,8 @@ template <typename T> class MasterValueParser : public ElementParser {
template <typename Parser, typename Value, typename... Tags, typename F>
static typename std::enable_if<std::is_constructible<Parser, Value>::value,
std::unique_ptr<ElementParser>>::type
MakeChildParser(MasterValueParser* parent, F consume_element_value,
const std::vector<Element<Value>>* member) {
MakeChildParser(MasterValueParser* parent, F consume_element_value,
const std::vector<Element<Value>>* member) {
Value default_value{};
if (!member->empty()) {
default_value = member->front().value();

View File

@ -24,7 +24,8 @@ namespace webm {
// parsing operations. The parser is allocated when Init is called. This class
// is intended to be used with recursive elements, where a parser needs to
// recursively instantiate parsers of the same type.
template <typename T> class RecursiveParser : public ElementParser {
template <typename T>
class RecursiveParser : public ElementParser {
public:
RecursiveParser() = default;

View File

@ -55,10 +55,12 @@ class VirtualBlockParser : public ElementParser {
BlockHeaderParser parser_;
enum class State {
/* clang-format off */
// State Transitions to state When
kReadingHeader, // kValidatingSize header parsed
kValidatingSize, // kDone no errors
kDone, // No transitions from here (must call Init)
/* clang-format on */
} state_ = State::kReadingHeader;
};

View File

@ -184,6 +184,7 @@ class WebmParser::DocumentParser {
private:
// Parsing states for the finite-state machine.
enum class State {
/* clang-format off */
// State Transitions to state When
kBegin, // kReadingChildId done
kReadingChildId, // kReadingChildSize done
@ -195,6 +196,7 @@ class WebmParser::DocumentParser {
kReadingChildBody, // kValidatingChildSize cached metadata
// kReadingChildId otherwise
kEndReached, // No transitions from here
/* clang-format on */
};
// The parser for parsing child element Ids.

View File

@ -24,7 +24,8 @@ namespace webm {
// Base class for unit tests that test an instance of the Parser inteface. The
// template parameter T is the parser class being tested.
template <typename T> class ParserTest : public testing::Test {
template <typename T>
class ParserTest : public testing::Test {
public:
// Sets the reader's internal buffer to the given buffer.
virtual void SetReaderData(std::vector<std::uint8_t> data) {
@ -34,7 +35,8 @@ template <typename T> class ParserTest : public testing::Test {
// Destroys and recreates the parser, forwarding the arguments to the
// constructor. This is primarily useful for tests that require the parser to
// have different constructor parameters.
template <typename... Args> void ResetParser(Args&&... args) {
template <typename... Args>
void ResetParser(Args&&... args) {
parser_.~T();
new (&parser_) T(std::forward<Args>(args)...);
}

View File

@ -41,17 +41,17 @@ TEST_F(AudioParserTest, DefaultParse) {
TEST_F(AudioParserTest, DefaultValues) {
SetReaderData({
0xB5, // ID = 0x85 (SamplingFrequency).
0xB5, // ID = 0x85 (SamplingFrequency).
0x40, 0x00, // Size = 0.
0x78, 0xB5, // ID = 0x78B5 (OutputSamplingFrequency).
0x80, // Size = 0.
0x80, // Size = 0.
0x9F, // ID = 0x9F (Channels).
0x9F, // ID = 0x9F (Channels).
0x40, 0x00, // Size = 0.
0x62, 0x64, // ID = 0x6264 (BitDepth).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -73,21 +73,21 @@ TEST_F(AudioParserTest, DefaultValues) {
TEST_F(AudioParserTest, CustomValues) {
SetReaderData({
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0x3F, 0x80, 0x00, 0x00, // Body (value = 1.0f).
0x78, 0xB5, // ID = 0x78B5 (OutputSamplingFrequency).
0x84, // Size = 4.
0x78, 0xB5, // ID = 0x78B5 (OutputSamplingFrequency).
0x84, // Size = 4.
0x3F, 0xDD, 0xB3, 0xD7, // Body (value = 1.73205077648162841796875f).
0x9F, // ID = 0x9F (Channels).
0x9F, // ID = 0x9F (Channels).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x62, 0x64, // ID = 0x6264 (BitDepth).
0x62, 0x64, // ID = 0x6264 (BitDepth).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
ParseAndVerify();
@ -109,8 +109,8 @@ TEST_F(AudioParserTest, CustomValues) {
TEST_F(AudioParserTest, AbsentOutputSamplingFrequency) {
SetReaderData({
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0x3F, 0x80, 0x00, 0x00, // Body (value = 1.0f).
});
@ -133,11 +133,11 @@ TEST_F(AudioParserTest, AbsentOutputSamplingFrequency) {
TEST_F(AudioParserTest, DefaultOutputSamplingFrequency) {
SetReaderData({
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0xB5, // ID = 0x85 (SamplingFrequency).
0x84, // Size = 4.
0x3F, 0x80, 0x00, 0x00, // Body (value = 1.0f).
0x78, 0xB5, // ID = 0x78B5 (OutputSamplingFrequency).
0x78, 0xB5, // ID = 0x78B5 (OutputSamplingFrequency).
0x10, 0x00, 0x00, 0x00, // Size = 0.
});

View File

@ -72,32 +72,32 @@ TEST_F(BlockGroupParserTest, DefaultParse) {
TEST_F(BlockGroupParserTest, DefaultValues) {
SetReaderData({
0xA1, // ID = 0xA1 (Block).
0x85, // Size = 5.
0x81, // Track number = 1.
0xA1, // ID = 0xA1 (Block).
0x85, // Size = 5.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0xA2, // ID = 0xA2 (BlockVirtual).
0x84, // Size = 4.
0x81, // Track number = 1.
0xA2, // ID = 0xA2 (BlockVirtual).
0x84, // Size = 4.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Flags = 0.
0x75, 0xA1, // ID = 0x75A1 (BlockAdditions).
0x80, // Size = 0.
0x80, // Size = 0.
0x9B, // ID = 0x9B (BlockDuration).
0x9B, // ID = 0x9B (BlockDuration).
0x40, 0x00, // Size = 0.
0xFB, // ID = 0xFB (ReferenceBlock).
0xFB, // ID = 0xFB (ReferenceBlock).
0x40, 0x00, // Size = 0.
0x75, 0xA2, // ID = 0x75A2 (DiscardPadding).
0x80, // Size = 0.
0x80, // Size = 0.
0x8E, // ID = 0x8E (Slices).
0x8E, // ID = 0x8E (Slices).
0x40, 0x00, // Size = 0.
});
@ -137,45 +137,45 @@ TEST_F(BlockGroupParserTest, DefaultValues) {
TEST_F(BlockGroupParserTest, CustomValues) {
SetReaderData({
0xA1, // ID = 0xA1 (Block).
0x85, // Size = 5.
0x82, // Track number = 2.
0xA1, // ID = 0xA1 (Block).
0x85, // Size = 5.
0x82, // Track number = 2.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0xA2, // ID = 0xA2 (BlockVirtual).
0x84, // Size = 4.
0x83, // Track number = 3.
0xA2, // ID = 0xA2 (BlockVirtual).
0x84, // Size = 4.
0x83, // Track number = 3.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Flags = 0.
0x75, 0xA1, // ID = 0x75A1 (BlockAdditions).
0x83, // Size = 3.
0x83, // Size = 3.
0xA6, // ID = 0xA6 (BlockMore).
0xA6, // ID = 0xA6 (BlockMore).
0x40, 0x00, // Size = 0.
0x9B, // ID = 0x9B (BlockDuration).
0x9B, // ID = 0x9B (BlockDuration).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xFB, // ID = 0xFB (ReferenceBlock).
0xFB, // ID = 0xFB (ReferenceBlock).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xFB, // ID = 0xFB (ReferenceBlock).
0xFB, // ID = 0xFB (ReferenceBlock).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x75, 0xA2, // ID = 0x75A2 (DiscardPadding).
0x81, // Size = 1.
0xFF, // Body (value = -1).
0x81, // Size = 1.
0xFF, // Body (value = -1).
0x8E, // ID = 0x8E (Slices).
0x8E, // ID = 0x8E (Slices).
0x40, 0x03, // Size = 3.
0xE8, // ID = 0xE8 (TimeSlice).
0xE8, // ID = 0xE8 (TimeSlice).
0x40, 0x00, // Size = 0.
});

View File

@ -22,9 +22,9 @@ class BlockHeaderParserTest : public ParserTest<BlockHeaderParser> {};
TEST_F(BlockHeaderParserTest, ValidBlock) {
SetReaderData({
0x81, // Track number = 1.
0x81, // Track number = 1.
0x12, 0x34, // Timecode = 4660.
0x00, // Flags.
0x00, // Flags.
});
ParseAndVerify();
@ -39,8 +39,8 @@ TEST_F(BlockHeaderParserTest, ValidBlock) {
TEST_F(BlockHeaderParserTest, IncrementalParse) {
SetReaderData({
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // Track number = 2.
0xFF, 0xFE, // Timecode = -2.
0xFF, // Flags.
0xFF, 0xFE, // Timecode = -2.
0xFF, // Flags.
});
IncrementalParseAndVerify();

View File

@ -68,10 +68,10 @@ struct TestData {
const TestData ebml_lacing_one_frame = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x86, // Flags = key_frame | ebml_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
0x86, // Flags = key_frame | ebml_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
// Lace data (1 frame).
// Frame 0.
@ -79,13 +79,13 @@ const TestData ebml_lacing_one_frame = {
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kEbml, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -96,10 +96,10 @@ const TestData ebml_lacing_one_frame = {
const TestData xiph_lacing_one_frame = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x82, // Flags = key_frame | xiph_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
0x82, // Flags = key_frame | xiph_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
// Lace data (1 frame).
// Frame 0.
@ -107,13 +107,13 @@ const TestData xiph_lacing_one_frame = {
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kXiph, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -124,23 +124,23 @@ const TestData xiph_lacing_one_frame = {
const TestData fixed_lacing_one_frame = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x84, // Flags = key_frame | fixed_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
0x84, // Flags = key_frame | fixed_lacing.
0x00, // Lace count - 1 = 0 (1 frame).
// Lace data (1 frame).
0x00,
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kFixed, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -151,17 +151,17 @@ const TestData fixed_lacing_one_frame = {
const TestData ebml_lacing = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x86, // Flags = key_frame | ebml_lacing.
0x05, // Lace count - 1 = 5 (6 frames).
0x86, // Flags = key_frame | ebml_lacing.
0x05, // Lace count - 1 = 5 (6 frames).
// Lace data (6 frames).
0xFF, // Lace 0 size = 127.
0xFF, // Lace 0 size = 127.
0x5F, 0x81, // Lace 1 size = 1.
0xC0, // Lace 2 size = 2.
0xFF, // Lace 3 size = 66.
0x81, // Lace 4 size = 4.
0xC0, // Lace 2 size = 2.
0xFF, // Lace 3 size = 66.
0x81, // Lace 4 size = 4.
// Lace 5 size inferred to be 5.
// Lace data (6 frames).
@ -200,13 +200,13 @@ const TestData ebml_lacing = {
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kEbml, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
6, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
6, // expected_num_frames
11, // expected_frame_start_position
// expected_frame_sizes
@ -217,15 +217,15 @@ const TestData ebml_lacing = {
const TestData xiph_lacing = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x82, // Flags = key_frame | xiph_lacing.
0x03, // Lace count - 1 = 3 (4 frames).
0x82, // Flags = key_frame | xiph_lacing.
0x03, // Lace count - 1 = 3 (4 frames).
// Lace sizes.
0xFF, 0xFF, 0x00, // Lace 0 size = 510.
0xFF, 0x01, // Lace 1 size = 256.
0x02, // Lace 2 size = 2.
0xFF, 0x01, // Lace 1 size = 256.
0x02, // Lace 2 size = 2.
// Lace 3 size inferred to be 3.
// Lace data (4 frames).
@ -306,13 +306,13 @@ const TestData xiph_lacing = {
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kXiph, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
4, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
4, // expected_num_frames
11, // expected_frame_start_position
// expected_frame_sizes
@ -323,10 +323,10 @@ const TestData xiph_lacing = {
const TestData fixed_lacing = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x84, // Flags = key_frame | fixed_lacing.
0x03, // Lace count - 1 = 3 (4 frames).
0x84, // Flags = key_frame | fixed_lacing.
0x03, // Lace count - 1 = 3 (4 frames).
// Lace data (4 frames).
0x00, 0x00, // Frame 0.
@ -336,13 +336,13 @@ const TestData fixed_lacing = {
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kFixed, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
4, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
4, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -355,20 +355,20 @@ const TestData no_lacing = {
{
0x40, 0x01, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x80, // Flags = key_frame.
0x80, // Flags = key_frame.
// Lace data (1 frame).
0x00, 0x00, 0x00, // Frame 0.
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kNone, // expected_lacing
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
true, // expected_is_visible
true, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -379,22 +379,22 @@ const TestData no_lacing = {
const TestData no_flags = {
// Data.
{
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Flags = 0.
// Lace data (1 frame).
0x00,
},
// Expected results.
1, // expected_track_number
0, // expected_timecode
1, // expected_track_number
0, // expected_timecode
Lacing::kNone, // expected_lacing
true, // expected_is_visible
false, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
true, // expected_is_visible
false, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
4, // expected_frame_start_position
// expected_frame_sizes
@ -406,22 +406,22 @@ const TestData no_flags = {
const TestData block_flags = {
// Data.
{
0x82, // Track number = 2.
0x82, // Track number = 2.
0xFE, 0xDC, // Timecode = -292.
0x08, // Flags = invisible.
0x08, // Flags = invisible.
// Lace data (1 frame).
0x00,
},
// Expected results.
2, // expected_track_number
-292, // expected_timecode
2, // expected_track_number
-292, // expected_timecode
Lacing::kNone, // expected_lacing
false, // expected_is_visible
false, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
false, // expected_is_visible
false, // expected_is_key_frame
false, // expected_is_discardable
1, // expected_num_frames
4, // expected_frame_start_position
// expected_frame_sizes
@ -435,20 +435,20 @@ const TestData simple_block_flags = {
{
0x41, 0x23, // Track number = 291.
0x12, 0x34, // Timecode = 4660.
0x89, // Flags = key_frame | invisible | discardable.
0x89, // Flags = key_frame | invisible | discardable.
// Lace data (1 frame).
0x00,
},
// Expected results.
291, // expected_track_number
4660, // expected_timecode
291, // expected_track_number
4660, // expected_timecode
Lacing::kNone, // expected_lacing
false, // expected_is_visible
true, // expected_is_key_frame
true, // expected_is_discardable
1, // expected_num_frames
false, // expected_is_visible
true, // expected_is_key_frame
true, // expected_is_discardable
1, // expected_num_frames
5, // expected_frame_start_position
// expected_frame_sizes
@ -613,14 +613,14 @@ class BasicBlockParserTest : public ElementParserTest<T, id> {
// Tests an invalid fixed-lace block that has inconsistent frame sizes.
void TestInvalidFixedLaceSizes() {
SetReaderData({
0x81, // Track number = 1.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x84, // Flags = key_frame | fixed_lacing.
0x01, // Lace count - 1 = 1 (2 frames).
0x84, // Flags = key_frame | fixed_lacing.
0x01, // Lace count - 1 = 1 (2 frames).
// Lace data (2 frames).
0x00, 0x00, // Frame 0.
0x01, // Frame 1 (invalid: inconsistent frame size).
0x01, // Frame 1 (invalid: inconsistent frame size).
});
EXPECT_CALL(callback_, OnFrame(_, _, _)).Times(0);

View File

@ -48,21 +48,21 @@ TEST_F(ChapterAtomParserTest, DefaultParse) {
TEST_F(ChapterAtomParserTest, DefaultValues) {
SetReaderData({
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x80, // Size = 0.
0x80, // Size = 0.
0x56, 0x54, // ID = 0x73C4 (ChapterStringUID).
0x80, // Size = 0.
0x80, // Size = 0.
0x91, // ID = 0x91 (ChapterTimeStart).
0x91, // ID = 0x91 (ChapterTimeStart).
0x40, 0x00, // Size = 0.
0x92, // ID = 0x91 (ChapterTimeEnd).
0x92, // ID = 0x91 (ChapterTimeEnd).
0x40, 0x00, // Size = 0.
0x80, // ID = 0x80 (ChapterDisplay).
0x80, // ID = 0x80 (ChapterDisplay).
0x40, 0x00, // Size = 0.
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x00, // Size = 0.
});
@ -94,55 +94,55 @@ TEST_F(ChapterAtomParserTest, DefaultValues) {
TEST_F(ChapterAtomParserTest, CustomValues) {
SetReaderData({
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x56, 0x54, // ID = 0x73C4 (ChapterStringUID).
0x81, // Size = 1.
0x41, // Body (value = "A").
0x81, // Size = 1.
0x41, // Body (value = "A").
0x91, // ID = 0x91 (ChapterTimeStart).
0x91, // ID = 0x91 (ChapterTimeStart).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x92, // ID = 0x91 (ChapterTimeEnd).
0x92, // ID = 0x91 (ChapterTimeEnd).
0x40, 0x01, // Size = 1.
0x03, // Body (value = 3).
0x03, // Body (value = 3).
0x80, // ID = 0x80 (ChapterDisplay).
0x80, // ID = 0x80 (ChapterDisplay).
0x40, 0x04, // Size = 4.
0x85, // ID = 0x85 (ChapString).
0x85, // ID = 0x85 (ChapString).
0x40, 0x01, // Size = 1.
0x42, // Body (value = "B").
0x42, // Body (value = "B").
0x80, // ID = 0x80 (ChapterDisplay).
0x80, // ID = 0x80 (ChapterDisplay).
0x40, 0x04, // Size = 4.
0x85, // ID = 0x85 (ChapString).
0x85, // ID = 0x85 (ChapString).
0x40, 0x01, // Size = 1.
0x43, // Body (value = "C").
0x43, // Body (value = "C").
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x12, // Size = 18.
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x81, // Size = 1.
0x04, // Body (value = 4).
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x04, // Size = 4.
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x05, // Body (value = 5).
0x81, // Size = 1.
0x05, // Body (value = 5).
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x04, // Size = 4.
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x06, // Body (value = 6).
0x81, // Size = 1.
0x06, // Body (value = 6).
});
ParseAndVerify();

View File

@ -39,14 +39,14 @@ TEST_F(ChapterDisplayParserTest, DefaultParse) {
TEST_F(ChapterDisplayParserTest, DefaultValues) {
SetReaderData({
0x85, // ID = 0x85 (ChapString).
0x85, // ID = 0x85 (ChapString).
0x40, 0x00, // Size = 0.
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x80, // Size = 0.
0x80, // Size = 0.
0x43, 0x7E, // ID = 0x437E (ChapCountry).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -67,28 +67,28 @@ TEST_F(ChapterDisplayParserTest, DefaultValues) {
TEST_F(ChapterDisplayParserTest, CustomValues) {
SetReaderData({
0x85, // ID = 0x85 (ChapString).
0x40, 0x05, // Size = 5.
0x85, // ID = 0x85 (ChapString).
0x40, 0x05, // Size = 5.
0x68, 0x65, 0x6C, 0x6C, 0x6F, // Body (value = "hello").
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x6C, 0x61, 0x6E, 0x67, 0x30, // body (value = "lang0").
0x43, 0x7E, // ID = 0x437E (ChapCountry).
0x85, // Size = 5.
0x43, 0x7E, // ID = 0x437E (ChapCountry).
0x85, // Size = 5.
0x61, 0x72, 0x65, 0x61, 0x30, // Body (value = "area0").
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x6C, 0x61, 0x6E, 0x67, 0x31, // body (value = "lang1").
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x43, 0x7C, // ID = 0x437C (ChapLanguage).
0x85, // Size = 5.
0x6C, 0x61, 0x6E, 0x67, 0x32, // body (value = "lang2").
0x43, 0x7E, // ID = 0x437E (ChapCountry).
0x85, // Size = 5.
0x43, 0x7E, // ID = 0x437E (ChapCountry).
0x85, // Size = 5.
0x61, 0x72, 0x65, 0x61, 0x31, // Body (value = "area1").
});

View File

@ -26,7 +26,7 @@ TEST_F(ChaptersParserTest, DefaultValues) {
SetReaderData({
0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
}
@ -34,18 +34,18 @@ TEST_F(ChaptersParserTest, DefaultValues) {
TEST_F(ChaptersParserTest, RepeatedValues) {
SetReaderData({
0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
0x84, // Size = 4.
0x84, // Size = 4.
0x45, 0xBC, // ID = 0x45BC (EditionUID).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
0x84, // Size = 4.
0x84, // Size = 4.
0x45, 0xBC, // ID = 0x45BC (EditionUID).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
ParseAndVerify();

View File

@ -52,20 +52,20 @@ TEST_F(ClusterParserTest, DefaultParse) {
TEST_F(ClusterParserTest, DefaultValues) {
SetReaderData({
0xE7, // ID = 0xE7 (Timecode).
0xE7, // ID = 0xE7 (Timecode).
0x40, 0x00, // Size = 0.
0xAB, // ID = 0xAB (PrevSize).
0xAB, // ID = 0xAB (PrevSize).
0x40, 0x00, // Size = 0.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0xA0, // ID = 0xA0 (BlockGroup).
0xA0, // ID = 0xA0 (BlockGroup).
0x40, 0x00, // Size = 0.
});
@ -96,41 +96,41 @@ TEST_F(ClusterParserTest, DefaultValues) {
TEST_F(ClusterParserTest, CustomValues) {
SetReaderData({
0xE7, // ID = 0xE7 (Timecode).
0xE7, // ID = 0xE7 (Timecode).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xAB, // ID = 0xAB (PrevSize).
0xAB, // ID = 0xAB (PrevSize).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x82, // Track number = 2.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x82, // Track number = 2.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0xA0, // ID = 0xA0 (BlockGroup).
0xA0, // ID = 0xA0 (BlockGroup).
0x40, 0x04, // Size = 4.
0x9B, // ID = 0x9B (BlockDuration).
0x9B, // ID = 0x9B (BlockDuration).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xA0, // ID = 0xA0 (BlockGroup).
0xA0, // ID = 0xA0 (BlockGroup).
0x40, 0x04, // Size = 4.
0x9B, // ID = 0x9B (BlockDuration).
0x9B, // ID = 0x9B (BlockDuration).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
});
{
@ -192,12 +192,12 @@ TEST_F(ClusterParserTest, SkipOnClusterBegin) {
TEST_F(ClusterParserTest, SkipSimpleBlock) {
SetReaderData({
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0xA3, // ID = 0xA3 (SimpleBlock).
0x85, // Size = 5.
0x81, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags = 0.
0x00, // Frame 0.
0x00, // Flags = 0.
0x00, // Frame 0.
});
{
@ -224,12 +224,12 @@ TEST_F(ClusterParserTest, SkipSimpleBlock) {
TEST_F(ClusterParserTest, SkipBlockGroup) {
SetReaderData({
0xA0, // ID = 0xA0 (BlockGroup).
0xA0, // ID = 0xA0 (BlockGroup).
0x40, 0x04, // Size = 4.
0x9B, // ID = 0x9B (BlockDuration).
0x9B, // ID = 0x9B (BlockDuration).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
{

View File

@ -79,46 +79,46 @@ TEST_F(ColourParserTest, DefaultParse) {
TEST_F(ColourParserTest, DefaultValues) {
SetReaderData({
0x55, 0xB1, // ID = 0x55B1 (MatrixCoefficients).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB2, // ID = 0x55B2 (BitsPerChannel).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB3, // ID = 0x55B3 (ChromaSubsamplingHorz).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB4, // ID = 0x55B4 (ChromaSubsamplingVert).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB5, // ID = 0x55B5 (CbSubsamplingHorz).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB6, // ID = 0x55B6 (CbSubsamplingVert).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB7, // ID = 0x55B7 (ChromaSitingHorz).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB8, // ID = 0x55B8 (ChromaSitingVert).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB9, // ID = 0x55B9 (Range).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xBA, // ID = 0x55BA (TransferCharacteristics).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xBB, // ID = 0x55BB (Primaries).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xBC, // ID = 0x55BC (MaxCLL).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xBD, // ID = 0x55BD (MaxFALL).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD0, // ID = 0x55D0 (MasteringMetadata).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -173,62 +173,62 @@ TEST_F(ColourParserTest, DefaultValues) {
TEST_F(ColourParserTest, CustomValues) {
SetReaderData({
0x55, 0xB1, // ID = 0x55B1 (MatrixCoefficients).
0x81, // Size = 1.
0x01, // Body (value = BT.709).
0x81, // Size = 1.
0x01, // Body (value = BT.709).
0x55, 0xB2, // ID = 0x55B2 (BitsPerChannel).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x55, 0xB3, // ID = 0x55B3 (ChromaSubsamplingHorz).
0x81, // Size = 1.
0x03, // Body (value = 3).
0x81, // Size = 1.
0x03, // Body (value = 3).
0x55, 0xB4, // ID = 0x55B4 (ChromaSubsamplingVert).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x55, 0xB5, // ID = 0x55B5 (CbSubsamplingHorz).
0x81, // Size = 1.
0x05, // Body (value = 5).
0x81, // Size = 1.
0x05, // Body (value = 5).
0x55, 0xB6, // ID = 0x55B6 (CbSubsamplingVert).
0x81, // Size = 1.
0x06, // Body (value = 6).
0x81, // Size = 1.
0x06, // Body (value = 6).
0x55, 0xB7, // ID = 0x55B7 (ChromaSitingHorz).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x55, 0xB8, // ID = 0x55B8 (ChromaSitingVert).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x55, 0xB9, // ID = 0x55B9 (Range).
0x81, // Size = 1.
0x03, // Body (value = 3 (derived)).
0x81, // Size = 1.
0x03, // Body (value = 3 (derived)).
0x55, 0xBA, // ID = 0x55BA (TransferCharacteristics).
0x81, // Size = 1.
0x04, // Body (value = BT.4706 System M with display gamma 2.2).
0x81, // Size = 1.
0x04, // Body (value = BT.4706 System M with display gamma 2.2).
0x55, 0xBB, // ID = 0x55BB (Primaries).
0x81, // Size = 1.
0x05, // Body (value = BT.4706 System B, G).
0x81, // Size = 1.
0x05, // Body (value = BT.4706 System B, G).
0x55, 0xBC, // ID = 0x55BC (MaxCLL).
0x81, // Size = 1.
0x06, // Body (value = 6).
0x81, // Size = 1.
0x06, // Body (value = 6).
0x55, 0xBD, // ID = 0x55BD (MaxFALL).
0x81, // Size = 1.
0x07, // Body (value = 7).
0x81, // Size = 1.
0x07, // Body (value = 7).
0x55, 0xD0, // ID = 0x55D0 (MasteringMetadata).
0x87, // Size = 7.
0x87, // Size = 7.
0x55, 0xD1, // ID = 0x55D1 (PrimaryRChromaticityX).
0x84, // Size = 4.
0x55, 0xD1, // ID = 0x55D1 (PrimaryRChromaticityX).
0x84, // Size = 4.
0x3F, 0x80, 0x00, 0x00, // Body (value = 1).
});

View File

@ -37,7 +37,7 @@ TEST_F(ContentEncAesSettingsParserTest, DefaultParse) {
TEST_F(ContentEncAesSettingsParserTest, DefaultValues) {
SetReaderData({
0x47, 0xE8, // ID = 0x47E8 (AESSettingsCipherMode).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -52,8 +52,8 @@ TEST_F(ContentEncAesSettingsParserTest, DefaultValues) {
TEST_F(ContentEncAesSettingsParserTest, CustomValues) {
SetReaderData({
0x47, 0xE8, // ID = 0x47E8 (AESSettingsCipherMode).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x81, // Size = 1.
0x00, // Body (value = 0).
});
ParseAndVerify();

View File

@ -46,16 +46,16 @@ TEST_F(ContentEncodingParserTest, DefaultParse) {
TEST_F(ContentEncodingParserTest, DefaultValues) {
SetReaderData({
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x80, // Size = 0.
0x80, // Size = 0.
0x50, 0x32, // ID = 0x5032 (ContentEncodingScope).
0x80, // Size = 0.
0x80, // Size = 0.
0x50, 0x33, // ID = 0x5033 (ContentEncodingType).
0x80, // Size = 0.
0x80, // Size = 0.
0x50, 0x35, // ID = 0x5035 (ContentEncryption).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -78,23 +78,23 @@ TEST_F(ContentEncodingParserTest, DefaultValues) {
TEST_F(ContentEncodingParserTest, CustomValues) {
SetReaderData({
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x50, 0x32, // ID = 0x5032 (ContentEncodingScope).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x50, 0x33, // ID = 0x5033 (ContentEncodingType).
0x81, // Size = 1.
0x01, // Body (value = encryption).
0x81, // Size = 1.
0x01, // Body (value = encryption).
0x50, 0x35, // ID = 0x5035 (ContentEncryption).
0x84, // Size = 4.
0x84, // Size = 4.
0x47, 0xE1, // ID = 0x47E1 (ContentEncAlgo).
0x81, // Size = 1.
0x05, // Body (value = AES).
0x81, // Size = 1.
0x05, // Body (value = AES).
});
ParseAndVerify();

View File

@ -35,7 +35,7 @@ TEST_F(ContentEncodingsParserTest, DefaultParse) {
TEST_F(ContentEncodingsParserTest, DefaultValues) {
SetReaderData({
0x62, 0x40, // ID = 0x6240 (ContentEncoding).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -50,18 +50,18 @@ TEST_F(ContentEncodingsParserTest, DefaultValues) {
TEST_F(ContentEncodingsParserTest, CustomValues) {
SetReaderData({
0x62, 0x40, // ID = 0x6240 (ContentEncoding).
0x84, // Size = 4.
0x84, // Size = 4.
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x62, 0x40, // ID = 0x6240 (ContentEncoding).
0x84, // Size = 4.
0x84, // Size = 4.
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
ParseAndVerify();

View File

@ -46,13 +46,13 @@ TEST_F(ContentEncryptionParserTest, DefaultParse) {
TEST_F(ContentEncryptionParserTest, DefaultValues) {
SetReaderData({
0x47, 0xE1, // ID = 0x47E1 (ContentEncAlgo).
0x80, // Size = 0.
0x80, // Size = 0.
0x47, 0xE2, // ID = 0x47E2 (ContentEncKeyID).
0x80, // Size = 0.
0x80, // Size = 0.
0x47, 0xE7, // ID = 0x47E7 (ContentEncAESSettings).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -72,19 +72,19 @@ TEST_F(ContentEncryptionParserTest, DefaultValues) {
TEST_F(ContentEncryptionParserTest, CustomValues) {
SetReaderData({
0x47, 0xE1, // ID = 0x47E1 (ContentEncAlgo).
0x81, // Size = 1.
0x05, // Body (value = AES).
0x81, // Size = 1.
0x05, // Body (value = AES).
0x47, 0xE2, // ID = 0x47E2 (ContentEncKeyID).
0x81, // Size = 1.
0x00, // Body.
0x81, // Size = 1.
0x00, // Body.
0x47, 0xE7, // ID = 0x47E7 (ContentEncAESSettings).
0x84, // Size = 4.
0x84, // Size = 4.
0x47, 0xE8, // ID = 0x47E8 (AESSettingsCipherMode).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x81, // Size = 1.
0x00, // Body (value = 0).
});
ParseAndVerify();

View File

@ -46,20 +46,20 @@ TEST_F(CueTrackPositionsParserTest, DefaultParse) {
TEST_F(CueTrackPositionsParserTest, DefaultValues) {
SetReaderData({
0xF7, // ID = 0xF7 (CueTrack).
0xF7, // ID = 0xF7 (CueTrack).
0x40, 0x00, // Size = 0.
0xF1, // ID = 0xF1 (CueClusterPosition).
0xF1, // ID = 0xF1 (CueClusterPosition).
0x40, 0x00, // Size = 0.
0xF0, // ID = 0xF0 (CueRelativePosition).
0xF0, // ID = 0xF0 (CueRelativePosition).
0x40, 0x00, // Size = 0.
0xB2, // ID = 0xB2 (CueDuration).
0xB2, // ID = 0xB2 (CueDuration).
0x40, 0x00, // Size = 0.
0x53, 0x78, // ID = 0x5378 (CueBlockNumber).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -84,25 +84,25 @@ TEST_F(CueTrackPositionsParserTest, DefaultValues) {
TEST_F(CueTrackPositionsParserTest, CustomValues) {
SetReaderData({
0xF7, // ID = 0xF7 (CueTrack).
0xF7, // ID = 0xF7 (CueTrack).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xF1, // ID = 0xF1 (CueClusterPosition).
0xF1, // ID = 0xF1 (CueClusterPosition).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0xF0, // ID = 0xF0 (CueRelativePosition).
0xF0, // ID = 0xF0 (CueRelativePosition).
0x40, 0x01, // Size = 1.
0x03, // Body (value = 3).
0x03, // Body (value = 3).
0xB2, // ID = 0xB2 (CueDuration).
0xB2, // ID = 0xB2 (CueDuration).
0x40, 0x01, // Size = 1.
0x04, // Body (value = 4).
0x04, // Body (value = 4).
0x53, 0x78, // ID = 0x5378 (CueBlockNumber).
0x81, // Size = 1.
0x05, // Body (value = 5).
0x81, // Size = 1.
0x05, // Body (value = 5).
});
ParseAndVerify();

View File

@ -31,31 +31,31 @@ TEST_F(EbmlParserTest, DefaultParse) {
TEST_F(EbmlParserTest, DefaultValues) {
SetReaderData({
0x42, 0x86, // ID = 0x4286 (EBMLVersion).
0x80, // Size = 0.
0x80, // Size = 0.
0x42, 0xF7, // ID = 0x42F7 (EBMLReadVersion).
0x80, // Size = 0.
0x80, // Size = 0.
0x42, 0xF2, // ID = 0x42F2 (EBMLMaxIDLength).
0x40, 0x00, // Size = 0.
0x42, 0xF3, // ID = 0x42F3 (EBMLMaxSizeLength).
0x80, // Size = 0.
0x80, // Size = 0.
0xEC, // ID = 0xEC (Void).
0xEC, // ID = 0xEC (Void).
0x40, 0x00, // Size = 0.
0x42, 0x82, // ID = 0x4282 (DocType).
0x40, 0x00, // Size = 0.
0x42, 0x87, // ID = 0x4287 (DocTypeVersion).
0x80, // Size = 0.
0x80, // Size = 0.
0x42, 0x85, // ID = 0x4285 (DocTypeReadVersion).
0x80, // Size = 0.
0x80, // Size = 0.
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0x01, 0x02, // Body.
});
@ -76,22 +76,22 @@ TEST_F(EbmlParserTest, DefaultValues) {
TEST_F(EbmlParserTest, CustomValues) {
SetReaderData({
0x42, 0x86, // ID = 0x4286 (EBMLVersion).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x42, 0xF7, // ID = 0x42F7 (EBMLReadVersion).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x42, 0xF2, // ID = 0x42F2 (EBMLMaxIDLength).
0x40, 0x02, // Size = 2.
0x00, 0x02, // Body (value = 2).
0x42, 0xF3, // ID = 0x42F3 (EBMLMaxSizeLength).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x81, // Size = 1.
0x04, // Body (value = 4).
0xEC, // ID = 0xEC (Void).
0xEC, // ID = 0xEC (Void).
0x40, 0x00, // Size = 0.
0x42, 0x82, // ID = 0x4282 (DocType).
@ -99,15 +99,15 @@ TEST_F(EbmlParserTest, CustomValues) {
0x48, 0x69, // Body (value = "Hi").
0x42, 0x87, // ID = 0x4287 (DocTypeVersion).
0x81, // Size = 1.
0xFF, // Body (value = 255).
0x81, // Size = 1.
0xFF, // Body (value = 255).
0x42, 0x85, // ID = 0x4285 (DocTypeReadVersion).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0x01, 0x02, // Body.
});

View File

@ -47,19 +47,19 @@ TEST_F(EditionEntryParserTest, DefaultValues) {
TEST_F(EditionEntryParserTest, CustomValues) {
SetReaderData({
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x04, // Size = 4.
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0xB6, // ID = 0xB6 (ChapterAtom).
0xB6, // ID = 0xB6 (ChapterAtom).
0x40, 0x04, // Size = 4.
0x73, 0xC4, // ID = 0x73C4 (ChapterUID).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
EditionEntry edition_entry;

View File

@ -31,21 +31,21 @@ TEST_F(InfoParserTest, DefaultParse) {
TEST_F(InfoParserTest, DefaultValues) {
SetReaderData({
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x80, // Size = 0.
0x80, // Size = 0.
0x44, 0x89, // ID = 0x4489 (Duration).
0x44, 0x89, // ID = 0x4489 (Duration).
0x20, 0x00, 0x00, // Size = 0.
0x44, 0x61, // ID = 0x4461 (DateUTC).
0x44, 0x61, // ID = 0x4461 (DateUTC).
0x20, 0x00, 0x00, // Size = 0.
0x7B, 0xA9, // ID = 0x7BA9 (Title).
0x7B, 0xA9, // ID = 0x7BA9 (Title).
0x20, 0x00, 0x00, // Size = 0.
0x4D, 0x80, // ID = 0x4D80 (MuxingApp).
0x4D, 0x80, // ID = 0x4D80 (MuxingApp).
0x20, 0x00, 0x00, // Size = 0.
0x57, 0x41, // ID = 0x5741 (WritingApp).
0x57, 0x41, // ID = 0x5741 (WritingApp).
0x20, 0x00, 0x00, // Size = 0.
});
@ -64,29 +64,29 @@ TEST_F(InfoParserTest, DefaultValues) {
TEST_F(InfoParserTest, CustomValues) {
SetReaderData({
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x44, 0x89, // ID = 0x4489 (Duration).
0x84, // Size = 4.
0x44, 0x89, // ID = 0x4489 (Duration).
0x84, // Size = 4.
0x4D, 0x8E, 0xF3, 0xC2, // Body (value = 299792448.0f).
0x44, 0x61, // ID = 0x4461 (DateUTC).
0x88, // Size = 8.
0x44, 0x61, // ID = 0x4461 (DateUTC).
0x88, // Size = 8.
0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, // Body (value = -1).
0x7B, 0xA9, // ID = 0x7BA9 (Title).
0x7B, 0xA9, // ID = 0x7BA9 (Title).
0x10, 0x00, 0x00, 0x03, // Size = 3.
0x66, 0x6F, 0x6F, // Body (value = "foo").
0x66, 0x6F, 0x6F, // Body (value = "foo").
0x4D, 0x80, // ID = 0x4D80 (MuxingApp).
0x4D, 0x80, // ID = 0x4D80 (MuxingApp).
0x10, 0x00, 0x00, 0x03, // Size = 3.
0x62, 0x61, 0x72, // Body (value = "bar").
0x62, 0x61, 0x72, // Body (value = "bar").
0x57, 0x41, // ID = 0x5741 (WritingApp).
0x57, 0x41, // ID = 0x5741 (WritingApp).
0x10, 0x00, 0x00, 0x03, // Size = 3.
0x62, 0x61, 0x7A, // Body (value = "baz").
0x62, 0x61, 0x7A, // Body (value = "baz").
});
Info info;

View File

@ -23,7 +23,7 @@ namespace {
// Creates a std::array from a string literal (and omits the trailing
// NUL-character).
template <std::size_t N>
std::array<std::uint8_t, N - 1> ArrayFromString(const char (&string)[N]) {
std::array<std::uint8_t, N - 1> ArrayFromString(const char(&string)[N]) {
std::array<std::uint8_t, N - 1> array;
std::copy_n(string, N - 1, array.begin());
return array;

View File

@ -79,8 +79,8 @@ TEST_F(MasterParserTest, ChildInitFails) {
// Indefinite unknown children should result in an error.
TEST_F(MasterParserTest, IndefiniteUnknownChild) {
SetReaderData({
0x80, // ID = 0x80 (unknown).
0xFF, // Size = unknown.
0x80, // ID = 0x80 (unknown).
0xFF, // Size = unknown.
0x00, 0x00, // Body.
});
@ -92,8 +92,8 @@ TEST_F(MasterParserTest, IndefiniteUnknownChild) {
// Child elements that overflow the master element's size should be detected.
TEST_F(MasterParserTest, ChildOverflow) {
SetReaderData({
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0xEC, // ID = 0xEC (Void).
0x82, // Size = 2.
0x00, 0x00, // Body.
});
@ -167,9 +167,9 @@ TEST_F(MasterParserTest, Empty) {
TEST_F(MasterParserTest, UnknownChildren) {
SetReaderData({
0x40, 0x00, // ID = 0x4000 (unknown).
0x80, // Size = 0.
0x80, // Size = 0.
0x80, // ID = 0x80 (unknown).
0x80, // ID = 0x80 (unknown).
0x40, 0x00, // Size = 0.
});
@ -284,8 +284,8 @@ TEST_F(MasterParserTest, UnknownSizeToFileEnd) {
// Parsing one byte at a time is okay.
TEST_F(MasterParserTest, IncrementalParse) {
SetReaderData({
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x08, 0x00, 0x00, 0x00, 0x06, // Size = 6.
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x08, 0x00, 0x00, 0x00, 0x06, // Size = 6.
0x01, 0x02, 0x03, 0x04, 0x05, 0x06, // Body.
});

View File

@ -121,13 +121,13 @@ TEST_F(MasterValueParserTest, DefaultValues) {
TEST_F(MasterValueParserTest, CustomValues) {
SetReaderData({
0xE7, // ID = 0xE7 (Timecode).
0x82, // Size = 2.
0xE7, // ID = 0xE7 (Timecode).
0x82, // Size = 2.
0x04, 0x00, // Body (value = 1024).
0xAB, // ID = 0xAB (PrevSize).
0xAB, // ID = 0xAB (PrevSize).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
{
@ -154,7 +154,7 @@ TEST_F(MasterValueParserTest, CustomValues) {
TEST_F(MasterValueParserTest, IncrementalParse) {
SetReaderData({
0xE7, // ID = 0xE7 (Timecode).
0xE7, // ID = 0xE7 (Timecode).
0x40, 0x02, // Size = 2.
0x04, 0x00, // Body (value = 1024).
@ -162,7 +162,7 @@ TEST_F(MasterValueParserTest, IncrementalParse) {
0x40, 0x02, // Size = 2.
0x00, 0x00, // Body.
0xAB, // ID = 0xAB (PrevSize).
0xAB, // ID = 0xAB (PrevSize).
0x40, 0x02, // Size = 2.
0x00, 0x01, // Body (value = 1).
});

View File

@ -62,34 +62,34 @@ TEST_F(MasteringMetadataParserTest, DefaultParse) {
TEST_F(MasteringMetadataParserTest, DefaultValues) {
SetReaderData({
0x55, 0xD1, // ID = 0x55D1 (PrimaryRChromaticityX).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD2, // ID = 0x55D2 (PrimaryRChromaticityY).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD3, // ID = 0x55D3 (PrimaryGChromaticityX).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD4, // ID = 0x55D4 (PrimaryGChromaticityY).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD5, // ID = 0x55D5 (PrimaryBChromaticityX).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD6, // ID = 0x55D6 (PrimaryBChromaticityY).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD7, // ID = 0x55D7 (WhitePointChromaticityX).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD8, // ID = 0x55D8 (WhitePointChromaticityY).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xD9, // ID = 0x55D9 (LuminanceMax).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xDA, // ID = 0x55DA (LuminanceMin).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -129,44 +129,44 @@ TEST_F(MasteringMetadataParserTest, DefaultValues) {
TEST_F(MasteringMetadataParserTest, CustomValues) {
SetReaderData({
0x55, 0xD1, // ID = 0x55D1 (PrimaryRChromaticityX).
0x84, // Size = 4.
0x55, 0xD1, // ID = 0x55D1 (PrimaryRChromaticityX).
0x84, // Size = 4.
0x3E, 0x00, 0x00, 0x00, // Body (value = 0.125).
0x55, 0xD2, // ID = 0x55D2 (PrimaryRChromaticityY).
0x84, // Size = 4.
0x55, 0xD2, // ID = 0x55D2 (PrimaryRChromaticityY).
0x84, // Size = 4.
0x3E, 0x80, 0x00, 0x00, // Body (value = 0.25).
0x55, 0xD3, // ID = 0x55D3 (PrimaryGChromaticityX).
0x84, // Size = 4.
0x55, 0xD3, // ID = 0x55D3 (PrimaryGChromaticityX).
0x84, // Size = 4.
0x3E, 0xC0, 0x00, 0x00, // Body (value = 0.375).
0x55, 0xD4, // ID = 0x55D4 (PrimaryGChromaticityY).
0x84, // Size = 4.
0x55, 0xD4, // ID = 0x55D4 (PrimaryGChromaticityY).
0x84, // Size = 4.
0x3F, 0x00, 0x00, 0x00, // Body (value = 0.5).
0x55, 0xD5, // ID = 0x55D5 (PrimaryBChromaticityX).
0x84, // Size = 4.
0x55, 0xD5, // ID = 0x55D5 (PrimaryBChromaticityX).
0x84, // Size = 4.
0x3F, 0x20, 0x00, 0x00, // Body (value = 0.625).
0x55, 0xD6, // ID = 0x55D6 (PrimaryBChromaticityY).
0x84, // Size = 4.
0x55, 0xD6, // ID = 0x55D6 (PrimaryBChromaticityY).
0x84, // Size = 4.
0x3F, 0x40, 0x00, 0x00, // Body (value = 0.75).
0x55, 0xD7, // ID = 0x55D7 (WhitePointChromaticityX).
0x84, // Size = 4.
0x55, 0xD7, // ID = 0x55D7 (WhitePointChromaticityX).
0x84, // Size = 4.
0x3F, 0x60, 0x00, 0x00, // Body (value = 0.875).
0x55, 0xD8, // ID = 0x55D8 (WhitePointChromaticityY).
0x84, // Size = 4.
0x55, 0xD8, // ID = 0x55D8 (WhitePointChromaticityY).
0x84, // Size = 4.
0x3F, 0x80, 0x00, 0x00, // Body (value = 1).
0x55, 0xD9, // ID = 0x55D9 (LuminanceMax).
0x84, // Size = 4.
0x55, 0xD9, // ID = 0x55D9 (LuminanceMax).
0x84, // Size = 4.
0x40, 0x00, 0x00, 0x00, // Body (value = 2).
0x55, 0xDA, // ID = 0x55DA (LuminanceMin).
0x84, // Size = 4.
0x55, 0xDA, // ID = 0x55DA (LuminanceMin).
0x84, // Size = 4.
0x40, 0x40, 0x00, 0x00, // Body (value = 3).
});

View File

@ -26,7 +26,7 @@ TEST_F(SeekHeadParserTest, DefaultValues) {
SetReaderData({
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
}
@ -34,18 +34,18 @@ TEST_F(SeekHeadParserTest, DefaultValues) {
TEST_F(SeekHeadParserTest, RepeatedValues) {
SetReaderData({
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x84, // Size = 4.
0x84, // Size = 4.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x84, // Size = 4.
0x84, // Size = 4.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
ParseAndVerify();

View File

@ -33,7 +33,7 @@ TEST_F(SeekParserTest, DefaultValues) {
// A SeekID element with a length of 0 isn't valid, so we don't test it.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x80, // Size = 0.
0x80, // Size = 0.
});
Seek seek;
@ -47,12 +47,12 @@ TEST_F(SeekParserTest, DefaultValues) {
TEST_F(SeekParserTest, CustomValues) {
SetReaderData({
0x53, 0xAB, // ID = 0x53AB (SeekID).
0x81, // Size = 1.
0x01, // Body.
0x81, // Size = 1.
0x01, // Body.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
Seek seek;

View File

@ -65,25 +65,25 @@ TEST_F(SegmentParserTest, EmptyParseWithDelayedStart) {
TEST_F(SegmentParserTest, DefaultValues) {
SetReaderData({
0x11, 0x4D, 0x9B, 0x74, // ID = 0x114D9B74 (SeekHead).
0x80, // Size = 0.
0x80, // Size = 0.
0x15, 0x49, 0xA9, 0x66, // ID = 0x1549A966 (Info).
0x80, // Size = 0.
0x80, // Size = 0.
0x1F, 0x43, 0xB6, 0x75, // ID = 0x1F43B675 (Cluster).
0x80, // Size = 0.
0x80, // Size = 0.
0x16, 0x54, 0xAE, 0x6B, // ID = 0x1654AE6B (Tracks).
0x80, // Size = 0.
0x80, // Size = 0.
0x1C, 0x53, 0xBB, 0x6B, // ID = 0x1C53BB6B (Cues).
0x80, // Size = 0.
0x80, // Size = 0.
0x10, 0x43, 0xA7, 0x70, // ID = 0x1043A770 (Chapters).
0x80, // Size = 0.
0x80, // Size = 0.
0x12, 0x54, 0xC3, 0x67, // ID = 0x1254C367 (Tags).
0x80, // Size = 0.
0x80, // Size = 0.
});
{
@ -108,124 +108,124 @@ TEST_F(SegmentParserTest, RepeatedValues) {
SetReaderData({
// Mutliple SeekHead elements.
0x11, 0x4D, 0x9B, 0x74, // ID = 0x114D9B74 (SeekHead).
0x8D, // Size = 13.
0x8D, // Size = 13.
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x11, 0x4D, 0x9B, 0x74, // ID = 0x114D9B74 (SeekHead).
0x8D, // Size = 13.
0x8D, // Size = 13.
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x4D, 0xBB, // ID = 0x4DBB (Seek).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x53, 0xAC, // ID = 0x53AC (SeekPosition).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
// Multiple Info elements.
0x15, 0x49, 0xA9, 0x66, // ID = 0x1549A966 (Info).
0x88, // Size = 8.
0x88, // Size = 8.
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x15, 0x49, 0xA9, 0x66, // ID = 0x1549A966 (Info).
0x88, // Size = 8.
0x88, // Size = 8.
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x2A, 0xD7, 0xB1, // ID = 0x2AD7B1 (TimecodeScale).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
// Multiple Cluster elements.
0x1F, 0x43, 0xB6, 0x75, // ID = 0x1F43B675 (Cluster).
0x86, // Size = 6.
0x86, // Size = 6.
0xE7, // ID = 0xE7 (Timecode).
0xE7, // ID = 0xE7 (Timecode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x1F, 0x43, 0xB6, 0x75, // ID = 0x1F43B675 (Cluster).
0x86, // Size = 6.
0x86, // Size = 6.
0xE7, // ID = 0xE7 (Timecode).
0xE7, // ID = 0xE7 (Timecode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
// Multiple Tracks elements.
0x16, 0x54, 0xAE, 0x6B, // ID = 0x1654AE6B (Tracks).
0x8B, // Size = 11.
0x8B, // Size = 11.
0xAE, // ID = 0xAE (TrackEntry).
0xAE, // ID = 0xAE (TrackEntry).
0x10, 0x00, 0x00, 0x06, // Size = 6.
0xD7, // ID = 0xD7 (TrackNumber).
0xD7, // ID = 0xD7 (TrackNumber).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x16, 0x54, 0xAE, 0x6B, // ID = 0x1654AE6B (Tracks).
0x8B, // Size = 11.
0x8B, // Size = 11.
0xAE, // ID = 0xAE (TrackEntry).
0xAE, // ID = 0xAE (TrackEntry).
0x10, 0x00, 0x00, 0x06, // Size = 6.
0xD7, // ID = 0xD7 (TrackNumber).
0xD7, // ID = 0xD7 (TrackNumber).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
// Single Cues element.
0x1C, 0x53, 0xBB, 0x6B, // ID = 0x1C53BB6B (Cues).
0x8B, // Size = 11.
0x8B, // Size = 11.
0xBB, // ID = 0xBB (CuePoint).
0xBB, // ID = 0xBB (CuePoint).
0x10, 0x00, 0x00, 0x06, // Size = 6.
0xB3, // ID = 0xB3 (CueTime).
0xB3, // ID = 0xB3 (CueTime).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
// Single Chapters element.
0x10, 0x43, 0xA7, 0x70, // ID = 0x1043A770 (Chapters).
0x8D, // Size = 13.
0x8D, // Size = 13.
0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
0x45, 0xB9, // ID = 0x45B9 (EditionEntry).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x45, 0xBC, // ID = 0x45BC (EditionUID).
0x45, 0xBC, // ID = 0x45BC (EditionUID).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
// Multiple Tags elements.
0x12, 0x54, 0xC3, 0x67, // ID = 0x1254C367 (Tags).
0x93, // Size = 19.
0x93, // Size = 19.
0x73, 0x73, // ID = 0x7373 (Tag).
0x73, 0x73, // ID = 0x7373 (Tag).
0x10, 0x00, 0x00, 0x0D, // Size = 13.
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x12, 0x54, 0xC3, 0x67, // ID = 0x1254C367 (Tags).
0x93, // Size = 19.
0x93, // Size = 19.
0x73, 0x73, // ID = 0x7373 (Tag).
0x73, 0x73, // ID = 0x7373 (Tag).
0x10, 0x00, 0x00, 0x0D, // Size = 13.
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
});
{
@ -260,7 +260,7 @@ TEST_F(SegmentParserTest, RepeatedValues) {
TEST_F(SegmentParserTest, Skip) {
SetReaderData({
0x1F, 0x43, 0xB6, 0x75, // ID = 0x1F43B675 (Cluster).
0x80, // Size = 0.
0x80, // Size = 0.
});
{
@ -288,24 +288,24 @@ TEST_F(SegmentParserTest, Seek) {
// element, with the ancestory: Segment -> Tracks -> TrackEntry -> Video.
0x01, // Body (value = 1).
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x03, // Body (value = 3).
0x03, // Body (value = 3).
// Single Cues element.
0x1C, 0x53, 0xBB, 0x6B, // ID = 0x1C53BB6B (Cues).
0x8B, // Size = 11.
0x8B, // Size = 11.
0xBB, // ID = 0xBB (CuePoint).
0xBB, // ID = 0xBB (CuePoint).
0x10, 0x00, 0x00, 0x06, // Size = 6.
0xB3, // ID = 0xB3 (CueTime).
0xB3, // ID = 0xB3 (CueTime).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
const ElementMetadata flag_interlaced_metadata = {Id::kFlagInterlaced, 0, 1,

View File

@ -50,22 +50,22 @@ TEST_F(SimpleTagParserTest, DefaultParse) {
TEST_F(SimpleTagParserTest, DefaultValues) {
SetReaderData({
0x45, 0xA3, // ID = 0x45A3 (TagName).
0x80, // Size = 0.
0x80, // Size = 0.
0x44, 0x7A, // ID = 0x447A (TagLanguage).
0x80, // Size = 0.
0x80, // Size = 0.
0x44, 0x84, // ID = 0x4484 (TagDefault).
0x80, // Size = 0.
0x80, // Size = 0.
0x44, 0x87, // ID = 0x4487 (TagString).
0x80, // Size = 0.
0x80, // Size = 0.
0x44, 0x85, // ID = 0x4485 (TagBinary).
0x80, // Size = 0.
0x80, // Size = 0.
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -95,52 +95,52 @@ TEST_F(SimpleTagParserTest, DefaultValues) {
TEST_F(SimpleTagParserTest, CustomValues) {
SetReaderData({
0x45, 0xA3, // ID = 0x45A3 (TagName).
0x81, // Size = 1.
0x61, // Body (value = "a").
0x81, // Size = 1.
0x61, // Body (value = "a").
0x44, 0x7A, // ID = 0x447A (TagLanguage).
0x81, // Size = 1.
0x62, // Body (value = "b").
0x81, // Size = 1.
0x62, // Body (value = "b").
0x44, 0x84, // ID = 0x4484 (TagDefault).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x44, 0x87, // ID = 0x4487 (TagString).
0x81, // Size = 1.
0x63, // Body (value = "c").
0x81, // Size = 1.
0x63, // Body (value = "c").
0x44, 0x85, // ID = 0x4485 (TagBinary).
0x81, // Size = 1.
0x01, // Body.
0x81, // Size = 1.
0x01, // Body.
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x99, // Size = 25.
0x99, // Size = 25.
0x44, 0x87, // ID = 0x4487 (TagString).
0x81, // Size = 1.
0x64, // Body (value = "d").
0x81, // Size = 1.
0x64, // Body (value = "d").
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x8B, // Size = 11.
0x8B, // Size = 11.
0x44, 0x87, // ID = 0x4487 (TagString).
0x81, // Size = 1.
0x65, // Body (value = "e").
0x81, // Size = 1.
0x65, // Body (value = "e").
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x84, // Size = 4.
0x84, // Size = 4.
0x44, 0x87, // ID = 0x4487 (TagString).
0x81, // Size = 1.
0x66, // Body (value = "f").
0x81, // Size = 1.
0x66, // Body (value = "f").
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x84, // Size = 4.
0x84, // Size = 4.
0x44, 0x87, // ID = 0x4487 (TagString).
0x81, // Size = 1.
0x67, // Body (value = "g").
0x81, // Size = 1.
0x67, // Body (value = "g").
});
ParseAndVerify();

View File

@ -33,10 +33,10 @@ TEST_F(TagParserTest, DefaultParse) {
TEST_F(TagParserTest, DefaultValues) {
SetReaderData({
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x80, // Size = 0.
0x80, // Size = 0.
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x80, // Size = 0.
0x80, // Size = 0.
});
Tag tag;
@ -52,25 +52,25 @@ TEST_F(TagParserTest, DefaultValues) {
TEST_F(TagParserTest, CustomValues) {
SetReaderData({
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x84, // Size = 4.
0x84, // Size = 4.
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x84, // Size = 4.
0x84, // Size = 4.
0x45, 0xA3, // ID = 0x45A3 (TagName).
0x81, // Size = 1.
0x61, // Body (value = "a").
0x81, // Size = 1.
0x61, // Body (value = "a").
0x67, 0xC8, // ID = 0x67C8 (SimpleTag).
0x84, // Size = 4.
0x84, // Size = 4.
0x44, 0x7A, // ID = 0x447A (TagLanguage).
0x81, // Size = 1.
0x62, // Body (value = "b").
0x81, // Size = 1.
0x62, // Body (value = "b").
});
Tag tag;

View File

@ -27,7 +27,7 @@ TEST_F(TagsParserTest, DefaultValues) {
SetReaderData({
0x73, 0x73, // ID = 0x7373 (Tag).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
}
@ -35,24 +35,24 @@ TEST_F(TagsParserTest, DefaultValues) {
TEST_F(TagsParserTest, RepeatedValues) {
SetReaderData({
0x73, 0x73, // ID = 0x7373 (Tag).
0x87, // Size = 7.
0x87, // Size = 7.
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x84, // Size = 4.
0x84, // Size = 4.
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x73, 0x73, // ID = 0x7373 (Tag).
0x87, // Size = 7.
0x87, // Size = 7.
0x63, 0xC0, // ID = 0x63C0 (Targets).
0x84, // Size = 4.
0x84, // Size = 4.
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
ParseAndVerify();

View File

@ -39,13 +39,13 @@ TEST_F(TargetsParserTest, DefaultParse) {
TEST_F(TargetsParserTest, DefaultValues) {
SetReaderData({
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x80, // Size = 0.
0x80, // Size = 0.
0x63, 0xCA, // ID = 0x63CA (TargetType).
0x80, // Size = 0.
0x80, // Size = 0.
0x63, 0xC5, // ID = 0x63C5 (TagTrackUID).
0x80, // Size = 0.
0x80, // Size = 0.
});
ParseAndVerify();
@ -66,20 +66,20 @@ TEST_F(TargetsParserTest, DefaultValues) {
TEST_F(TargetsParserTest, CustomValues) {
SetReaderData({
0x68, 0xCA, // ID = 0x68CA (TargetTypeValue).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x81, // Size = 1.
0x00, // Body (value = 0).
0x63, 0xCA, // ID = 0x63CA (TargetType).
0x82, // Size = 2.
0x82, // Size = 2.
0x48, 0x69, // Body (value = "Hi").
0x63, 0xC5, // ID = 0x63C5 (TagTrackUID).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x81, // Size = 1.
0x01, // Body (value = 1).
0x63, 0xC5, // ID = 0x63C5 (TagTrackUID).
0x81, // Size = 1.
0x02, // Body (value = 2).
0x81, // Size = 1.
0x02, // Body (value = 2).
});
ParseAndVerify();

View File

@ -39,58 +39,58 @@ TEST_F(TrackEntryParserTest, DefaultParse) {
TEST_F(TrackEntryParserTest, DefaultValues) {
SetReaderData({
0xD7, // ID = 0xD7 (TrackNumber).
0xD7, // ID = 0xD7 (TrackNumber).
0x20, 0x00, 0x00, // Size = 0.
0x73, 0xC5, // ID = 0x73C5 (TrackUID).
0x73, 0xC5, // ID = 0x73C5 (TrackUID).
0x20, 0x00, 0x00, // Size = 0.
0x83, // ID = 0x83 (TrackType).
0x83, // ID = 0x83 (TrackType).
0x20, 0x00, 0x00, // Size = 0.
0xB9, // ID = 0xB9 (FlagEnabled).
0xB9, // ID = 0xB9 (FlagEnabled).
0x20, 0x00, 0x00, // Size = 0.
0x88, // ID = 0x88 (FlagDefault).
0x88, // ID = 0x88 (FlagDefault).
0x20, 0x00, 0x00, // Size = 0.
0x55, 0xAA, // ID = 0x55AA (FlagForced).
0x55, 0xAA, // ID = 0x55AA (FlagForced).
0x20, 0x00, 0x00, // Size = 0.
0x9C, // ID = 0x9C (FlagLacing).
0x9C, // ID = 0x9C (FlagLacing).
0x20, 0x00, 0x00, // Size = 0.
0x23, 0xE3, 0x83, // ID = 0x23E383 (DefaultDuration).
0x80, // Size = 0.
0x80, // Size = 0.
0x53, 0x6E, // ID = 0x536E (Name).
0x53, 0x6E, // ID = 0x536E (Name).
0x20, 0x00, 0x00, // Size = 0.
0x22, 0xB5, 0x9C, // ID = 0x22B59C (Language).
0x80, // Size = 0.
0x80, // Size = 0.
0x86, // ID = 0x86 (CodecID).
0x86, // ID = 0x86 (CodecID).
0x20, 0x00, 0x00, // Size = 0.
0x63, 0xA2, // ID = 0x63A2 (CodecPrivate).
0x63, 0xA2, // ID = 0x63A2 (CodecPrivate).
0x20, 0x00, 0x00, // Size = 0.
0x25, 0x86, 0x88, // ID = 0x258688 (CodecName).
0x80, // Size = 0.
0x80, // Size = 0.
0x56, 0xAA, // ID = 0x56AA (CodecDelay).
0x56, 0xAA, // ID = 0x56AA (CodecDelay).
0x20, 0x00, 0x00, // Size = 0.
0x56, 0xBB, // ID = 0x56BB (SeekPreRoll).
0x56, 0xBB, // ID = 0x56BB (SeekPreRoll).
0x20, 0x00, 0x00, // Size = 0.
0xE0, // ID = 0xE0 (Video).
0xE0, // ID = 0xE0 (Video).
0x20, 0x00, 0x00, // Size = 0.
0xE1, // ID = 0xE1 (Audio).
0xE1, // ID = 0xE1 (Audio).
0x20, 0x00, 0x00, // Size = 0.
0x6D, 0x80, // ID = 0x6D80 (ContentEncodings).
0x6D, 0x80, // ID = 0x6D80 (ContentEncodings).
0x20, 0x00, 0x00, // Size = 0.
});
@ -121,89 +121,89 @@ TEST_F(TrackEntryParserTest, DefaultValues) {
TEST_F(TrackEntryParserTest, CustomValues) {
SetReaderData({
0xD7, // ID = 0xD7 (TrackNumber).
0xD7, // ID = 0xD7 (TrackNumber).
0x20, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x73, 0xC5, // ID = 0x73C5 (TrackUID).
0x73, 0xC5, // ID = 0x73C5 (TrackUID).
0x20, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x83, // ID = 0x83 (TrackType).
0x83, // ID = 0x83 (TrackType).
0x20, 0x00, 0x01, // Size = 1.
0x03, // Body (value = complex).
0x03, // Body (value = complex).
0xB9, // ID = 0xB9 (FlagEnabled).
0xB9, // ID = 0xB9 (FlagEnabled).
0x20, 0x00, 0x01, // Size = 1.
0x00, // Body (value = 0).
0x00, // Body (value = 0).
0x88, // ID = 0x88 (FlagDefault).
0x88, // ID = 0x88 (FlagDefault).
0x20, 0x00, 0x01, // Size = 1.
0x00, // Body (value = 0).
0x00, // Body (value = 0).
0x55, 0xAA, // ID = 0x55AA (FlagForced).
0x55, 0xAA, // ID = 0x55AA (FlagForced).
0x20, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0x9C, // ID = 0x9C (FlagLacing).
0x9C, // ID = 0x9C (FlagLacing).
0x20, 0x00, 0x01, // Size = 1.
0x00, // Body (value = 0).
0x00, // Body (value = 0).
0x23, 0xE3, 0x83, // ID = 0x23E383 (DefaultDuration).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x81, // Size = 1.
0x04, // Body (value = 4).
0x53, 0x6E, // ID = 0x536E (Name).
0x53, 0x6E, // ID = 0x536E (Name).
0x20, 0x00, 0x01, // Size = 1.
0x41, // Body (value = "A").
0x41, // Body (value = "A").
0x22, 0xB5, 0x9C, // ID = 0x22B59C (Language).
0x81, // Size = 1.
0x42, // Body (value = "B").
0x81, // Size = 1.
0x42, // Body (value = "B").
0x86, // ID = 0x86 (CodecID).
0x86, // ID = 0x86 (CodecID).
0x20, 0x00, 0x01, // Size = 1.
0x43, // Body (value = "C").
0x43, // Body (value = "C").
0x63, 0xA2, // ID = 0x63A2 (CodecPrivate).
0x63, 0xA2, // ID = 0x63A2 (CodecPrivate).
0x20, 0x00, 0x01, // Size = 1.
0x00, // Body.
0x00, // Body.
0x25, 0x86, 0x88, // ID = 0x258688 (CodecName).
0x81, // Size = 1.
0x44, // Body (value = "D").
0x81, // Size = 1.
0x44, // Body (value = "D").
0x56, 0xAA, // ID = 0x56AA (CodecDelay).
0x56, 0xAA, // ID = 0x56AA (CodecDelay).
0x20, 0x00, 0x01, // Size = 1.
0x05, // Body (value = 5).
0x05, // Body (value = 5).
0x56, 0xBB, // ID = 0x56BB (SeekPreRoll).
0x56, 0xBB, // ID = 0x56BB (SeekPreRoll).
0x20, 0x00, 0x01, // Size = 1.
0x06, // Body (value = 6).
0x06, // Body (value = 6).
0xE0, // ID = 0xE0 (Video).
0xE0, // ID = 0xE0 (Video).
0x20, 0x00, 0x06, // Size = 6.
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x20, 0x00, 0x01, // Size = 1.
0x03, // Body (value = display aspect ratio).
0x03, // Body (value = display aspect ratio).
0xE1, // ID = 0xE1 (Audio).
0xE1, // ID = 0xE1 (Audio).
0x20, 0x00, 0x05, // Size = 5.
0x9F, // ID = 0x9F (Channels).
0x9F, // ID = 0x9F (Channels).
0x20, 0x00, 0x01, // Size = 1.
0x08, // Body (value = 8).
0x08, // Body (value = 8).
0x6D, 0x80, // ID = 0x6D80 (ContentEncodings).
0x6D, 0x80, // ID = 0x6D80 (ContentEncodings).
0x20, 0x00, 0x0B, // Size = 11.
0x62, 0x40, // ID = 0x6240 (ContentEncoding).
0x62, 0x40, // ID = 0x6240 (ContentEncoding).
0x20, 0x00, 0x06, // Size = 6.
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x50, 0x31, // ID = 0x5031 (ContentEncodingOrder).
0x20, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
TrackEntry track_entry;

View File

@ -79,49 +79,49 @@ TEST_F(VideoParserTest, DefaultParse) {
TEST_F(VideoParserTest, DefaultValues) {
SetReaderData({
0x9A, // ID = 0x9A (FlagInterlaced).
0x9A, // ID = 0x9A (FlagInterlaced).
0x20, 0x00, 0x00, // Size = 0.
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x20, 0x00, 0x00, // Size = 0.
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x20, 0x00, 0x00, // Size = 0.
0xB0, // ID = 0xB0 (PixelWidth).
0xB0, // ID = 0xB0 (PixelWidth).
0x20, 0x00, 0x00, // Size = 0.
0xBA, // ID = 0xBA (PixelHeight).
0xBA, // ID = 0xBA (PixelHeight).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xAA, // ID = 0x54AA (PixelCropBottom).
0x54, 0xAA, // ID = 0x54AA (PixelCropBottom).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xBB, // ID = 0x54BB (PixelCropTop).
0x54, 0xBB, // ID = 0x54BB (PixelCropTop).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xCC, // ID = 0x54CC (PixelCropLeft).
0x54, 0xCC, // ID = 0x54CC (PixelCropLeft).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xDD, // ID = 0x54DD (PixelCropRight).
0x54, 0xDD, // ID = 0x54DD (PixelCropRight).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xB0, // ID = 0x54B0 (DisplayWidth).
0x54, 0xB0, // ID = 0x54B0 (DisplayWidth).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xBA, // ID = 0x54BA (DisplayHeight).
0x54, 0xBA, // ID = 0x54BA (DisplayHeight).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x20, 0x00, 0x00, // Size = 0.
0x54, 0xB3, // ID = 0x54B3 (AspectRatioType).
0x54, 0xB3, // ID = 0x54B3 (AspectRatioType).
0x20, 0x00, 0x00, // Size = 0.
0x23, 0x83, 0xE3, // ID = 0x2383E3 (FrameRate).
0x80, // Size = 0.
0x80, // Size = 0.
0x55, 0xB0, // ID = 0x55B0 (Colour).
0x55, 0xB0, // ID = 0x55B0 (Colour).
0x20, 0x00, 0x00, // Size = 0.
});
@ -177,68 +177,68 @@ TEST_F(VideoParserTest, DefaultValues) {
TEST_F(VideoParserTest, CustomValues) {
SetReaderData({
0x9A, // ID = 0x9A (FlagInterlaced).
0x9A, // ID = 0x9A (FlagInterlaced).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = progressive).
0x02, // Body (value = progressive).
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x53, 0xB8, // ID = 0x53B8 (StereoMode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = top-bottom (right eye first)).
0x02, // Body (value = top-bottom (right eye first)).
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x53, 0xC0, // ID = 0x53C0 (AlphaMode).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x03, // Body (value = 3).
0x03, // Body (value = 3).
0xB0, // ID = 0xB0 (PixelWidth).
0xB0, // ID = 0xB0 (PixelWidth).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x04, // Body (value = 4).
0x04, // Body (value = 4).
0xBA, // ID = 0xBA (PixelHeight).
0xBA, // ID = 0xBA (PixelHeight).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x05, // Body (value = 5).
0x05, // Body (value = 5).
0x54, 0xAA, // ID = 0x54AA (PixelCropBottom).
0x54, 0xAA, // ID = 0x54AA (PixelCropBottom).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x06, // Body (value = 6).
0x06, // Body (value = 6).
0x54, 0xBB, // ID = 0x54BB (PixelCropTop).
0x54, 0xBB, // ID = 0x54BB (PixelCropTop).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x07, // Body (value = 7).
0x07, // Body (value = 7).
0x54, 0xCC, // ID = 0x54CC (PixelCropLeft).
0x54, 0xCC, // ID = 0x54CC (PixelCropLeft).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x08, // Body (value = 8).
0x08, // Body (value = 8).
0x54, 0xDD, // ID = 0x54DD (PixelCropRight).
0x54, 0xDD, // ID = 0x54DD (PixelCropRight).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x09, // Body (value = 9).
0x09, // Body (value = 9).
0x54, 0xB0, // ID = 0x54B0 (DisplayWidth).
0x54, 0xB0, // ID = 0x54B0 (DisplayWidth).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x0A, // Body (value = 10).
0x0A, // Body (value = 10).
0x54, 0xBA, // ID = 0x54BA (DisplayHeight).
0x54, 0xBA, // ID = 0x54BA (DisplayHeight).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x0B, // Body (value = 11).
0x0B, // Body (value = 11).
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x54, 0xB2, // ID = 0x54B2 (DisplayUnit).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = inches).
0x02, // Body (value = inches).
0x54, 0xB3, // ID = 0x54B3 (AspectRatioType).
0x54, 0xB3, // ID = 0x54B3 (AspectRatioType).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = keep aspect ratio).
0x01, // Body (value = keep aspect ratio).
0x23, 0x83, 0xE3, // ID = 0x2383E3 (FrameRate).
0x84, // Size = 4.
0x23, 0x83, 0xE3, // ID = 0x2383E3 (FrameRate).
0x84, // Size = 4.
0x40, 0x0F, 0x1B, 0xBD, // Body (value = 2.2360680103302001953125f).
0x55, 0xB0, // ID = 0x55B0 (Colour).
0x55, 0xB0, // ID = 0x55B0 (Colour).
0x10, 0x00, 0x00, 0x07, // Size = 7.
0x55, 0xB2, // ID = 0x55B2 (BitsPerChannel).
0x55, 0xB2, // ID = 0x55B2 (BitsPerChannel).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
});
ParseAndVerify();
@ -355,13 +355,13 @@ TEST_F(VideoParserTest, AbsentDisplaySize) {
TEST_F(VideoParserTest, DefaultDisplaySize) {
SetReaderData({
0xB0, // ID = 0xB0 (PixelWidth).
0xB0, // ID = 0xB0 (PixelWidth).
0x40, 0x01, // Size = 1.
0x01, // Body (value = 1).
0x01, // Body (value = 1).
0xBA, // ID = 0xBA (PixelHeight).
0xBA, // ID = 0xBA (PixelHeight).
0x40, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
0x54, 0xB0, // ID = 0x54B0 (DisplayWidth).
0x40, 0x00, // Size = 0.

View File

@ -34,7 +34,7 @@ TEST_F(VirtualBlockParserTest, InvalidBlock) {
SetReaderData({
0x40, 0x01, // Track number = 1.
0x00, 0x00, // Timecode = 0.
0x00, // Flags.
0x00, // Flags.
});
// Initialize with 1 byte short.
@ -43,9 +43,9 @@ TEST_F(VirtualBlockParserTest, InvalidBlock) {
TEST_F(VirtualBlockParserTest, ValidBlock) {
SetReaderData({
0x81, // Track number = 1.
0x81, // Track number = 1.
0x12, 0x34, // Timecode = 4660.
0x00, // Flags.
0x00, // Flags.
});
ParseAndVerify();
@ -59,8 +59,8 @@ TEST_F(VirtualBlockParserTest, ValidBlock) {
TEST_F(VirtualBlockParserTest, IncrementalParse) {
SetReaderData({
0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, // Track number = 2.
0xFF, 0xFE, // Timecode = -2.
0x00, // Flags.
0xFF, 0xFE, // Timecode = -2.
0x00, // Flags.
});
IncrementalParseAndVerify();

View File

@ -59,7 +59,7 @@ TEST_F(WebmParserTest, InvalidId) {
TEST_F(WebmParserTest, InvalidSize) {
BufferReader reader = {
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x00, // Size must have 1+ bits set in the first byte.
0x00, // Size must have 1+ bits set in the first byte.
};
MockCallback callback;
@ -80,10 +80,10 @@ TEST_F(WebmParserTest, InvalidSize) {
TEST_F(WebmParserTest, DefaultParse) {
BufferReader reader = {
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x80, // Size = 0.
0x80, // Size = 0.
0x18, 0x53, 0x80, 0x67, // ID = 0x18538067 (Segment).
0x80, // Size = 0.
0x80, // Size = 0.
};
MockCallback callback;
@ -109,11 +109,11 @@ TEST_F(WebmParserTest, DefaultParse) {
TEST_F(WebmParserTest, SeekEbml) {
BufferReader reader = {
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x87, // Size = 7.
0x87, // Size = 7.
0x42, 0x86, // ID = 0x4286 (EBMLVersion).
0x42, 0x86, // ID = 0x4286 (EBMLVersion).
0x10, 0x00, 0x00, 0x01, // Size = 1.
0x02, // Body (value = 2).
0x02, // Body (value = 2).
};
std::uint64_t num_to_skip = 5; // Skip the starting EBML element metadata.
std::uint64_t num_actually_skipped = 0;
@ -144,10 +144,10 @@ TEST_F(WebmParserTest, SeekEbml) {
TEST_F(WebmParserTest, SeekSegment) {
BufferReader reader = {
0x18, 0x53, 0x80, 0x67, // ID = 0x18538067 (Segment).
0x85, // Size = 5.
0x85, // Size = 5.
0x15, 0x49, 0xA9, 0x66, // ID = 0x1549A966 (Info).
0x80, // Size = 0.
0x80, // Size = 0.
};
std::uint64_t num_to_skip = 5; // Skip the starting Segment element metadata.
std::uint64_t num_actually_skipped = 0;
@ -185,7 +185,7 @@ TEST_F(WebmParserTest, SeekVoid) {
0x00, // Body.
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x80, // Size = 0.
0x80, // Size = 0.
};
std::uint64_t num_to_skip = 2; // Skip the first Void element.
std::uint64_t num_actually_skipped = 0;
@ -261,7 +261,7 @@ TEST_F(WebmParserTest, Swap) {
0x00, // Body.
0x1A, 0x45, 0xDF, 0xA3, // ID = 0x1A45DFA3 (EBML).
0x80, // Size = 0.
0x80, // Size = 0.
};
MockCallback callback;