Commit 10de5c3b by 景炳强

1.解决黑闪屏问题 2.解决开机第一次启动不能输出问题

parent 02accdae
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -75,7 +75,7 @@
<Link>
<AdditionalLibraryDirectories>.\ThirdParty\libyuv\lib;.\ThirdParty\OpenCV\x64\vc15\lib;.\ThirdParty\NewTek\lib\x64;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<AdditionalDependencies>Processing.NDI.Lib.Advanced.x64.lib;opencv_world460.lib;yuv.lib;jpeg.lib;%(AdditionalDependencies);$(Qt_LIBS_)</AdditionalDependencies>
<UACExecutionLevel>RequireAdministrator</UACExecutionLevel>
<UACExecutionLevel>AsInvoker</UACExecutionLevel>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'" Label="Configuration">
......
......@@ -85,6 +85,7 @@ private:
//std::thread thd;
int Index;
bool PrevInputSignalAbsent;
};
......
......@@ -105,4 +105,5 @@ private:
qint32 Device_id;
qint32 output_deley_ms;//
qint32 audio_max_size;
BMDDisplayMode outputDisplayMode;
};
......@@ -20,7 +20,8 @@ DeckLinkInputDevice::DeckLinkInputDevice(QObject* parent, ComPtr<IDeckLink>& dev
bLastValidFrameStatus(false),
SupportedInputConnections(bmdVideoConnectionUnspecified),
SelectedInputConnection(bmdVideoConnectionUnspecified),
Index(index)
Index(index),
PrevInputSignalAbsent(false)
{
//thd = std::thread(&DeckLinkInputDevice::ForwardThread, this);
}
......@@ -83,11 +84,28 @@ HRESULT DeckLinkInputDevice::VideoInputFrameArrived(IDeckLinkVideoInputFrame* vi
//emit ArrivedFrame(frame);
if (videoFrame && Capture) {
unsigned flags = videoFrame->GetFlags();
bool noInputSourceFlag = false;
if (flags & bmdFrameHasNoInputSource)
{
qDebug() << GetCurrDateTimeStr() << "index: " << Index << " DeckLinkInputDevice get video frame No input source " << hex << flags << " ------------ \n";
noInputSourceFlag = true;
}
bool restartStream = !noInputSourceFlag && PrevInputSignalAbsent;
if(restartStream)
{
DeckLinkInput->StopStreams();
DeckLinkInput->FlushStreams();
DeckLinkInput->StartStreams();
}
PrevInputSignalAbsent = noInputSourceFlag;
if (!noInputSourceFlag)
{
auto cur_time = QDateTime::currentMSecsSinceEpoch();
Capture->AddFrame(frame, cur_time);
}
}
if(audioPacket)
{
//qDebug() << "DeckLinkInputDevice get audio packet--------------" << "\n";
......
......@@ -129,7 +129,7 @@ HRESULT DeckLinkOutputDevice::ScheduledPlaybackHasStopped()
bool DeckLinkOutputDevice::StartPlayback(BMDDisplayMode displayMode, bool enable3D, BMDPixelFormat pixelFormat, bool requireReferenceLocked, IDeckLinkScreenPreviewCallback* screenPreviewCallback)
{
BMDDisplayMode outputDisplayMode;
//BMDDisplayMode outputDisplayMode;
#if OUTPUT_1080
switch (OutputPlayMode)
......@@ -353,7 +353,7 @@ bool DeckLinkOutputDevice::getReferenceSignalMode(BMDDisplayMode* mode)
//std::lock_guard<std::mutex> locker(mutex);
current_video_time = outputImage->getInputFrameCurTimeStamp();
ComPtr<DeckLinkOutputVideoFrame> videoFrame = MakeComPtr<DeckLinkOutputVideoFrame>(outputImage);
videoFrame->GetFlags();
// Record the stream time of the first frame, so we can start playing from the point
//if(!seenFirstVideoFrame)
//{
......@@ -378,6 +378,8 @@ bool DeckLinkOutputDevice::getReferenceSignalMode(BMDDisplayMode* mode)
else if (ret == E_FAIL)
{
qDebug() << "Failure." << "\n";
deckLinkOutput->DisableVideoOutput();
deckLinkOutput->EnableVideoOutput(outputDisplayMode, bmdVideoOutputFlagDefault);
}
else
{
......
......@@ -26,7 +26,7 @@ std::map<qint32, qint32> map_scale_mode;
int main_ver = 1;
int mid_ver = 0;
int small_ver = 2;
int small_ver = 4;
MomentaMedia::MomentaMedia(QWidget *parent)
: QMainWindow(parent)
......
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