MythTV  master
subtitlereader.h
Go to the documentation of this file.
1 #ifndef SUBTITLEREADER_H
2 #define SUBTITLEREADER_H
3 
4 #include <QMutex>
5 
6 extern "C" {
7 #include "libavcodec/avcodec.h"
8 }
9 
10 #include "mythdeque.h"
11 #include "textsubtitleparser.h"
12 
14 {
15  public:
16  AVSubtitles() = default;
18  QMutex m_lock;
19  bool m_fixPosition {false};
20 };
21 
23 {
24  public:
25  RawTextSubs(void) = default;
26 
27  QStringList m_buffers;
28  uint64_t m_duration {0};
29  QMutex m_lock;
30 };
31 
32 class SubtitleReader : public QObject
33 {
34  Q_OBJECT
35 
36  signals:
37  void TextSubtitlesUpdated();
38 
39  public:
41  ~SubtitleReader() override;
42 
43  void EnableAVSubtitles(bool enable);
44  void EnableTextSubtitles(bool enable);
45  void EnableRawTextSubtitles(bool enable);
46 
48  bool AddAVSubtitle(AVSubtitle& subtitle, bool fix_position,
49  bool allow_forced);
50  void ClearAVSubtitles(void);
51  static void FreeAVSubtitle(AVSubtitle &sub);
52 
54  bool HasTextSubtitles(void);
55  void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress);
56 
57  QStringList GetRawTextSubtitles(uint64_t &duration);
58  void AddRawTextSubtitle(const QStringList& list, uint64_t duration);
59  void ClearRawTextSubtitles(void);
60 
61  private:
63  bool m_avSubtitlesEnabled {false};
65  bool m_textSubtitlesEnabled {false};
68 };
69 
70 #endif // SUBTITLEREADER_H
SubtitleReader::TextSubtitlesUpdated
void TextSubtitlesUpdated()
textsubtitleparser.h
SubtitleReader::GetRawTextSubtitles
QStringList GetRawTextSubtitles(uint64_t &duration)
Definition: subtitlereader.cpp:107
SubtitleReader::m_textSubtitles
TextSubtitles m_textSubtitles
Definition: subtitlereader.h:64
SubtitleReader
Definition: subtitlereader.h:32
SubtitleReader::AddAVSubtitle
bool AddAVSubtitle(AVSubtitle &subtitle, bool fix_position, bool allow_forced)
Definition: subtitlereader.cpp:32
SubtitleReader::EnableAVSubtitles
void EnableAVSubtitles(bool enable)
Definition: subtitlereader.cpp:17
mythdeque.h
SubtitleReader::ClearAVSubtitles
void ClearAVSubtitles(void)
Definition: subtitlereader.cpp:77
SubtitleReader::LoadExternalSubtitles
void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress)
Definition: subtitlereader.cpp:93
SubtitleReader::EnableTextSubtitles
void EnableTextSubtitles(bool enable)
Definition: subtitlereader.cpp:22
SubtitleReader::~SubtitleReader
~SubtitleReader() override
Definition: subtitlereader.cpp:10
AVSubtitles
Definition: subtitlereader.h:13
SubtitleReader::ClearRawTextSubtitles
void ClearRawTextSubtitles(void)
Definition: subtitlereader.cpp:130
TextSubtitles
Definition: textsubtitleparser.h:36
SubtitleReader::FreeAVSubtitle
static void FreeAVSubtitle(AVSubtitle &sub)
Definition: subtitlereader.cpp:88
RawTextSubs::m_lock
QMutex m_lock
Definition: subtitlereader.h:29
SubtitleReader::m_rawTextSubtitles
RawTextSubs m_rawTextSubtitles
Definition: subtitlereader.h:66
SubtitleReader::GetTextSubtitles
TextSubtitles * GetTextSubtitles(void)
Definition: subtitlereader.h:53
SubtitleReader::EnableRawTextSubtitles
void EnableRawTextSubtitles(bool enable)
Definition: subtitlereader.cpp:27
SubtitleReader::AddRawTextSubtitle
void AddRawTextSubtitle(const QStringList &list, uint64_t duration)
Definition: subtitlereader.cpp:119
SubtitleReader::GetAVSubtitles
AVSubtitles * GetAVSubtitles(void)
Definition: subtitlereader.h:47
SubtitleReader::SubtitleReader
SubtitleReader()
Definition: subtitlereader.cpp:4
RawTextSubs::RawTextSubs
RawTextSubs(void)=default
SubtitleReader::m_rawTextSubtitlesEnabled
bool m_rawTextSubtitlesEnabled
Definition: subtitlereader.h:67
SubtitleReader::m_avSubtitlesEnabled
bool m_avSubtitlesEnabled
Definition: subtitlereader.h:63
AVSubtitles::m_buffers
MythDeque< AVSubtitle > m_buffers
Definition: subtitlereader.h:17
RawTextSubs::m_duration
uint64_t m_duration
Definition: subtitlereader.h:28
AVSubtitles::AVSubtitles
AVSubtitles()=default
SubtitleReader::m_textSubtitlesEnabled
bool m_textSubtitlesEnabled
Definition: subtitlereader.h:65
RawTextSubs::m_buffers
QStringList m_buffers
Definition: subtitlereader.h:27
MythDeque< AVSubtitle >
AVSubtitles::m_fixPosition
bool m_fixPosition
Definition: subtitlereader.h:19
RawTextSubs
Definition: subtitlereader.h:22
AVSubtitles::m_lock
QMutex m_lock
Definition: subtitlereader.h:18
SubtitleReader::HasTextSubtitles
bool HasTextSubtitles(void)
Definition: subtitlereader.cpp:102
SubtitleReader::m_avSubtitles
AVSubtitles m_avSubtitles
Definition: subtitlereader.h:62