MythTV master
iptvtuningdata.cpp
Go to the documentation of this file.
1#include "iptvtuningdata.h"
2
4
5bool IPTVTuningData::IsValid(void) const
6{
7 bool ret = (m_dataUrl.isValid() && (IsUDP() || IsRTP() || IsRTSP() || IsHLS() || IsHTTPTS()));
8
9 LOG(VB_CHANNEL, LOG_DEBUG, QString("IPTVTuningdata (%1): IsValid = %2")
10 .arg(m_dataUrl.toString(),
11 ret ? "true" : "false"));
12
13 return ret;
14}
15
16bool IPTVTuningData::CanReadHTTP(QByteArray &buffer) const
17{
18 // Check needed for use in the unit test
19 if (QCoreApplication::instance() == nullptr)
20 {
21 LOG(VB_GENERAL, LOG_ERR, QString("CanReadHTTP - No QCoreApplication!!"));
22 return false;
23 }
24
25 QString url = m_dataUrl.toString();
26 MythSingleDownload downloader;
27 downloader.DownloadURL(url, &buffer, 5s, 0, 2000);
28 if (buffer.isEmpty())
29 {
30 LOG(VB_GENERAL, LOG_ERR, QString("CanReadHTTP - Failed, error:%1 url:%2")
31 .arg(downloader.ErrorString(), url));
32 return false;
33 }
34 return true;
35}
bool IsValid(void) const
bool IsRTP(void) const
bool IsHLS() const
bool IsHTTPTS() const
bool IsRTSP(void) const
bool CanReadHTTP(QByteArray &buffer) const
bool IsUDP(void) const
QString ErrorString(void) const
bool DownloadURL(const QUrl &url, QByteArray *buffer, std::chrono::seconds timeout=30s, uint redirs=0, qint64 maxsize=0, QString *final_url=nullptr)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition: mythlogging.h:39