MythTV  master
filewriterbase.h
Go to the documentation of this file.
1 #ifndef FILEWRITERBASE_H
2 #define FILEWRITERBASE_H
3 
4 #include <QString>
5 
6 #include "mythframe.h"
7 #include "audiooutputsettings.h"
8 
10 {
11  public:
12  FileWriterBase() = default;
13  virtual ~FileWriterBase() = default;
14 
15  virtual bool Init(void) { return true; }
16  virtual bool OpenFile(void) { return true; }
17  virtual bool CloseFile(void) { return true; }
18 
19  virtual int WriteVideoFrame(VideoFrame *frame);
20  virtual int WriteAudioFrame(unsigned char *buf, int fnum, long long &timecode);
21  virtual int WriteTextFrame(int /*vbimode*/, unsigned char */*buf*/, int /*len*/,
22  long long /*timecode*/, int /*pagenr*/) { return 1; }
23  virtual int WriteSeekTable(void) { return 1; }
24 
25  virtual bool SwitchToNextFile(void) { return false; }
26 
27  void SetFilename(const QString& fname) { m_filename = fname; }
28  void SetContainer(const QString& cont) { m_container = cont; }
29  void SetVideoCodec(const QString& codec) { m_videoCodec = codec; }
30  void SetVideoBitrate(int bitrate) { m_videoBitrate = bitrate; }
31  void SetWidth(int width) { m_width = width; }
32  void SetHeight(int height) { m_height = height; }
33  void SetAspect(float aspect) { m_aspect = aspect; }
34  void SetFramerate(double rate) { m_frameRate = rate; }
35  void SetKeyFrameDist(int dist) { m_keyFrameDist = dist; }
36  void SetAudioCodec(const QString& codec) { m_audioCodec = codec; }
37  void SetAudioBitrate(int bitrate) { m_audioBitrate = bitrate; }
38  void SetAudioChannels(int channels) { m_audioChannels = channels; }
39  void SetAudioFrameRate(int rate) { m_audioFrameRate = rate; }
40  void SetAudioFormat(AudioFormat f) { m_audioFormat = f; }
41  void SetThreadCount(int count) { m_encodingThreadCount = count; }
42  void SetTimecodeOffset(long long o) { m_startingTimecodeOffset = o; }
43  void SetEncodingPreset(const QString& preset) { m_encodingPreset = preset; }
44  void SetEncodingTune(const QString& tune) { m_encodingTune = tune; }
45 
46  long long GetFramesWritten(void) const { return m_framesWritten; }
47  long long GetTimecodeOffset(void) const { return m_startingTimecodeOffset; }
51  int GetAudioFrameSize(void) const { return m_audioFrameSize; }
52 
53  protected:
54  QString m_filename;
55  QString m_container;
56  QString m_videoCodec;
57  int m_videoBitrate {800000};
58  int m_width {0};
59  int m_height {0};
60  float m_aspect {1.333333};
61  double m_frameRate {29.97};
62  int m_keyFrameDist {15};
63  QString m_audioCodec;
64  int m_audioBitrate {0};
65  int m_audioChannels {2};
66  int m_audioFrameRate {48000};
67  AudioFormat m_audioFormat {FORMAT_S16};
68  int m_audioFrameSize {-1};
69  int m_encodingThreadCount {1};
70  long long m_framesWritten {0};
71  long long m_startingTimecodeOffset {-1};
73  QString m_encodingTune;
74 };
75 
76 #endif
77 
78 /* vim: set expandtab tabstop=4 shiftwidth=4: */
79 
virtual bool OpenFile(void)
void SetVideoBitrate(int bitrate)
void SetAudioFormat(AudioFormat f)
virtual int WriteSeekTable(void)
void SetEncodingTune(const QString &tune)
void SetAudioBitrate(int bitrate)
virtual bool SwitchToNextFile(void)
QString m_videoCodec
QString m_filename
void SetAudioFrameRate(int rate)
void SetFramerate(double rate)
void SetFilename(const QString &fname)
void SetKeyFrameDist(int dist)
void SetHeight(int height)
QString m_container
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QString m_encodingPreset
void SetAudioChannels(int channels)
QString m_audioCodec
void SetVideoCodec(const QString &codec)
void SetAudioCodec(const QString &codec)
void SetThreadCount(int count)
QString m_encodingTune
virtual int WriteTextFrame(int, unsigned char *, int, long long, int)
long long GetFramesWritten(void) const
void SetEncodingPreset(const QString &preset)
void SetAspect(float aspect)
void SetContainer(const QString &cont)
virtual bool Init(void)
void SetTimecodeOffset(long long o)
void SetWidth(int width)
long long GetTimecodeOffset(void) const
int GetAudioFrameSize(void) const
number of audio samples (per channel) in an AVFrame
virtual bool CloseFile(void)