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 #ifndef MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ | 5 #ifndef MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
6 #define MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ | 6 #define MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 26 matching lines...) Expand all Loading... |
37 // | 37 // |
38 // Returns -1 if the parse fails. | 38 // Returns -1 if the parse fails. |
39 // Returns 0 if more data is needed. | 39 // Returns 0 if more data is needed. |
40 // Returns the number of bytes parsed on success. | 40 // Returns the number of bytes parsed on success. |
41 int Parse(const uint8* buf, int size); | 41 int Parse(const uint8* buf, int size); |
42 | 42 |
43 base::TimeDelta cluster_start_time() const { return cluster_start_time_; } | 43 base::TimeDelta cluster_start_time() const { return cluster_start_time_; } |
44 const BufferQueue& audio_buffers() const { return audio_.buffers(); } | 44 const BufferQueue& audio_buffers() const { return audio_.buffers(); } |
45 const BufferQueue& video_buffers() const { return video_.buffers(); } | 45 const BufferQueue& video_buffers() const { return video_.buffers(); } |
46 | 46 |
| 47 // Returns true if the last Parse() call stopped at the end of a cluster. |
| 48 bool cluster_ended() const { return cluster_ended_; } |
| 49 |
47 private: | 50 private: |
48 // Helper class that manages per-track state. | 51 // Helper class that manages per-track state. |
49 class Track { | 52 class Track { |
50 public: | 53 public: |
51 explicit Track(int track_num); | 54 explicit Track(int track_num); |
52 ~Track(); | 55 ~Track(); |
53 | 56 |
54 int track_num() const { return track_num_; } | 57 int track_num() const { return track_num_; } |
55 const BufferQueue& buffers() const { return buffers_; } | 58 const BufferQueue& buffers() const { return buffers_; } |
56 | 59 |
(...skipping 24 matching lines...) Expand all Loading... |
81 | 84 |
82 WebMListParser parser_; | 85 WebMListParser parser_; |
83 | 86 |
84 int64 last_block_timecode_; | 87 int64 last_block_timecode_; |
85 scoped_array<uint8> block_data_; | 88 scoped_array<uint8> block_data_; |
86 int block_data_size_; | 89 int block_data_size_; |
87 int64 block_duration_; | 90 int64 block_duration_; |
88 | 91 |
89 int64 cluster_timecode_; | 92 int64 cluster_timecode_; |
90 base::TimeDelta cluster_start_time_; | 93 base::TimeDelta cluster_start_time_; |
| 94 bool cluster_ended_; |
91 | 95 |
92 Track audio_; | 96 Track audio_; |
93 Track video_; | 97 Track video_; |
94 | 98 |
95 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); | 99 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); |
96 }; | 100 }; |
97 | 101 |
98 } // namespace media | 102 } // namespace media |
99 | 103 |
100 #endif // MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ | 104 #endif // MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
OLD | NEW |