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_BASE_STREAM_PARSER_H_ | 5 #ifndef MEDIA_BASE_STREAM_PARSER_H_ |
6 #define MEDIA_BASE_STREAM_PARSER_H_ | 6 #define MEDIA_BASE_STREAM_PARSER_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
| 11 #include <vector> |
11 | 12 |
12 #include "base/callback_forward.h" | 13 #include "base/callback_forward.h" |
13 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
15 #include "base/time/time.h" | 16 #include "base/time/time.h" |
16 #include "media/base/media_export.h" | 17 #include "media/base/media_export.h" |
17 #include "media/base/media_log.h" | 18 #include "media/base/media_log.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 | 21 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 | 105 |
105 // Called when there is new data to parse. | 106 // Called when there is new data to parse. |
106 // | 107 // |
107 // Returns true if the parse succeeds. | 108 // Returns true if the parse succeeds. |
108 virtual bool Parse(const uint8* buf, int size) = 0; | 109 virtual bool Parse(const uint8* buf, int size) = 0; |
109 | 110 |
110 private: | 111 private: |
111 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 112 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
112 }; | 113 }; |
113 | 114 |
| 115 // Appends to |merged_buffers| the provided buffers in decode-timestamp order. |
| 116 // Any previous contents of |merged_buffers| is assumed to have lower |
| 117 // decode timestamps versus the provided buffers. All provided buffer queues |
| 118 // are assumed to already be in decode-timestamp order. |
| 119 // Returns false if any of the provided audio/video/text buffers are found |
| 120 // to not be in decode timestamp order, or have a decode timestamp less than |
| 121 // the last buffer, if any, in |merged_buffers|. Partial results may exist |
| 122 // in |merged_buffers| in this case. Returns true on success. |
| 123 // No validation of media type within the various buffer queues is done here. |
| 124 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate |
| 125 // subtle issues with tie-breaking. See http://crbug.com/338484. |
| 126 MEDIA_EXPORT bool MergeBufferQueues( |
| 127 const StreamParser::BufferQueue& audio_buffers, |
| 128 const StreamParser::BufferQueue& video_buffers, |
| 129 const StreamParser::TextBufferQueueMap& text_buffers, |
| 130 StreamParser::BufferQueue* merged_buffers); |
| 131 |
114 } // namespace media | 132 } // namespace media |
115 | 133 |
116 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 134 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
OLD | NEW |