Skip to content

Commit

Permalink
Final subtitle changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
linuxdude42 committed May 14, 2023
1 parent ed3baf3 commit 676fe63
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 32 deletions.
2 changes: 1 addition & 1 deletion mythtv/bindings/perl/MythTV.pm
Expand Up @@ -116,7 +116,7 @@ package MythTV;
# schema version supported in the main code. We need to check that the schema
# version in the database is as expected by the bindings, which are expected
# to be kept in sync with the main code.
our $SCHEMA_VERSION = "1377";
our $SCHEMA_VERSION = "1378";

# NUMPROGRAMLINES is defined in mythtv/libs/libmythtv/programinfo.h and is
# the number of items in a ProgramInfo QStringList group used by
Expand Down
2 changes: 1 addition & 1 deletion mythtv/bindings/python/MythTV/static.py.in
Expand Up @@ -5,7 +5,7 @@ Contains any static and global variables for MythTV Python Bindings
"""

OWN_VERSION = @MYTHTV_PYTHON_OWN_VERSION@
SCHEMA_VERSION = 1377
SCHEMA_VERSION = 1378
NVSCHEMA_VERSION = 1007
MUSICSCHEMA_VERSION = 1025
PROTO_VERSION = '91'
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythbase/mythversion.h.in
Expand Up @@ -74,7 +74,7 @@ static constexpr const char* MYTH_PROTO_TOKEN { "BuzzOff" };
* mythtv/bindings/php/MythBackend.php
*/

static constexpr const char* MYTH_DATABASE_VERSION { "1377" };
static constexpr const char* MYTH_DATABASE_VERSION { "1378" };

MBASE_PUBLIC const char *GetMythSourceVersion();
MBASE_PUBLIC const char *GetMythSourcePath();
Expand Down
2 changes: 1 addition & 1 deletion mythtv/libs/libmythtv/captions/subtitlereader.cpp
Expand Up @@ -122,7 +122,7 @@ void SubtitleReader::LoadExternalSubtitles(const QString &subtitleFileName,

bool SubtitleReader::HasTextSubtitles(void)
{
return m_textSubtitles.GetSubtitleCount() >= 0;
return m_textSubtitles.GetHasSubtitles();
}

QStringList SubtitleReader::GetRawTextSubtitles(std::chrono::milliseconds &duration)
Expand Down
10 changes: 1 addition & 9 deletions mythtv/libs/libmythtv/captions/textsubtitleparser.h
Expand Up @@ -38,7 +38,6 @@ class text_subtitle_t

using TextSubtitleList = std::vector<text_subtitle_t>;

class TextSubtitleParser;
class TextSubtitles : public QObject
{
Q_OBJECT
Expand All @@ -65,25 +64,18 @@ class TextSubtitles : public QObject
m_isInProgress = isInProgress;
}
void SetHasSubtitles(bool hasSubs) { m_hasSubtitles = hasSubs; }

// Returns -1 if there is no subtitle file.
int GetSubtitleCount(void) const
{ return m_hasSubtitles ? m_subtitles.size() : -1; }
bool GetHasSubtitles() const { return m_hasSubtitles; }

void Lock(void) { m_lock.lock(); }
void Unlock(void) { m_lock.unlock(); }

private:
TextSubtitleList m_subtitles;
QString m_fileName;
QDateTime m_lastLoaded;
off_t m_byteCount {0};
// Note: m_isInProgress is overly conservative because it doesn't
// change from true to false after a recording completes.
bool m_isInProgress {false};
// It's possible to have zero subtitles at the start of playback
// because none have yet been written for an in-progress
// recording, so use m_hasSubtitles instead of m_subtitles.size().
bool m_hasSubtitles {false};
#if QT_VERSION < QT_VERSION_CHECK(5,14,0)
QMutex m_lock {QMutex::Recursive};
Expand Down
10 changes: 10 additions & 0 deletions mythtv/libs/libmythtv/dbcheck.cpp
Expand Up @@ -3942,6 +3942,16 @@ static bool doUpgradeTVDatabaseSchema(void)
return false;
}

if (dbver == "1377")
{
DBUpdates updates {
"DELETE FROM settings WHERE value='SubtitleCodec'; ",
};
if (!performActualUpdate("MythTV", "DBSchemaVer",
updates, "1378", dbver))
return false;
}

return true;
}

Expand Down
19 changes: 0 additions & 19 deletions mythtv/programs/mythfrontend/globalsettings.cpp
Expand Up @@ -17,7 +17,6 @@
#include <QFileInfo>
#include <QFontDatabase>
#include <QImage>
#include <QTextCodec>
#include <QtGlobal>

// MythTV headers
Expand Down Expand Up @@ -1568,23 +1567,6 @@ static HostComboBoxSetting *DecodeVBIFormat()
}
#endif

static HostComboBoxSetting *SubtitleCodec()
{
auto *gc = new HostComboBoxSetting("SubtitleCodec");

gc->setLabel(OSDSettings::tr("Subtitle Codec"));

QList<QByteArray> list = QTextCodec::availableCodecs();

for (const auto & codec : qAsConst(list))
{
QString val = QString(codec);
gc->addSelection(val, val, val.toLower() == "utf-8");
}

return gc;
}

static HostComboBoxSetting *ChannelOrdering()
{
auto *gc = new HostComboBoxSetting("ChannelOrdering");
Expand Down Expand Up @@ -4498,7 +4480,6 @@ OSDSettings::OSDSettings()
addChild(PersistentBrowseMode());
addChild(BrowseAllTuners());
addChild(DefaultCCMode());
addChild(SubtitleCodec());

//GroupSetting *cc = new GroupSetting();
//cc->setLabel(tr("Closed Captions"));
Expand Down

0 comments on commit 676fe63

Please sign in to comment.