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 #ifndef MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ | 5 #ifndef MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ |
6 #define MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ | 6 #define MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "media/base/audio_decoder_config.h" | 9 #include "media/base/audio_decoder_config.h" |
10 #include "media/base/stream_parser.h" | 10 #include "media/base/stream_parser.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 // | 32 // |
33 // Parsed frame(s) are represented as "{ xxK yyK zzK }" Where xx, yy, and zz | 33 // Parsed frame(s) are represented as "{ xxK yyK zzK }" Where xx, yy, and zz |
34 // are the timestamps in milliseconds of each parsed frame. For example: | 34 // are the timestamps in milliseconds of each parsed frame. For example: |
35 // | 35 // |
36 // "NewSegment{ 0K 23K 46K }EndOfSegment" | 36 // "NewSegment{ 0K 23K 46K }EndOfSegment" |
37 // "NewSegment{ 0K }{ 23K }{ 46K }EndOfSegment" | 37 // "NewSegment{ 0K }{ 23K }{ 46K }EndOfSegment" |
38 // "NewSegment{ 0K }{ 23K }EndOfSegmentNewSegment{ 46K }EndOfSegment" | 38 // "NewSegment{ 0K }{ 23K }EndOfSegmentNewSegment{ 46K }EndOfSegment" |
39 // | 39 // |
40 std::string ParseFile(const std::string& filename, int append_bytes); | 40 std::string ParseFile(const std::string& filename, int append_bytes); |
41 | 41 |
| 42 // The last AudioDecoderConfig handed to OnNewConfig(). |
| 43 AudioDecoderConfig last_audio_config_; |
| 44 |
42 private: | 45 private: |
43 void InitializeParser(); | 46 void InitializeParser(); |
44 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size); | 47 bool AppendDataInPieces(const uint8* data, size_t length, size_t piece_size); |
45 | 48 |
46 void OnInitDone(bool success, | 49 void OnInitDone(bool success, |
47 base::TimeDelta duration, | 50 base::TimeDelta duration, |
48 bool auto_update_timestamp_offset); | 51 bool auto_update_timestamp_offset); |
49 bool OnNewConfig(const AudioDecoderConfig& audio_config, | 52 bool OnNewConfig(const AudioDecoderConfig& audio_config, |
50 const VideoDecoderConfig& video_config, | 53 const VideoDecoderConfig& video_config, |
51 const StreamParser::TextTrackConfigMap& text_config); | 54 const StreamParser::TextTrackConfigMap& text_config); |
52 bool OnNewBuffers(const StreamParser::BufferQueue& audio_buffers, | 55 bool OnNewBuffers(const StreamParser::BufferQueue& audio_buffers, |
53 const StreamParser::BufferQueue& video_buffers, | 56 const StreamParser::BufferQueue& video_buffers, |
54 const StreamParser::TextBufferQueueMap& text_map); | 57 const StreamParser::TextBufferQueueMap& text_map); |
55 void OnKeyNeeded(const std::string& type, | 58 void OnKeyNeeded(const std::string& type, |
56 const std::vector<uint8>& init_data); | 59 const std::vector<uint8>& init_data); |
57 void OnNewSegment(); | 60 void OnNewSegment(); |
58 void OnEndOfSegment(); | 61 void OnEndOfSegment(); |
59 | 62 |
60 scoped_ptr<StreamParser> parser_; | 63 scoped_ptr<StreamParser> parser_; |
61 std::stringstream results_stream_; | 64 std::stringstream results_stream_; |
62 | 65 |
63 DISALLOW_COPY_AND_ASSIGN(StreamParserTestBase); | 66 DISALLOW_COPY_AND_ASSIGN(StreamParserTestBase); |
64 }; | 67 }; |
65 | 68 |
66 } // namespace media | 69 } // namespace media |
67 | 70 |
68 #endif // MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ | 71 #endif // MEDIA_FORMATS_COMMON_STREAM_PARSER_TEST_BASE_H_ |
OLD | NEW |