Commit 4a8e44bb by 景炳强

fixed

parent 109ce9e1
...@@ -96,7 +96,7 @@ private: ...@@ -96,7 +96,7 @@ private:
int m_fps; int m_fps;
uint64_t m_lastRecvTS; uint64_t m_lastRecvTS;
bool m_isActive;
}; };
class DeckLinkInputFormatChangedEvent : public QEvent class DeckLinkInputFormatChangedEvent : public QEvent
......
...@@ -35,6 +35,9 @@ public: ...@@ -35,6 +35,9 @@ public:
ComPtr<DeckLinkInputDevice> GetSelectedDevice(void) const { return SelectedDevice; } ComPtr<DeckLinkInputDevice> GetSelectedDevice(void) const { return SelectedDevice; }
CaptureThread* GetCapture() { return Capture.get(); } CaptureThread* GetCapture() { return Capture.get(); }
void updateToolBoxTitle();
public slots: public slots:
void InputDeviceChanged(int selectedDeviceIndex); void InputDeviceChanged(int selectedDeviceIndex);
void InputConnectionChanged(int selectedConnectionIndex); void InputConnectionChanged(int selectedConnectionIndex);
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "ui_MomentaMedia.h" #include "ui_MomentaMedia.h"
static const int kPreviewDevicesCount = 4; static const int kPreviewDevicesCount = 2;
class MomentaMedia : public QMainWindow class MomentaMedia : public QMainWindow
{ {
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "Utils/Platform.h" #include "Utils/Platform.h"
#include "BlackMagicDesign/DeckLinkInputDevice.h" #include "BlackMagicDesign/DeckLinkInputDevice.h"
#include "Utils/Common.h" #include "Utils/Common.h"
#include "BlackMagicDesign/DeckLinkInputPage.h"
extern int AudioChannel; extern int AudioChannel;
...@@ -24,7 +25,8 @@ DeckLinkInputDevice::DeckLinkInputDevice(QObject* parent, ComPtr<IDeckLink>& dev ...@@ -24,7 +25,8 @@ DeckLinkInputDevice::DeckLinkInputDevice(QObject* parent, ComPtr<IDeckLink>& dev
m_pushed(true), m_pushed(true),
PrevInputSignalAbsent(false), PrevInputSignalAbsent(false),
m_fps(0), m_fps(0),
m_lastRecvTS(TimeMilliSecond()) m_lastRecvTS(TimeMilliSecond()),
m_isActive(false)
{ {
//thd = std::thread(&DeckLinkInputDevice::ForwardThread, this); //thd = std::thread(&DeckLinkInputDevice::ForwardThread, this);
} }
...@@ -93,6 +95,13 @@ HRESULT DeckLinkInputDevice::VideoInputFrameArrived(IDeckLinkVideoInputFrame* vi ...@@ -93,6 +95,13 @@ HRESULT DeckLinkInputDevice::VideoInputFrameArrived(IDeckLinkVideoInputFrame* vi
//return S_OK; //return S_OK;
noInputSourceFlag = true; noInputSourceFlag = true;
} }
if (!m_isActive && !noInputSourceFlag)
{
m_isActive = true;
((DeckLinkInputPage*)Owner)->updateToolBoxTitle();
}
bool restartStream = !noInputSourceFlag && PrevInputSignalAbsent; bool restartStream = !noInputSourceFlag && PrevInputSignalAbsent;
if (restartStream) if (restartStream)
{ {
...@@ -340,5 +349,5 @@ HRESULT DeckLinkInputDevice::SetInputVideoConnection(BMDVideoConnection connecti ...@@ -340,5 +349,5 @@ HRESULT DeckLinkInputDevice::SetInputVideoConnection(BMDVideoConnection connecti
bool DeckLinkInputDevice::IsActive() bool DeckLinkInputDevice::IsActive()
{ {
return IsDeviceActive(DeckLink); return m_isActive;
} }
...@@ -367,6 +367,25 @@ void DeckLinkInputPage::SelectedDeviceChanged() ...@@ -367,6 +367,25 @@ void DeckLinkInputPage::SelectedDeviceChanged()
PreviewView->GetOverlay()->SetDeviceLabel(title); PreviewView->GetOverlay()->SetDeviceLabel(title);
} }
void DeckLinkInputPage::updateToolBoxTitle()
{
int indexToSelect = 0;
bool active = true;
if (SelectedDevice)
{
indexToSelect = DeviceListCombo->findData(QVariant::fromValue((void*)SelectedDevice->GetDeckLinkInstance().Get()));
active = SelectedDevice->IsActive();
}
QToolBox* toolBox = findParent<QToolBox>(this);
int pageIndex = toolBox->indexOf(this);
QString title = QString("Input %1: %2%3").arg(pageIndex + 1).arg(DeviceListCombo->itemText(indexToSelect)).arg(active ? "" : " [inactive]");
toolBox->setItemText(pageIndex, title);
PreviewView->GetOverlay()->SetDeviceLabel(title);
}
void DeckLinkInputPage::RefreshInputConnectionMenu() void DeckLinkInputPage::RefreshInputConnectionMenu()
{ {
BMDVideoConnection supportedConnections; BMDVideoConnection supportedConnections;
......
...@@ -43,16 +43,16 @@ MomentaMedia::MomentaMedia(QWidget *parent) ...@@ -43,16 +43,16 @@ MomentaMedia::MomentaMedia(QWidget *parent)
InputDevicePages[0] = ui.devicePage1; InputDevicePages[0] = ui.devicePage1;
InputDevicePages[1] = ui.devicePage2; InputDevicePages[1] = ui.devicePage2;
InputDevicePages[2] = ui.devicePage3; //InputDevicePages[2] = ui.devicePage3;
InputDevicePages[3] = ui.devicePage4; //InputDevicePages[3] = ui.devicePage4;
OutputDevicePages[0] = ui.deviceOutputPage1; OutputDevicePages[0] = ui.deviceOutputPage1;
OutputDevicePages[1] = ui.deviceOutputPage2; OutputDevicePages[1] = ui.deviceOutputPage2;
OutputDevicePages[2] = ui.deviceOutputPage3; //OutputDevicePages[2] = ui.deviceOutputPage3;
OutputDevicePages[3] = ui.deviceOutputPage4; //OutputDevicePages[3] = ui.deviceOutputPage4;
ProcessThreads[0] = std::make_shared<ProcessThread>(); ProcessThreads[0] = std::make_shared<ProcessThread>();
ProcessThreads[1] = std::make_shared<ProcessThread>(); ProcessThreads[1] = std::make_shared<ProcessThread>();
ProcessThreads[2] = std::make_shared<ProcessThread>(); //ProcessThreads[2] = std::make_shared<ProcessThread>();
ProcessThreads[3] = std::make_shared<ProcessThread>(); // ProcessThreads[3] = std::make_shared<ProcessThread>();
DeleyTimeEdit = ui.deleyTimeEdit; DeleyTimeEdit = ui.deleyTimeEdit;
...@@ -74,7 +74,7 @@ MomentaMedia::MomentaMedia(QWidget *parent) ...@@ -74,7 +74,7 @@ MomentaMedia::MomentaMedia(QWidget *parent)
for(size_t i = 0; i < InputDevicePages.size(); i++) for(size_t i = 0; i < InputDevicePages.size(); i++)
{ {
InputDevicePages[i]->SetPreviewSize(previewViewSize, i); InputDevicePages[i]->SetPreviewSize(previewViewSize, i);
PreviewLayout->addWidget(InputDevicePages[i]->GetPreviewView(), (int)i / 4, (int)i % 4); PreviewLayout->addWidget(InputDevicePages[i]->GetPreviewView(), (int)i / 2, (int)i % 2);
connect(InputDevicePages[i], &DeckLinkInputPage::RequestDeckLink, this, std::bind(&MomentaMedia::RequestInputDevice, this, InputDevicePages[i], std::placeholders::_1)); connect(InputDevicePages[i], &DeckLinkInputPage::RequestDeckLink, this, std::bind(&MomentaMedia::RequestInputDevice, this, InputDevicePages[i], std::placeholders::_1));
connect(InputDevicePages[i], &DeckLinkInputPage::RequestDeckLinkIfAvailable, std::bind(&MomentaMedia::RequestInputDeviceIfAvailable, this, InputDevicePages[i], std::placeholders::_1)); connect(InputDevicePages[i], &DeckLinkInputPage::RequestDeckLinkIfAvailable, std::bind(&MomentaMedia::RequestInputDeviceIfAvailable, this, InputDevicePages[i], std::placeholders::_1));
...@@ -84,7 +84,7 @@ MomentaMedia::MomentaMedia(QWidget *parent) ...@@ -84,7 +84,7 @@ MomentaMedia::MomentaMedia(QWidget *parent)
for(size_t i = 0; i < OutputDevicePages.size(); i++) for(size_t i = 0; i < OutputDevicePages.size(); i++)
{ {
OutputDevicePages[i]->SetPreviewSize(previewViewSize); OutputDevicePages[i]->SetPreviewSize(previewViewSize);
PreviewLayout->addWidget(OutputDevicePages[i]->GetPreviewView(), (int)i / 4 + 1, (int)i % 4); PreviewLayout->addWidget(OutputDevicePages[i]->GetPreviewView(), (int)i / 2 + 1, (int)i % 2);
if( i < InputDevicePages.size()) if( i < InputDevicePages.size())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment