Skip to content

Commit

Permalink
MythVideoOutputNull: Remove pause frame code
Browse files Browse the repository at this point in the history
- pause frame functionality is only required by MythPlayerUI, which no
longer used null videooutput.
  • Loading branch information
mark-kendall committed Oct 15, 2020
1 parent b3d42cf commit fffb6a0
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 49 deletions.
46 changes: 1 addition & 45 deletions mythtv/libs/libmythtv/mythvideooutnull.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,16 +60,6 @@ MythVideoOutputNull* MythVideoOutputNull::Create(QSize VideoDim, QSize VideoDisp
return nullptr;
}

void MythVideoOutputNull::CreatePauseFrame(void)
{
m_avPauseFrame.Init(FMT_YV12, MythVideoFrame::GetAlignedBuffer(m_videoBuffers.GetScratchFrame()->m_bufferSize),
m_videoBuffers.GetScratchFrame()->m_bufferSize, m_videoBuffers.GetScratchFrame()->m_width,
m_videoBuffers.GetScratchFrame()->m_height);
m_avPauseFrame.m_frameNumber = m_videoBuffers.GetScratchFrame()->m_frameNumber;
m_avPauseFrame.m_frameCounter = m_videoBuffers.GetScratchFrame()->m_frameCounter;
m_avPauseFrame.ClearBufferToBlank();
}

bool MythVideoOutputNull::InputChanged(const QSize& VideoDim,
const QSize& VideoDispDim,
float Aspect,
Expand All @@ -89,8 +79,6 @@ bool MythVideoOutputNull::InputChanged(const QSize& VideoDim,
return false;
}

QMutexLocker locker(&m_globalLock);

if (VideoDispDim == GetVideoDim())
{
MoveResize();
Expand All @@ -111,10 +99,6 @@ bool MythVideoOutputNull::InputChanged(const QSize& VideoDim,
"VideoOutputNull::InputChanged(): Failed to recreate buffers");
m_errorState = kError_Unknown;
}
else
{
CreatePauseFrame();
}

if (m_dbDisplayProfile)
m_dbDisplayProfile->SetVideoRenderer("null");
Expand All @@ -135,19 +119,15 @@ bool MythVideoOutputNull::Init(const QSize& VideoDim, const QSize& VideoDispDim,
return false;
}

QMutexLocker locker(&m_globalLock);

MythVideoOutput::Init(VideoDim, VideoDispDim, Aspect, DisplayVisibleRect, CodecID);
m_videoBuffers.Init(VideoBuffers::GetNumBuffers(FMT_YV12), true, kNeedFreeFrames,
m_videoBuffers.Init(VideoBuffers::GetNumBuffers(FMT_YV12), false, kNeedFreeFrames,
kPrebufferFramesNormal, kPrebufferFramesSmall);

const QSize videodim = GetVideoDim();

if (!m_videoBuffers.CreateBuffers(FMT_YV12, videodim.width(), videodim.height()))
return false;

CreatePauseFrame();

if (m_dbDisplayProfile)
m_dbDisplayProfile->SetVideoRenderer("null");

Expand All @@ -172,36 +152,12 @@ void MythVideoOutputNull::SetDeinterlacing(bool Enable, bool DoubleRate, MythDei

void MythVideoOutputNull::RenderFrame(MythVideoFrame* Frame, FrameScanType /*Scan*/)
{
if (!Frame)
Frame = m_videoBuffers.GetScratchFrame();
if (Frame)
m_framesPlayed = Frame->m_frameNumber + 1;
else
LOG(VB_GENERAL, LOG_ERR, LOC + "No frame in PrepareFrame!");
}

void MythVideoOutputNull::UpdatePauseFrame(int64_t& DisplayTimecode, FrameScanType /*Scan*/)
{
QMutexLocker locker(&m_globalLock);

// Try used frame first, then fall back to scratch frame.
m_videoBuffers.BeginLock(kVideoBuffer_used);
MythVideoFrame *used = nullptr;
if (m_videoBuffers.Size(kVideoBuffer_used) > 0)
used = m_videoBuffers.Head(kVideoBuffer_used);

if (used)
m_avPauseFrame.CopyFrame(used);
m_videoBuffers.EndLock();

if (!used)
{
m_videoBuffers.GetScratchFrame()->m_frameNumber = m_framesPlayed - 1;
m_videoBuffers.GetScratchFrame()->CopyFrame(&m_avPauseFrame);
}

DisplayTimecode = m_avPauseFrame.m_displayTimecode;
}

void MythVideoOutputNull::PrepareFrame(MythVideoFrame* Frame, FrameScanType Scan)
{
Expand Down
4 changes: 0 additions & 4 deletions mythtv/libs/libmythtv/mythvideooutnull.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,11 @@ class MythVideoOutputNull : public MythVideoOutput
float Aspect, MythCodecID CodecID,
bool& AspectOnly,
int ReferenceFrames, bool ForceChange) override;
void UpdatePauseFrame(int64_t& DisplayTimecode, FrameScanType Scan = kScan_Progressive) override;
void CreatePauseFrame(void);

protected:
MythVideoOutputNull() = default;

private:
Q_DISABLE_COPY(MythVideoOutputNull)
QMutex m_globalLock { QMutex::Recursive };
MythVideoFrame m_avPauseFrame;
};
#endif

0 comments on commit fffb6a0

Please sign in to comment.