]> git.sesse.net Git - nageru/blobdiff - nageru/glwidget.cpp
Make number of cards flexible at runtime.
[nageru] / nageru / glwidget.cpp
index 62aeebc9cc14a0a7de7ca47a2be03076d1d79537..f5f350a6865188194f7bf58c7a778521cd0dad92 100644 (file)
@@ -88,7 +88,7 @@ void GLWidget::initializeGL()
 {
        static once_flag flag;
        call_once(flag, [this]{
-               global_mixer = new Mixer(QGLFormat::toSurfaceFormat(format()), global_flags.num_cards);
+               global_mixer = new Mixer(QGLFormat::toSurfaceFormat(format()));
                global_audio_mixer = global_mixer->get_audio_mixer();
                global_mainwindow->mixer_created(global_mixer);
                global_mixer->start();
@@ -227,12 +227,13 @@ void GLWidget::show_preview_context_menu(unsigned signal_num, const QPoint &pos)
        QMenu mode_submenu;
        QActionGroup mode_group(&mode_submenu);
 
-       unsigned num_cards = global_mixer->get_num_cards();
        unsigned current_card = global_mixer->map_signal_to_card(signal_num);
        bool is_ffmpeg = global_mixer->card_is_ffmpeg(current_card);
 
        if (!is_ffmpeg) {  // FFmpeg inputs are not connected to any card; they're locked to a given input and have a given Y'CbCr interpretatio and have a given Y'CbCr interpretation.
-               for (unsigned card_index = 0; card_index < num_cards; ++card_index) {
+               for (unsigned card_index = 0; card_index < MAX_VIDEO_CARDS; ++card_index) {
+                       if (!global_mixer->card_is_active(card_index)) continue;
+                       if (global_mixer->card_is_cef(card_index) || global_mixer->card_is_ffmpeg(card_index)) continue;
                        QString description(QString::fromStdString(global_mixer->get_card_description(card_index)));
                        QAction *action = new QAction(description, &card_group);
                        action->setCheckable(true);