Add details (where missing) for histograms and remove a few that are not worth provid...
[chromium-blink-merge.git] / media / midi / midi_manager_alsa.h
blob04e1d09907086aaafeaae0ab106d951b8abb9642
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
3 // found in the LICENSE file.
5 #ifndef MEDIA_MIDI_MIDI_MANAGER_ALSA_H_
6 #define MEDIA_MIDI_MIDI_MANAGER_ALSA_H_
8 #include <poll.h>
9 #include <vector>
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/threading/thread.h"
14 #include "media/midi/midi_manager.h"
16 namespace media {
18 class MidiManagerAlsa : public MidiManager {
19 public:
20 MidiManagerAlsa();
21 virtual ~MidiManagerAlsa();
23 // MidiManager implementation.
24 virtual void StartInitialization() OVERRIDE;
25 virtual void DispatchSendMidiData(MidiManagerClient* client,
26 uint32 port_index,
27 const std::vector<uint8>& data,
28 double timestamp) OVERRIDE;
30 private:
31 void EventReset();
32 void EventLoop();
34 class MidiDeviceInfo;
35 std::vector<scoped_refptr<MidiDeviceInfo> > in_devices_;
36 std::vector<scoped_refptr<MidiDeviceInfo> > out_devices_;
37 base::Thread send_thread_;
38 base::Thread event_thread_;
40 // Used for shutting down the |event_thread_| safely.
41 int pipe_fd_[2];
42 // Used for polling input MIDI ports and |pipe_fd_| in |event_thread_|.
43 std::vector<struct pollfd> poll_fds_;
45 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa);
48 } // namespace media
50 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_