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 CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ | 5 #ifndef CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ |
6 #define CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ | 6 #define CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 | 15 |
16 namespace speech { | 16 namespace content { |
17 | 17 |
18 // Models a chunk-oriented byte buffer. The term chunk is herein defined as an | 18 // Models a chunk-oriented byte buffer. The term chunk is herein defined as an |
19 // arbitrary sequence of bytes that is preceeded by N header bytes, indicating | 19 // arbitrary sequence of bytes that is preceeded by N header bytes, indicating |
20 // its size. Data may be appended to the buffer with no particular respect of | 20 // its size. Data may be appended to the buffer with no particular respect of |
21 // chunks boundaries. However, chunks can be extracted (FIFO) only when their | 21 // chunks boundaries. However, chunks can be extracted (FIFO) only when their |
22 // content (according to their header) is fully available in the buffer. | 22 // content (according to their header) is fully available in the buffer. |
23 // The current implementation support only 4 byte Big Endian headers. | 23 // The current implementation support only 4 byte Big Endian headers. |
24 // Empty chunks (i.e. the sequence 00 00 00 00) are NOT allowed. | 24 // Empty chunks (i.e. the sequence 00 00 00 00) are NOT allowed. |
25 // | 25 // |
26 // E.g. 00 00 00 04 xx xx xx xx 00 00 00 02 yy yy 00 00 00 04 zz zz zz zz | 26 // E.g. 00 00 00 04 xx xx xx xx 00 00 00 02 yy yy 00 00 00 04 zz zz zz zz |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 }; | 63 }; |
64 | 64 |
65 ScopedVector<Chunk> chunks_; | 65 ScopedVector<Chunk> chunks_; |
66 scoped_ptr<Chunk> partial_chunk_; | 66 scoped_ptr<Chunk> partial_chunk_; |
67 size_t total_bytes_stored_; | 67 size_t total_bytes_stored_; |
68 | 68 |
69 DISALLOW_COPY_AND_ASSIGN(ChunkedByteBuffer); | 69 DISALLOW_COPY_AND_ASSIGN(ChunkedByteBuffer); |
70 }; | 70 }; |
71 | 71 |
72 | 72 |
73 } // namespace speech | 73 } // namespace content |
74 | 74 |
75 #endif // CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ | 75 #endif // CONTENT_BROWSER_SPEECH_CHUNKED_BYTE_BUFFER_H_ |
OLD | NEW |