Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(612)

Side by Side Diff: media/midi/usb_midi_descriptor_parser.h

Issue 105043008: Introduce USB MIDI descriptor parser (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/media.gyp ('k') | media/midi/usb_midi_descriptor_parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_MIDI_USB_MIDI_DESCRIPTOR_PARSER_H_
6 #define MEDIA_MIDI_USB_MIDI_DESCRIPTOR_PARSER_H_
7
8 #include <vector>
9
10 #include "base/basictypes.h"
11 #include "media/base/media_export.h"
12 #include "media/midi/usb_midi_jack.h"
13
14 namespace media {
15
16 class UsbMidiDevice;
17
18 // UsbMidiDescriptorParser parses USB descriptors and
19 // generates input / output lists of MIDIPortInfo.
20 // This is not a generic USB descriptor parser: this parser is designed
21 // for collecting USB-MIDI jacks information from the descriptor.
22 class MEDIA_EXPORT UsbMidiDescriptorParser {
23 public:
24 UsbMidiDescriptorParser();
25 ~UsbMidiDescriptorParser();
26
27 // Returns true if the operation succeeds.
28 // When an incorrect input is given, this method may return true but
29 // never crashes.
30 bool Parse(UsbMidiDevice* device,
31 const uint8* data,
32 size_t size,
33 std::vector<UsbMidiJack>* jacks);
34
35 private:
36 bool ParseInternal(UsbMidiDevice* device,
37 const uint8* data,
38 size_t size,
39 std::vector<UsbMidiJack>* jacks);
40 bool ParseInterface(const uint8* data, size_t size);
41 bool ParseCSInterface(UsbMidiDevice* device, const uint8* data, size_t size);
42 bool ParseEndpoint(const uint8* data, size_t size);
43 bool ParseCSEndpoint(const uint8* data,
44 size_t size,
45 std::vector<UsbMidiJack>* jacks);
46 void Clear();
47
48 bool is_parsing_usb_midi_interface_;
49 uint8 current_endpoint_address_;
50 uint8 current_cable_number_;
51
52 std::vector<UsbMidiJack> incomplete_jacks_;
53
54 DISALLOW_COPY_AND_ASSIGN(UsbMidiDescriptorParser);
55 };
56
57
58 } // namespace media
59
60 #endif // MEDIA_MIDI_USB_MIDI_DESCRIPTOR_PARSER_H_
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | media/midi/usb_midi_descriptor_parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698