MythTV master
HLSSegment.h
Go to the documentation of this file.
1#ifndef HLS_SEGMENT_H
2#define HLS_SEGMENT_H
3
4#include "libmythbase/mythconfig.h"
5
6#include <cstdint>
7
8#if CONFIG_LIBCRYPTO
9#include <openssl/aes.h>
10#endif // CONFIG_LIBCRYPTO
11
12#include <QString>
13#include <QUrl>
14
17
19{
20 public:
21 friend class HLSReader;
22
23 HLSRecSegment(int input);
24 HLSRecSegment(const HLSRecSegment& rhs);
25 HLSRecSegment(int input, int sequence, std::chrono::milliseconds duration,
26 QString title, QUrl uri);
28
30
31 bool Download(QByteArray & buffer);
32
33 int64_t Sequence(void) const { return m_sequence; }
34 QString Title(void) const { return m_title; }
35 QUrl Url(void) const { return m_url; }
36 std::chrono::milliseconds Duration(void) const { return m_duration; }
37
38 QString toString(void) const;
39
40#if CONFIG_LIBCRYPTO
41 public:
42 bool SetAESIV(QString line);
43 bool IVLoaded(void) const { return m_ivLoaded; }
44
45 QByteArray AESIV(void) { return m_aesIV; }
46 bool HasKeyPath(void) const { return !m_keypath.isEmpty(); }
47 QString KeyPath(void) const { return m_keypath; }
48 void SetKeyPath(const QString& x) { m_keypath = x; }
49#endif // CONFIG_LIBCRYPTO
50
51 protected:
52 int m_inputId {0}; // input card ID
53 int64_t m_sequence {0}; // unique sequence number
54 std::chrono::milliseconds m_duration {0ms}; // segment duration
55 uint64_t m_bitrate {0}; // bitrate of segment's content (bits per second)
56 QString m_title; // human-readable informative title of the media segment
57 QUrl m_url;
58
59#if CONFIG_LIBCRYPTO
60 private:
61 QString m_keypath; // URL path of the encrypted key
62 bool m_ivLoaded {false};
63 QByteArray m_aesIV {AES_BLOCK_SIZE,0}; // IV used when decypher the block
64#endif // CONFIG_LIBCRYPTO
65
66};
67
68#endif // HLS_SEGMENT_H
int64_t m_sequence
Definition: HLSSegment.h:53
QString Title(void) const
Definition: HLSSegment.h:34
bool Download(QByteArray &buffer)
std::chrono::milliseconds Duration(void) const
Definition: HLSSegment.h:36
int64_t Sequence(void) const
Definition: HLSSegment.h:33
uint64_t m_bitrate
Definition: HLSSegment.h:55
QUrl Url(void) const
Definition: HLSSegment.h:35
QString toString(void) const
Definition: HLSSegment.cpp:64
QString m_title
Definition: HLSSegment.h:56
HLSRecSegment(int input)
Definition: HLSSegment.cpp:16
std::chrono::milliseconds m_duration
Definition: HLSSegment.h:54
HLSRecSegment & operator=(const HLSRecSegment &rhs)
Definition: HLSSegment.cpp:40