MythTV
master
libs
libmythtv
captions
srtwriter.h
Go to the documentation of this file.
1
// -*- Mode: c++ -*-
2
#ifndef SRTWRITER_H_
3
#define SRTWRITER_H_
4
5
#include <QStringList>
6
#include <QImage>
7
#include <QPoint>
8
#include <QHash>
9
#include <QTime>
10
11
#include <QtXml/QDomDocument>
12
#include <QtXml/QDomElement>
13
14
#include "
avformatdecoder.h
"
15
#include "
mythplayer.h
"
16
#include "
captions/teletextextractorreader.h
"
17
#include "
format.h
"
18
19
#include "
mythccextractorplayer.h
"
20
21
class
OneSubtitle
;
22
27
class
MTV_PUBLIC
SRTWriter
28
{
29
public
:
30
explicit
SRTWriter
(
const
QString &fileName) :
31
m_outFile(fileName), m_outStream(&m_outFile)
32
{
33
m_outStream.setCodec(
"UTF-8"
);
34
if
(!m_outFile.open(QFile::WriteOnly))
35
{
36
LOG
(VB_GENERAL, LOG_ERR, QString(
"Failed to create '%1'"
)
37
.
arg
(fileName));
38
}
39
else
40
{
41
LOG
(VB_GENERAL, LOG_DEBUG, QString(
"Created '%1'"
)
42
.
arg
(fileName));
43
}
44
}
45
~SRTWriter
(
void
)
46
{
47
m_outFile.close();
48
}
49
50
void
AddSubtitle(
const
OneSubtitle
&sub,
int
number);
51
52
bool
IsOpen
(
void
) {
return
m_outFile.isOpen(); }
53
void
Flush
(
void
) { m_outStream.flush(); }
54
55
private
:
57
static
QString FormatTime(uint64_t time_in_msec);
59
QFile
m_outFile
;
61
QTextStream
m_outStream
;
62
};
63
64
#endif
/* SRTWRITER_H_ */
SRTWriter::IsOpen
bool IsOpen(void)
Definition:
srtwriter.h:52
format.h
arg
arg(title).arg(filename).arg(doDelete))
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition:
mythlogging.h:23
mythplayer.h
OneSubtitle
Represents one subtitle record.
Definition:
mythccextractorplayer.h:29
teletextextractorreader.h
SRTWriter::SRTWriter
SRTWriter(const QString &fileName)
Definition:
srtwriter.h:30
SRTWriter
Class to write SubRip files.
Definition:
srtwriter.h:27
SRTWriter::m_outStream
QTextStream m_outStream
Output stream associated with m_outFile.
Definition:
srtwriter.h:61
SRTWriter::m_outFile
QFile m_outFile
Output file.
Definition:
srtwriter.h:59
mythccextractorplayer.h
MTV_PUBLIC
#define MTV_PUBLIC
Definition:
mythtvexp.h:15
avformatdecoder.h
SRTWriter::Flush
void Flush(void)
Definition:
srtwriter.h:53
SRTWriter::~SRTWriter
~SRTWriter(void)
Definition:
srtwriter.h:45
Generated on Wed Jan 13 2021 03:17:48 for MythTV by
1.8.17