Browse Source

DVB: HbbTV fix streaming video.

chirpmodem-v8.0.0
Jon Beniston 1 month ago
parent
commit
6e4d7c136a
  1. 5
      plugins/channelrx/demoddvb/dvbdemod.qrc
  2. 65
      plugins/channelrx/demoddvb/dvbdemodgui.cpp
  3. 2
      plugins/channelrx/demoddvb/dvbdemodgui.h
  4. 61
      plugins/channelrx/demoddvb/dvbdemodgui.ui
  5. 242
      plugins/channelrx/demoddvb/dvbdemodhbbtv.cpp
  6. 25
      plugins/channelrx/demoddvb/dvbdemodhbbtv.h
  7. 488
      plugins/channelrx/demoddvb/hbbtv/oipf.js
  8. BIN
      plugins/channelrx/demoddvb/icons/blue.png
  9. BIN
      plugins/channelrx/demoddvb/icons/green.png
  10. BIN
      plugins/channelrx/demoddvb/icons/red.png
  11. BIN
      plugins/channelrx/demoddvb/icons/runapps.png
  12. BIN
      plugins/channelrx/demoddvb/icons/yellow.png
  13. 7
      plugins/channelrx/demoddvb/readme.md
  14. 17
      sdrgui/dtv/dtvstreamplayback.cpp
  15. 2
      sdrgui/dtv/dtvstreamplayback.h
  16. 191
      sdrgui/dtv/dtvstreamremuxer.cpp
  17. 9
      sdrgui/dtv/dtvstreamremuxer.h

5
plugins/channelrx/demoddvb/dvbdemod.qrc

@ -3,6 +3,11 @@ @@ -3,6 +3,11 @@
<file>images/angeltv.png</file>
<file>icons/deinterlace.png</file>
<file>icons/gpu.png</file>
<file>icons/runapps.png</file>
<file>icons/red.png</file>
<file>icons/green.png</file>
<file>icons/yellow.png</file>
<file>icons/blue.png</file>
<file>hbbtv/oipf.js</file>
</qresource>
</RCC>

65
plugins/channelrx/demoddvb/dvbdemodgui.cpp

@ -737,9 +737,7 @@ void DVBDemodGUI::appsMenu(const QPoint& position) @@ -737,9 +737,7 @@ void DVBDemodGUI::appsMenu(const QPoint& position)
if (chosen == run)
{
m_settings.m_hbbtv = run->isChecked();
applySetting("hbbtv");
updateHbbTV();
ui->hbbtv->setChecked(run->isChecked()); // As the switch does
}
#ifdef DVBDEMOD_HBBTV
else if (chosen == clear)
@ -761,6 +759,13 @@ void DVBDemodGUI::updateHbbTV() @@ -761,6 +759,13 @@ void DVBDemodGUI::updateHbbTV()
connect(m_hbbtv, &DVBDemodHbbTV::videoAreaChanged, this, &DVBDemodGUI::hbbtvVideoArea);
connect(m_hbbtv, &DVBDemodHbbTV::channelChangeRequested, this, &DVBDemodGUI::hbbtvChannelChange);
connect(m_hbbtv, &DVBDemodHbbTV::mediaRequest, this, &DVBDemodGUI::hbbtvMedia);
connect(m_hbbtv, &DVBDemodHbbTV::drmRequested, this, [this](const QString& system) {
// (Shown over the application's page too, by DVBDemodHbbTV)
const QString text = QString("The application's video is protected by %1 DRM, which SDRangel can't play").arg(system);
setStatusText(text);
setStatusToolTip(text);
m_statusMessageTimer.start();
});
connect(m_hbbtv, &DVBDemodHbbTV::channelStepRequested, this, [this](int direction) {
QKeyEvent key(QEvent::KeyPress, direction > 0 ? Qt::Key_ChannelUp : Qt::Key_ChannelDown, Qt::NoModifier);
m_guideOverlay->handleKey(&key);
@ -900,8 +905,12 @@ void DVBDemodGUI::hbbtvVideoArea(const QRectF& area) @@ -900,8 +905,12 @@ void DVBDemodGUI::hbbtvVideoArea(const QRectF& area)
}
const QRect page = hbbtvPageRect(screen);
screen->setVideoArea(QRectF((page.x() + area.x() * page.width()) / screen->width(), (page.y() + area.y() * page.height()) / screen->height(),
area.width() * page.width() / screen->width(), area.height() * page.height() / screen->height()));
const QRectF screenArea((page.x() + area.x() * page.width()) / screen->width(), (page.y() + area.y() * page.height()) / screen->height(),
area.width() * page.width() / screen->width(), area.height() * page.height() / screen->height());
qDebug("DVBDemodGUI::hbbtvVideoArea: %s screen %dx%d: page %d,%d %dx%d, video %.3f,%.3f %.3fx%.3f of the screen",
screen == ui->screenTV ? "window's" : "full", screen->width(), screen->height(), page.x(), page.y(), page.width(), page.height(),
screenArea.x(), screenArea.y(), screenArea.width(), screenArea.height());
screen->setVideoArea(screenArea);
}
// The application's video/broadcast setChannel(): a service of this multiplex, or another the guide knows of
@ -949,15 +958,45 @@ void DVBDemodGUI::hbbtvRed() @@ -949,15 +958,45 @@ void DVBDemodGUI::hbbtvRed()
#endif
}
// Red buttons, on the ribbon, guide and here, while the service played has an HbbTV application to run
// Red buttons, on the ribbon, guide and here, while the service played has an HbbTV application to run; and here, the
// green, yellow and blue, while one's running
void DVBDemodGUI::displayRedButton()
{
bool shown = false;
bool running = false;
#ifdef DVBDEMOD_HBBTV
shown = m_hbbtv && m_hbbtv->hasAutostartApp();
running = m_hbbtv && m_hbbtv->isRunning();
#endif
m_guideOverlay->setRedButton(shown);
ui->redButton->setVisible(shown);
ui->redButton->setVisible(shown || running);
ui->greenButton->setVisible(running);
ui->yellowButton->setVisible(running);
ui->blueButton->setVisible(running);
}
// As the key pressed and released on the video, for the application. The video gets the keys after
void DVBDemodGUI::hbbtvKey(int key)
{
#ifdef DVBDEMOD_HBBTV
if (m_hbbtv)
{
QKeyEvent press(QEvent::KeyPress, key, Qt::NoModifier);
QKeyEvent release(QEvent::KeyRelease, key, Qt::NoModifier);
m_hbbtv->keyPress(&press);
m_hbbtv->keyRelease(&release);
m_hbbtv->takeFocus();
}
#else
(void) key;
#endif
}
void DVBDemodGUI::on_hbbtv_toggled(bool checked)
{
m_settings.m_hbbtv = checked;
applySetting("hbbtv");
updateHbbTV();
}
// The application's media, as iPlayer's: played by a player of its own, in place of the broadcast's (stopped while
@ -1913,6 +1952,13 @@ DVBDemodGUI::DVBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban @@ -1913,6 +1952,13 @@ DVBDemodGUI::DVBDemodGUI(PluginAPI* pluginAPI, DeviceUISet *deviceUISet, Baseban
connect(m_guideOverlay, &DTVGuideOverlay::playService, this, &DVBDemodGUI::guideServiceSelected);
connect(m_guideOverlay, &DTVGuideOverlay::redButton, this, &DVBDemodGUI::hbbtvRed);
ui->redButton->setVisible(false);
ui->greenButton->setVisible(false);
ui->yellowButton->setVisible(false);
ui->blueButton->setVisible(false);
#ifndef DVBDEMOD_HBBTV
ui->hbbtv->setEnabled(false);
ui->hbbtv->setToolTip("Interactive applications (HbbTV): not built, as Qt WebEngine is needed");
#endif
connect(&MainCore::instance()->getMasterTimer(), SIGNAL(timeout()), this, SLOT(tick())); // 50 ms
@ -2081,6 +2127,7 @@ void DVBDemodGUI::displaySettings() @@ -2081,6 +2127,7 @@ void DVBDemodGUI::displaySettings()
blockApplySettings(true);
ui->deltaFrequency->setValue(m_settings.m_inputFrequencyOffset);
ui->hbbtv->setChecked(m_settings.m_hbbtv);
int bandwidthIndex = 0;
for (int i = 0; i < (int) std::size(m_bandwidths); i++)
@ -3042,6 +3089,10 @@ void DVBDemodGUI::makeUIConnections() @@ -3042,6 +3089,10 @@ void DVBDemodGUI::makeUIConnections()
QObject::connect(ui->epg, &QToolButton::clicked, this, &DVBDemodGUI::on_epg_clicked);
QObject::connect(ui->apps, &QToolButton::clicked, this, &DVBDemodGUI::on_apps_clicked);
QObject::connect(ui->redButton, &QToolButton::clicked, this, &DVBDemodGUI::hbbtvRed);
QObject::connect(ui->greenButton, &QToolButton::clicked, this, [this]() { hbbtvKey(Qt::Key_G); });
QObject::connect(ui->yellowButton, &QToolButton::clicked, this, [this]() { hbbtvKey(Qt::Key_Y); });
QObject::connect(ui->blueButton, &QToolButton::clicked, this, [this]() { hbbtvKey(Qt::Key_B); });
QObject::connect(ui->hbbtv, &ButtonSwitch::toggled, this, &DVBDemodGUI::on_hbbtv_toggled);
ui->apps->setContextMenuPolicy(Qt::CustomContextMenu);
QObject::connect(ui->apps, &QToolButton::customContextMenuRequested, this, &DVBDemodGUI::appsMenu);
ui->epg->setContextMenuPolicy(Qt::CustomContextMenu);

2
plugins/channelrx/demoddvb/dvbdemodgui.h

@ -251,6 +251,8 @@ private slots: @@ -251,6 +251,8 @@ private slots:
void hbbtvVideoArea(const QRectF& area);
void hbbtvChannelChange(int networkId, int transportStreamId, int serviceId);
void hbbtvRed(); //!< The red button clicked
void hbbtvKey(int key); //!< A coloured button clicked: its key (G, Y or B) given to the application
void on_hbbtv_toggled(bool checked);
void hbbtvMedia(const QString& command, int id, const QString& url, const QMap<QString, QString>& options, double position);
void stopStreamPlayback(); //!< The application's media stopped, and the broadcast played again
void displayRedButton();

61
plugins/channelrx/demoddvb/dvbdemodgui.ui

@ -774,7 +774,7 @@ @@ -774,7 +774,7 @@
<bool>false</bool>
</property>
<property name="toolTip">
<string>Watch the programme in HD, when the programme guide says it's also on another service</string>
<string>Watch the programme in HD, if available</string>
</property>
<property name="text">
<string>HD</string>
@ -784,7 +784,7 @@ @@ -784,7 +784,7 @@
<item>
<widget class="ButtonSwitch" name="deinterlace">
<property name="toolTip">
<string>Deinterlace video (bwdif, or the GPU's with hardware decoding)</string>
<string>Deinterlace video</string>
</property>
<property name="text">
<string/>
@ -978,23 +978,68 @@ @@ -978,23 +978,68 @@
<item>
<widget class="QToolButton" name="apps">
<property name="toolTip">
<string>Show the interactive applications (red button) of the service played: HbbTV's and others from its AIT, and its MHEG-5 and HbbTV object carousels, with their files</string>
<string>Show the interactive applications (red button) of the current service.</string>
</property>
<property name="text">
<string>Apps</string>
</property>
</widget>
</item>
<item>
<widget class="ButtonSwitch" name="hbbtv">
<property name="toolTip">
<string>Run interactive applications (HbbTV, the red button).</string>
</property>
<property name="icon">
<iconset resource="dvbdemod.qrc">
<normaloff>:/demoddvb/icons/runapps.png</normaloff>:/demoddvb/icons/runapps.png</iconset>
</property>
<property name="checkable">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="redButton">
<property name="toolTip">
<string>The red button: the service's interactive application (HbbTV), as R on the video</string>
<string>The red button: the service's interactive application (HbbTV) - or press R on the video</string>
</property>
<property name="styleSheet">
<string notr="true">QToolButton { color: #e62928; font-weight: bold; }</string>
<property name="icon">
<iconset resource="dvbdemod.qrc">
<normaloff>:/demoddvb/icons/red.png</normaloff>:/demoddvb/icons/red.png</iconset>
</property>
<property name="text">
<string>Red</string>
</widget>
</item>
<item>
<widget class="QToolButton" name="greenButton">
<property name="toolTip">
<string>The green button, for the interactive application (HbbTV) - or press G on the video</string>
</property>
<property name="icon">
<iconset resource="dvbdemod.qrc">
<normaloff>:/demoddvb/icons/green.png</normaloff>:/demoddvb/icons/green.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="yellowButton">
<property name="toolTip">
<string>The yellow button, for the interactive application (HbbTV) - or press Y on the video</string>
</property>
<property name="icon">
<iconset resource="dvbdemod.qrc">
<normaloff>:/demoddvb/icons/yellow.png</normaloff>:/demoddvb/icons/yellow.png</iconset>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="blueButton">
<property name="toolTip">
<string>The blue button, for the interactive application (HbbTV) - or press B on the video</string>
</property>
<property name="icon">
<iconset resource="dvbdemod.qrc">
<normaloff>:/demoddvb/icons/blue.png</normaloff>:/demoddvb/icons/blue.png</iconset>
</property>
</widget>
</item>

242
plugins/channelrx/demoddvb/dvbdemodhbbtv.cpp

@ -17,6 +17,8 @@ @@ -17,6 +17,8 @@
///////////////////////////////////////////////////////////////////////////////////
#include <atomic>
#include <cmath>
#include <iterator>
#include <QApplication>
#include <QCoreApplication>
@ -56,6 +58,10 @@ namespace { @@ -56,6 +58,10 @@ namespace {
const QString m_messagePrefix = QStringLiteral("\u0001sdrangel:");
const QString m_scriptName = QStringLiteral("sdrangel-oipf");
constexpr int m_checkMs = 250;
constexpr qint64 m_repeatMs = 60000; //!< A message like one logged (its numbers aside) held back for this long
constexpr int m_retransparentMax = 3; //!< Times the view's made transparent again, for a video area
// setContent()'s content is percent-encoded to go to the renderer, which takes 2 MB less 30 bytes of it
constexpr int m_setContentLimit = 2 * 1024 * 1024 - 30;
constexpr int m_retryMs = 30000; //!< Before a failed AUTOSTART application's tried again
constexpr int m_applicationTypeHbbTV = 0x10;
constexpr int m_autostart = 1;
@ -180,7 +186,7 @@ DVBDemodHbbTV::DVBDemodHbbTV(DTVApps *apps, QObject *parent) : @@ -180,7 +186,7 @@ DVBDemodHbbTV::DVBDemodHbbTV(DTVApps *apps, QObject *parent) :
{
m_server->start();
connect(m_server, &DTVCarouselServer::served, this, [this](const QString& path, int status) {
emit log(QString("Carousel: %1 %2").arg(path).arg(status));
logLimited(QString("Carousel: %1 %2").arg(path).arg(status), QString());
});
QFile script(":/demoddvb/hbbtv/oipf.js");
@ -357,6 +363,45 @@ void DVBDemodHbbTV::makeTransparent() @@ -357,6 +363,45 @@ void DVBDemodHbbTV::makeTransparent()
}
}
// While the video's shown in the page, the view's kept transparent. Qt makes it opaque (its QQuickWidget's clear colour,
// and not stacked on top, so composited without blending: black over the video) when Chromium reports the page's
// background opaque, as TVP VOD's black, while it's browsed. When it's cleared for the video, Chromium doesn't always
// report it's transparent again (until the view's resized, as for full screen): it does once the background SDRangel
// gives the page changes, so it's made black then transparent again
void DVBDemodHbbTV::keepTransparent()
{
if (!m_view || m_videoArea.isNull() || m_retransparent || (m_retransparentCount >= m_retransparentMax)) {
return;
}
bool opaque = false;
for (QQuickWidget *widget : m_view->findChildren<QQuickWidget*>()) {
opaque = opaque || !widget->testAttribute(Qt::WA_AlwaysStackOnTop);
}
if (!opaque) {
return;
}
// Not over and over (each time the page's drawn again, perhaps a flash): if it's still opaque, it's as the page is
// (its background opaque, as an image the video's area can't be cut from), until the video's area changes
if (++m_retransparentCount >= m_retransparentMax) {
qDebug("DVBDemodHbbTV::keepTransparent: the page's drawn opaque over its video: made transparent again, not again");
} else {
qDebug("DVBDemodHbbTV::keepTransparent: the page's drawn opaque over its video: made transparent again");
}
m_retransparent = true;
m_page->setBackgroundColor(Qt::black);
QTimer::singleShot(0, this, [this]() {
m_page->setBackgroundColor(Qt::transparent);
makeTransparent();
// Not again until Chromium's had a while to say what the page's background is
QTimer::singleShot(1000, this, [this]() { m_retransparent = false; });
});
}
void DVBDemodHbbTV::takeFocus()
{
if (!m_view) {
@ -380,6 +425,19 @@ bool DVBDemodHbbTV::eventFilter(QObject *object, QEvent *event) @@ -380,6 +425,19 @@ bool DVBDemodHbbTV::eventFilter(QObject *object, QEvent *event)
{
const QEvent::Type type = event->type();
// A widget the view's made, as WebEngine does for a page's drawing when the view's moved to another window (full
// screen video's): made transparent, and not taking the mouse, as the first were, else it hides the video
if ((type == QEvent::ChildAdded) && (object == m_view.data()))
{
QObject *child = static_cast<QChildEvent*>(event)->child();
if (child && child->isWidgetType())
{
qDebug("DVBDemodHbbTV::eventFilter: view widget added: %s", child->metaObject()->className());
QTimer::singleShot(0, this, &DVBDemodHbbTV::makeTransparent);
}
}
if ((type == QEvent::KeyPress) || (type == QEvent::KeyRelease) || (type == QEvent::ShortcutOverride))
{
QKeyEvent *key = static_cast<QKeyEvent*>(event);
@ -412,8 +470,25 @@ void DVBDemodHbbTV::setViewGeometry(const QRect& geometry) @@ -412,8 +470,25 @@ void DVBDemodHbbTV::setViewGeometry(const QRect& geometry)
}
m_view->setGeometry(geometry);
// Applications are laid out for 1280 by 720 pixels
m_page->setZoomFactor(std::max(0.25, std::min(5.0, geometry.width() / 1280.0)));
m_viewWidth = geometry.width();
applyZoom();
}
// Applications are laid out for 1280 by 720 pixels, or some for 1920 by 1080: zoomed to fill the view. The view's
// device pixels rounded up, so the page's no wider than that (with display scaling the view's a fraction of a device
// pixel wider, which would make it 1281: an application choosing its layout by media queries would take a wider one)
void DVBDemodHbbTV::applyZoom()
{
if (m_viewWidth > 0)
{
const double ratio = m_view ? m_view->devicePixelRatioF() : 1.0;
const double devicePixels = std::ceil(m_viewWidth * ratio);
const double zoom = devicePixels / (ratio * m_layoutWidth) * (1.0 + 1e-6);
m_page->setZoomFactor(std::max(0.25, std::min(5.0, zoom)));
qDebug("DVBDemodHbbTV::applyZoom: view %d wide, device pixel ratio %.3f, laid out for %d: zoom %.5f",
m_viewWidth, ratio, m_layoutWidth, zoom);
}
}
void DVBDemodHbbTV::setViewParent(QWidget *parent)
@ -492,6 +567,7 @@ void DVBDemodHbbTV::setNetworkAllowed(bool allowed) @@ -492,6 +567,7 @@ void DVBDemodHbbTV::setNetworkAllowed(bool allowed)
{
m_interceptor->m_networkAllowed = allowed;
updateProxy();
updateScript(); // Its configuration has the proxy if it's allowed (Qt 5)
}
// Qt 5's WebEngine sends the page's origin whatever the interceptor says, which broadcasters' servers refuse: a
@ -561,6 +637,11 @@ bool DVBDemodHbbTV::keyPress(QKeyEvent *event) @@ -561,6 +637,11 @@ bool DVBDemodHbbTV::keyPress(QKeyEvent *event)
m_redDelivered.start();
}
// Which keys the application's given, for the log (as what it does may follow from one)
if (!event->isAutoRepeat()) {
qDebug("DVBDemodHbbTV::keyPress: key %d given to the application", code);
}
m_page->runJavaScript(QString("window.__sdrangelHbbTV && window.__sdrangelHbbTV.key(%1, true)").arg(code));
return true;
}
@ -583,6 +664,7 @@ bool DVBDemodHbbTV::pressRed() @@ -583,6 +664,7 @@ bool DVBDemodHbbTV::pressRed()
if (isRunning() && m_loaded && (m_keyset & m_keysetRed))
{
qDebug("DVBDemodHbbTV::pressRed: red given to the application");
m_page->runJavaScript("window.__sdrangelHbbTV && (window.__sdrangelHbbTV.key(403, true), window.__sdrangelHbbTV.key(403, false))");
m_redDelivered.start();
return true;
@ -612,6 +694,12 @@ bool DVBDemodHbbTV::pressRed() @@ -612,6 +694,12 @@ bool DVBDemodHbbTV::pressRed()
QString DVBDemodHbbTV::getStatus() const
{
// The application's asked for a DRM licence for its video, which can't be played: for a while, over what it shows
// (as it may only say it's loading, or that something went wrong)
if (m_drmRequest.isValid() && (m_drmRequest.elapsed() < 8000)) {
return QString("Protected by %1 DRM: can't be played").arg(m_drmSystem);
}
if (!m_userRequest.isValid() || (m_userRequest.elapsed() > 60000)) {
return QString();
}
@ -754,6 +842,7 @@ void DVBDemodHbbTV::showStatus() @@ -754,6 +842,7 @@ void DVBDemodHbbTV::showStatus()
void DVBDemodHbbTV::check()
{
showStatus();
keepTransparent();
if (m_channel.m_serviceId == 0) {
return;
@ -859,6 +948,12 @@ void DVBDemodHbbTV::navigate(const QString& url, const QString& name, uint32_t o @@ -859,6 +948,12 @@ void DVBDemodHbbTV::navigate(const QString& url, const QString& name, uint32_t o
m_keysetSinceLoad = false;
m_pageStatus.clear();
if (m_layoutWidth != m_defaultLayoutWidth)
{
m_layoutWidth = m_defaultLayoutWidth;
applyZoom();
}
if (m_mediaId != 0)
{
emit mediaRequest("stop", m_mediaId, QString(), QMap<QString, QString>(), 0.0);
@ -966,7 +1061,43 @@ void DVBDemodHbbTV::consoleMessage(int level, const QString& message, int line, @@ -966,7 +1061,43 @@ void DVBDemodHbbTV::consoleMessage(int level, const QString& message, int line,
return;
}
emit log(QString("Console%1: %2 (%3:%4)").arg(level >= 2 ? " error" : "").arg(message).arg(source).arg(line));
logLimited(QString("Console%1: %2 (%3:%4)").arg(level >= 2 ? " error" : "").arg(message).arg(source).arg(line), source);
}
// Logged, unless one like it was a short while ago: applications log what they do often (as a player its position, a few
// times a second) or poll (as a carousel's file, every few seconds), which would fill the log. Like it: the same but
// for its numbers, from the same script. The next logged says how many weren't
void DVBDemodHbbTV::logLimited(const QString& text, const QString& from)
{
if (!m_logLimited)
{
emit log(text);
return;
}
static const QRegularExpression numbers("\\d+(\\.\\d+)?");
const QString key = from + '\n' + QString(text).replace(numbers, "#");
const qint64 now = QDateTime::currentMSecsSinceEpoch();
auto it = m_repeated.find(key);
if ((it != m_repeated.end()) && (now - it->m_loggedAt < m_repeatMs))
{
it->m_held++;
return;
}
const int held = it != m_repeated.end() ? it->m_held : 0;
emit log(held > 0 ? QString("%1 (and %2 like it in the last minute, not logged)").arg(text).arg(held) : text);
// The old forgotten, now and then
if (m_repeated.size() > 500)
{
for (auto old = m_repeated.begin(); old != m_repeated.end();) {
old = now - old->m_loggedAt >= m_repeatMs ? m_repeated.erase(old) : std::next(old);
}
}
m_repeated.insert(key, Repeated{now, 0});
}
// From oipf.js
@ -1025,10 +1156,42 @@ void DVBDemodHbbTV::message(const QJsonObject& message) @@ -1025,10 +1156,42 @@ void DVBDemodHbbTV::message(const QJsonObject& message)
emit log(QString("setChannel %1.%2.%3").arg(message.value("onid").toInt()).arg(message.value("tsid").toInt()).arg(message.value("sid").toInt()));
emit channelChangeRequested(message.value("onid").toInt(-1), message.value("tsid").toInt(-1), message.value("sid").toInt());
}
else if (type == "drm")
{
// DRM system ids (DVB CA system ids, as urn:dvb:casystemid:19219): the ones applications use, by name
static const QMap<QString, QString> names = {
{"19219", "PlayReady"}, {"19156", "Widevine"}, {"19188", "Marlin"}};
const QString id = message.value("system").toString();
const QString number = id.section(':', -1);
const QString system = names.value(number, id.isEmpty() ? QString("DRM") : id);
emit log(QString("DRM message (%1) for %2: no DRM system, so protected video can't be played").arg(message.value("type").toString(), system));
m_drmSystem = system;
m_drmRequest.start();
showStatus();
emit drmRequested(system);
}
else if (type == "step")
{
emit channelStepRequested(message.value("d").toInt());
}
else if (type == "layout")
{
// Its html or body 1920 pixels wide: made for a 1920 by 1080 browser. Only as laid out in the viewport it's
// zoomed to: while the view's resized it's briefly wider or narrower, and an application choosing its layout
// by media queries (as TVP VOD's) would take the wider one, then keep it if it were zoomed for that
const int width = message.value("w").toInt();
const int viewport = message.value("vw").toInt();
const int layoutWidth = (width >= 1900) && (width <= 1940) ? 1920 : m_defaultLayoutWidth;
qDebug("DVBDemodHbbTV::message: layout %d in a viewport %d wide, zoomed for %d", width, viewport, m_layoutWidth);
if ((viewport <= m_layoutWidth) && (viewport >= m_layoutWidth - 2) && (layoutWidth != m_layoutWidth))
{
m_layoutWidth = layoutWidth;
applyZoom();
emit log(QString("Laid out for %1 pixels wide: zoomed to fit").arg(layoutWidth));
}
}
else if (type == "video")
{
QRectF area;
@ -1042,6 +1205,12 @@ void DVBDemodHbbTV::message(const QJsonObject& message) @@ -1042,6 +1205,12 @@ void DVBDemodHbbTV::message(const QJsonObject& message)
if (area != m_videoArea)
{
m_videoArea = area;
m_retransparentCount = 0;
// Once the page's cleared its backgrounds over it, and Chromium's said what that makes the page's
QTimer::singleShot(300, this, &DVBDemodHbbTV::keepTransparent);
qDebug("DVBDemodHbbTV::message: video %s: %s", qPrintable(message.value("what").toString()),
message.value("full").toBool() ? "full screen" : message.value("hidden").toBool() ? "hidden (full screen)"
: qPrintable(QString("%1,%2 %3x%4").arg(area.x(), 0, 'f', 3).arg(area.y(), 0, 'f', 3).arg(area.width(), 0, 'f', 3).arg(area.height(), 0, 'f', 3)));
emit videoAreaChanged(area);
}
}
@ -1054,6 +1223,26 @@ void DVBDemodHbbTV::message(const QJsonObject& message) @@ -1054,6 +1223,26 @@ void DVBDemodHbbTV::message(const QJsonObject& message)
if (command == "load")
{
// Only by HTTP. SDRangel's player (FFmpeg) fetches it, not the browser, so the interceptor doesn't see it:
// refused here as the browser's requests are when the internet's not allowed (but a carousel's file), and
// other protocols (as file:, concat:) never, as the page could ask for anything
const QUrl requested(url);
const bool http = (requested.scheme() == "http") || (requested.scheme() == "https");
const bool allowed = http && (m_interceptor->m_networkAllowed || m_server->isServerUrl(url));
if (!allowed)
{
emit log(QString("Media %1 refused: %2").arg(id).arg(url));
QJsonObject data;
data.insert("code", http ? 2 : 4); // MEDIA_ERR_NETWORK, MEDIA_ERR_SRC_NOT_SUPPORTED
data.insert("message", http ? "The internet isn't allowed" : "Not an HTTP URL");
mediaEvent(id, "error", data);
return;
}
// And the protocols its demuxers open (as a manifest's segments) only those of HTTP
options["protocol_whitelist"] = "http,https,tcp,tls,crypto,httpproxy";
// FFmpeg fetches it as the page would: with its user agent, and a carousel's file from the server by the
// loopback address (FFmpeg's resolver doesn't know *.localhost), its host given in the header
options["user_agent"] = m_profile->httpUserAgent();
@ -1198,7 +1387,19 @@ void DVBDemodHbbTV::downloadRequested(const QUrl& url, const QString& mimeType) @@ -1198,7 +1387,19 @@ void DVBDemodHbbTV::downloadRequested(const QUrl& url, const QString& mimeType)
// With oipf.js in it as well: given so, a page's scripts aren't always injected (Qt WebEngine doesn't inject
// them in one given after another, as when the service changes from one application served so to another)
m_page->setContent(withScript(reply->readAll(), scriptSource()), "text/html", url);
const QByteArray page = withScript(reply->readAll(), scriptSource());
if (page.toPercentEncoding().size() < m_setContentLimit)
{
m_page->setContent(page, "text/html", url);
return;
}
// Too large to be given: a page that loads it (from where it is, so of its origin) and writes it into itself
const QString contentType = reply->header(QNetworkRequest::ContentTypeHeader).toString();
const QRegularExpressionMatch charset = QRegularExpression("charset\\s*=\\s*\"?([^\";\\s]+)", QRegularExpression::CaseInsensitiveOption).match(contentType);
emit log(QString("%1 is too large to be given to the page (%2 bytes): loaded by a script").arg(url.toString()).arg(page.size()));
m_page->setContent(loaderPage(url, charset.hasMatch() ? charset.captured(1) : QString("utf-8")), "text/html", url);
});
}
@ -1246,7 +1447,10 @@ QJsonObject DVBDemodHbbTV::configuration() const @@ -1246,7 +1447,10 @@ QJsonObject DVBDemodHbbTV::configuration() const
config.insert("version", QCoreApplication::applicationVersion());
config.insert("serverPort", m_server->getPort());
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
// Only if the internet's allowed: else requests to it fail as the browser's own do (not as the proxy's 404)
if (m_interceptor->m_networkAllowed) {
config.insert("proxy", m_server->getProxyPath());
}
#endif
return config;
}
@ -1255,9 +1459,11 @@ QJsonObject DVBDemodHbbTV::configuration() const @@ -1255,9 +1459,11 @@ QJsonObject DVBDemodHbbTV::configuration() const
// </ (so it can be in a page's <script> element)
QString DVBDemodHbbTV::scriptSource() const
{
// Not by arg(): the script has %s of its own
const QString source = "window.__sdrangelHbbTVConfig = " + QString::fromUtf8(QJsonDocument(configuration()).toJson(QJsonDocument::Compact))
+ ";\n" + m_oipfScript;
// Not by arg(): the script has %s of its own. The configuration's < escaped (only in its strings, as JSON has no
// other): its programmes' names and descriptions are the broadcaster's, and <!-- with <script in a page's script
// element would make the rest of the page part of it
const QString config = QString::fromUtf8(QJsonDocument(configuration()).toJson(QJsonDocument::Compact)).replace("<", "\\u003c");
const QString source = "window.__sdrangelHbbTVConfig = " + config + ";\n" + m_oipfScript;
QString ascii;
ascii.reserve(source.size());
@ -1296,6 +1502,26 @@ QByteArray DVBDemodHbbTV::withScript(const QByteArray& page, const QString& scri @@ -1296,6 +1502,26 @@ QByteArray DVBDemodHbbTV::withScript(const QByteArray& page, const QString& scri
return result;
}
// A page that loads one too large to be given by setContent(): oipf.js, then its own script fetching the page (from
// where it is, its origin and URL the page's) and writing it into itself, as it would have been
QByteArray DVBDemodHbbTV::loaderPage(const QUrl& url, const QString& charset) const
{
const QString quotedUrl = QString::fromUtf8(QJsonDocument(QJsonArray{url.toString(QUrl::FullyEncoded)}).toJson(QJsonDocument::Compact)).replace("<", "\\u003c");
const QString quotedType = QString::fromUtf8(QJsonDocument(QJsonArray{QString("text/html; charset=%1").arg(charset)}).toJson(QJsonDocument::Compact))
.replace("<", "\\u003c");
const QString loader = QString(
"(function () {"
" var x = new XMLHttpRequest();"
" x.open('GET', %1[0]);"
" x.overrideMimeType(%2[0]);"
" x.onload = function () { document.open(); document.write(x.responseText); document.close(); };"
" x.onerror = function () { console.log('[sdrangel] the page could not be loaded'); };"
" x.send();"
" })();").arg(quotedUrl, quotedType);
return "<!DOCTYPE html><html><head><script>" + scriptSource().toLatin1() + "</script><script>" + loader.toLatin1()
+ "</script></head><body></body></html>";
}
// oipf.js, with the TV's state, in each page before its scripts
void DVBDemodHbbTV::updateScript()
{

25
plugins/channelrx/demoddvb/dvbdemodhbbtv.h

@ -22,6 +22,7 @@ @@ -22,6 +22,7 @@
#include <vector>
#include <QElapsedTimer>
#include <QHash>
#include <QJsonObject>
#include <QMap>
#include <QObject>
@ -86,6 +87,9 @@ public: @@ -86,6 +87,9 @@ public:
QWebEnginePage *getPage() { return m_page; }
//! Whether applications may use the internet: if not, only the carousels are loaded from
void setNetworkAllowed(bool allowed);
//! Whether messages like ones logged a short while ago (the application's console's, its carousel's files) are
//! held back: on unless every one's wanted (as by a test)
void setLogLimited(bool limited) { m_logLimited = limited; }
//! The user agent sent, for testing as a particular TV: empty for SDRangel's own. The environment variable
//! DTV_HBBTV_USER_AGENT sets it too
void setUserAgent(const QString& userAgent);
@ -135,6 +139,8 @@ signals: @@ -135,6 +139,8 @@ signals:
void videoAreaChanged(const QRectF& area);
void channelChangeRequested(int networkId, int transportStreamId, int serviceId);
void channelStepRequested(int direction);
//! The application asked for a DRM system's licence, as for protected video (which can't be played): its name
void drmRequested(const QString& system);
void appStarted(const QString& url, const QString& name);
//! The application's media (as iPlayer's video): command load (url, with FFmpeg's options), play, pause, seek
//! (position, seconds) or stop. Media's played by the GUI's player, under the page
@ -159,20 +165,24 @@ private: @@ -159,20 +165,24 @@ private:
void navigate(const QString& url, const QString& name, uint32_t organisationId, int applicationId, bool autostart);
void message(const QJsonObject& message);
void consoleMessage(int level, const QString& message, int line, const QString& source);
void logLimited(const QString& text, const QString& from);
void createApplication(const QString& uri);
void destroyApplication();
void setVisible(bool visible);
void showView();
void loadFinished(bool ok);
void updateScript();
void applyZoom();
QString scriptSource() const;
static QByteArray withScript(const QByteArray& page, const QString& script);
QByteArray loaderPage(const QUrl& url, const QString& charset) const;
void showStatus(); //!< getStatus() in the page, over what the application shows
void updateProxy();
QJsonObject configuration() const;
QJsonObject channelJson(const Channel& channel) const;
QString appUrl(const DTVApps::App& app) const;
void makeTransparent();
void keepTransparent();
void downloadRequested(const QUrl& url, const QString& mimeType);
DTVApps *m_apps;
@ -202,17 +212,32 @@ private: @@ -202,17 +212,32 @@ private:
bool m_suppressed;
int m_keyset;
QRectF m_videoArea;
bool m_retransparent = false; //!< The view's being made transparent again
int m_retransparentCount = 0; //!< Times, for the video's area: not over and over, if the page stays opaque
bool m_pendingRed; //!< Red's to be given to the application started for it, once it asks for it
int m_mediaId; //!< Of the media being played, 0 if none
QElapsedTimer m_userRequest; //!< Since the user last pressed red or gave the application a key
QElapsedTimer m_failed; //!< Since an application last failed to load
QElapsedTimer m_drmRequest; //!< Since the application asked for a DRM licence (protected video)
QString m_drmSystem; //!< Which DRM system's, by name
int m_appCarouselPid; //!< The carousel the running application's loaded from, -1 if none
int m_loadsStarted; //!< Qt 5: page loads started, to tell a failed load from one replaced by another
QElapsedTimer m_loadedAt; //!< Since the running application's page loaded
bool m_keysetSinceLoad; //!< It's set its keyset since: it's ready
QString m_pageStatus; //!< Status last shown in the page
struct Repeated
{
qint64 m_loggedAt; //!< ms since epoch
int m_held; //!< Not logged since
};
QHash<QString, Repeated> m_repeated; //!< Messages logged, by their shape (their numbers aside) and where from
bool m_logLimited = true;
QElapsedTimer m_redDelivered; //!< Since red was last given to the application
QElapsedTimer m_pendingRedTimer;
int m_viewWidth = 0;
int m_layoutWidth = m_defaultLayoutWidth; //!< Pixels the application's laid out for: 1280, or 1920 for some
static constexpr int m_defaultLayoutWidth = 1280;
};
#endif // INCLUDE_DVBDEMODHBBTV_H

488
plugins/channelrx/demoddvb/hbbtv/oipf.js

@ -12,6 +12,141 @@ @@ -12,6 +12,141 @@
}
var config = window.__sdrangelHbbTVConfig || {};
// The console's own log, for messages to SDRangel and its log: an application may replace it (as BBC's do, with one
// that does nothing), which would cut SDRangel off from the page. Taken before the application's scripts run
var consoleLog = console.log.bind(console);
// A page whose root (html) has an opaque background when it's loaded is drawn opaque from then on (Qt WebEngine
// keeps that colour behind it): the video under it, though the application later makes the root transparent (or
// it's cleared over the video), stays hidden. Its root's held transparent until a while after it's loaded, and its
// body's (which is the root's when the root has none). A constructed sheet, as there's no element yet to put a
// style in
if ((window.top === window) && document.adoptedStyleSheets && window.CSSStyleSheet) {
try {
var rootHeld = new CSSStyleSheet();
rootHeld.replaceSync('html, body { background-color: transparent !important; }');
document.adoptedStyleSheets = document.adoptedStyleSheets.concat([rootHeld]);
window.addEventListener('load', function () {
setTimeout(function () {
document.adoptedStyleSheets = document.adoptedStyleSheets.filter(function (s) { return s !== rootHeld; });
}, 500);
});
} catch (e) {
consoleLog('[sdrangel] root not held transparent: ' + e);
}
}
// For SDRangel's log, as applications' own errors seldom say what failed: requests that fail (4xx, 5xx), with what
// the server said, and objects logged as errors written out (else "[object Object]")
function describeValue(value) {
if (!value || (typeof value !== 'object')) {
return String(value);
}
var parts = [];
if (value instanceof Error) {
parts.push(value.name + ': ' + value.message);
}
// As an axios error's: its code, the response's status, and the request
['code', 'status'].forEach(function (key) {
if ((value[key] !== undefined) && (typeof value[key] !== 'object')) {
parts.push(key + ' ' + value[key]);
}
});
if (value.response && (value.response.status !== undefined)) {
parts.push('response ' + value.response.status);
}
if (value.config && value.config.url) {
parts.push((value.config.method || '').toUpperCase() + ' ' + value.config.url);
}
if (!parts.length) {
try {
parts.push(JSON.stringify(value).slice(0, 300));
} catch (e) {
parts.push(Object.prototype.toString.call(value));
}
}
return parts.join(', ');
}
['error', 'warn'].forEach(function (level) {
var original = console[level];
console[level] = function () {
// As it was if it can't be described (as an object whose properties throw, or another origin's window):
// the application's own logging mustn't fail
var args = Array.prototype.map.call(arguments, function (a) {
if (!a || (typeof a !== 'object')) {
return a;
}
try {
return describeValue(a);
} catch (e) {
return a;
}
});
return original.apply(console, args);
};
});
function logFailedRequest(request, status, body) {
consoleLog('[sdrangel] request failed: ' + request + ': ' + status + (body ? ': ' + String(body).replace(/\s+/g, ' ').slice(0, 300) : ''));
}
var loggedXhrOpen = XMLHttpRequest.prototype.open;
var loggedXhrSend = XMLHttpRequest.prototype.send;
XMLHttpRequest.prototype.open = function (method, url) {
this.__sdrangelRequest = String(method).toUpperCase() + ' ' + String(url);
return loggedXhrOpen.apply(this, arguments);
};
XMLHttpRequest.prototype.send = function () {
var xhr = this;
xhr.addEventListener('loadend', function () {
if (xhr.status >= 400) {
var body = '';
try {
body = ((xhr.responseType === '') || (xhr.responseType === 'text')) ? xhr.responseText
: (xhr.responseType === 'json') ? JSON.stringify(xhr.response) : '';
} catch (e) {
body = '';
}
logFailedRequest(xhr.__sdrangelRequest, xhr.status, body);
}
});
return loggedXhrSend.apply(this, arguments);
};
if (window.fetch) {
var loggedFetch = window.fetch;
window.fetch = function (input, init) {
var request = ((init && init.method) || (input && input.method) || 'GET').toUpperCase() + ' ' + (input && input.url ? input.url : String(input));
return loggedFetch.apply(this, arguments).then(function (response) {
if (response.status >= 400) {
response.clone().text().then(function (body) { logFailedRequest(request, response.status, body); }, function () {
logFailedRequest(request, response.status, '');
});
}
return response;
});
};
}
var keysetValue = 0;
var ownerApplication = null;
var videoObjects = []; // video/broadcast objects bound to the service, or with a channel set
@ -19,7 +154,16 @@ @@ -19,7 +154,16 @@
var lastVideo = '';
function send(message) {
console.log('\u0001sdrangel:' + JSON.stringify(message));
consoleLog('\u0001sdrangel:' + JSON.stringify(message));
}
// The application closing its window (as BBC iPlayer exits, on devices it takes for older ones): on a TV that ends
// it, as destroyApplication() does. A browser won't close a window a script didn't open
if (window.top === window) {
window.close = function () {
consoleLog('[sdrangel] window.close(): the application destroyed');
send({ t: 'destroy' });
};
}
// Keys (OIPF DAE 7.2.5.2, TS 102 796 Annex A)
@ -351,6 +495,8 @@ @@ -351,6 +495,8 @@
}
};
var nextDrmMessage = 1;
var applicationManager = {
getOwnerApplication: function (doc) { return application(); },
getChildApplications: function () { return []; },
@ -371,8 +517,29 @@ @@ -371,8 +517,29 @@
},
'video/broadcast': videoBroadcast,
'application/oipfdrmagent': {
sendDRMMessage: function () { return ''; },
DRMSystemStatus: function () { return 1; }
// There's no DRM system (as PlayReady, an application asking for a licence for its protected video): its
// messages answered so (OIPF DAE 7.6.1.1, result 5, unknown DRM system), else it waits for ever. And
// SDRangel told, to say why the video won't play
sendDRMMessage: function (msgType, msg, DRMSystemID) {
var agent = this;
var msgID = 'sdrangel-drm-' + (nextDrmMessage++);
send({ t: 'drm', system: String(DRMSystemID || ''), type: String(msgType || '') });
setTimeout(function () {
if (typeof agent.onDRMMessageResult === 'function') {
agent.onDRMMessageResult(msgID, '', 5);
}
var event = new Event('DRMMessageResult');
event.msgID = msgID;
event.resultMsg = '';
event.resultCode = 5;
agent.dispatchEvent(event);
}, 0);
return msgID;
},
DRMSystemStatus: function () { return 1; } // DRM_UNKNOWN
},
'application/oipfparentalcontrolmanager': {
parentalRatingSchemes: [],
@ -469,6 +636,12 @@ @@ -469,6 +636,12 @@
// Where the video's shown: in the bound video/broadcast object, as fractions of the page (1280 by 720 pixels), or
// full screen if there's none, or it's set to full screen
function reportVideo() {
// The application's page's: not a frame's in it (as an advertising SDK's), which would say the video's full
// screen, and its layout's width, in place of the page's
if (window.top !== window) {
return;
}
var message = { t: 'video', full: true };
var width = window.innerWidth || 1280, height = window.innerHeight || 720;
@ -485,21 +658,301 @@ @@ -485,21 +658,301 @@
var style = window.getComputedStyle(object);
var rect = object.getBoundingClientRect();
// Which it is, for the log
var what = object.tagName.toLowerCase() + (object.id ? '#' + object.id : '') + (object.type ? ' ' + object.type : '');
if ((style.display === 'none') || (style.visibility === 'hidden') || (rect.width <= 0) || (rect.height <= 0)) {
message = { t: 'video', full: false, hidden: true };
message = { t: 'video', full: false, hidden: true, what: what };
continue;
}
message = { t: 'video', full: false, x: rect.left / width, y: rect.top / height, w: rect.width / width, h: rect.height / height };
message = { t: 'video', full: false, x: rect.left / width, y: rect.top / height, w: rect.width / width, h: rect.height / height, what: what };
punch(object, rect);
break;
}
if (message.full || message.hidden) {
unpunch();
}
var text = JSON.stringify(message);
if (text !== lastVideo) {
lastVideo = text;
send(message);
}
reportLayout();
}
// The width the page is laid out for: an application made for 1920 by 1080 (its html or body that wide) is zoomed
// to fit, as a TV with a 1920 by 1080 browser would show it, rather than shown in part
var lastLayout = '';
function reportLayout() {
var layoutWidth = 0;
[document.documentElement, document.body].forEach(function (element) {
if (element) {
layoutWidth = Math.max(layoutWidth, parseFloat(window.getComputedStyle(element).width) || 0);
}
});
layoutWidth = Math.round(layoutWidth);
// With the viewport's width: what it was laid out in (while the view's resized, it's briefly not the width
// it's zoomed to, which an application choosing its layout by media queries may follow)
var key = layoutWidth + ',' + window.innerWidth;
if (layoutWidth && (key !== lastLayout)) {
lastLayout = key;
send({ t: 'layout', w: layoutWidth, vw: window.innerWidth });
}
}
// SDRangel draws the video under the page. On a TV it's shown over what's under its element in the page (it's drawn
// in the element, or through a hole punched in the graphics to the video plane), so what's under it here mustn't
// hide it: its own background, its ancestors' (as an opaque page's, cleared where it is, their colour drawn around
// it), and other elements drawn under it (as an application's own player, loading, under an advert's video):
// hidden if they're within it, else their backgrounds cleared where it is. Until it's no longer shown
var punchProperties = ['background-color', 'background-image', 'background-position', 'background-size', 'background-repeat',
'background-origin', 'background-clip', 'visibility'];
var punched = []; // Each element changed, with its own style's values before
var punchKey = '';
var punchObject = null;
var punchRect = null;
var punchColors = []; // Each ancestor left as it was, with its colour then: done again if one changes
function unpunch() {
punched.forEach(function (p) {
punchProperties.forEach(function (name) {
p.element.style.setProperty(name, p.saved[name].value, p.saved[name].priority);
});
});
punched = [];
punchKey = '';
punchObject = null;
punchRect = null;
punchColors = [];
}
function isTransparent(color) {
return (color === 'transparent') || /rgba\(.*,\s*0\)$/.test(color);
}
function isPunched(element) {
return punched.some(function (p) { return p.element === element; });
}
// Its style saved, to be put back
function save(element) {
var saved = {};
punchProperties.forEach(function (name) {
saved[name] = { value: element.style.getPropertyValue(name), priority: element.style.getPropertyPriority(name) };
});
punched.push({ element: element, saved: saved });
}
// Where an element's background's drawn: its border box, but the whole page for the root's (and the body's, when
// it's given to the root, as the root has none), from the root's box (CSS 2 14.2)
function backgroundBox(element) {
var root = document.documentElement;
var rootStyle = window.getComputedStyle(root);
var canvas = (element === root) || ((element === document.body) && isTransparent(rootStyle.backgroundColor)
&& (rootStyle.backgroundImage === 'none'));
if (!canvas) {
return element.getBoundingClientRect();
}
var r = root.getBoundingClientRect();
return { left: r.left, top: r.top, width: Math.max(r.width, root.scrollWidth, window.innerWidth),
height: Math.max(r.height, root.scrollHeight, window.innerHeight) };
}
// An element's background cleared where the video is, its colour drawn around it. False if it has none to clear
// (transparent), or can't be (an image the video doesn't cover)
function cutBackground(element, rect) {
var style = window.getComputedStyle(element);
var color = style.backgroundColor;
var box = backgroundBox(element);
// The hole, in the element's background's box
var x0 = Math.max(0, rect.left - box.left), y0 = Math.max(0, rect.top - box.top);
var x1 = Math.min(box.width, rect.right - box.left), y1 = Math.min(box.height, rect.bottom - box.top);
var covers = (x0 <= 0) && (y0 <= 0) && (x1 >= box.width) && (y1 >= box.height);
if ((isTransparent(color) && (style.backgroundImage === 'none')) || ((style.backgroundImage !== 'none') && !covers)
|| (x1 <= x0) || (y1 <= y0)) {
return false;
}
save(element);
var images = [], positions = [], sizes = [];
var piece = function (x, y, w, h) {
if ((w > 0) && (h > 0) && !isTransparent(color)) {
images.push('linear-gradient(' + color + ', ' + color + ')');
positions.push(x + 'px ' + y + 'px');
sizes.push(w + 'px ' + h + 'px');
}
};
piece(0, 0, box.width, y0); // Above
piece(0, y1, box.width, box.height - y1); // Below
piece(0, y0, x0, y1 - y0); // Left
piece(x1, y0, box.width - x1, y1 - y0); // Right
element.style.setProperty('background-color', 'transparent', 'important');
element.style.setProperty('background-image', images.length ? images.join(', ') : 'none', 'important');
element.style.setProperty('background-position', positions.length ? positions.join(', ') : '0 0', 'important');
element.style.setProperty('background-size', sizes.length ? sizes.join(', ') : 'auto', 'important');
element.style.setProperty('background-repeat', 'no-repeat', 'important');
element.style.setProperty('background-origin', 'border-box', 'important');
element.style.setProperty('background-clip', 'border-box', 'important');
return true;
}
// Elements drawn under the video, other than its ancestors: what's at points across it, after it (in the order
// they're drawn, top first), all hit for the while (as an advertising SDK's video, and overlays, ignore the
// pointer). Hidden if they're within it, else their backgrounds cut. Only added to, while the same video's
// shown: once hidden they aren't hit
var lastBeneath = 0;
// An element, for the log: tag, id, classes, its box and background
function describe(element) {
var style = window.getComputedStyle(element);
var r = element.getBoundingClientRect();
var name = element.tagName.toLowerCase() + (element.id ? '#' + element.id : '')
+ ((typeof element.className === 'string') && element.className.trim() ? '.' + element.className.trim().split(/\s+/).slice(0, 2).join('.') : '');
return name + ' [' + Math.round(r.left) + ',' + Math.round(r.top) + ' ' + Math.round(r.width) + 'x' + Math.round(r.height) + ']'
+ (isTransparent(style.backgroundColor) ? '' : ' bg ' + style.backgroundColor)
+ (style.backgroundImage !== 'none' ? ' image' : '') + (style.visibility === 'hidden' ? ' hidden' : '')
+ ((style.opacity !== '1') ? ' opacity ' + style.opacity : '');
}
var lastAboveLog = '';
function punchBeneath(object, rect) {
lastBeneath = Date.now();
var hitAll = document.createElement('style');
hitAll.textContent = '*, *::before, *::after { pointer-events: auto !important; }';
(document.head || document.documentElement).appendChild(hitAll);
var beneath = [];
var above = [];
for (var fy = 0.1; fy < 1; fy += 0.2) {
for (var fx = 0.1; fx < 1; fx += 0.2) {
var list = document.elementsFromPoint(rect.left + fx * rect.width, rect.top + fy * rect.height);
var at = list.indexOf(object);
for (var j = 0; j < at; j++) {
if ((above.indexOf(list[j]) < 0)) {
above.push(list[j]);
}
}
for (var i = at + 1; (at >= 0) && (i < list.length); i++) {
if (!list[i].contains(object) && (beneath.indexOf(list[i]) < 0)) {
beneath.push(list[i]);
}
}
}
}
hitAll.remove();
var changed = [];
beneath.forEach(function (element) {
if (isPunched(element)) {
return;
}
var r = element.getBoundingClientRect();
var within = (r.left >= rect.left - 2) && (r.top >= rect.top - 2) && (r.right <= rect.right + 2) && (r.bottom <= rect.bottom + 2);
if (within) {
changed.push('hid ' + describe(element));
save(element);
element.style.setProperty('visibility', 'hidden', 'important');
} else if (cutBackground(element, rect)) {
changed.push('cut ' + describe(element));
}
});
if (changed.length) {
consoleLog('[sdrangel] under the video: ' + changed.join('; '));
}
// What's over it, that could hide it: logged when that changes
var over = above.filter(function (element) {
var style = window.getComputedStyle(element);
return (style.visibility !== 'hidden') && (!isTransparent(style.backgroundColor) || (style.backgroundImage !== 'none')
|| /^(CANVAS|IMG|VIDEO|IFRAME|OBJECT|EMBED)$/.test(element.tagName));
}).map(describe).join('; ');
if (over !== lastAboveLog) {
lastAboveLog = over;
consoleLog('[sdrangel] over the video: ' + (over || 'nothing drawn'));
}
// What's drawn over the video (as an advert's countdown) kept, though it's in an element hidden as under it
above.forEach(function (element) {
var inHidden = punched.some(function (p) {
return (p.element !== element) && p.element.contains(element) && (p.element.style.getPropertyValue('visibility') === 'hidden');
});
if (inHidden && !isPunched(element)) {
save(element);
element.style.setProperty('visibility', 'visible', 'important');
}
});
}
function punch(object, rect) {
var key = [Math.round(rect.left), Math.round(rect.top), Math.round(rect.width), Math.round(rect.height)].join(',');
if ((key === punchKey) && (object === punchObject) && punchColors.every(function (c) {
return window.getComputedStyle(c.element).backgroundColor === c.color;
})) {
// As what's under it may have been added: now and then, as styling every element to find it is slow
if ((object instanceof HTMLMediaElement) && (Date.now() - lastBeneath > 2000)) {
punchBeneath(object, rect);
}
return;
}
unpunch();
punchKey = key;
punchObject = object;
punchRect = rect;
// The element itself: on a TV the video's drawn in it, hiding its background, which here would hide the video
// under the page (as an advertising SDK's video element, black)
var ownStyle = window.getComputedStyle(object);
if (!isTransparent(ownStyle.backgroundColor) || (ownStyle.backgroundImage !== 'none')) {
save(object);
object.style.setProperty('background-color', 'transparent', 'important');
object.style.setProperty('background-image', 'none', 'important');
}
for (var element = object.parentElement; element; element = element.parentElement) {
if (!cutBackground(element, rect)) {
punchColors.push({ element: element, color: window.getComputedStyle(element).backgroundColor });
}
}
consoleLog('[sdrangel] video ' + describe(object) + ' in ' + window.innerWidth + 'x' + window.innerHeight + ': '
+ (punched.length ? 'backgrounds cleared: ' + punched.map(function (p) { return describe(p.element); }).join('; ') : 'nothing to clear')
+ '; html ' + window.getComputedStyle(document.documentElement).backgroundColor
+ ', body ' + (document.body ? window.getComputedStyle(document.body).backgroundColor : 'none'));
lastAboveLog = '';
// Media SDRangel plays for the application (as an advert, over its own player): not a video/broadcast object,
// which applications put over their pages, to say where the broadcast's shown
if (object instanceof HTMLMediaElement) {
punchBeneath(object, rect);
}
}
setInterval(reportVideo, 250);
@ -615,6 +1068,19 @@ @@ -615,6 +1068,19 @@
m.ended = false;
fireMedia(element, 'seeking');
send({ t: 'media', cmd: 'seek', id: m.id, position: value });
// Playing, it's done when SDRangel's playing from there. Paused (as an application's seek bar pauses while
// it's moved), there's nothing to wait for: SDRangel goes on from there when it's played. An application
// waiting for it to be done (as TVP VOD's player, which won't seek again until it is) would wait for ever
if (m.paused) {
setTimeout(function () {
if (m.seeking && m.paused) {
m.seeking = false;
fireMedia(element, 'timeupdate');
fireMedia(element, 'seeked');
}
}, 0);
}
});
define('duration', function () { return m.duration; });
define('paused', function () { return m.paused; });
@ -719,7 +1185,7 @@ @@ -719,7 +1185,7 @@
}
var m = mediaState.get(element) || makeProxy(element);
console.log('[sdrangel] media ' + m.id + ': ' + url);
consoleLog('[sdrangel] media ' + m.id + ': ' + url);
m.url = url;
m.paused = true;
m.ended = false;
@ -790,7 +1256,7 @@ @@ -790,7 +1256,7 @@
var t = String(type).toLowerCase();
var result = /application\/dash\+xml|mpegurl|video\/mp4|audio\/mp4|video\/mp2t|audio\/mpeg|audio\/aac/.test(t) ? 'probably'
: canPlayType.call(this, type);
console.log('[sdrangel] canPlayType ' + type + ' "' + result + '"');
consoleLog('[sdrangel] canPlayType ' + type + ' "' + result + '"');
return result;
};
@ -859,15 +1325,15 @@ @@ -859,15 +1325,15 @@
if (window.MediaSource) {
var addSourceBuffer = MediaSource.prototype.addSourceBuffer;
MediaSource.prototype.addSourceBuffer = function (type) {
console.log('[sdrangel] MSE addSourceBuffer ' + type);
consoleLog('[sdrangel] MSE addSourceBuffer ' + type);
return addSourceBuffer.apply(this, arguments);
};
}
// Dialogs would block the application
window.alert = function (text) { console.log('alert: ' + text); };
window.confirm = function (text) { console.log('confirm: ' + text); return false; };
window.prompt = function (text) { console.log('prompt: ' + text); return null; };
window.alert = function (text) { consoleLog('alert: ' + text); };
window.confirm = function (text) { consoleLog('confirm: ' + text); return false; };
window.prompt = function (text) { consoleLog('prompt: ' + text); return null; };
// SDRangel's status (as the red button loading), over everything the application shows
var statusElement = null;

BIN
plugins/channelrx/demoddvb/icons/blue.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 616 B

BIN
plugins/channelrx/demoddvb/icons/green.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 688 B

BIN
plugins/channelrx/demoddvb/icons/red.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 636 B

BIN
plugins/channelrx/demoddvb/icons/runapps.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 430 B

BIN
plugins/channelrx/demoddvb/icons/yellow.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 609 B

7
plugins/channelrx/demoddvb/readme.md

@ -463,11 +463,14 @@ The Apps button opens a list of the interactive (red button) applications: @@ -463,11 +463,14 @@ The Apps button opens a list of the interactive (red button) applications:
the transport stream, and how much of each has been received. A large carousel takes a minute or so, and is
received again as the broadcaster updates it.
Right click the Apps button to run the HbbTV applications.
The switch beside it (a play symbol in a screen) runs the HbbTV applications.
Keys for the red, green, yellow and blue buttons are R, G, Y and B (or F1 to F4), Back is Backspace, and the arrows, Enter and digits are themselves.
The red button shows while the service has an application to run; it and the green, yellow and blue buttons correspond
to those buttons on a TV remote control. You can also use the keys R, G, Y and B (or F1 to F4). Back is the Backspace kay.
Use the arrows keys to navigate, and press Enter for OK.
Some broadcasters (such as the BBC) only serve their online applications to TVs they've certified, so videos may not play.
Other videos requiring DRM will also not play.
<h4>Scan</h4>

17
sdrgui/dtv/dtvstreamplayback.cpp

@ -64,6 +64,7 @@ void DTVStreamPlayback::load(const QString& url, const QMap<QString, QString>& o @@ -64,6 +64,7 @@ void DTVStreamPlayback::load(const QString& url, const QMap<QString, QString>& o
m_options = options;
m_position = 0.0;
m_duration = std::nan("");
m_urlResolved = false;
startRemuxer(0.0);
m_timer.start(m_checkMs);
}
@ -78,6 +79,8 @@ void DTVStreamPlayback::play() @@ -78,6 +79,8 @@ void DTVStreamPlayback::play()
if (!m_remuxer) {
startRemuxer(m_position);
} else {
m_remuxer->setPlaying(true);
}
startPlayer();
@ -134,6 +137,11 @@ double DTVStreamPlayback::getPosition() const @@ -134,6 +137,11 @@ double DTVStreamPlayback::getPosition() const
return m_position;
}
int DTVStreamPlayback::getBuffered()
{
return m_fifo->fill();
}
double DTVStreamPlayback::getDuration() const
{
return m_duration;
@ -151,6 +159,14 @@ void DTVStreamPlayback::startRemuxer(double position) @@ -151,6 +159,14 @@ void DTVStreamPlayback::startRemuxer(double position)
m_fifo->reset();
m_remuxer = new DTVStreamRemuxer(m_fifo.get(), m_url, m_options, position, this);
DTVStreamRemuxer *remuxer = m_remuxer;
m_remuxer->setPlaying(m_playing);
// Its redirect found once: the URL it gives used after (as when it's paused or seeks)
m_remuxer->setResolveRedirects(!m_urlResolved);
connect(m_remuxer, &DTVStreamRemuxer::resolved, this, [this, remuxer](const QString& url) {
if (remuxer == m_remuxer) {
m_url = url;
}
}, Qt::QueuedConnection);
connect(m_remuxer, &DTVStreamRemuxer::opened, this, [this, remuxer](double duration, int width, int height) {
if (remuxer != m_remuxer) {
@ -159,6 +175,7 @@ void DTVStreamPlayback::startRemuxer(double position) @@ -159,6 +175,7 @@ void DTVStreamPlayback::startRemuxer(double position)
const bool first = std::isnan(m_duration);
m_duration = duration;
m_urlResolved = true;
if (first) {
emit metadata(duration, width, height);

2
sdrgui/dtv/dtvstreamplayback.h

@ -62,6 +62,7 @@ public: @@ -62,6 +62,7 @@ public:
double getDuration() const; //!< NaN until known, infinite if live
void setAudioOutput(int sampleRate, double latency);
DTVVideoPlayer *getPlayer() { return m_player; }
int getBuffered(); //!< Bytes of the stream written, not yet read by the player
signals:
void metadata(double duration, int width, int height);
@ -87,6 +88,7 @@ private: @@ -87,6 +88,7 @@ private:
std::unique_ptr<DTVTSFifo> m_fifo;
DTVStreamRemuxer *m_remuxer;
DTVVideoPlayer *m_player;
bool m_urlResolved = false; //!< m_url's the one its redirect gave (or it doesn't redirect)
std::atomic<double> m_frameTime; //!< Timestamp of the last picture shown, NaN if none yet
std::atomic<qint64> m_frameAt; //!< When, ms since epoch
std::atomic<bool> m_playingSignalled;

191
sdrgui/dtv/dtvstreamremuxer.cpp

@ -17,22 +17,41 @@ @@ -17,22 +17,41 @@
///////////////////////////////////////////////////////////////////////////////////
#include <algorithm>
#include <chrono>
#include <cmath>
#include <condition_variable>
#include <deque>
#include <iterator>
#include <limits>
#include <mutex>
#include <thread>
extern "C" {
#include <libavformat/avformat.h>
#include <libavutil/opt.h>
}
#include <QElapsedTimer>
#include "dtv/dtvtsfifo.h"
#include "dtv/dtvstreamremuxer.h"
namespace {
constexpr int m_fifoHigh = 3 * 1024 * 1024; //!< Bytes in the FIFO above which writing waits
// Seconds ahead of real time packets are written: the player decodes what it's given straight away (as a broadcast
// comes in real time), and keeps its audio FIFO (a second) to 3/4 full by dropping the oldest, so a stream given faster
// than it's played sounds too fast, and the video, timed by the audio, runs ahead. Enough for the decoders' delays
constexpr double m_lead = 0.3;
constexpr int m_ioBufferSize = 188 * 512;
// Read ahead of what's written, by another thread: reading waits while a segment's fetched (as FFmpeg's DASH and HLS
// demuxers do), which would otherwise hold up what's due, as the player plays it (video late, then audio dropped as
// what was held up comes all at once)
constexpr double m_readAhead = 10.0; //!< Seconds of the stream read ahead, at most
constexpr size_t m_readAheadBytes = 64 * 1024 * 1024; //!< And bytes
// What's written late by more than this (the stream's fetched more slowly than it's played, for longer than what's
// read ahead) is played on from then, rather than what's held up written all at once
constexpr double m_resync = 1.0;
QString errorText(int error)
{
@ -41,6 +60,36 @@ QString errorText(int error) @@ -41,6 +60,36 @@ QString errorText(int error)
return QString::fromUtf8(text);
}
// The URL an HTTP one's redirected to, as FFmpeg's asked for it (its options given): else as it is. A DASH manifest's
// segments are found relative to where it is, which FFmpeg's demuxer takes to be the URL it's given, not where that
// redirects to: as TVP's, a token's URL redirected to a cache, whose segments from the first host fail (412)
QString redirected(const QString& url, const AVDictionary *options, AVIOInterruptCB *interrupt)
{
if (!url.startsWith("http:", Qt::CaseInsensitive) && !url.startsWith("https:", Qt::CaseInsensitive)) {
return url;
}
AVDictionary *copy = nullptr;
av_dict_copy(&copy, options, 0);
AVIOContext *io = nullptr;
QString result = url;
if (avio_open2(&io, url.toUtf8().constData(), AVIO_FLAG_READ, interrupt, &copy) >= 0)
{
uint8_t *location = nullptr;
if ((av_opt_get(io, "location", AV_OPT_SEARCH_CHILDREN, &location) >= 0) && location && *location) {
result = QString::fromUtf8((const char *) location);
}
av_free(location);
avio_closep(&io);
}
av_dict_free(&copy);
return result;
}
} // namespace
DTVStreamRemuxer::DTVStreamRemuxer(DTVTSFifo *fifo, const QString& url, const QMap<QString, QString>& options, double start, QObject *parent) :
@ -104,7 +153,15 @@ void DTVStreamRemuxer::run() @@ -104,7 +153,15 @@ void DTVStreamRemuxer::run()
}
av_dict_set(&options, "reconnect", "1", 0);
int ret = avformat_open_input(&in, m_url.toUtf8().constData(), nullptr, &options);
const QString url = m_resolveRedirects ? redirected(m_url, options, &in->interrupt_callback) : m_url;
if (url != m_url)
{
qDebug("DTVStreamRemuxer::run: %s redirected to %s", qPrintable(m_url.left(80)), qPrintable(url.left(120)));
emit resolved(url);
}
int ret = avformat_open_input(&in, url.toUtf8().constData(), nullptr, &options);
av_dict_free(&options);
if (ret < 0)
@ -214,29 +271,115 @@ void DTVStreamRemuxer::run() @@ -214,29 +271,115 @@ void DTVStreamRemuxer::run()
}
else
{
int64_t base = AV_NOPTS_VALUE; // The first packet's time (in AV_TIME_BASE)
// Packets read ahead, with their times (seconds, in the stream), and how much
std::mutex mutex;
std::condition_variable changed;
std::deque<std::pair<AVPacket *, double>> queue;
size_t queuedBytes = 0;
double lastWritten = -1e9; // Time of the last packet written
bool readDone = false; // The end of the stream (or an error) read
bool endOfStream = false; // The end of the stream
std::thread reader([&]() {
AVPacket *read = av_packet_alloc();
while (!m_stop)
{
ret = av_read_frame(in, packet);
if (ret < 0)
{
if (ret != AVERROR_EXIT) {
m_finished = true;
std::unique_lock<std::mutex> lock(mutex);
changed.wait(lock, [&]() {
return m_stop || queue.empty()
|| ((queuedBytes < m_readAheadBytes) && (queue.back().second - lastWritten < m_readAhead));
});
}
if (m_stop) {
break;
}
const int s = packet->stream_index;
const int result = av_read_frame(in, read);
if (result < 0)
{
std::lock_guard<std::mutex> lock(mutex);
endOfStream = result != AVERROR_EXIT;
break;
}
const int s = read->stream_index;
if ((s < 0) || (s >= 64) || (outIndex[s] < 0) || ((packet->dts == AV_NOPTS_VALUE) && (packet->pts == AV_NOPTS_VALUE)))
if ((s < 0) || (s >= 64) || (outIndex[s] < 0) || ((read->dts == AV_NOPTS_VALUE) && (read->pts == AV_NOPTS_VALUE)))
{
av_packet_unref(packet);
av_packet_unref(read);
continue;
}
const int64_t first = read->dts != AV_NOPTS_VALUE ? read->dts : read->pts;
const double time = av_rescale_q(first, in->streams[s]->time_base, AVRational{1, AV_TIME_BASE}) / (double) AV_TIME_BASE;
std::lock_guard<std::mutex> lock(mutex);
queuedBytes += read->size;
queue.emplace_back(av_packet_clone(read), time);
av_packet_unref(read);
changed.notify_all();
}
av_packet_free(&read);
std::lock_guard<std::mutex> lock(mutex);
readDone = true;
changed.notify_all();
});
int64_t base = AV_NOPTS_VALUE; // The first packet's time (in AV_TIME_BASE)
// Seconds it's been played since its first packet was written: standing still while it isn't played
QElapsedTimer clock;
bool clockRunning = false;
double played = 0.0; // Before the clock was last stopped
auto now = [&]() {
const bool playing = m_playing;
if (playing && !clockRunning)
{
clock.start();
clockRunning = true;
}
else if (!playing && clockRunning)
{
played += clock.nsecsElapsed() * 1e-9;
clockRunning = false;
}
return played + (clockRunning ? clock.nsecsElapsed() * 1e-9 : 0.0);
};
double slip = 0.0; // Seconds it's been held up for, beyond what was read ahead
while (!m_stop)
{
AVPacket *next = nullptr;
{
std::unique_lock<std::mutex> lock(mutex);
while (!m_stop && queue.empty() && !readDone) {
changed.wait_for(lock, std::chrono::milliseconds(20));
}
if (m_stop || queue.empty())
{
// All of it written
m_finished = !m_stop && endOfStream;
break;
}
next = queue.front().first;
queuedBytes -= next->size;
lastWritten = queue.front().second;
queue.pop_front();
changed.notify_all();
}
av_packet_free(&packet);
packet = next;
const int s = packet->stream_index;
const AVRational inBase = in->streams[s]->time_base;
const int64_t first = packet->dts != AV_NOPTS_VALUE ? packet->dts : packet->pts;
@ -249,6 +392,21 @@ void DTVStreamRemuxer::run() @@ -249,6 +392,21 @@ void DTVStreamRemuxer::run()
base / (double) AV_TIME_BASE, packet->pts != AV_NOPTS_VALUE ? packet->pts * av_q2d(inBase) : -1.0);
}
// Played in real time: a packet's written no sooner than its time, less the lead
double due = (av_rescale_q(first, inBase, AVRational{1, AV_TIME_BASE}) - base) / (double) AV_TIME_BASE - m_lead + slip;
const double late = now() - due;
if (late > m_resync)
{
qDebug("DTVStreamRemuxer::run: %.1f s late (the stream's fetched more slowly than it's played): played on from now", late);
slip += late;
due += late;
}
while (!m_stop && (now() < due)) {
msleep((unsigned long) std::max(1.0, std::min(20.0, (due - now()) * 1000.0)));
}
// Rebased, to start at m_timestampStart
const int64_t shift = av_rescale_q((int64_t) (m_timestampStart * AV_TIME_BASE) - base, AVRational{1, AV_TIME_BASE}, inBase);
@ -271,6 +429,19 @@ void DTVStreamRemuxer::run() @@ -271,6 +429,19 @@ void DTVStreamRemuxer::run()
}
}
// The reader stopped (the loop only ends early when it's stopped, which interrupts its reading), and what it
// read and wasn't written freed
{
std::lock_guard<std::mutex> lock(mutex);
changed.notify_all();
}
reader.join();
for (auto& queued : queue) {
av_packet_free(&queued.first);
}
if (!m_stop) {
av_write_trailer(out);
}

9
sdrgui/dtv/dtvstreamremuxer.h

@ -47,11 +47,18 @@ public: @@ -47,11 +47,18 @@ public:
double getDuration() const { return m_duration; } //!< Seconds, NaN until known, infinite if live
double getTimestampOffset() const { return m_offset; } //!< NaN until the first packet's written
bool isFinished() const { return m_finished; } //!< The end of the stream written
//! Whether it's played. Until it is (loaded before it's played, or paused), only what's due as it starts is
//! written, so it's not given all at once when it's played; and its time stands still while it isn't
void setPlaying(bool playing) { m_playing = playing; }
//! Whether the URL's redirect's found first (before it's started): not if it's the URL a redirect gave
void setResolveRedirects(bool resolve) { m_resolveRedirects = resolve; }
static constexpr double m_timestampStart = 1.0;
signals:
void opened(double duration, int width, int height);
//! The URL the given one redirects to
void resolved(const QString& url);
void failed(const QString& error);
protected:
@ -69,6 +76,8 @@ private: @@ -69,6 +76,8 @@ private:
std::atomic<double> m_duration;
std::atomic<double> m_offset;
std::atomic<bool> m_finished;
std::atomic<bool> m_playing{false};
bool m_resolveRedirects = true;
};
#endif // INCLUDE_DTVSTREAMREMUXER_H

Loading…
Cancel
Save