Skip to content

Commit

Permalink
Coverity: Fix a few warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-kendall committed Jan 23, 2020
1 parent ad5df1c commit 9ab9932
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 10 deletions.
5 changes: 4 additions & 1 deletion mythtv/libs/libmythtv/decoders/avformatdecoder.cpp
Expand Up @@ -345,6 +345,9 @@ AvFormatDecoder::AvFormatDecoder(MythPlayer *parent,
m_ccd708(new CC708Decoder(parent->GetCC708Reader())),
m_ttd(new TeletextDecoder(parent->GetTeletextReader()))
{
// this will be deleted and recreated once decoder is set up
m_mythCodecCtx = new MythCodecContext(this, kCodec_NONE);

m_audioSamples = (uint8_t *)av_mallocz(AudioOutput::kMaxSizeBuffer);
m_ccd608->SetIgnoreTimecode(true);

Expand Down Expand Up @@ -3250,7 +3253,7 @@ int AvFormatDecoder::H264PreProcessPkt(AVStream *stream, AVPacket *pkt)
// size and rate is extremely error prone and FFmpeg gets it right far more often.
// N.B. if a decoder deinterlacer is in use - the stream must be progressive
bool doublerate = false;
bool decoderdeint = m_mythCodecCtx->IsDeinterlacing(doublerate, true);
bool decoderdeint = m_mythCodecCtx ? m_mythCodecCtx->IsDeinterlacing(doublerate, true) : false;
m_parent->SetVideoParams(width, height, seqFPS, m_currentAspect, forcechange,
static_cast<int>(m_h264Parser->getRefFrames()),
decoderdeint ? kScan_Progressive : kScan_Ignore);
Expand Down
4 changes: 1 addition & 3 deletions mythtv/libs/libmythtv/decoders/decoderbase.cpp
Expand Up @@ -21,9 +21,7 @@ DecoderBase::DecoderBase(MythPlayer *parent, const ProgramInfo &pginfo)
m_totalDuration(AVRationalInit(0)),

// language preference
m_languagePreference(iso639_get_language_key_list()),
// this will be deleted and recreated once decoder is set up
m_mythCodecCtx(new MythCodecContext(this, kCodec_NONE))
m_languagePreference(iso639_get_language_key_list())
{
ResetTracks();
m_tracks[kTrackTypeAudio].push_back(StreamInfo(0, 0, 0, 0, 0));
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/videocolourspace.cpp
Expand Up @@ -504,7 +504,7 @@ QMatrix4x4 VideoColourSpace::GetPrimaryConversion(int Source, int Dest)

auto source = static_cast<AVColorPrimaries>(Source);
auto dest = static_cast<AVColorPrimaries>(Dest);
auto custom = m_customDisplayPrimaries != nullptr || m_customDisplayGamma > 0.0F;
auto custom = m_customDisplayPrimaries != nullptr;

// No-op
if (!custom && (source == dest))
Expand Down
2 changes: 0 additions & 2 deletions mythtv/libs/libmythui/mythuihelper.cpp
Expand Up @@ -266,8 +266,6 @@ void MythUIHelperPrivate::StoreGUIsettings()

font.setStyleHint(QFont::SansSerif, QFont::PreferAntialias);
font.setPixelSize(static_cast<int>(lroundf(19.0F * m_hmult)));
if (!m_display)
m_display = MythDisplay::AcquireRelease();
int stretch = static_cast<int>(100 / m_display->GetPixelAspectRatio());
font.setStretch(stretch); // QT
m_fontStretch = stretch; // MythUI
Expand Down
7 changes: 5 additions & 2 deletions mythtv/libs/libmythui/opengl/mythpainteropengl.cpp
Expand Up @@ -82,7 +82,11 @@ void MythOpenGLPainter::Begin(QPaintDevice *Parent)
MythPainter::Begin(Parent);

if (!m_parent)
{
m_parent = dynamic_cast<QWidget *>(Parent);
if (!m_parent)
return;
}

if (!m_render)
{
Expand Down Expand Up @@ -132,8 +136,7 @@ void MythOpenGLPainter::Begin(QPaintDevice *Parent)
if (m_target || m_swapControl)
{
m_render->BindFramebuffer(m_target);
if (m_parent)
m_render->SetViewPort(QRect(0, 0, m_parent->width(), m_parent->height()));
m_render->SetViewPort(QRect(0, 0, m_parent->width(), m_parent->height()));
m_render->SetBackground(0, 0, 0, 0);
m_render->ClearFramebuffer();
}
Expand Down
4 changes: 3 additions & 1 deletion mythtv/libs/libmythui/platforms/mythdrmdevice.cpp
Expand Up @@ -113,12 +113,14 @@ MythEDID MythDRMDevice::GetEDID(void)

static QString GetConnectorName(drmModeConnector *Connector)
{
if (!Connector)
return "Unknown";
static const QString connectorNames[DRM_MODE_CONNECTOR_DPI + 1] =
{ "None", "VGA", "DVI", "DVI", "DVI", "Composite", "TV", "LVDS",
"CTV", "DIN", "DP", "HDMI", "HDMI", "TV", "eDP", "Virtual", "DSI", "DPI"
};
uint32_t type = qMin(Connector->connector_type, static_cast<uint32_t>(DRM_MODE_CONNECTOR_DPI));
return Connector ? QString("%1%2").arg(connectorNames[type]).arg(Connector->connector_type_id) : "Unknown";
return QString("%1%2").arg(connectorNames[type]).arg(Connector->connector_type_id);
}

void MythDRMDevice::Authenticate(void)
Expand Down

0 comments on commit 9ab9932

Please sign in to comment.