Skip to content

Commit

Permalink
Add a get_bool_option function to transcode.cpp.
Browse files Browse the repository at this point in the history
The clang-tidy "implicit boolean conversion" check pointed out a
couple of places where integers were implicitly converted to booleans
in conditional statements.  Add a get_bool_option function (that
handles the int->bool conversion) to allow better type checking of the
callers.

https://clang.llvm.org/extra/clang-tidy/checks/readability-implicit-bool-conversion.html
  • Loading branch information
linuxdude42 committed Apr 1, 2019
1 parent c556789 commit c7819f5
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions mythtv/programs/mythtranscode/transcode.cpp
Expand Up @@ -197,6 +197,11 @@ static int get_int_option(RecordingProfile *profile, const QString &name)
return ret_int;
}

static int get_bool_option(RecordingProfile *profile, const QString &name)
{
return static_cast<int>(get_int_option(profile, name));
}

static void TranscodeWriteText(void *ptr, unsigned char *buf, int len,
int timecode, int pagenr)
{
Expand Down Expand Up @@ -650,20 +655,20 @@ int Transcode::TranscodeFile(const QString &inputname,
vidfilters = get_str_option(m_recProfile, "transcodefilters");

if (encodingType == "MPEG-2" &&
get_int_option(m_recProfile, "transcodelossless"))
get_bool_option(m_recProfile, "transcodelossless"))
{
LOG(VB_GENERAL, LOG_NOTICE, "Switching to MPEG-2 transcoder.");
SetPlayerContext(nullptr);
return REENCODE_MPEG2TRANS;
}

// Recorder setup
if (get_int_option(m_recProfile, "transcodelossless"))
if (get_bool_option(m_recProfile, "transcodelossless"))
{
vidsetting = encodingType;
audsetting = "MP3";
}
else if (get_int_option(m_recProfile, "transcoderesize"))
else if (get_bool_option(m_recProfile, "transcoderesize"))
{
int actualHeight = (video_height == 1088 ? 1080 : video_height);

Expand Down

0 comments on commit c7819f5

Please sign in to comment.