44#include "libavutil/imgutils.h"
79 : m_parent(parent), m_dsmcc(new
Dsmcc()),
100 QString fullnameA =
GetConfDir() +
"/" + name;
101 QByteArray fnameA = fullnameA.toLatin1();
107 QByteArray fnameB = fullnameB.toLatin1();
112 QString fullnameC =
GetShareDir() +
"themes/" + name;
113 QByteArray fnameC = fullnameC.toLatin1();
118 const QString& fullnameD = name;
119 QByteArray fnameD = fullnameD.toLatin1();
124 LOG(VB_GENERAL, LOG_ERR, QString(
"[mhi] Unable to find font: %1").arg(name));
178 LOG(VB_MHEG, LOG_INFO,
179 QString(
"[mhi] Restart ch=%1 source=%2 live=%3 tuneinfo=0x%4")
180 .arg(chanid).arg(sourceid).arg(isLive).arg(tuneinfo,0,16));
247 std::chrono::milliseconds toWait = 0ms;
268 toWait = (toWait > 1s || toWait <= 0ms) ? 1s : toWait;
270 if (!
m_stop && (toWait > 0ms))
296 unsigned char *data,
int length,
int componentTag,
297 unsigned carouselId,
int dataBroadcastId)
299 auto *dataCopy = (
unsigned char*) malloc(length *
sizeof(
unsigned char));
301 if (dataCopy ==
nullptr)
304 memcpy(dataCopy, data, length*
sizeof(
unsigned char));
308 componentTag, carouselId,
320 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] SetNetBootInfo version %1 mode %2 len %3")
321 .arg(data[0]).arg(data[1]).arg(length));
360 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Unknown NetworkBoot type %1")
370 if (objectPath.startsWith(
"http:") || objectPath.startsWith(
"https:"))
381 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
390 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
404 LOG(VB_MHEG, LOG_INFO, QString(
405 "[mhi] CheckAccess(%1) No auth.servers").arg(objectPath) );
409 QByteArray host = QUrl(objectPath).host().toLocal8Bit();
410 if (!servers.contains(host))
412 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] CheckAccess(%1) Host not known")
414 LOG(VB_MHEG, LOG_DEBUG, QString(
"[mhi] Permitted servers: %1")
415 .arg(servers.constData()) );
418 if (!objectPath.startsWith(
"https:"))
422 if (!objectPath.startsWith(
"https:"))
439 bool const isIC = objectPath.startsWith(
"http:") || objectPath.startsWith(
"https:");
449 QStringList path = objectPath.split(QChar(
'/'), Qt::SkipEmptyParts);
454 bool bReported =
false;
455 QElapsedTimer
t;
t.start();
464 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Received %1").arg(objectPath));
468 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Not found %1").arg(objectPath));
481 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Received %1").arg(objectPath));
488 if (
t.hasExpired(60000))
491 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] timed out %1").arg(objectPath));
498 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Waiting for %1").arg(objectPath));
512 using key_t = QPair< QString,
int >;
517 int Find(
const QString &name,
int reg)
const
521 void key(
const QString &name,
int code,
int r1,
522 int r2=0,
int r3=0,
int r4=0,
int r5=0,
int r6=0,
int r7=0,
int r8=0,
int r9=0);
528 int r2,
int r3,
int r4,
int r5,
int r6,
int r7,
int r8,
int r9)
556 QStringList keylist =
GET_KEY(
"TV Playback",
"TEXTEXIT").split(QChar(
','));
557 bool strict = !keylist.contains(
"Esc", Qt::CaseInsensitive);
615 LOG(VB_GENERAL, LOG_INFO, QString(
"[mhi] Adding MHEG key %1:%2:%3")
626 LOG(VB_MHEG, LOG_INFO,
627 QString(
"[mhi] Reinit video(y:%1 x:%2 w:%3 h:%4) "
628 "vis(y:%5 x:%6 w:%7 h:%8) aspect=%9")
629 .arg(videoRect.y()).arg(videoRect.x())
630 .arg(videoRect.width()).arg(videoRect.height())
631 .arg(dispRect.y()).arg(dispRect.x())
632 .arg(dispRect.width()).arg(dispRect.height()).arg(aspect));
636 enum : std::uint8_t { kNone, kHoriz, kBoth };
638 auto const aspectd =
static_cast<double>(aspect);
639 double const vz = (mode == kBoth) ? std::min(1.15, 1. / sqrt(aspectd)) : 1.;
640 double const hz = (mode > kNone) ? vz * aspectd : 1.;
643 int(dispRect.height() * (1 - vz) / 2),
644 int(dispRect.width() * hz),
int(dispRect.height() * vz) );
646 dispRect.y() +
int(dispRect.height() * (1 - hz) / 2),
647 int(dispRect.width() * hz),
int(dispRect.height() * hz) );
652 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] SetInputRegister %1").arg(num));
668 if (!osdWindow || !osdPainter)
684 QRect imageRect(data->
m_x, data->
m_y,
696 rect.width(), rect.height());
699 newData->m_x = rect.x();
700 newData->m_y = rect.y();
701 newData->m_bUnder =
true;
713 for (
int count = 0; it !=
m_display.end(); ++it, count++)
721 auto *uiimage =
new MythUIImage(osdWindow, QString(
"itv%1").arg(count));
724 uiimage->SetImage(image);
769 QSize(
ScaleX(r.width(),
true),
ScaleY(r.height(),
true)) };
790 const QRect scaledRect =
Scale(displayRect);
794 data->
m_image = image.convertToFormat(QImage::Format_ARGB32).scaled(
795 scaledRect.width(), scaledRect.height(),
796 Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
797 data->m_x = scaledRect.x();
798 data->m_y = scaledRect.y();
799 data->m_bUnder = bUnder;
826 return n + (-n & (r - 1));
841 vidRect.setWidth(
Roundup(vidRect.width(), 2));
842 vidRect.setHeight(
Roundup(vidRect.height(), 2));
844 emit
m_parent->GetPlayer()->ResizeForInteractiveTV(vidRect);
860 "SELECT networkid, serviceid, transportid, chanid "
861 "FROM channel, dtv_multiplex "
862 "WHERE channel.deleted IS NULL "
863 " AND channel.mplexid = dtv_multiplex.mplexid "
864 " AND channel.sourceid = dtv_multiplex.sourceid "
865 " AND channel.sourceid = :SOURCEID ;" );
876 int nid = query.
value(0).toInt();
877 int sid = query.
value(1).toInt();
878 int tid = query.
value(2).toInt();
879 int cid = query.
value(3).toInt();
895 for (
int i = 0; i < 1 ; i++)
897 if (str.startsWith(
"dvb://"))
899 QStringList list = str.mid(6).split(
'.');
900 if (list.size() != 3)
905 int netID = list[0].toInt(&ok, 16);
908 int transportID = !list[1].isEmpty() ? list[1].toInt(&ok, 16) : -1;
911 int serviceID = list[2].toInt(&ok, 16);
920 Key_t(netID,serviceID) );
929 if (
Tid(it) == transportID)
937 else if (str.startsWith(
"rec://svc/lcn/"))
941 int channelNo = str.mid(14).toInt(&ok);
947 "WHERE deleted IS NULL AND "
948 " channum = :CHAN AND "
949 " channel.sourceid = :SOURCEID");
953 nResult = query.
value(0).toInt();
955 else if (str ==
"rec://svc/cur")
959 else if (str ==
"rec://svc/def")
965 LOG(VB_GENERAL, LOG_WARNING,
966 QString(
"[mhi] GetChannelIndex -- Unrecognized URL %1")
971 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetChannelIndex %1 => %2")
972 .arg(str).arg(nResult));
979 int &transportId,
int &serviceId)
987 if (
Cid(it) == channelId)
989 transportId =
Tid(it);
993 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetServiceInfo %1 => NID=%2 TID=%3 SID=%4")
994 .arg(channelId).arg(netId).arg(transportId).arg(serviceId));
999 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] GetServiceInfo %1 failed").arg(channelId));
1007 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] Can't TuneTo %1 0x%2 while not live")
1008 .arg(channel).arg(tuneinfo,0,16));
1012 LOG(VB_GENERAL, LOG_INFO, QString(
"[mhi] TuneTo %1 0x%2")
1013 .arg(channel).arg(tuneinfo,0,16));
1017 MythEvent me(QString(
"NETWORK_CONTROL CHANID %1").arg(channel));
1030 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginStream %1 0x%2")
1031 .arg(stream).arg((quintptr)notify,0,16));
1037 if (stream.startsWith(
"http://") || stream.startsWith(
"https://"))
1042 if (QUrl(stream).authority().isEmpty())
1045 emit
m_parent->GetPlayer()->SetInteractiveStream(stream);
1046 return !stream.isEmpty();
1056 int transportId = 0;
1075 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] EndStream 0x%1")
1079 emit
m_parent->GetPlayer()->SetInteractiveStream(QString());
1088 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Stream 0x%1 %2")
1089 .arg((quintptr)
m_notify,0,16).arg(bStarted ?
"started" :
"stopped"));
1101 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginAudio %1").arg(tag));
1108 return m_parent->GetPlayer()->SetAudioByComponentTag(tag);
1121 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginVideo %1").arg(tag));
1128 return m_parent->GetPlayer()->SetVideoByComponentTag(tag);
1141 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamPos() : -1ms;
1147 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamMaxPos() : -1ms;
1154 emit
m_parent->GetPlayer()->SetInteractiveStreamPos(pos);
1163 emit
m_parent->GetPlayer()->PlayInteractiveStream(play);
1170 return new MHIDLA(
this, isBoxed, lineColour, fillColour);
1189 if (colour.
alpha() == 0 || height == 0 || width == 0)
1192 QImage qImage(width, height, QImage::Format_ARGB32);
1193 qImage.fill(qRgba(colour.
red(), colour.
green(), colour.
blue(), colour.
alpha()));
1195 AddToDisplay(qImage, QRect(xPos, yPos, width, height));
1204 const QImage &qImage,
bool bScaled,
bool bUnder)
1206 if (qImage.isNull())
1209 QRect imageRect(x, y, qImage.width(), qImage.height());
1210 QRect displayRect = clipRect & imageRect;
1212 if (bScaled || displayRect == imageRect)
1216 else if (!displayRect.isEmpty())
1218 QImage clipped = qImage.copy(displayRect.translated(-x, -y));
1231 QRect bounds = reg.boundingRect();
1232 DrawRect(bounds.x(), bounds.y(), bounds.width(), bounds.height(),
1286 int maxAscent = face->size->metrics.ascender;
1287 int maxDescent = -face->size->metrics.descender;
1289 FT_Bool useKerning = FT_HAS_KERNING(face);
1290 FT_UInt previous = 0;
1292 for (
int n = 0; n < strLen; n++)
1294 QChar ch = str.at(n);
1295 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1297 if (glyphIndex == 0)
1299 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Unknown glyph 0x%1")
1300 .arg(
static_cast<short>(ch.unicode()),0,16));
1307 if (useKerning && previous != 0)
1310 FT_Get_Kerning(face, previous, glyphIndex,
1311 FT_KERNING_DEFAULT, &delta);
1315 error = FT_Load_Glyph(face, glyphIndex, 0);
1320 FT_GlyphSlot slot = face->glyph;
1321 FT_Pos advance = slot->metrics.horiAdvance + kerning;
1325 if (
FT2Point(width + advance) > maxSize)
1333 int descent = slot->metrics.height - slot->metrics.horiBearingY;
1335 maxAscent = std::max<FT_Pos>(slot->metrics.horiBearingY, maxAscent);
1337 maxDescent = std::max(descent, maxDescent);
1340 previous = glyphIndex;
1356 for (
int j = 0; j <
m_width; j++)
1358 m_image.setPixel(j, i, qRgba(0, 0, 0, 0));
1378 FT_Bool useKerning = FT_HAS_KERNING(face);
1379 FT_UInt previous = 0;
1381 int len = str.length();
1382 for (
int n = 0; n < len; n++)
1386 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1387 if (glyphIndex == 0)
1393 if (useKerning && previous != 0)
1396 FT_Get_Kerning(face, previous, glyphIndex,
1397 FT_KERNING_DEFAULT, &delta);
1400 FT_Error
error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER);
1405 FT_GlyphSlot slot = face->glyph;
1406 if (slot->format != FT_GLYPH_FORMAT_BITMAP)
1409 if ((
enum FT_Pixel_Mode_)slot->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)
1412 unsigned char *source = slot->bitmap.buffer;
1414 int baseX =
FT2Point(posX) + slot->bitmap_left;
1415 int baseY = pixelY - slot->bitmap_top;
1417 for (
unsigned int i = 0; i < slot->bitmap.rows; i++)
1419 for (
unsigned int j = 0; j < slot->bitmap.width; j++)
1421 int greyLevel = source[j];
1424 int red = colour.
red();
1425 int green = colour.
green();
1426 int blue = colour.
blue();
1427 int alpha = colour.
alpha() *
1428 greyLevel / slot->bitmap.num_grays;
1429 int xBit = j + baseX;
1430 int yBit = i + baseY;
1435 if (xBit >= 0 && xBit <
m_width &&
1439 qRgba(red, green, blue, alpha));
1442 source += slot->bitmap.pitch;
1444 posX += slot->advance.x;
1445 previous = glyphIndex;
1452 QRgb qColour = qRgba(colour.
red(), colour.
green(),
1468 if (width <= 0 || height <= 0)
1471 int imageWidth =
m_image.width();
1472 int imageHeight =
m_image.height();
1473 if (x+width > imageWidth)
1474 width = imageWidth - x;
1476 if (y+height > imageHeight)
1477 height = imageHeight - y;
1479 if (width <= 0 || height <= 0)
1482 for (
int i = 0; i < height; i++)
1484 for (
int j = 0; j < width; j++)
1486 m_image.setPixel(x+j, y+i, qColour);
1556 if (abs(y2-y1) > abs(
x2-
x1))
1579 int dy = abs(y2-y1);
1580 int yStep = y2 >= y1 ? 1 : -1;
1599 for (
int x =
x1; x <=
x2; x++)
1610 m_image.setPixel(y+i, x+j, colour);
1615 m_image.setPixel(x+j, y+i, colour);
1628 m_image.setPixel(y+i, x+j, colour);
1633 m_image.setPixel(x+j, y+i, colour);
1700 int nPoints = xArray.size();
1706 QVector <lineSeg> lineArray(nPoints);
1711 int lastX = xArray[nPoints-1];
1712 int lastY = yArray[nPoints-1];
1715 for (
int k = 0; k < nPoints; k++)
1717 int thisX = xArray[k];
1718 int thisY = yArray[k];
1723 lineArray[nLines].m_yBottom = thisY;
1724 lineArray[nLines].m_yTop = lastY;
1725 lineArray[nLines].m_xBottom = thisX;
1729 lineArray[nLines].m_yBottom = lastY;
1730 lineArray[nLines].m_yTop = thisY;
1731 lineArray[nLines].m_xBottom = lastX;
1733 lineArray[nLines++].m_slope =
1734 (float)(thisX-lastX) / (float)(thisY-lastY);
1736 yMin = std::min(thisY, yMin);
1737 yMax = std::max(thisY, yMax);
1747 for (
int y = yMin; y < yMax; y++)
1752 for (
int l = 0; l < nLines; l++)
1754 if (y >= lineArray[l].m_yBottom && y < lineArray[l].m_yTop)
1756 int x = (int)round((
float)(y - lineArray[l].m_yBottom) *
1757 lineArray[l].m_slope) + lineArray[l].m_xBottom;
1758 if (crossings == 0 || x < xMin)
1760 if (crossings == 0 || x > xMax)
1767 for (
int x = xMin; x <= xMax; x++)
1768 m_image.setPixel(x, y, fillColour);
1773 int lastXpoint = xArray[nPoints-1];
1774 int lastYpoint = yArray[nPoints-1];
1775 for (
int i = 0; i < nPoints; i++)
1777 DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint);
1778 lastXpoint = xArray[i];
1779 lastYpoint = yArray[i];
1784 for (
int i = 1; i < nPoints; i++)
1786 DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]);
1792 : m_parent(parent), m_tiled(tiled),
1810 QImage tiledImage = QImage(rect.width(), rect.height(),
1811 QImage::Format_ARGB32);
1813 for (
int i = 0; i < rect.width(); i++)
1815 for (
int j = 0; j < rect.height(); j++)
1834 if (!
m_image.loadFromData(data, length,
"PNG"))
1850 if (!
m_image.loadFromData(data, length,
"JPG"))
1867 AVCodecContext *c =
nullptr;
1870 uint8_t *buff =
nullptr;
1871 bool gotPicture =
false;
1875 const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO);
1884 av_packet_unref(&pkt);
1885 avcodec_free_context(&c);
1887 std::unique_ptr<
MHIBitmap,
decltype(cleanup_fn)>
cleanup {
this, cleanup_fn };
1889 c = avcodec_alloc_context3(
nullptr);
1891 if (avcodec_open2(c, codec,
nullptr) < 0)
1895 if (av_new_packet(&pkt, length) < 0)
1898 memcpy(pkt.data, data, length);
1903 for (
int limit=0; limit<10 && !gotPicture; limit++)
1905 int len = avcodec_receive_frame(c, picture);
1908 if (len == AVERROR(EAGAIN))
1911 len = avcodec_send_packet(c, &pkt);
1912 if (len == AVERROR(EAGAIN) || len == AVERROR_EOF)
1917 LOG(VB_GENERAL, LOG_ERR,
1918 QString(
"[mhi] video decode error: %1 (%2)")
1930 int nContentWidth = c->width;
1931 int nContentHeight = c->height;
1932 m_image = QImage(nContentWidth, nContentHeight, QImage::Format_ARGB32);
1936 memset(&retbuf, 0,
sizeof(
AVFrame));
1938 int bufflen = nContentWidth * nContentHeight * 3;
1939 auto *outputbuf = (
unsigned char*)av_malloc(bufflen);
1941 av_image_fill_arrays(retbuf.data, retbuf.linesize,
1942 outputbuf, AV_PIX_FMT_RGB24,
1943 nContentWidth, nContentHeight,IMAGE_ALIGN);
1947 nContentWidth, nContentHeight);
1949 uint8_t * buf = outputbuf;
1953 for (
int i = 0; i < nContentHeight; i++)
1955 for (
int j = 0; j < nContentWidth; j++)
1960 m_image.setPixel(j, i, qRgb(red, green, blue));
1963 av_freep(
reinterpret_cast<void*
>(&outputbuf));
1973 if (newWidth ==
m_image.width() && newHeight ==
m_image.height())
1976 if (newWidth <= 0 || newHeight <= 0)
1983 Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
std::vector< int > MHPointVec
MHEG * MHCreateEngine(MHContext *context)
Data for the queued DSMCC tables.
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