| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include "media/midi/midi_manager.h" | 5 #include "media/midi/midi_manager.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 | 9 |
| 10 namespace media { | 10 namespace media { |
| 11 | 11 |
| 12 #if !defined(OS_MACOSX) && !defined(OS_WIN) | 12 #if !defined(OS_MACOSX) && !defined(OS_WIN) |
| 13 // TODO(crogers): implement MIDIManager for other platforms. | 13 // TODO(crogers): implement MIDIManager for other platforms. |
| 14 MIDIManager* MIDIManager::Create() { | 14 MIDIManager* MIDIManager::Create() { |
| 15 return NULL; | 15 return new MIDIManager; |
| 16 } | 16 } |
| 17 #endif | 17 #endif |
| 18 | 18 |
| 19 MIDIManager::MIDIManager() | 19 MIDIManager::MIDIManager() |
| 20 : initialized_(false) { | 20 : initialized_(false) { |
| 21 } | 21 } |
| 22 | 22 |
| 23 MIDIManager::~MIDIManager() { | 23 MIDIManager::~MIDIManager() { |
| 24 } | 24 } |
| 25 | 25 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 36 return initialized_; | 36 return initialized_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 void MIDIManager::EndSession(MIDIManagerClient* client) { | 39 void MIDIManager::EndSession(MIDIManagerClient* client) { |
| 40 base::AutoLock auto_lock(clients_lock_); | 40 base::AutoLock auto_lock(clients_lock_); |
| 41 ClientList::iterator i = clients_.find(client); | 41 ClientList::iterator i = clients_.find(client); |
| 42 if (i != clients_.end()) | 42 if (i != clients_.end()) |
| 43 clients_.erase(i); | 43 clients_.erase(i); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void MIDIManager::DispatchSendMIDIData(MIDIManagerClient* client, |
| 47 uint32 port_index, |
| 48 const std::vector<uint8>& data, |
| 49 double timestamp) { |
| 50 NOTREACHED(); |
| 51 } |
| 52 |
| 53 bool MIDIManager::Initialize() { |
| 54 return false; |
| 55 } |
| 56 |
| 46 void MIDIManager::AddInputPort(const MIDIPortInfo& info) { | 57 void MIDIManager::AddInputPort(const MIDIPortInfo& info) { |
| 47 input_ports_.push_back(info); | 58 input_ports_.push_back(info); |
| 48 } | 59 } |
| 49 | 60 |
| 50 void MIDIManager::AddOutputPort(const MIDIPortInfo& info) { | 61 void MIDIManager::AddOutputPort(const MIDIPortInfo& info) { |
| 51 output_ports_.push_back(info); | 62 output_ports_.push_back(info); |
| 52 } | 63 } |
| 53 | 64 |
| 54 void MIDIManager::ReceiveMIDIData( | 65 void MIDIManager::ReceiveMIDIData( |
| 55 uint32 port_index, | 66 uint32 port_index, |
| 56 const uint8* data, | 67 const uint8* data, |
| 57 size_t length, | 68 size_t length, |
| 58 double timestamp) { | 69 double timestamp) { |
| 59 base::AutoLock auto_lock(clients_lock_); | 70 base::AutoLock auto_lock(clients_lock_); |
| 60 | 71 |
| 61 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) | 72 for (ClientList::iterator i = clients_.begin(); i != clients_.end(); ++i) |
| 62 (*i)->ReceiveMIDIData(port_index, data, length, timestamp); | 73 (*i)->ReceiveMIDIData(port_index, data, length, timestamp); |
| 63 } | 74 } |
| 64 | 75 |
| 65 } // namespace media | 76 } // namespace media |
| OLD | NEW |