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

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

Issue 2673423002: Web MIDI: add dynamic MidiManager instantiation support for Linux (Closed)
Patch Set: update metrics Created 3 years, 10 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
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 #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 <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 }; 366 };
367 }; 367 };
368 368
369 using SourceMap = base::hash_map<int, uint32_t>; 369 using SourceMap = base::hash_map<int, uint32_t>;
370 using OutPortMap = base::hash_map<uint32_t, int>; 370 using OutPortMap = base::hash_map<uint32_t, int>;
371 using ScopedSndSeqPtr = std::unique_ptr<snd_seq_t, SndSeqDeleter>; 371 using ScopedSndSeqPtr = std::unique_ptr<snd_seq_t, SndSeqDeleter>;
372 using ScopedSndMidiEventPtr = 372 using ScopedSndMidiEventPtr =
373 std::unique_ptr<snd_midi_event_t, SndMidiEventDeleter>; 373 std::unique_ptr<snd_midi_event_t, SndMidiEventDeleter>;
374 374
375 // An internal callback that runs on MidiSendThread. 375 // An internal callback that runs on MidiSendThread.
376 void SendMidiData(uint32_t port_index, const std::vector<uint8_t>& data); 376 void SendMidiData(int instance_id,
377 MidiManagerClient* client,
378 uint32_t port_index,
379 const std::vector<uint8_t>& data);
377 380
378 void ScheduleEventLoop(); 381 void EventLoop(int instance_id);
379 void EventLoop();
380 void ProcessSingleEvent(snd_seq_event_t* event, double timestamp); 382 void ProcessSingleEvent(snd_seq_event_t* event, double timestamp);
381 void ProcessClientStartEvent(int client_id); 383 void ProcessClientStartEvent(int client_id);
382 void ProcessPortStartEvent(const snd_seq_addr_t& addr); 384 void ProcessPortStartEvent(const snd_seq_addr_t& addr);
383 void ProcessClientExitEvent(const snd_seq_addr_t& addr); 385 void ProcessClientExitEvent(const snd_seq_addr_t& addr);
384 void ProcessPortExitEvent(const snd_seq_addr_t& addr); 386 void ProcessPortExitEvent(const snd_seq_addr_t& addr);
385 void ProcessUdevEvent(udev_device* dev); 387 void ProcessUdevEvent(udev_device* dev);
386 void AddCard(udev_device* dev); 388 void AddCard(udev_device* dev);
387 void RemoveCard(int number); 389 void RemoveCard(int number);
388 390
389 // Updates port_state_ and Web MIDI state from alsa_seq_state_. 391 // Updates port_state_ and Web MIDI state from alsa_seq_state_.
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
440 int out_client_id_; 442 int out_client_id_;
441 int in_port_id_; 443 int in_port_id_;
442 444
443 // ALSA event -> MIDI coder. 445 // ALSA event -> MIDI coder.
444 ScopedSndMidiEventPtr decoder_; 446 ScopedSndMidiEventPtr decoder_;
445 447
446 // udev, for querying hardware devices. 448 // udev, for querying hardware devices.
447 device::ScopedUdevPtr udev_; 449 device::ScopedUdevPtr udev_;
448 device::ScopedUdevMonitorPtr udev_monitor_; 450 device::ScopedUdevMonitorPtr udev_monitor_;
449 451
450 // Threads for sending and receiving. These are initialized in the 452 int instance_id_;
451 // constructor, but are started at the end of StartInitialization.
452 base::Thread event_thread_;
453 base::Thread send_thread_;
454 453
455 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa); 454 DISALLOW_COPY_AND_ASSIGN(MidiManagerAlsa);
456 }; 455 };
457 456
458 } // namespace midi 457 } // namespace midi
459 458
460 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_ 459 #endif // MEDIA_MIDI_MIDI_MANAGER_ALSA_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698