OLD | NEW |
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 #ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 5 #ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
6 #define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 6 #define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
7 | 7 |
8 #include <alsa/asoundlib.h> | 8 #include <alsa/asoundlib.h> |
9 #include <map> | 9 #include <map> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
17 #include "base/synchronization/lock.h" | 17 #include "base/synchronization/lock.h" |
18 #include "base/threading/thread.h" | 18 #include "base/threading/thread.h" |
19 #include "base/values.h" | 19 #include "base/values.h" |
| 20 #include "device/udev_linux/scoped_udev.h" |
20 #include "media/midi/midi_manager.h" | 21 #include "media/midi/midi_manager.h" |
21 | 22 |
22 namespace media { | 23 namespace media { |
23 | 24 |
24 class MEDIA_EXPORT MidiManagerAlsa final : public MidiManager { | 25 class MEDIA_EXPORT MidiManagerAlsa final : public MidiManager { |
25 public: | 26 public: |
26 MidiManagerAlsa(); | 27 MidiManagerAlsa(); |
27 ~MidiManagerAlsa() override; | 28 ~MidiManagerAlsa() override; |
28 | 29 |
29 // MidiManager implementation. | 30 // MidiManager implementation. |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 int in_port_id_; | 306 int in_port_id_; |
306 OutPortMap out_ports_; // guarded by out_ports_lock_ | 307 OutPortMap out_ports_; // guarded by out_ports_lock_ |
307 base::Lock out_ports_lock_; // guards out_ports_ | 308 base::Lock out_ports_lock_; // guards out_ports_ |
308 | 309 |
309 // Mapping from ALSA client:port to our index. | 310 // Mapping from ALSA client:port to our index. |
310 SourceMap source_map_; | 311 SourceMap source_map_; |
311 | 312 |
312 // ALSA event -> MIDI coder. | 313 // ALSA event -> MIDI coder. |
313 snd_midi_event_t* decoder_; | 314 snd_midi_event_t* decoder_; |
314 | 315 |
| 316 // udev, for querying hardware devices. |
| 317 device::ScopedUdevPtr udev_; |
| 318 |
315 base::Thread send_thread_; | 319 base::Thread send_thread_; |
316 base::Thread event_thread_; | 320 base::Thread event_thread_; |
317 | 321 |
318 bool event_thread_shutdown_; // guarded by shutdown_lock_ | 322 bool event_thread_shutdown_; // guarded by shutdown_lock_ |
319 base::Lock shutdown_lock_; // guards event_thread_shutdown_ | 323 base::Lock shutdown_lock_; // guards event_thread_shutdown_ |
320 | 324 |
321 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa); | 325 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa); |
322 }; | 326 }; |
323 | 327 |
324 } // namespace media | 328 } // namespace media |
325 | 329 |
326 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ | 330 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ |
OLD | NEW |