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 22 matching lines...) Expand all Loading... |
33 // | 33 // |
34 // Returns -1 if the parse fails. | 34 // Returns -1 if the parse fails. |
35 // Returns 0 if more data is needed. | 35 // Returns 0 if more data is needed. |
36 // Returns the number of bytes parsed on success. | 36 // Returns the number of bytes parsed on success. |
37 int Parse(const uint8* buf, int size); | 37 int Parse(const uint8* buf, int size); |
38 | 38 |
39 base::TimeDelta cluster_start_time() const { return cluster_start_time_; } | 39 base::TimeDelta cluster_start_time() const { return cluster_start_time_; } |
40 const BufferQueue& audio_buffers() const { return audio_.buffers(); } | 40 const BufferQueue& audio_buffers() const { return audio_.buffers(); } |
41 const BufferQueue& video_buffers() const { return video_.buffers(); } | 41 const BufferQueue& video_buffers() const { return video_.buffers(); } |
42 | 42 |
| 43 // Tells the parser to apply |offset| to the timestamp of the next buffers it |
| 44 // parses. |
| 45 void SetTimestampOffset(base::TimeDelta offset); |
| 46 |
| 47 // Resets |timestamp_offset_|. |
| 48 void ClearTimestampOffset(); |
| 49 |
43 private: | 50 private: |
44 // Helper class that manages per-track state. | 51 // Helper class that manages per-track state. |
45 class Track { | 52 class Track { |
46 public: | 53 public: |
47 explicit Track(int track_num); | 54 explicit Track(int track_num); |
48 ~Track(); | 55 ~Track(); |
49 | 56 |
50 int track_num() const { return track_num_; } | 57 int track_num() const { return track_num_; } |
51 const BufferQueue& buffers() const { return buffers_; } | 58 const BufferQueue& buffers() const { return buffers_; } |
52 | 59 |
(...skipping 28 matching lines...) Expand all Loading... |
81 scoped_array<uint8> block_data_; | 88 scoped_array<uint8> block_data_; |
82 int block_data_size_; | 89 int block_data_size_; |
83 int64 block_duration_; | 90 int64 block_duration_; |
84 | 91 |
85 int64 cluster_timecode_; | 92 int64 cluster_timecode_; |
86 base::TimeDelta cluster_start_time_; | 93 base::TimeDelta cluster_start_time_; |
87 | 94 |
88 Track audio_; | 95 Track audio_; |
89 Track video_; | 96 Track video_; |
90 | 97 |
| 98 // An offset to apply to the timestamp of each buffer. |
| 99 base::TimeDelta timestamp_offset_; |
| 100 |
91 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); | 101 DISALLOW_IMPLICIT_CONSTRUCTORS(WebMClusterParser); |
92 }; | 102 }; |
93 | 103 |
94 } // namespace media | 104 } // namespace media |
95 | 105 |
96 #endif // MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ | 106 #endif // MEDIA_WEBM_WEBM_CLUSTER_PARSER_H_ |
OLD | NEW |