]> git.sesse.net Git - nageru/blobdiff - nageru/input_mapping.cpp
Make number of cards flexible at runtime.
[nageru] / nageru / input_mapping.cpp
index dfcc97ce5e6613cd8c51f12d55a1be49433daf5f..cad723a7a92b9c8dee18809e4525b9011d2ade30 100644 (file)
 using namespace std;
 using namespace google::protobuf;
 
-string spec_to_string(DeviceSpec device_spec)
-{
-       char buf[256];
-
-       switch (device_spec.type) {
-       case InputSourceType::SILENCE:
-               return "<silence>";
-       case InputSourceType::CAPTURE_CARD:
-               snprintf(buf, sizeof(buf), "Capture card %u", device_spec.index);
-               return buf;
-       case InputSourceType::ALSA_INPUT:
-               snprintf(buf, sizeof(buf), "ALSA input %u", device_spec.index);
-               return buf;
-       case InputSourceType::FFMPEG_VIDEO_INPUT:
-               snprintf(buf, sizeof(buf), "FFmpeg input %u", device_spec.index);
-               return buf;
-       default:
-               assert(false);
-       }
-}
-
 bool save_input_mapping_to_file(const map<DeviceSpec, DeviceInfo> &devices, const InputMapping &input_mapping, const string &filename)
 {
        InputMappingProto mapping_proto;
@@ -83,12 +62,10 @@ bool load_input_mapping_from_file(const map<DeviceSpec, DeviceInfo> &devices, co
                case DeviceSpecProto::SILENCE:
                        device_mapping.push_back(DeviceSpec{InputSourceType::SILENCE, 0});
                        break;
-               case DeviceSpecProto::FFMPEG_VIDEO_INPUT:
                case DeviceSpecProto::CAPTURE_CARD: {
                        // First see if there's a card that matches on both index and name.
                        DeviceSpec spec;
-                       spec.type = (device_proto.type() == DeviceSpecProto::CAPTURE_CARD) ?
-                               InputSourceType::CAPTURE_CARD : InputSourceType::FFMPEG_VIDEO_INPUT;
+                       spec.type = InputSourceType::CAPTURE_CARD;
                        spec.index = unsigned(device_proto.index());
                        assert(devices.count(spec));