| 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 #include "media/midi/midi_manager_alsa.h" | 5 #include "media/midi/midi_manager_alsa.h" | 
| 6 | 6 | 
| 7 #include <alsa/asoundlib.h> | 7 #include <alsa/asoundlib.h> | 
| 8 #include <stdlib.h> | 8 #include <stdlib.h> | 
| 9 #include <algorithm> | 9 #include <algorithm> | 
| 10 #include <string> | 10 #include <string> | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 36 | 36 | 
| 37 // Minimum client id for which we will have ALSA card devices for. When we | 37 // Minimum client id for which we will have ALSA card devices for. When we | 
| 38 // are searching for card devices (used to get the path, id, and manufacturer), | 38 // are searching for card devices (used to get the path, id, and manufacturer), | 
| 39 // we don't want to get confused by kernel clients that do not have a card. | 39 // we don't want to get confused by kernel clients that do not have a card. | 
| 40 // See seq_clientmgr.c in the ALSA code for this. | 40 // See seq_clientmgr.c in the ALSA code for this. | 
| 41 // TODO(agoode): Add proper client -> card export from the kernel to avoid | 41 // TODO(agoode): Add proper client -> card export from the kernel to avoid | 
| 42 //               hardcoding. | 42 //               hardcoding. | 
| 43 const int kMinimumClientIdForCards = 16; | 43 const int kMinimumClientIdForCards = 16; | 
| 44 | 44 | 
| 45 // udev key constants. | 45 // udev key constants. | 
|  | 46 #if defined(USE_UDEV) | 
| 46 const char kSoundClass[] = "sound"; | 47 const char kSoundClass[] = "sound"; | 
| 47 const char kIdVendor[] = "ID_VENDOR"; | 48 const char kIdVendor[] = "ID_VENDOR"; | 
| 48 const char kIdVendorEnc[] = "ID_VENDOR_ENC"; | 49 const char kIdVendorEnc[] = "ID_VENDOR_ENC"; | 
| 49 const char kIdVendorFromDatabase[] = "ID_VENDOR_FROM_DATABASE"; | 50 const char kIdVendorFromDatabase[] = "ID_VENDOR_FROM_DATABASE"; | 
| 50 const char kSysattrVendorName[] = "vendor_name"; | 51 const char kSysattrVendorName[] = "vendor_name"; | 
| 51 const char kIdVendorId[] = "ID_VENDOR_ID"; | 52 const char kIdVendorId[] = "ID_VENDOR_ID"; | 
| 52 const char kSysattrVendor[] = "vendor"; | 53 const char kSysattrVendor[] = "vendor"; | 
| 53 const char kIdModelId[] = "ID_MODEL_ID"; | 54 const char kIdModelId[] = "ID_MODEL_ID"; | 
| 54 const char kSysattrModel[] = "model"; | 55 const char kSysattrModel[] = "model"; | 
| 55 const char kIdBus[] = "ID_BUS"; | 56 const char kIdBus[] = "ID_BUS"; | 
| 56 const char kIdPath[] = "ID_PATH"; | 57 const char kIdPath[] = "ID_PATH"; | 
| 57 const char kUsbInterfaceNum[] = "ID_USB_INTERFACE_NUM"; | 58 const char kUsbInterfaceNum[] = "ID_USB_INTERFACE_NUM"; | 
|  | 59 #endif  // defined(USE_UDEV) | 
| 58 | 60 | 
| 59 // ALSA constants. | 61 // ALSA constants. | 
| 60 const char kAlsaHw[] = "hw"; | 62 const char kAlsaHw[] = "hw"; | 
| 61 | 63 | 
| 62 // Constants for the capabilities we search for in inputs and outputs. | 64 // Constants for the capabilities we search for in inputs and outputs. | 
| 63 // See http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html. | 65 // See http://www.alsa-project.org/alsa-doc/alsa-lib/seq.html. | 
| 64 const unsigned int kRequiredInputPortCaps = | 66 const unsigned int kRequiredInputPortCaps = | 
| 65     SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ; | 67     SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ; | 
| 66 const unsigned int kRequiredOutputPortCaps = | 68 const unsigned int kRequiredOutputPortCaps = | 
| 67     SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE; | 69     SND_SEQ_PORT_CAP_WRITE | SND_SEQ_PORT_CAP_SUBS_WRITE; | 
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 725       } | 727       } | 
| 726     } | 728     } | 
| 727   } | 729   } | 
| 728 } | 730 } | 
| 729 | 731 | 
| 730 MidiManager* MidiManager::Create() { | 732 MidiManager* MidiManager::Create() { | 
| 731   return new MidiManagerAlsa(); | 733   return new MidiManagerAlsa(); | 
| 732 } | 734 } | 
| 733 | 735 | 
| 734 }  // namespace media | 736 }  // namespace media | 
| OLD | NEW | 
|---|