MythTV  0.27pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
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 "frame.h"
9 
10 typedef enum {
20 
21 
22 class MTV_PUBLIC HTTPLiveStream
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  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(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 = NULL);
80  static DTC::LiveStreamInfoList *GetLiveStreamInfoList( const QString &FileName = "");
81 
82  protected:
83  bool m_writing;
85  QString m_sourceFile;
86  QString m_sourceHost;
89  QString m_outDir;
90  QString m_outBase;
92  QString m_outFile;
94  QString m_audioOutFile;
101  QString m_httpPrefix;
105  uint32_t m_bitrate;
106  uint32_t m_audioBitrate;
108  int32_t m_sampleRate;
109 
110  QDateTime m_created;
111  QDateTime m_lastModified;
113  QString m_relativeURL;
114  QString m_fullURL;
116 
118 };
119 
120 #endif
121 
122 /* vim: set expandtab tabstop=4 shiftwidth=4: */
123