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 "mythchrono.h"
11 #include "mythdeque.h"
12 #include "textsubtitleparser.h"
13 
15 {
16  public:
17  AVSubtitles() = default;
19  QMutex m_lock;
20  bool m_fixPosition {false};
21 };
22 
24 {
25  public:
26  RawTextSubs(void) = default;
27 
28  QStringList m_buffers;
29  std::chrono::milliseconds m_duration {0ms};
30  QMutex m_lock;
31 };
32 
33 class SubtitleReader : public QObject
34 {
35  Q_OBJECT
36 
37  signals:
38  void TextSubtitlesUpdated();
39 
40  public:
42  ~SubtitleReader() override;
43 
44  void EnableAVSubtitles(bool enable);
45  void EnableTextSubtitles(bool enable);
46  void EnableRawTextSubtitles(bool enable);
47 
49  bool AddAVSubtitle(AVSubtitle& subtitle, bool fix_position,
50  bool allow_forced);
51  void ClearAVSubtitles(void);
52  static void FreeAVSubtitle(AVSubtitle &sub);
53 
55  bool HasTextSubtitles(void);
56  void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress);
57 
58  QStringList GetRawTextSubtitles(std::chrono::milliseconds &duration);
59  void AddRawTextSubtitle(const QStringList& list, std::chrono::milliseconds duration);
60  void ClearRawTextSubtitles(void);
61 
62  private:
64  bool m_avSubtitlesEnabled {false};
66  bool m_textSubtitlesEnabled {false};
69 };
70 
71 #endif // SUBTITLEREADER_H
SubtitleReader::TextSubtitlesUpdated
void TextSubtitlesUpdated()
textsubtitleparser.h
SubtitleReader::m_textSubtitles
TextSubtitles m_textSubtitles
Definition: subtitlereader.h:65
SubtitleReader
Definition: subtitlereader.h:33
SubtitleReader::AddAVSubtitle
bool AddAVSubtitle(AVSubtitle &subtitle, bool fix_position, bool allow_forced)
Definition: subtitlereader.cpp:35
SubtitleReader::EnableAVSubtitles
void EnableAVSubtitles(bool enable)
Definition: subtitlereader.cpp:20
mythdeque.h
SubtitleReader::ClearAVSubtitles
void ClearAVSubtitles(void)
Definition: subtitlereader.cpp:81
RawTextSubs::m_duration
std::chrono::milliseconds m_duration
Definition: subtitlereader.h:29
SubtitleReader::LoadExternalSubtitles
void LoadExternalSubtitles(const QString &subtitleFileName, bool isInProgress)
Definition: subtitlereader.cpp:97
SubtitleReader::EnableTextSubtitles
void EnableTextSubtitles(bool enable)
Definition: subtitlereader.cpp:25
SubtitleReader::~SubtitleReader
~SubtitleReader() override
Definition: subtitlereader.cpp:13
AVSubtitles
Definition: subtitlereader.h:14
SubtitleReader::ClearRawTextSubtitles
void ClearRawTextSubtitles(void)
Definition: subtitlereader.cpp:134
TextSubtitles
Definition: textsubtitleparser.h:36
SubtitleReader::FreeAVSubtitle
static void FreeAVSubtitle(AVSubtitle &sub)
Definition: subtitlereader.cpp:92
RawTextSubs::m_lock
QMutex m_lock
Definition: subtitlereader.h:30
SubtitleReader::m_rawTextSubtitles
RawTextSubs m_rawTextSubtitles
Definition: subtitlereader.h:67
SubtitleReader::GetTextSubtitles
TextSubtitles * GetTextSubtitles(void)
Definition: subtitlereader.h:54
SubtitleReader::EnableRawTextSubtitles
void EnableRawTextSubtitles(bool enable)
Definition: subtitlereader.cpp:30
SubtitleReader::GetRawTextSubtitles
QStringList GetRawTextSubtitles(std::chrono::milliseconds &duration)
Definition: subtitlereader.cpp:111
SubtitleReader::GetAVSubtitles
AVSubtitles * GetAVSubtitles(void)
Definition: subtitlereader.h:48
SubtitleReader::SubtitleReader
SubtitleReader()
Definition: subtitlereader.cpp:7
RawTextSubs::RawTextSubs
RawTextSubs(void)=default
SubtitleReader::m_rawTextSubtitlesEnabled
bool m_rawTextSubtitlesEnabled
Definition: subtitlereader.h:68
SubtitleReader::m_avSubtitlesEnabled
bool m_avSubtitlesEnabled
Definition: subtitlereader.h:64
AVSubtitles::m_buffers
MythDeque< AVSubtitle > m_buffers
Definition: subtitlereader.h:18
AVSubtitles::AVSubtitles
AVSubtitles()=default
SubtitleReader::m_textSubtitlesEnabled
bool m_textSubtitlesEnabled
Definition: subtitlereader.h:66
RawTextSubs::m_buffers
QStringList m_buffers
Definition: subtitlereader.h:28
MythDeque< AVSubtitle >
AVSubtitles::m_fixPosition
bool m_fixPosition
Definition: subtitlereader.h:20
RawTextSubs
Definition: subtitlereader.h:23
AVSubtitles::m_lock
QMutex m_lock
Definition: subtitlereader.h:19
SubtitleReader::HasTextSubtitles
bool HasTextSubtitles(void)
Definition: subtitlereader.cpp:106
mythchrono.h
SubtitleReader::AddRawTextSubtitle
void AddRawTextSubtitle(const QStringList &list, std::chrono::milliseconds duration)
Definition: subtitlereader.cpp:123
SubtitleReader::m_avSubtitles
AVSubtitles m_avSubtitles
Definition: subtitlereader.h:63