]> git.sesse.net Git - nageru/blobdiff - nageru/mixer.cpp
Make so that auto white balance is stored per (physical) card, not per signal.
[nageru] / nageru / mixer.cpp
index aac421126b904642ff38f131252faf50727f2be7..63d1f724df4c41032382808d9adb5ba2d2286176 100644 (file)
@@ -801,7 +801,8 @@ void Mixer::bm_frame(unsigned card_index, uint16_t timecode,
                //
                // Only bother doing MJPEG encoding if there are any connected clients
                // that want the stream.
-               if (httpd.get_num_connected_multicam_clients() > 0) {
+               if (httpd.get_num_connected_multicam_clients() > 0 ||
+                   httpd.get_num_connected_siphon_clients(card_index) > 0) {
                        vector<int32_t> converted_samples = convert_audio_to_fixed32(audio_frame.data + audio_offset, num_samples, audio_format, 2);
                        lock_guard<mutex> lock(card_mutex);
                        if (card->new_raw_audio.empty()) {
@@ -1076,7 +1077,7 @@ void Mixer::thread_func()
                        master_card_index = output_card_index;
                } else {
                        master_card_is_output = false;
-                       master_card_index = theme->map_signal(master_clock_channel);
+                       master_card_index = theme->map_signal_to_card(master_clock_channel);
                        assert(master_card_index < num_cards + num_video_inputs);
                }
 
@@ -1133,12 +1134,12 @@ void Mixer::thread_func()
                        if (fabs(new_frame->neutral_color.r - last_received_neutral_color[card_index].r) > 1e-3 ||
                            fabs(new_frame->neutral_color.g - last_received_neutral_color[card_index].g) > 1e-3 ||
                            fabs(new_frame->neutral_color.b - last_received_neutral_color[card_index].b) > 1e-3) {
-                               theme->set_wb_for_signal(card_index, new_frame->neutral_color.r, new_frame->neutral_color.g, new_frame->neutral_color.b);
+                               theme->set_wb_for_card(card_index, new_frame->neutral_color.r, new_frame->neutral_color.g, new_frame->neutral_color.b);
                                last_received_neutral_color[card_index] = new_frame->neutral_color;
                        }
 
                        if (new_frame->frame->data_copy != nullptr && mjpeg_encoder->should_encode_mjpeg_for_card(card_index)) {
-                               RGBTriplet neutral_color = theme->get_white_balance_for_signal(card_index);
+                               RGBTriplet neutral_color = theme->get_white_balance_for_card(card_index);
                                mjpeg_encoder->upload_frame(pts_int, card_index, new_frame->frame, new_frame->video_format, new_frame->y_offset, new_frame->cbcr_offset, move(raw_audio[card_index]), neutral_color);
                        }
 
@@ -1237,11 +1238,11 @@ void Mixer::trim_queue(CaptureCard *card, size_t safe_queue_length)
 pair<string, string> Mixer::get_channels_json()
 {
        Channels ret;
-       for (int channel_idx = 2; channel_idx < theme->get_num_channels(); ++channel_idx) {
+       for (int channel_idx = 0; channel_idx < theme->get_num_channels(); ++channel_idx) {
                Channel *channel = ret.add_channel();
-               channel->set_index(channel_idx);
-               channel->set_name(theme->get_channel_name(channel_idx));
-               channel->set_color(theme->get_channel_color(channel_idx));
+               channel->set_index(channel_idx + 2);
+               channel->set_name(theme->get_channel_name(channel_idx + 2));
+               channel->set_color(theme->get_channel_color(channel_idx + 2));
        }
        string contents;
        google::protobuf::util::MessageToJsonString(ret, &contents);  // Ignore any errors.