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 <QChar> // Fix Qt6 GCC SFINAE warning
13#include <QByteArray>
14#include <QString>
15#include <QUrl>
16
18
20{
21 public:
22 friend class HLSReader;
23
24 HLSRecSegment(int input);
25 HLSRecSegment(const HLSRecSegment& rhs);
26 HLSRecSegment(int input, int sequence, std::chrono::milliseconds duration,
27 QString title, QUrl uri);
29
31
32 bool Download(QByteArray & buffer);
33
34 int64_t Sequence(void) const { return m_sequence; }
35 QString Title(void) const { return m_title; }
36 QUrl Url(void) const { return m_url; }
37 std::chrono::milliseconds Duration(void) const { return m_duration; }
38
39 QString toString(void) const;
40
41#if CONFIG_LIBCRYPTO
42 public:
43 bool SetAESIV(QString line);
44 bool IVLoaded(void) const { return m_ivLoaded; }
45
46 QByteArray AESIV(void) { return m_aesIV; }
47 bool HasKeyPath(void) const { return !m_keypath.isEmpty(); }
48 QString KeyPath(void) const { return m_keypath; }
49 void SetKeyPath(const QString& x) { m_keypath = x; }
50#endif // CONFIG_LIBCRYPTO
51
52 protected:
53 int m_inputId {0}; // input card ID
54 int64_t m_sequence {0}; // unique sequence number
55 std::chrono::milliseconds m_duration {0ms}; // segment duration
56 uint64_t m_bitrate {0}; // bitrate of segment's content (bits per second)
57 QString m_title; // human-readable informative title of the media segment
58 QUrl m_url;
59
60#if CONFIG_LIBCRYPTO
61 private:
62 QString m_keypath; // URL path of the encrypted key
63 bool m_ivLoaded {false};
64 QByteArray m_aesIV {AES_BLOCK_SIZE,0}; // IV used when decypher the block
65#endif // CONFIG_LIBCRYPTO
66
67};
68
69#endif // HLS_SEGMENT_H
int64_t m_sequence
Definition: HLSSegment.h:54
QString Title(void) const
Definition: HLSSegment.h:35
bool Download(QByteArray &buffer)
std::chrono::milliseconds Duration(void) const
Definition: HLSSegment.h:37
int64_t Sequence(void) const
Definition: HLSSegment.h:34
uint64_t m_bitrate
Definition: HLSSegment.h:56
QUrl Url(void) const
Definition: HLSSegment.h:36
QString toString(void) const
Definition: HLSSegment.cpp:64
QString m_title
Definition: HLSSegment.h:57
HLSRecSegment(int input)
Definition: HLSSegment.cpp:16
std::chrono::milliseconds m_duration
Definition: HLSSegment.h:55
HLSRecSegment & operator=(const HLSRecSegment &rhs)
Definition: HLSSegment.cpp:40