Chromium Code Reviews| 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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 // Called when a seek occurs. This flushes the current parser state | 101 // Called when a seek occurs. This flushes the current parser state |
| 101 // and puts the parser in a state where it can receive data for the new seek | 102 // and puts the parser in a state where it can receive data for the new seek |
| 102 // point. | 103 // point. |
| 103 virtual void Flush() = 0; | 104 virtual void Flush() = 0; |
| 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 |
| 111 // Appends to |merged_buffers| the provided buffers in decode-timestamp order. | |
| 112 // Any previous contents of |merged_buffers| is assumed to have lower | |
| 113 // decode timestamps versus the provided buffers. All provided buffer queues | |
| 114 // are assumed to already be in decode-timestamp order. | |
| 115 // Returns false if any of the provided audio/video/text buffers are found | |
| 116 // to not be in decode timestamp order, or have a decode timestamp less than | |
| 117 // the last buffer, if any, in |merged_buffers|. Partial results may exist | |
| 118 // in |merged_buffers| in this case. Returns true on success. | |
| 119 // No validation of media type within the various buffer queues is done here. | |
| 120 // TODO(wolenetz/acolwell): Merge incrementally in parsers to eliminate | |
| 121 // subtle issues with tie-breaking. See http://crbug.com/338484. | |
| 122 static bool MergeBufferQueues(const BufferQueue& audio_buffers, | |
| 123 const BufferQueue& video_buffers, | |
| 124 const TextBufferQueueMap& text_buffers, | |
| 125 BufferQueue* merged_buffers); | |
|
xhwang
2014/01/29 08:04:50
put static function before non-static functions.
wolenetz
2014/02/05 02:49:53
Done (actually changed to non-member function per
| |
| 126 | |
| 110 private: | 127 private: |
| 128 // Helper that does the bulk of the overloaded method, above. | |
| 129 static bool MergeBufferQueues(std::vector<const BufferQueue*> buffer_queues, | |
|
xhwang
2014/01/29 08:04:50
pass the vector by const-ref?
We usually don't li
wolenetz
2014/02/05 02:49:53
Done and done. And made it a non-member .cc-scoped
| |
| 130 BufferQueue* merged_buffers); | |
| 131 | |
| 111 DISALLOW_COPY_AND_ASSIGN(StreamParser); | 132 DISALLOW_COPY_AND_ASSIGN(StreamParser); |
| 112 }; | 133 }; |
| 113 | 134 |
| 114 } // namespace media | 135 } // namespace media |
| 115 | 136 |
| 116 #endif // MEDIA_BASE_STREAM_PARSER_H_ | 137 #endif // MEDIA_BASE_STREAM_PARSER_H_ |
| OLD | NEW |