Skip to content

Commit

Permalink
VideoOutput: Add an override/force option to SetDeinterlacing
Browse files Browse the repository at this point in the history
- which adds back deinterlacing setting for HLS
  • Loading branch information
mark-kendall committed Nov 1, 2019
1 parent 76e5e8a commit 3a7a0ab
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 18 deletions.
9 changes: 3 additions & 6 deletions mythtv/libs/libmythtv/mythplayer.cpp
Expand Up @@ -2548,13 +2548,10 @@ void MythPlayer::EnableFrameRateMonitor(bool enable)
output_jmeter->SetNumCycles(static_cast<int>(rate));
}

void MythPlayer::ForceDeinterlacer(const QString &overridefilter)
void MythPlayer::ForceDeinterlacer(bool DoubleRate, MythDeintType Deinterlacer)
{
if (!videoOutput)
return;

(void)overridefilter;
LOG(VB_GENERAL, LOG_ERR, LOC + "ForceDeinterlacer not yet re-implemented");
if (videoOutput)
videoOutput->SetDeinterlacing(true, DoubleRate, Deinterlacer);
}

void MythPlayer::VideoStart(void)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/mythplayer.h
Expand Up @@ -180,7 +180,7 @@ class MTV_PUBLIC MythPlayer
void SetDuration(int duration);
void SetVideoResize(const QRect &videoRect);
void EnableFrameRateMonitor(bool enable = false);
void ForceDeinterlacer(const QString &override = QString());
void ForceDeinterlacer(bool DoubleRate, MythDeintType Deinterlacer);
void SetFrameRate(double fps);

// Gets
Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/tv_play.cpp
Expand Up @@ -12231,8 +12231,8 @@ void TV::HandleDeinterlacer(PlayerContext *ctx, const QString &action)

QString deint = action.mid(13);
ctx->LockDeletePlayer(__FILE__, __LINE__);
if (ctx->m_player)
ctx->m_player->ForceDeinterlacer(deint);
//if (ctx->m_player)
// ctx->m_player->ForceDeinterlacer(deint);
ctx->UnlockDeletePlayer(__FILE__, __LINE__);
}

Expand Down
7 changes: 6 additions & 1 deletion mythtv/libs/libmythtv/videoout_null.cpp
Expand Up @@ -200,8 +200,13 @@ void VideoOutputNull::StopEmbedding(void)
VideoOutput::StopEmbedding();
}

void VideoOutputNull::SetDeinterlacing(bool, bool)
void VideoOutputNull::SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force /*=DEINT_NONE*/)
{
if (DEINT_NONE != Force)
{
VideoOutput::SetDeinterlacing(Enable, DoubleRate, Force);
return;
}
m_videoBuffers.SetDeinterlacing(DEINT_NONE, DEINT_NONE, m_videoCodecID);
}

Expand Down
4 changes: 2 additions & 2 deletions mythtv/libs/libmythtv/videoout_null.h
Expand Up @@ -10,13 +10,13 @@ class VideoOutputNull : public VideoOutput
public:
static void GetRenderOptions(RenderOptions &Options);
VideoOutputNull();
~VideoOutputNull();
~VideoOutputNull() override;

bool Init(const QSize &video_dim_buf,
const QSize &video_dim_disp,
float aspect,
WId winid, const QRect &win_rect, MythCodecID codec_id) override; // VideoOutput
void SetDeinterlacing(bool Enable, bool DoubleRate) override;
void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force = DEINT_NONE) override;
void PrepareFrame(VideoFrame *buffer, FrameScanType, OSD *osd) override; // VideoOutput
void Show(FrameScanType ) override; // VideoOutput
void CreatePauseFrame(void);
Expand Down
11 changes: 9 additions & 2 deletions mythtv/libs/libmythtv/videooutbase.cpp
Expand Up @@ -368,7 +368,7 @@ MythDeintType VideoOutput::ParseDeinterlacer(const QString &Deinterlacer)
return result;
}

void VideoOutput::SetDeinterlacing(bool Enable, bool DoubleRate)
void VideoOutput::SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force /*=DEINT_NONE*/)
{
if (!Enable)
{
Expand All @@ -379,7 +379,14 @@ void VideoOutput::SetDeinterlacing(bool Enable, bool DoubleRate)

MythDeintType singlerate = DEINT_NONE;
MythDeintType doublerate = DEINT_NONE;
if (m_dbDisplayProfile)
if (DEINT_NONE != Force)
{
singlerate = Force;
if (DoubleRate)
doublerate = Force;
LOG(VB_PLAYBACK, LOG_INFO, LOC + "Overriding deinterlacers");
}
else if (m_dbDisplayProfile)
{
singlerate = ParseDeinterlacer(m_dbDisplayProfile->GetSingleRatePreferences());
if (DoubleRate)
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videooutbase.h
Expand Up @@ -54,7 +54,7 @@ class VideoOutput
float VideoAspect, WId WinID,
const QRect &WindowRect, MythCodecID CodecID);
virtual void SetVideoFrameRate(float);
virtual void SetDeinterlacing(bool Enable, bool DoubleRate);
virtual void SetDeinterlacing(bool Enable, bool DoubleRate, MythDeintType Force = DEINT_NONE);
virtual void ProcessFrame(VideoFrame *Frame, OSD *Osd, const PIPMap &PipPlayers,
FrameScanType Scan = kScan_Ignore) = 0;
virtual void PrepareFrame(VideoFrame *Frame, FrameScanType, OSD *Osd) = 0;
Expand Down
7 changes: 4 additions & 3 deletions mythtv/programs/mythtranscode/transcode.cpp
Expand Up @@ -615,9 +615,6 @@ int Transcode::TranscodeFile(const QString &inputname,
}

arb->m_audioFrameSize = avfw->GetAudioFrameSize() * arb->m_channels * 2;

//GetPlayer()->SetVideoFilters(
// gCoreContext->GetSetting("HTTPLiveStreamFilters", "yadif=1:-1:1"));
}
#if CONFIG_LIBMP3LAME
else if (fifodir.isEmpty())
Expand Down Expand Up @@ -878,6 +875,10 @@ int Transcode::TranscodeFile(const QString &inputname,
return REENCODE_ERROR;
}

// must come after InitForTranscode - which creates the VideoOutput instance
if (hlsMode)
GetPlayer()->ForceDeinterlacer(false, DEINT_CPU | DEINT_MEDIUM);

VideoFrame frame;
memset(&frame, 0, sizeof(frame));
// Do not use padding when compressing to RTjpeg or when in fifomode.
Expand Down

0 comments on commit 3a7a0ab

Please sign in to comment.