1 #ifndef _INPUT_MAPPING_H
2 #define _INPUT_MAPPING_H 1
9 enum class InputSourceType { SILENCE, CAPTURE_CARD, ALSA_INPUT, FFMPEG_VIDEO_INPUT };
14 bool operator== (const DeviceSpec &other) const {
15 return type == other.type && index == other.index;
18 bool operator< (const DeviceSpec &other) const {
19 if (type != other.type)
20 return type < other.type;
21 return index < other.index;
25 std::string display_name;
26 unsigned num_channels;
27 std::string alsa_name, alsa_info, alsa_address; // ALSA devices only, obviously.
30 static inline uint64_t DeviceSpec_to_key(const DeviceSpec &device_spec)
32 return (uint64_t(device_spec.type) << 32) | device_spec.index;
35 static inline DeviceSpec key_to_DeviceSpec(uint64_t key)
37 return DeviceSpec{ InputSourceType(key >> 32), unsigned(key & 0xffffffff) };
44 int source_channel[2] { -1, -1 }; // Left and right. -1 = none.
47 std::vector<Bus> buses;
50 // This is perhaps not the most user-friendly output, but it's at least better
51 // than the raw index.
52 std::string spec_to_string(DeviceSpec device_spec);
54 bool save_input_mapping_to_file(const std::map<DeviceSpec, DeviceInfo> &devices,
55 const InputMapping &mapping,
56 const std::string &filename);
57 bool load_input_mapping_from_file(const std::map<DeviceSpec, DeviceInfo> &devices,
58 const std::string &filename,
59 InputMapping *mapping);
61 #endif // !defined(_INPUT_MAPPING_H)