OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MIDI_MIDI_MESSAGE_QUEUE_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ |
6 #define MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ | 6 #define MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
11 #include <deque> | 11 #include <deque> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "media/midi/midi_export.h" | 15 #include "media/midi/midi_export.h" |
16 | 16 |
17 namespace media { | |
18 namespace midi { | 17 namespace midi { |
19 | 18 |
20 // A simple message splitter for possibly unsafe/corrupted MIDI data stream. | 19 // A simple message splitter for possibly unsafe/corrupted MIDI data stream. |
21 // This class allows you to: | 20 // This class allows you to: |
22 // - maintain fragmented MIDI message. | 21 // - maintain fragmented MIDI message. |
23 // - skip any invalid data sequence. | 22 // - skip any invalid data sequence. |
24 // - reorder MIDI messages so that "System Real Time Message", which can be | 23 // - reorder MIDI messages so that "System Real Time Message", which can be |
25 // inserted at any point of the byte stream, is placed at the boundary of | 24 // inserted at any point of the byte stream, is placed at the boundary of |
26 // complete MIDI messages. | 25 // complete MIDI messages. |
27 // - (Optional) reconstruct complete MIDI messages from data stream where | 26 // - (Optional) reconstruct complete MIDI messages from data stream where |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 void Get(std::vector<uint8_t>* message); | 64 void Get(std::vector<uint8_t>* message); |
66 | 65 |
67 private: | 66 private: |
68 std::deque<uint8_t> queue_; | 67 std::deque<uint8_t> queue_; |
69 std::vector<uint8_t> next_message_; | 68 std::vector<uint8_t> next_message_; |
70 const bool allow_running_status_; | 69 const bool allow_running_status_; |
71 DISALLOW_COPY_AND_ASSIGN(MidiMessageQueue); | 70 DISALLOW_COPY_AND_ASSIGN(MidiMessageQueue); |
72 }; | 71 }; |
73 | 72 |
74 } // namespace midi | 73 } // namespace midi |
75 } // namespace media | |
76 | 74 |
77 #endif // MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ | 75 #endif // MEDIA_MIDI_MIDI_MESSAGE_QUEUE_H_ |
OLD | NEW |