OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 start += append_size; | 55 start += append_size; |
56 } | 56 } |
57 return true; | 57 return true; |
58 } | 58 } |
59 | 59 |
60 void InitF(bool init_ok, base::TimeDelta duration) { | 60 void InitF(bool init_ok, base::TimeDelta duration) { |
61 DVLOG(1) << "InitF: ok=" << init_ok | 61 DVLOG(1) << "InitF: ok=" << init_ok |
62 << ", dur=" << duration.InMilliseconds(); | 62 << ", dur=" << duration.InMilliseconds(); |
63 } | 63 } |
64 | 64 |
65 bool NewConfigF(const AudioDecoderConfig& ac, const VideoDecoderConfig& vc) { | 65 bool NewConfigF(const AudioDecoderConfig& ac, |
| 66 const VideoDecoderConfig& vc, |
| 67 const TextTrackConfigMap& tc) { |
66 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig() | 68 DVLOG(1) << "NewConfigF: audio=" << ac.IsValidConfig() |
67 << ", video=" << vc.IsValidConfig(); | 69 << ", video=" << vc.IsValidConfig(); |
68 configs_received_ = true; | 70 configs_received_ = true; |
69 return true; | 71 return true; |
70 } | 72 } |
71 | 73 |
72 | 74 |
73 void DumpBuffers(const std::string& label, | 75 void DumpBuffers(const std::string& label, |
74 const StreamParser::BufferQueue& buffers) { | 76 const StreamParser::BufferQueue& buffers) { |
75 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); | 77 DVLOG(2) << "DumpBuffers: " << label << " size " << buffers.size(); |
76 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); | 78 for (StreamParser::BufferQueue::const_iterator buf = buffers.begin(); |
77 buf != buffers.end(); buf++) { | 79 buf != buffers.end(); buf++) { |
78 DVLOG(3) << " n=" << buf - buffers.begin() | 80 DVLOG(3) << " n=" << buf - buffers.begin() |
79 << ", size=" << (*buf)->data_size() | 81 << ", size=" << (*buf)->data_size() |
80 << ", dur=" << (*buf)->duration().InMilliseconds(); | 82 << ", dur=" << (*buf)->duration().InMilliseconds(); |
81 } | 83 } |
82 } | 84 } |
83 | 85 |
84 bool NewBuffersF(const StreamParser::BufferQueue& audio_buffers, | 86 bool NewBuffersF(const StreamParser::BufferQueue& audio_buffers, |
85 const StreamParser::BufferQueue& video_buffers) { | 87 const StreamParser::BufferQueue& video_buffers) { |
86 DumpBuffers("audio_buffers", audio_buffers); | 88 DumpBuffers("audio_buffers", audio_buffers); |
87 DumpBuffers("video_buffers", video_buffers); | 89 DumpBuffers("video_buffers", video_buffers); |
88 return true; | 90 return true; |
89 } | 91 } |
90 | 92 |
91 bool NewTextBuffersF(TextTrack* text_track, | 93 bool NewTextBuffersF(int text_track, |
92 const StreamParser::BufferQueue& buffers) { | 94 const StreamParser::BufferQueue& buffers) { |
93 return true; | 95 return true; |
94 } | 96 } |
95 | 97 |
96 void KeyNeededF(const std::string& type, | 98 void KeyNeededF(const std::string& type, |
97 const std::vector<uint8>& init_data) { | 99 const std::vector<uint8>& init_data) { |
98 DVLOG(1) << "KeyNeededF: " << init_data.size(); | 100 DVLOG(1) << "KeyNeededF: " << init_data.size(); |
99 EXPECT_EQ(kMp4InitDataType, type); | 101 EXPECT_EQ(kMp4InitDataType, type); |
100 EXPECT_FALSE(init_data.empty()); | 102 EXPECT_FALSE(init_data.empty()); |
101 } | 103 } |
102 | 104 |
103 scoped_ptr<TextTrack> AddTextTrackF( | |
104 TextKind kind, | |
105 const std::string& label, | |
106 const std::string& language) { | |
107 return scoped_ptr<TextTrack>(); | |
108 } | |
109 | |
110 void NewSegmentF() { | 105 void NewSegmentF() { |
111 DVLOG(1) << "NewSegmentF"; | 106 DVLOG(1) << "NewSegmentF"; |
112 } | 107 } |
113 | 108 |
114 void EndOfSegmentF() { | 109 void EndOfSegmentF() { |
115 DVLOG(1) << "EndOfSegmentF()"; | 110 DVLOG(1) << "EndOfSegmentF()"; |
116 } | 111 } |
117 | 112 |
118 void InitializeParser() { | 113 void InitializeParser() { |
119 parser_->Init( | 114 parser_->Init( |
120 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)), | 115 base::Bind(&MP4StreamParserTest::InitF, base::Unretained(this)), |
121 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)), | 116 base::Bind(&MP4StreamParserTest::NewConfigF, base::Unretained(this)), |
122 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)), | 117 base::Bind(&MP4StreamParserTest::NewBuffersF, base::Unretained(this)), |
123 base::Bind(&MP4StreamParserTest::NewTextBuffersF, | 118 base::Bind(&MP4StreamParserTest::NewTextBuffersF, |
124 base::Unretained(this)), | 119 base::Unretained(this)), |
125 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)), | 120 base::Bind(&MP4StreamParserTest::KeyNeededF, base::Unretained(this)), |
126 base::Bind(&MP4StreamParserTest::AddTextTrackF, base::Unretained(this)), | 121 true, |
127 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)), | 122 base::Bind(&MP4StreamParserTest::NewSegmentF, base::Unretained(this)), |
128 base::Bind(&MP4StreamParserTest::EndOfSegmentF, | 123 base::Bind(&MP4StreamParserTest::EndOfSegmentF, |
129 base::Unretained(this)), | 124 base::Unretained(this)), |
130 LogCB()); | 125 LogCB()); |
131 } | 126 } |
132 | 127 |
133 bool ParseMP4File(const std::string& filename, int append_bytes) { | 128 bool ParseMP4File(const std::string& filename, int append_bytes) { |
134 InitializeParser(); | 129 InitializeParser(); |
135 | 130 |
136 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); | 131 scoped_refptr<DecoderBuffer> buffer = ReadTestDataFile(filename); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 EXPECT_TRUE(AppendDataInPieces(buffer->data() + kFirstMoofOffset, | 201 EXPECT_TRUE(AppendDataInPieces(buffer->data() + kFirstMoofOffset, |
207 buffer->data_size() - kFirstMoofOffset, | 202 buffer->data_size() - kFirstMoofOffset, |
208 512)); | 203 512)); |
209 } | 204 } |
210 | 205 |
211 // TODO(strobe): Create and test media which uses CENC auxiliary info stored | 206 // TODO(strobe): Create and test media which uses CENC auxiliary info stored |
212 // inside a private box | 207 // inside a private box |
213 | 208 |
214 } // namespace mp4 | 209 } // namespace mp4 |
215 } // namespace media | 210 } // namespace media |
OLD | NEW |