OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string.h> | 5 #include <string.h> |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/formats/mp4/box_reader.h" | 10 #include "media/formats/mp4/box_reader.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // Extended-size header child box | 24 // Extended-size header child box |
25 0x00, 0x00, 0x00, 0x01, 'p', 's', 's', 'h', | 25 0x00, 0x00, 0x00, 0x01, 'p', 's', 's', 'h', |
26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, | 26 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x14, |
27 0xfa, 0xce, 0xca, 0xfe, | 27 0xfa, 0xce, 0xca, 0xfe, |
28 // Empty free box | 28 // Empty free box |
29 0x00, 0x00, 0x00, 0x08, 'f', 'r', 'e', 'e', | 29 0x00, 0x00, 0x00, 0x08, 'f', 'r', 'e', 'e', |
30 // Trailing garbage | 30 // Trailing garbage |
31 0x00 }; | 31 0x00 }; |
32 | 32 |
33 struct FreeBox : Box { | 33 struct FreeBox : Box { |
34 virtual bool Parse(BoxReader* reader) OVERRIDE { | 34 virtual bool Parse(BoxReader* reader) override { |
35 return true; | 35 return true; |
36 } | 36 } |
37 virtual FourCC BoxType() const OVERRIDE { return FOURCC_FREE; } | 37 virtual FourCC BoxType() const override { return FOURCC_FREE; } |
38 }; | 38 }; |
39 | 39 |
40 struct PsshBox : Box { | 40 struct PsshBox : Box { |
41 uint32 val; | 41 uint32 val; |
42 | 42 |
43 virtual bool Parse(BoxReader* reader) OVERRIDE { | 43 virtual bool Parse(BoxReader* reader) override { |
44 return reader->Read4(&val); | 44 return reader->Read4(&val); |
45 } | 45 } |
46 virtual FourCC BoxType() const OVERRIDE { return FOURCC_PSSH; } | 46 virtual FourCC BoxType() const override { return FOURCC_PSSH; } |
47 }; | 47 }; |
48 | 48 |
49 struct SkipBox : Box { | 49 struct SkipBox : Box { |
50 uint8 a, b; | 50 uint8 a, b; |
51 uint16 c; | 51 uint16 c; |
52 int32 d; | 52 int32 d; |
53 int64 e; | 53 int64 e; |
54 | 54 |
55 std::vector<PsshBox> kids; | 55 std::vector<PsshBox> kids; |
56 FreeBox mpty; | 56 FreeBox mpty; |
57 | 57 |
58 virtual bool Parse(BoxReader* reader) OVERRIDE { | 58 virtual bool Parse(BoxReader* reader) override { |
59 RCHECK(reader->ReadFullBoxHeader() && | 59 RCHECK(reader->ReadFullBoxHeader() && |
60 reader->Read1(&a) && | 60 reader->Read1(&a) && |
61 reader->Read1(&b) && | 61 reader->Read1(&b) && |
62 reader->Read2(&c) && | 62 reader->Read2(&c) && |
63 reader->Read4s(&d) && | 63 reader->Read4s(&d) && |
64 reader->Read4sInto8s(&e)); | 64 reader->Read4sInto8s(&e)); |
65 return reader->ScanChildren() && | 65 return reader->ScanChildren() && |
66 reader->ReadChildren(&kids) && | 66 reader->ReadChildren(&kids) && |
67 reader->MaybeReadChild(&mpty); | 67 reader->MaybeReadChild(&mpty); |
68 } | 68 } |
69 virtual FourCC BoxType() const OVERRIDE { return FOURCC_SKIP; } | 69 virtual FourCC BoxType() const override { return FOURCC_SKIP; } |
70 | 70 |
71 SkipBox(); | 71 SkipBox(); |
72 virtual ~SkipBox(); | 72 virtual ~SkipBox(); |
73 }; | 73 }; |
74 | 74 |
75 SkipBox::SkipBox() {} | 75 SkipBox::SkipBox() {} |
76 SkipBox::~SkipBox() {} | 76 SkipBox::~SkipBox() {} |
77 | 77 |
78 class BoxReaderTest : public testing::Test { | 78 class BoxReaderTest : public testing::Test { |
79 protected: | 79 protected: |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, | 226 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, |
227 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, // usertype | 227 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F, 0x10, // usertype |
228 0x00, | 228 0x00, |
229 }; | 229 }; |
230 | 230 |
231 TestTopLevelBox(kData, sizeof(kData), FOURCC_UUID); | 231 TestTopLevelBox(kData, sizeof(kData), FOURCC_UUID); |
232 } | 232 } |
233 | 233 |
234 } // namespace mp4 | 234 } // namespace mp4 |
235 } // namespace media | 235 } // namespace media |
OLD | NEW |