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

Side by Side Diff: media/midi/midi_manager_usb.cc

Issue 516893002: [MIDI] Make android MIDI port id unique (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "media/midi/midi_manager_usb.h" 5 #include "media/midi/midi_manager_usb.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
11 #include "base/strings/stringprintf.h"
11 #include "media/midi/usb_midi_descriptor_parser.h" 12 #include "media/midi/usb_midi_descriptor_parser.h"
12 #include "media/midi/usb_midi_device.h" 13 #include "media/midi/usb_midi_device.h"
13 #include "media/midi/usb_midi_input_stream.h" 14 #include "media/midi/usb_midi_input_stream.h"
14 #include "media/midi/usb_midi_jack.h" 15 #include "media/midi/usb_midi_jack.h"
15 #include "media/midi/usb_midi_output_stream.h" 16 #include "media/midi/usb_midi_output_stream.h"
16 17
17 namespace media { 18 namespace media {
18 19
19 MidiManagerUsb::MidiManagerUsb(scoped_ptr<UsbMidiDevice::Factory> factory) 20 MidiManagerUsb::MidiManagerUsb(scoped_ptr<UsbMidiDevice::Factory> factory)
20 : device_factory_(factory.Pass()) { 21 : device_factory_(factory.Pass()) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 &jacks); 88 &jacks);
88 if (!parse_result) { 89 if (!parse_result) {
89 initialize_callback_.Run(MIDI_INITIALIZATION_ERROR); 90 initialize_callback_.Run(MIDI_INITIALIZATION_ERROR);
90 return; 91 return;
91 } 92 }
92 std::vector<UsbMidiJack> input_jacks; 93 std::vector<UsbMidiJack> input_jacks;
93 for (size_t j = 0; j < jacks.size(); ++j) { 94 for (size_t j = 0; j < jacks.size(); ++j) {
94 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) { 95 if (jacks[j].direction() == UsbMidiJack::DIRECTION_OUT) {
95 output_streams_.push_back(new UsbMidiOutputStream(jacks[j])); 96 output_streams_.push_back(new UsbMidiOutputStream(jacks[j]));
96 // TODO(yhirano): Set appropriate properties. 97 // TODO(yhirano): Set appropriate properties.
97 AddOutputPort(MidiPortInfo()); 98 MidiPortInfo port;
99 port.id = base::StringPrintf("port-%zu-%zu", i, j);
Takashi Toyoshima 2014/08/28 11:52:11 I might be wrong, but the i and j mean the USB por
yhirano 2014/08/28 13:09:14 They are just indices and are not meaningful. I wi
100 AddOutputPort(port);
98 } else { 101 } else {
99 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN); 102 DCHECK_EQ(jacks[j].direction(), UsbMidiJack::DIRECTION_IN);
100 input_jacks.push_back(jacks[j]); 103 input_jacks.push_back(jacks[j]);
101 // TODO(yhirano): Set appropriate properties. 104 // TODO(yhirano): Set appropriate properties.
102 AddInputPort(MidiPortInfo()); 105 MidiPortInfo port;
106 port.id = base::StringPrintf("port-%zu-%zu", i, j);
107 AddInputPort(port);
103 } 108 }
104 } 109 }
105 input_stream_.reset(new UsbMidiInputStream(input_jacks, this)); 110 input_stream_.reset(new UsbMidiInputStream(input_jacks, this));
106 } 111 }
107 initialize_callback_.Run(MIDI_OK); 112 initialize_callback_.Run(MIDI_OK);
108 } 113 }
109 114
110 } // namespace media 115 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698