20#include "libmythbase/mythconfig.h"
45#include "libavutil/imgutils.h"
80 : m_parent(parent), m_dsmcc(new
Dsmcc()),
101 QString fullnameA =
GetConfDir() +
"/" + name;
102 QByteArray fnameA = fullnameA.toLatin1();
108 QByteArray fnameB = fullnameB.toLatin1();
113 QString fullnameC =
GetShareDir() +
"themes/" + name;
114 QByteArray fnameC = fullnameC.toLatin1();
119 const QString& fullnameD = name;
120 QByteArray fnameD = fullnameD.toLatin1();
125 LOG(VB_GENERAL, LOG_ERR, QString(
"[mhi] Unable to find font: %1").arg(name));
179 LOG(VB_MHEG, LOG_INFO,
180 QString(
"[mhi] Restart ch=%1 source=%2 live=%3 tuneinfo=0x%4")
181 .arg(chanid).arg(sourceid).arg(isLive).arg(tuneinfo,0,16));
248 std::chrono::milliseconds toWait = 0ms;
269 toWait = (toWait > 1s || toWait <= 0ms) ? 1s : toWait;
271 if (!
m_stop && (toWait > 0ms))
298 unsigned char *data,
int length,
int componentTag,
299 unsigned carouselId,
int dataBroadcastId)
305 dsmcc =
new DSMCCPacket(data, length, componentTag,
306 carouselId, dataBroadcastId);
308 catch (
const std::bad_alloc& e)
326 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] SetNetBootInfo version %1 mode %2 len %3")
327 .arg(data[0]).arg(data[1]).arg(length));
366 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Unknown NetworkBoot type %1")
376 if (objectPath.startsWith(
"http:") || objectPath.startsWith(
"https:"))
387 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
396 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
410 LOG(VB_MHEG, LOG_INFO, QString(
411 "[mhi] CheckAccess(%1) No auth.servers").arg(objectPath) );
415 QByteArray host = QUrl(objectPath).host().toLocal8Bit();
416 if (!servers.contains(host))
418 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] CheckAccess(%1) Host not known")
420 LOG(VB_MHEG, LOG_DEBUG, QString(
"[mhi] Permitted servers: %1")
421 .arg(servers.constData()) );
424 if (!objectPath.startsWith(
"https:"))
428 if (!objectPath.startsWith(
"https:"))
445 bool const isIC = objectPath.startsWith(
"http:") || objectPath.startsWith(
"https:");
455 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
460 bool bReported =
false;
461 QElapsedTimer
t;
t.start();
470 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Received %1").arg(objectPath));
474 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Not found %1").arg(objectPath));
487 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Received %1").arg(objectPath));
494 if (
t.hasExpired(60000))
497 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] timed out %1").arg(objectPath));
504 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Waiting for %1").arg(objectPath));
518 using key_t = QPair< QString,
int >;
523 int Find(
const QString &name,
int reg)
const
527 void key(
const QString &name,
int code,
int r1,
528 int r2=0,
int r3=0,
int r4=0,
int r5=0,
int r6=0,
int r7=0,
int r8=0,
int r9=0);
534 int r2,
int r3,
int r4,
int r5,
int r6,
int r7,
int r8,
int r9)
562 QStringList keylist =
GET_KEY(
"TV Playback",
"TEXTEXIT").split(QChar(
','));
563 bool strict = !keylist.contains(
"Esc", Qt::CaseInsensitive);
621 LOG(VB_GENERAL, LOG_INFO, QString(
"[mhi] Adding MHEG key %1:%2:%3")
632 LOG(VB_MHEG, LOG_INFO,
633 QString(
"[mhi] Reinit video(y:%1 x:%2 w:%3 h:%4) "
634 "vis(y:%5 x:%6 w:%7 h:%8) aspect=%9")
635 .arg(videoRect.y()).arg(videoRect.x())
636 .arg(videoRect.width()).arg(videoRect.height())
637 .arg(dispRect.y()).arg(dispRect.x())
638 .arg(dispRect.width()).arg(dispRect.height()).arg(aspect));
642 enum : std::uint8_t { kNone, kHoriz, kBoth };
644 auto const aspectd =
static_cast<double>(aspect);
645 double const vz = (mode == kBoth) ? std::min(1.15, 1. / sqrt(aspectd)) : 1.;
646 double const hz = (mode > kNone) ? vz * aspectd : 1.;
649 int(dispRect.height() * (1 - vz) / 2),
650 int(dispRect.width() * hz),
int(dispRect.height() * vz) );
652 dispRect.y() +
int(dispRect.height() * (1 - hz) / 2),
653 int(dispRect.width() * hz),
int(dispRect.height() * hz) );
658 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] SetInputRegister %1").arg(num));
674 if (!osdWindow || !osdPainter)
690 QRect imageRect(data->
m_x, data->
m_y,
702 rect.width(), rect.height());
705 newData->m_x = rect.x();
706 newData->m_y = rect.y();
707 newData->m_bUnder =
true;
719 for (
int count = 0; it !=
m_display.end(); ++it, count++)
727 auto *uiimage =
new MythUIImage(osdWindow, QString(
"itv%1").arg(count));
730 uiimage->SetImage(image);
775 QSize(
ScaleX(r.width(),
true),
ScaleY(r.height(),
true)) };
796 const QRect scaledRect =
Scale(displayRect);
800 data->
m_image = image.convertToFormat(QImage::Format_ARGB32).scaled(
801 scaledRect.width(), scaledRect.height(),
802 Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
803 data->m_x = scaledRect.x();
804 data->m_y = scaledRect.y();
805 data->m_bUnder = bUnder;
836 return n + (-n & (r - 1));
851 vidRect.setWidth(
Roundup(vidRect.width(), 2));
852 vidRect.setHeight(
Roundup(vidRect.height(), 2));
854 emit
m_parent->GetPlayer()->ResizeForInteractiveTV(vidRect);
870 "SELECT networkid, serviceid, transportid, chanid "
871 "FROM channel, dtv_multiplex "
872 "WHERE channel.deleted IS NULL "
873 " AND channel.mplexid = dtv_multiplex.mplexid "
874 " AND channel.sourceid = dtv_multiplex.sourceid "
875 " AND channel.sourceid = :SOURCEID ;" );
886 int nid = query.
value(0).toInt();
887 int sid = query.
value(1).toInt();
888 int tid = query.
value(2).toInt();
889 int cid = query.
value(3).toInt();
905 for (
int i = 0; i < 1 ; i++)
907 if (str.startsWith(
"dvb://"))
909 QStringList list = str.mid(6).split(
'.');
910 if (list.size() != 3)
915 int netID = list[0].toInt(&ok, 16);
918 int transportID = !list[1].isEmpty() ? list[1].toInt(&ok, 16) : -1;
921 int serviceID = list[2].toInt(&ok, 16);
930 Key_t(netID,serviceID) );
941 if (
Tid(it) == transportID)
949 else if (str.startsWith(
"rec://svc/lcn/"))
953 int channelNo = str.mid(14).toInt(&ok);
959 "WHERE deleted IS NULL AND "
960 " channum = :CHAN AND "
961 " channel.sourceid = :SOURCEID");
965 nResult = query.
value(0).toInt();
967 else if (str ==
"rec://svc/cur")
971 else if (str ==
"rec://svc/def")
977 LOG(VB_GENERAL, LOG_WARNING,
978 QString(
"[mhi] GetChannelIndex -- Unrecognized URL %1")
983 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetChannelIndex %1 => %2")
984 .arg(str).arg(nResult));
991 int &transportId,
int &serviceId)
999 if (
Cid(it) == channelId)
1001 transportId =
Tid(it);
1004 serviceId =
Sid(it);
1005 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetServiceInfo %1 => NID=%2 TID=%3 SID=%4")
1006 .arg(channelId).arg(netId).arg(transportId).arg(serviceId));
1011 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] GetServiceInfo %1 failed").arg(channelId));
1019 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] Can't TuneTo %1 0x%2 while not live")
1020 .arg(channel).arg(tuneinfo,0,16));
1024 LOG(VB_GENERAL, LOG_INFO, QString(
"[mhi] TuneTo %1 0x%2")
1025 .arg(channel).arg(tuneinfo,0,16));
1029 MythEvent me(QString(
"NETWORK_CONTROL CHANID %1").arg(channel));
1042 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginStream %1 0x%2")
1043 .arg(stream).arg((quintptr)notify,0,16));
1049 if (stream.startsWith(
"http://") || stream.startsWith(
"https://"))
1054 if (QUrl(stream).authority().isEmpty())
1057 emit
m_parent->GetPlayer()->SetInteractiveStream(stream);
1058 return !stream.isEmpty();
1068 int transportId = 0;
1087 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] EndStream 0x%1")
1091 emit
m_parent->GetPlayer()->SetInteractiveStream(QString());
1100 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Stream 0x%1 %2")
1101 .arg((quintptr)
m_notify,0,16).arg(bStarted ?
"started" :
"stopped"));
1113 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginAudio %1").arg(tag));
1120 return m_parent->GetPlayer()->SetAudioByComponentTag(tag);
1133 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginVideo %1").arg(tag));
1140 return m_parent->GetPlayer()->SetVideoByComponentTag(tag);
1153 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamPos() : -1ms;
1159 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamMaxPos() : -1ms;
1166 emit
m_parent->GetPlayer()->SetInteractiveStreamPos(pos);
1175 emit
m_parent->GetPlayer()->PlayInteractiveStream(play);
1182 return new MHIDLA(
this, isBoxed, lineColour, fillColour);
1201 if (colour.
alpha() == 0 || height == 0 || width == 0)
1204 QImage qImage(width, height, QImage::Format_ARGB32);
1205 qImage.fill(qRgba(colour.
red(), colour.
green(), colour.
blue(), colour.
alpha()));
1207 AddToDisplay(qImage, QRect(xPos, yPos, width, height));
1216 const QImage &qImage,
bool bScaled,
bool bUnder)
1218 if (qImage.isNull())
1221 QRect imageRect(x, y, qImage.width(), qImage.height());
1222 QRect displayRect = clipRect & imageRect;
1224 if (bScaled || displayRect == imageRect)
1228 else if (!displayRect.isEmpty())
1230 QImage clipped = qImage.copy(displayRect.translated(-x, -y));
1243 QRect bounds = reg.boundingRect();
1244 DrawRect(bounds.x(), bounds.y(), bounds.width(), bounds.height(),
1298 int maxAscent = face->size->metrics.ascender;
1299 int maxDescent = -face->size->metrics.descender;
1301 FT_Bool useKerning = FT_HAS_KERNING(face);
1302 FT_UInt previous = 0;
1304 for (
int n = 0; n < strLen; n++)
1306 QChar ch = str.at(n);
1307 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1309 if (glyphIndex == 0)
1311 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Unknown glyph 0x%1")
1312 .arg(
static_cast<short>(ch.unicode()),0,16));
1319 if (useKerning && previous != 0)
1322 FT_Get_Kerning(face, previous, glyphIndex,
1323 FT_KERNING_DEFAULT, &delta);
1327 error = FT_Load_Glyph(face, glyphIndex, 0);
1332 FT_GlyphSlot slot = face->glyph;
1333 FT_Pos advance = slot->metrics.horiAdvance + kerning;
1337 if (
FT2Point(width + advance) > maxSize)
1345 int descent = slot->metrics.height - slot->metrics.horiBearingY;
1347 maxAscent = std::max<FT_Pos>(slot->metrics.horiBearingY, maxAscent);
1349 maxDescent = std::max(descent, maxDescent);
1352 previous = glyphIndex;
1368 for (
int j = 0; j <
m_width; j++)
1370 m_image.setPixel(j, i, qRgba(0, 0, 0, 0));
1390 FT_Bool useKerning = FT_HAS_KERNING(face);
1391 FT_UInt previous = 0;
1393 int len = str.length();
1394 for (
int n = 0; n < len; n++)
1398 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1399 if (glyphIndex == 0)
1405 if (useKerning && previous != 0)
1408 FT_Get_Kerning(face, previous, glyphIndex,
1409 FT_KERNING_DEFAULT, &delta);
1412 FT_Error
error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER);
1417 FT_GlyphSlot slot = face->glyph;
1418 if (slot->format != FT_GLYPH_FORMAT_BITMAP)
1421 if ((
enum FT_Pixel_Mode_)slot->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)
1424 unsigned char *source = slot->bitmap.buffer;
1426 int baseX =
FT2Point(posX) + slot->bitmap_left;
1427 int baseY = pixelY - slot->bitmap_top;
1429 for (
unsigned int i = 0; i < slot->bitmap.rows; i++)
1431 for (
unsigned int j = 0; j < slot->bitmap.width; j++)
1433 int greyLevel = source[j];
1436 int red = colour.
red();
1437 int green = colour.
green();
1438 int blue = colour.
blue();
1439 int alpha = colour.
alpha() *
1440 greyLevel / slot->bitmap.num_grays;
1441 int xBit = j + baseX;
1442 int yBit = i + baseY;
1447 if (xBit >= 0 && xBit <
m_width &&
1451 qRgba(red, green, blue, alpha));
1454 source += slot->bitmap.pitch;
1456 posX += slot->advance.x;
1457 previous = glyphIndex;
1464 QRgb qColour = qRgba(colour.
red(), colour.
green(),
1480 if (width <= 0 || height <= 0)
1483 int imageWidth =
m_image.width();
1484 int imageHeight =
m_image.height();
1485 if (x+width > imageWidth)
1486 width = imageWidth - x;
1488 if (y+height > imageHeight)
1489 height = imageHeight - y;
1491 if (width <= 0 || height <= 0)
1494 for (
int i = 0; i < height; i++)
1496 for (
int j = 0; j < width; j++)
1498 m_image.setPixel(x+j, y+i, qColour);
1568 if (abs(y2-y1) > abs(
x2-
x1))
1591 int dy = abs(y2-y1);
1592 int yStep = y2 >= y1 ? 1 : -1;
1611 for (
int x =
x1; x <=
x2; x++)
1622 m_image.setPixel(y+i, x+j, colour);
1627 m_image.setPixel(x+j, y+i, colour);
1640 m_image.setPixel(y+i, x+j, colour);
1645 m_image.setPixel(x+j, y+i, colour);
1712 int nPoints = xArray.size();
1718 QVector <lineSeg> lineArray(nPoints);
1723 int lastX = xArray[nPoints-1];
1724 int lastY = yArray[nPoints-1];
1727 for (
int k = 0; k < nPoints; k++)
1729 int thisX = xArray[k];
1730 int thisY = yArray[k];
1735 lineArray[nLines].m_yBottom = thisY;
1736 lineArray[nLines].m_yTop = lastY;
1737 lineArray[nLines].m_xBottom = thisX;
1741 lineArray[nLines].m_yBottom = lastY;
1742 lineArray[nLines].m_yTop = thisY;
1743 lineArray[nLines].m_xBottom = lastX;
1745 lineArray[nLines++].m_slope =
1746 (float)(thisX-lastX) / (float)(thisY-lastY);
1748 yMin = std::min(thisY, yMin);
1749 yMax = std::max(thisY, yMax);
1759 for (
int y = yMin; y < yMax; y++)
1764 for (
int l = 0; l < nLines; l++)
1766 if (y >= lineArray[l].m_yBottom && y < lineArray[l].m_yTop)
1768 int x = (int)round((
float)(y - lineArray[l].m_yBottom) *
1769 lineArray[l].m_slope) + lineArray[l].m_xBottom;
1770 if (crossings == 0 || x < xMin)
1772 if (crossings == 0 || x > xMax)
1779 for (
int x = xMin; x <= xMax; x++)
1780 m_image.setPixel(x, y, fillColour);
1785 int lastXpoint = xArray[nPoints-1];
1786 int lastYpoint = yArray[nPoints-1];
1787 for (
int i = 0; i < nPoints; i++)
1789 DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint);
1790 lastXpoint = xArray[i];
1791 lastYpoint = yArray[i];
1796 for (
int i = 1; i < nPoints; i++)
1798 DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]);
1804 : m_parent(parent), m_tiled(tiled),
1822 QImage tiledImage = QImage(rect.width(), rect.height(),
1823 QImage::Format_ARGB32);
1825 for (
int i = 0; i < rect.width(); i++)
1827 for (
int j = 0; j < rect.height(); j++)
1846 if (!
m_image.loadFromData(data, length,
"PNG"))
1862 if (!
m_image.loadFromData(data, length,
"JPG"))
1879 AVCodecContext *c =
nullptr;
1882 uint8_t *buff =
nullptr;
1883 bool gotPicture =
false;
1887 const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO);
1896 av_packet_unref(&pkt);
1897 avcodec_free_context(&c);
1899 std::unique_ptr<
MHIBitmap,
decltype(cleanup_fn)>
cleanup {
this, cleanup_fn };
1901 c = avcodec_alloc_context3(
nullptr);
1903 if (avcodec_open2(c, codec,
nullptr) < 0)
1907 if (av_new_packet(&pkt, length) < 0)
1910 memcpy(pkt.data, data, length);
1915 for (
int limit=0; limit<10 && !gotPicture; limit++)
1917 int len = avcodec_receive_frame(c, picture);
1920 if (len == AVERROR(EAGAIN))
1923 len = avcodec_send_packet(c, &pkt);
1924 if (len == AVERROR(EAGAIN) || len == AVERROR_EOF)
1929 LOG(VB_GENERAL, LOG_ERR,
1930 QString(
"[mhi] video decode error: %1 (%2)")
1942 int nContentWidth = c->width;
1943 int nContentHeight = c->height;
1944 m_image = QImage(nContentWidth, nContentHeight, QImage::Format_ARGB32);
1948 memset(&retbuf, 0,
sizeof(
AVFrame));
1950 int bufflen = nContentWidth * nContentHeight * 3;
1951 auto *outputbuf = (
unsigned char*)av_malloc(bufflen);
1953 av_image_fill_arrays(retbuf.data, retbuf.linesize,
1954 outputbuf, AV_PIX_FMT_RGB24,
1955 nContentWidth, nContentHeight,IMAGE_ALIGN);
1959 nContentWidth, nContentHeight);
1961 uint8_t * buf = outputbuf;
1965 for (
int i = 0; i < nContentHeight; i++)
1967 for (
int j = 0; j < nContentWidth; j++)
1972 m_image.setPixel(j, i, qRgb(red, green, blue));
1975 av_freep(
reinterpret_cast<void*
>(&outputbuf));
1985 if (newWidth ==
m_image.width() && newHeight ==
m_image.height())
1988 if (newWidth <= 0 || newHeight <= 0)
1995 Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
std::vector< int > MHPointVec
MHEG * MHCreateEngine(MHContext *context)
Data for the queued DSMCC tables.
std::vector< uint8_t > m_data
int GetDSMCCObject(QStringList &objectPath, QByteArray &result)
void ProcessSection(const unsigned char *data, int length, int componentTag, unsigned carouselId, int dataBroadcastId)
void OptimiseDisplayedArea()
This is the interface between an MHEG engine and a MythTV TV object.
virtual void GenerateUserAction(int nCode)=0
virtual void EngineEvent(int)=0
virtual void StreamStarted(MHStream *, bool bStarted=true)=0
virtual void DrawDisplay(const QRegion &toDraw)=0
virtual void SetBooting()=0
virtual std::chrono::milliseconds RunAll(void)=0
Object for drawing bitmaps.
void Draw(int x, int y, QRect rect, bool tiled, bool bUnder) override
Draw the completed drawing onto the display.
MHIBitmap(MHIContext *parent, bool tiled)
void ScaleImage(int newWidth, int newHeight) override
Scale the bitmap. Only used for image derived from MPEG I-frames.
void CreateFromMPEG(const unsigned char *data, int length) override
Create bitmap from single I frame MPEG.
void CreateFromPNG(const unsigned char *data, int length) override
Create bitmap from PNG.
void CreateFromJPEG(const unsigned char *data, int length) override
Create bitmap from JPEG.
Contains various utility functions for interactive television.
ChannelCache_t m_channelCache
bool OfferKey(const QString &key)
void StreamPlay(bool play) override
void Reinit(QRect videoRect, QRect dispRect, float aspect)
The display area has changed.
void QueueDSMCCPacket(unsigned char *data, int length, int componentTag, unsigned carouselId, int dataBroadcastId)
MHTextDisplay * CreateText(void) override
bool GetServiceInfo(int channelId, int &netId, int &origNetId, int &transportId, int &serviceId) override
Get netId etc from the channel index.
std::chrono::milliseconds GetStreamMaxPos() override
QRect ScaleVideo(QRect r) const
MythDeque< DSMCCPacket * > m_dsmccQueue
static int Cid(ChannelCache_t::const_iterator it)
void NetworkBootRequested(void)
bool GetDSMCCObject(const QString &objectPath, QByteArray &result)
std::chrono::milliseconds GetStreamPos() override
std::list< MHIImageData * > m_display
void DrawImage(int x, int y, QRect rect, const QImage &image, bool bScaled=false, bool bUnder=false)
void GetInitialStreams(int &audioTag, int &videoTag) const
Get the initial component tags.
void StopVideo() override
Stop displaying video.
void StopEngine(void)
Stop the MHEG engine if it's running and waits until it has.
MythDeque< int > m_keyQueue
void RequireRedraw(const QRegion ®ion) override
An area of the screen/image needs to be redrawn.
bool GetCarouselData(const QString &objectPath, QByteArray &result) override
std::chrono::milliseconds SetStreamPos(std::chrono::milliseconds pos) override
MHBitmapDisplay * CreateBitmap(bool tiled) override
static int Tid(ChannelCache_t::const_iterator it)
bool TuneTo(int channel, int tuneinfo) override
int GetICStatus() override
int GetChannelIndex(const QString &str) override
void Restart(int chanid, int sourceid, bool isLive)
Restart the MHEG engine.
bool CheckAccess(const QString &objectPath, QByteArray &cert)
void SetNetBootInfo(const unsigned char *data, uint length)
int ScaleVideoX(int n, bool roundup=false) const
std::vector< unsigned char > m_nbiData
bool BeginVideo(int tag) override
Begin displaying video.
void ProcessDSMCCQueue(void)
QRect Scale(QRect r) const
bool CheckCarouselObject(const QString &objectPath) override
MHIContext(InteractiveTV *parent)
static int Sid(ChannelCache_t::const_iterator it)
void SetInputRegister(int num) override
bool BeginStream(const QString &str, MHStream *notify) override
Begin playing the specified stream.
QWaitCondition m_engineWait
MHDLADisplay * CreateDynamicLineArt(bool isBoxed, MHRgba lineColour, MHRgba fillColour) override
Creation functions for various visibles.
bool StreamStarted(bool bStarted=true)
void AddToDisplay(const QImage &image, QRect rect, bool bUnder=false)
void DrawVideo(const QRect &videoRect, const QRect &dispRect) override
void DrawRect(int xPos, int yPos, int width, int height, MHRgba colour) override
Additional drawing functions.
bool IsFaceLoaded(void) const
static const int kStdDisplayWidth
int ScaleVideoY(int n, bool roundup=false) const
void EndStream() override
bool BeginAudio(int tag) override
Begin playing audio.
MHInteractionChannel m_ic
void StopAudio() override
Stop playing audio.
void UpdateOSD(InteractiveScreen *osdWindow, MythPainter *osdPainter)
Update the display.
void DrawBackground(const QRegion ®) override
int ScaleX(int n, bool roundup=false) const
static int Nid(ChannelCache_t::const_iterator it)
int ScaleY(int n, bool roundup=false) const
bool LoadFont(const QString &name)
static const int kStdDisplayHeight
FT_Face GetFontFace(void)
Object for displaying Dynamic Line Art.
MHRgba m_boxFillColour
Fill colour for the background.
void DrawPoly(bool isFilled, const MHPointVec &xArray, const MHPointVec &yArray) override
void DrawLine(int x1, int y1, int x2, int y2) override
void DrawBorderedRectangle(int x, int y, int width, int height) override
int m_width
Width of the drawing.
MHRgba m_boxLineColour
Line colour for the background.
void DrawRect(int x, int y, int width, int height, MHRgba colour)
void Clear(void) override
Clear the drawing.
void Draw(int x, int y) override
Draw the completed drawing onto the display.
MHRgba m_lineColour
Current line colour.
void DrawArcSector(int x, int y, int width, int height, int start, int arc, bool isSector) override
int m_lineWidth
Current line width.
void DrawOval(int x, int y, int width, int height) override
bool m_boxed
Does it have a border?
void DrawLineSub(int x1, int y1, int x2, int y2, bool swapped)
MHRgba m_fillColour
Current fill colour.
int m_height
Height of the drawing.
Data for items in the interactive television display stack.
void SetFont(int size, bool isBold, bool isItalic) override
void AddText(int x, int y, const QString &str, MHRgba colour) override
void Clear(void) override
void SetSize(int width, int height) override
void Draw(int x, int y) override
QRect GetBounds(const QString &str, int &strLen, int maxSize=-1) override
EResult GetFile(const QString &csPath, QByteArray &data, const QByteArray &cert=QByteArray())
bool CheckFile(const QString &csPath, const QByteArray &cert=QByteArray())
QHash< key_t, int > m_map
void key(const QString &name, int code, int r1, int r2=0, int r3=0, int r4=0, int r5=0, int r6=0, int r7=0, int r8=0, int r9=0)
QPair< QString, int > key_t
int Find(const QString &name, int reg) const
QSqlQuery wrapper that fetches a DB connection from the connection pool.
bool prepare(const QString &query)
QSqlQuery::prepare() is not thread safe in Qt <= 3.3.2.
QVariant value(int i) const
bool isActive(void) const
bool exec(void)
Wrap QSqlQuery::exec() so we can display SQL.
void bindValue(const QString &placeholder, const QVariant &val)
Add a single binding.
bool next(void)
Wrap QSqlQuery::next() so we can display the query results.
static MSqlQueryInfo InitCon(ConnectionReuse _reuse=kNormalConnection)
Only use this in combination with MSqlQuery constructor.
This is a wrapper around QThread that does several additional things.
void start(QThread::Priority p=QThread::InheritPriority)
Tell MThread to start running the thread in the near future.
bool wait(std::chrono::milliseconds time=std::chrono::milliseconds::max())
Wait for the MThread to exit, with a maximum timeout.
int Copy(AVFrame *To, const MythVideoFrame *From, unsigned char *Buffer, AVPixelFormat Fmt=AV_PIX_FMT_YUV420P)
Initialise AVFrame and copy contents of VideoFrame frame into it, performing any required conversion.
MythAVFrame little utility class that act as a safe way to allocate an AVFrame which can then be allo...
void dispatch(const MythEvent &event)
int GetNumSetting(const QString &key, int defaultval=0)
static void DBError(const QString &where, const MSqlQuery &query)
T dequeue()
Removes item from front of list and returns a copy. O(1).
void enqueue(const T &d)
Adds item to the back of the list. O(1).
This class is used as a container for messages.
void Assign(const QImage &img)
int DecrRef(void) override
Decrements reference count and deletes on 0.
MythImage * GetFormatImage()
Returns a blank reference counted image in the format required for the Draw functions for this painte...
Wrapper around QRect allowing us to handle percentage and other relative values for areas in mythui.
Image widget, displays a single image or multiple images in sequence.
virtual void SetVisible(bool visible)
void DeleteAllChildren(void)
Delete all child widgets.
static constexpr uint8_t FONT_WIDTHRES
const unsigned kTuneQuietly
static int FT2Point(FT_F26Dot6 fp)
static FT_Library ft_library
const unsigned kTuneCarReset
const unsigned kTuneKeepApp
const unsigned kTuneCarId
const unsigned kTuneKeepChnl
static FT_F26Dot6 Point2FT(int pt)
static constexpr uint8_t FONT_HEIGHTRES
static constexpr const char * FONT_TO_USE
int Roundup(int n, int r)
static constexpr uint16_t NBI_VERSION_UNSET
char * av_make_error_stdstring(std::string &errbuf, int errnum)
A C++ equivalent to av_make_error_string.
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
QString GetShareDir(void)
QString GetFontsDir(void)
static bool VERBOSE_LEVEL_CHECK(uint64_t mask, LogLevel_t level)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
static QString GET_KEY(const QString &Context, const QString &Action)
static constexpr const char * ACTION_7
static constexpr const char * ACTION_5
static constexpr const char * ACTION_0
static constexpr const char * ACTION_LEFT
static constexpr const char * ACTION_DOWN
static constexpr const char * ACTION_3
static constexpr const char * ACTION_1
static constexpr const char * ACTION_4
static constexpr const char * ACTION_RIGHT
static constexpr const char * ACTION_SELECT
static constexpr const char * ACTION_UP
static constexpr const char * ACTION_6
static constexpr const char * ACTION_8
static constexpr const char * ACTION_2
static constexpr const char * ACTION_9
static QString cleanup(const QString &str)
#define ACTION_MENUYELLOW