MythTV  master
httplivestream.h
Go to the documentation of this file.
1 #ifndef HTTPLIVESTREAM_H
2 #define HTTPLIVESTREAM_H
3 
4 #include <QString>
5 
7 
8 #include "mythframe.h"
9 
10 typedef enum {
20 
21 
23 {
24  public:
25  HTTPLiveStream(QString srcFile, uint16_t width = 640, uint16_t height = 480,
26  uint32_t bitrate = 800000, uint32_t abitrate = 64000,
27  uint16_t maxSegments = 0, uint16_t segmentSize = 10,
28  uint32_t aobitrate = 32000, int32_t srate = -1);
29  explicit HTTPLiveStream(int streamid);
30  ~HTTPLiveStream();
31 
32  bool InitForWrite(void);
33  bool LoadFromDB(void);
34 
35  int GetStreamID(void) const { return m_streamid; }
36  uint16_t GetWidth(void) const { return m_width; }
37  uint16_t GetHeight(void) const { return m_height; }
38  uint32_t GetBitrate(void) const { return m_bitrate; }
39  uint32_t GetAudioBitrate(void) const { return m_audioBitrate; }
40  uint32_t GetAudioOnlyBitrate(void) const { return m_audioOnlyBitrate; }
41  uint16_t GetMaxSegments(void) const { return m_maxSegments; }
42  QString GetSourceFile(void) const { return m_sourceFile; }
43  QString GetHTMLPageName(void) const;
44  QString GetMetaPlaylistName(void) const;
45  QString GetPlaylistName(bool audioOnly = false) const;
46  uint16_t GetSegmentSize(void) const { return m_segmentSize; }
47  QString GetFilename(uint16_t segmentNumber = 0, bool fileOnly = false,
48  bool audioOnly = false, bool encoded = false) const;
49  QString GetCurrentFilename(
50  bool audioOnly = false, bool encoded = false) const;
51 
52  void SetOutputVars(void);
53 
54  HTTPLiveStreamStatus GetDBStatus(void) const;
55 
56  int AddStream(void);
57  bool AddSegment(void);
58 
59  bool WriteHTML(void);
60  bool WriteMetaPlaylist(void);
61  bool WritePlaylist(bool audioOnly = false, bool writeEndTag = false);
62 
63  bool SaveSegmentInfo(void);
64 
65  bool UpdateSizeInfo(uint16_t width, uint16_t height,
66  uint16_t srcwidth, uint16_t srcheight);
67  bool UpdateStatus(HTTPLiveStreamStatus status);
68  bool UpdateStatusMessage(const QString& message);
69  bool UpdatePercentComplete(int percent);
70 
71  QString StatusToString(HTTPLiveStreamStatus status);
72 
73  bool CheckStop(void);
74 
75  DTC::LiveStreamInfo *StartStream(void);
76  static DTC::LiveStreamInfo *StopStream(int id);
77  static bool RemoveStream(int id);
78 
79  DTC::LiveStreamInfo *GetLiveStreamInfo(DTC::LiveStreamInfo *info = nullptr);
80  static DTC::LiveStreamInfoList *GetLiveStreamInfoList( const QString &FileName = "");
81 
82  protected:
83  bool m_writing {false};
84  int m_streamid {-1};
85  QString m_sourceFile;
86  QString m_sourceHost;
87  uint16_t m_sourceWidth {0};
88  uint16_t m_sourceHeight {0};
89  QString m_outDir;
90  QString m_outBase;
92  QString m_outFile;
94  QString m_audioOutFile;
96  uint16_t m_segmentSize {10};
97  uint16_t m_maxSegments {0};
98  uint16_t m_segmentCount {0};
99  uint16_t m_startSegment {0};
100  uint16_t m_curSegment {0};
101  QString m_httpPrefix;
103  uint16_t m_height {480};
104  uint16_t m_width {640};
105  uint32_t m_bitrate {800000};
106  uint32_t m_audioBitrate { 64000};
107  uint32_t m_audioOnlyBitrate { 32000};
108  int32_t m_sampleRate {-1};
109 
110  QDateTime m_created;
111  QDateTime m_lastModified;
112  uint16_t m_percentComplete {0};
113  QString m_relativeURL;
114  QString m_fullURL;
116 
118 };
119 
120 #endif
121 
122 /* vim: set expandtab tabstop=4 shiftwidth=4: */
123 
uint16_t GetWidth(void) const
QString m_outFileEncoded
QString m_httpPrefixRel
QString m_relativeURL
QString GetSourceFile(void) const
uint16_t GetSegmentSize(void) const
HTTPLiveStreamStatus
QString m_sourceHost
QDateTime m_created
QString m_statusMessage
#define MTV_PUBLIC
Definition: mythtvexp.h:15
int GetStreamID(void) const
unsigned short uint16_t
Definition: iso6937tables.h:1
QString m_audioOutFileEncoded
uint32_t GetBitrate(void) const
uint32_t GetAudioOnlyBitrate(void) const
QDateTime m_lastModified
QString m_httpPrefix
uint16_t GetHeight(void) const
QString m_audioOutFile
uint16_t GetMaxSegments(void) const
QString m_sourceFile
uint32_t GetAudioBitrate(void) const
QString m_outBaseEncoded