]> git.sesse.net Git - kdenlive/commitdiff
Fix segfault choosing Blackmagic playback card for the first time.
authorDan Dennedy <dan@dennedy.org>
Tue, 22 Mar 2011 05:28:50 +0000 (05:28 +0000)
committerDan Dennedy <dan@dennedy.org>
Tue, 22 Mar 2011 05:28:50 +0000 (05:28 +0000)
svn path=/trunk/kdenlive/; revision=5511

src/blackmagic/devices.cpp
src/kdenlivesettings.kcfg
src/renderer.cpp

index 8c139b71abc3c80dfc7a9efa1fc12a2a464a897f..fddb4ae9361fc0a9f09fd95b15fbb39b4883bda8 100644 (file)
@@ -163,9 +163,6 @@ bool BMInterface::getBlackMagicOutputDeviceList(KComboBox *devicelist)
     while(deckLinkIterator->Next(&deckLink) == S_OK) {
         char *      deviceNameString = NULL;
 
-        // Increment the total number of DeckLink cards found
-        numDevices++;
-        //if (numDevices > 1)
         kDebug() << "// FOUND a BM device\n\n+++++++++++++++++++++++++++++++++++++";
 
         // *** Print the model name of the DeckLink card
@@ -221,7 +218,7 @@ bool BMInterface::getBlackMagicOutputDeviceList(KComboBox *devicelist)
                 // Release the IDeckLinkDisplayMode object to prevent a leak
                 displayMode->Release();
             }*/
-            devicelist->addItem(deviceName);
+            devicelist->addItem(deviceName, numDevices++);
             found = true;
         }
 
index 8e0dc584d1ab861794fe2900c7f7f0dac9a00ea6..c03c47c4b76b66ba57617528f959e5df4f7a5de2 100644 (file)
       <label>Use Blackmagic device for video out.</label>
       <default>false</default>
     </entry>
-    <entry name="blackmagic_output_device" type="UInt">
+    <entry name="blackmagic_output_device" type="Int">
       <label>Blackmagic video output device.</label>
       <default>0</default>
     </entry>
index 054aa0c6ff50934d43bb338eeb3ab904de4b5865..c70abc4eaab2ec182ad12506ba1bfa097f7f1b35 100644 (file)
@@ -198,22 +198,25 @@ void Render::buildConsumer(const QString profileName)
     if (KdenliveSettings::external_display() && m_name != "clip") {
         // Use blackmagic card for video output
         QMap< QString, QString > profileProperties = ProfilesDialog::getSettingsFromFile(profileName);
-        if (BMInterface::isSupportedProfile(KdenliveSettings::blackmagic_output_device(), profileProperties)) {
-            QString decklink = "decklink:" + QString::number(KdenliveSettings::blackmagic_output_device());
-            tmp = qstrdup(decklink.toUtf8().constData());
-            m_mltConsumer = new Mlt::Consumer(*m_mltProfile, tmp);
-            delete[] tmp;
-            if (m_mltConsumer->is_valid()) {
-                m_externalConsumer = true;
-                m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
-                m_mltConsumer->set("terminate_on_pause", 0);
-                m_mltConsumer->set("buffer", 12);
-                m_mltConsumer->set("deinterlace_method", "onefield");
-                m_mltConsumer->set("real_time", KdenliveSettings::mltthreads());
-                mlt_log_set_callback(kdenlive_callback);
-            }
-            if (m_mltConsumer && m_mltConsumer->is_valid()) return;
-        } else KMessageBox::informationList(qApp->activeWindow(), i18n("Your project's profile %1 is not compatible with the blackmagic output card. Please see supported profiles below. Switching to normal video display.", m_mltProfile->description()), BMInterface::supportedModes(KdenliveSettings::blackmagic_output_device()));
+        int device = KdenliveSettings::blackmagic_output_device();
+        if (device >= 0) {
+            if (BMInterface::isSupportedProfile(device, profileProperties)) {
+                QString decklink = "decklink:" + QString::number(KdenliveSettings::blackmagic_output_device());
+                tmp = qstrdup(decklink.toUtf8().constData());
+                m_mltConsumer = new Mlt::Consumer(*m_mltProfile, tmp);
+                delete[] tmp;
+                if (m_mltConsumer->is_valid()) {
+                    m_externalConsumer = true;
+                    m_mltConsumer->listen("consumer-frame-show", this, (mlt_listener) consumer_frame_show);
+                    m_mltConsumer->set("terminate_on_pause", 0);
+                    m_mltConsumer->set("buffer", 12);
+                    m_mltConsumer->set("deinterlace_method", "onefield");
+                    m_mltConsumer->set("real_time", KdenliveSettings::mltthreads());
+                    mlt_log_set_callback(kdenlive_callback);
+                }
+                if (m_mltConsumer && m_mltConsumer->is_valid()) return;
+            } else KMessageBox::informationList(qApp->activeWindow(), i18n("Your project's profile %1 is not compatible with the blackmagic output card. Please see supported profiles below. Switching to normal video display.", m_mltProfile->description()), BMInterface::supportedModes(KdenliveSettings::blackmagic_output_device()));
+        }
     }
     m_externalConsumer = false;
     QString videoDriver = KdenliveSettings::videodrivername();