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;
832 return n + (-n & (r - 1));
847 vidRect.setWidth(
Roundup(vidRect.width(), 2));
848 vidRect.setHeight(
Roundup(vidRect.height(), 2));
850 emit
m_parent->GetPlayer()->ResizeForInteractiveTV(vidRect);
866 "SELECT networkid, serviceid, transportid, chanid "
867 "FROM channel, dtv_multiplex "
868 "WHERE channel.deleted IS NULL "
869 " AND channel.mplexid = dtv_multiplex.mplexid "
870 " AND channel.sourceid = dtv_multiplex.sourceid "
871 " AND channel.sourceid = :SOURCEID ;" );
882 int nid = query.
value(0).toInt();
883 int sid = query.
value(1).toInt();
884 int tid = query.
value(2).toInt();
885 int cid = query.
value(3).toInt();
901 for (
int i = 0; i < 1 ; i++)
903 if (str.startsWith(
"dvb://"))
905 QStringList list = str.mid(6).split(
'.');
906 if (list.size() != 3)
911 int netID = list[0].toInt(&ok, 16);
914 int transportID = !list[1].isEmpty() ? list[1].toInt(&ok, 16) : -1;
917 int serviceID = list[2].toInt(&ok, 16);
926 Key_t(netID,serviceID) );
935 if (
Tid(it) == transportID)
943 else if (str.startsWith(
"rec://svc/lcn/"))
947 int channelNo = str.mid(14).toInt(&ok);
953 "WHERE deleted IS NULL AND "
954 " channum = :CHAN AND "
955 " channel.sourceid = :SOURCEID");
959 nResult = query.
value(0).toInt();
961 else if (str ==
"rec://svc/cur")
965 else if (str ==
"rec://svc/def")
971 LOG(VB_GENERAL, LOG_WARNING,
972 QString(
"[mhi] GetChannelIndex -- Unrecognized URL %1")
977 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetChannelIndex %1 => %2")
978 .arg(str).arg(nResult));
985 int &transportId,
int &serviceId)
993 if (
Cid(it) == channelId)
995 transportId =
Tid(it);
999 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] GetServiceInfo %1 => NID=%2 TID=%3 SID=%4")
1000 .arg(channelId).arg(netId).arg(transportId).arg(serviceId));
1005 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] GetServiceInfo %1 failed").arg(channelId));
1013 LOG(VB_MHEG, LOG_WARNING, QString(
"[mhi] Can't TuneTo %1 0x%2 while not live")
1014 .arg(channel).arg(tuneinfo,0,16));
1018 LOG(VB_GENERAL, LOG_INFO, QString(
"[mhi] TuneTo %1 0x%2")
1019 .arg(channel).arg(tuneinfo,0,16));
1023 MythEvent me(QString(
"NETWORK_CONTROL CHANID %1").arg(channel));
1036 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginStream %1 0x%2")
1037 .arg(stream).arg((quintptr)notify,0,16));
1043 if (stream.startsWith(
"http://") || stream.startsWith(
"https://"))
1048 if (QUrl(stream).authority().isEmpty())
1051 emit
m_parent->GetPlayer()->SetInteractiveStream(stream);
1052 return !stream.isEmpty();
1062 int transportId = 0;
1081 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] EndStream 0x%1")
1085 emit
m_parent->GetPlayer()->SetInteractiveStream(QString());
1094 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Stream 0x%1 %2")
1095 .arg((quintptr)
m_notify,0,16).arg(bStarted ?
"started" :
"stopped"));
1107 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginAudio %1").arg(tag));
1114 return m_parent->GetPlayer()->SetAudioByComponentTag(tag);
1127 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] BeginVideo %1").arg(tag));
1134 return m_parent->GetPlayer()->SetVideoByComponentTag(tag);
1147 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamPos() : -1ms;
1153 return m_parent->GetPlayer() ?
m_parent->GetPlayer()->GetStreamMaxPos() : -1ms;
1160 emit
m_parent->GetPlayer()->SetInteractiveStreamPos(pos);
1169 emit
m_parent->GetPlayer()->PlayInteractiveStream(play);
1176 return new MHIDLA(
this, isBoxed, lineColour, fillColour);
1195 if (colour.
alpha() == 0 || height == 0 || width == 0)
1198 QImage qImage(width, height, QImage::Format_ARGB32);
1199 qImage.fill(qRgba(colour.
red(), colour.
green(), colour.
blue(), colour.
alpha()));
1201 AddToDisplay(qImage, QRect(xPos, yPos, width, height));
1210 const QImage &qImage,
bool bScaled,
bool bUnder)
1212 if (qImage.isNull())
1215 QRect imageRect(x, y, qImage.width(), qImage.height());
1216 QRect displayRect = clipRect & imageRect;
1218 if (bScaled || displayRect == imageRect)
1222 else if (!displayRect.isEmpty())
1224 QImage clipped = qImage.copy(displayRect.translated(-x, -y));
1237 QRect bounds = reg.boundingRect();
1238 DrawRect(bounds.x(), bounds.y(), bounds.width(), bounds.height(),
1292 int maxAscent = face->size->metrics.ascender;
1293 int maxDescent = -face->size->metrics.descender;
1295 FT_Bool useKerning = FT_HAS_KERNING(face);
1296 FT_UInt previous = 0;
1298 for (
int n = 0; n < strLen; n++)
1300 QChar ch = str.at(n);
1301 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1303 if (glyphIndex == 0)
1305 LOG(VB_MHEG, LOG_INFO, QString(
"[mhi] Unknown glyph 0x%1")
1306 .arg(
static_cast<short>(ch.unicode()),0,16));
1313 if (useKerning && previous != 0)
1316 FT_Get_Kerning(face, previous, glyphIndex,
1317 FT_KERNING_DEFAULT, &delta);
1321 error = FT_Load_Glyph(face, glyphIndex, 0);
1326 FT_GlyphSlot slot = face->glyph;
1327 FT_Pos advance = slot->metrics.horiAdvance + kerning;
1331 if (
FT2Point(width + advance) > maxSize)
1339 int descent = slot->metrics.height - slot->metrics.horiBearingY;
1341 maxAscent = std::max<FT_Pos>(slot->metrics.horiBearingY, maxAscent);
1343 maxDescent = std::max(descent, maxDescent);
1346 previous = glyphIndex;
1362 for (
int j = 0; j <
m_width; j++)
1364 m_image.setPixel(j, i, qRgba(0, 0, 0, 0));
1384 FT_Bool useKerning = FT_HAS_KERNING(face);
1385 FT_UInt previous = 0;
1387 int len = str.length();
1388 for (
int n = 0; n < len; n++)
1392 FT_UInt glyphIndex = FT_Get_Char_Index(face, ch.unicode());
1393 if (glyphIndex == 0)
1399 if (useKerning && previous != 0)
1402 FT_Get_Kerning(face, previous, glyphIndex,
1403 FT_KERNING_DEFAULT, &delta);
1406 FT_Error
error = FT_Load_Glyph(face, glyphIndex, FT_LOAD_RENDER);
1411 FT_GlyphSlot slot = face->glyph;
1412 if (slot->format != FT_GLYPH_FORMAT_BITMAP)
1415 if ((
enum FT_Pixel_Mode_)slot->bitmap.pixel_mode != FT_PIXEL_MODE_GRAY)
1418 unsigned char *source = slot->bitmap.buffer;
1420 int baseX =
FT2Point(posX) + slot->bitmap_left;
1421 int baseY = pixelY - slot->bitmap_top;
1423 for (
unsigned int i = 0; i < slot->bitmap.rows; i++)
1425 for (
unsigned int j = 0; j < slot->bitmap.width; j++)
1427 int greyLevel = source[j];
1430 int red = colour.
red();
1431 int green = colour.
green();
1432 int blue = colour.
blue();
1433 int alpha = colour.
alpha() *
1434 greyLevel / slot->bitmap.num_grays;
1435 int xBit = j + baseX;
1436 int yBit = i + baseY;
1441 if (xBit >= 0 && xBit <
m_width &&
1445 qRgba(red, green, blue, alpha));
1448 source += slot->bitmap.pitch;
1450 posX += slot->advance.x;
1451 previous = glyphIndex;
1458 QRgb qColour = qRgba(colour.
red(), colour.
green(),
1474 if (width <= 0 || height <= 0)
1477 int imageWidth =
m_image.width();
1478 int imageHeight =
m_image.height();
1479 if (x+width > imageWidth)
1480 width = imageWidth - x;
1482 if (y+height > imageHeight)
1483 height = imageHeight - y;
1485 if (width <= 0 || height <= 0)
1488 for (
int i = 0; i < height; i++)
1490 for (
int j = 0; j < width; j++)
1492 m_image.setPixel(x+j, y+i, qColour);
1562 if (abs(y2-y1) > abs(
x2-
x1))
1585 int dy = abs(y2-y1);
1586 int yStep = y2 >= y1 ? 1 : -1;
1605 for (
int x =
x1; x <=
x2; x++)
1616 m_image.setPixel(y+i, x+j, colour);
1621 m_image.setPixel(x+j, y+i, colour);
1634 m_image.setPixel(y+i, x+j, colour);
1639 m_image.setPixel(x+j, y+i, colour);
1706 int nPoints = xArray.size();
1712 QVector <lineSeg> lineArray(nPoints);
1717 int lastX = xArray[nPoints-1];
1718 int lastY = yArray[nPoints-1];
1721 for (
int k = 0; k < nPoints; k++)
1723 int thisX = xArray[k];
1724 int thisY = yArray[k];
1729 lineArray[nLines].m_yBottom = thisY;
1730 lineArray[nLines].m_yTop = lastY;
1731 lineArray[nLines].m_xBottom = thisX;
1735 lineArray[nLines].m_yBottom = lastY;
1736 lineArray[nLines].m_yTop = thisY;
1737 lineArray[nLines].m_xBottom = lastX;
1739 lineArray[nLines++].m_slope =
1740 (float)(thisX-lastX) / (float)(thisY-lastY);
1742 yMin = std::min(thisY, yMin);
1743 yMax = std::max(thisY, yMax);
1753 for (
int y = yMin; y < yMax; y++)
1758 for (
int l = 0; l < nLines; l++)
1760 if (y >= lineArray[l].m_yBottom && y < lineArray[l].m_yTop)
1762 int x = (int)round((
float)(y - lineArray[l].m_yBottom) *
1763 lineArray[l].m_slope) + lineArray[l].m_xBottom;
1764 if (crossings == 0 || x < xMin)
1766 if (crossings == 0 || x > xMax)
1773 for (
int x = xMin; x <= xMax; x++)
1774 m_image.setPixel(x, y, fillColour);
1779 int lastXpoint = xArray[nPoints-1];
1780 int lastYpoint = yArray[nPoints-1];
1781 for (
int i = 0; i < nPoints; i++)
1783 DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint);
1784 lastXpoint = xArray[i];
1785 lastYpoint = yArray[i];
1790 for (
int i = 1; i < nPoints; i++)
1792 DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]);
1798 : m_parent(parent), m_tiled(tiled),
1816 QImage tiledImage = QImage(rect.width(), rect.height(),
1817 QImage::Format_ARGB32);
1819 for (
int i = 0; i < rect.width(); i++)
1821 for (
int j = 0; j < rect.height(); j++)
1840 if (!
m_image.loadFromData(data, length,
"PNG"))
1856 if (!
m_image.loadFromData(data, length,
"JPG"))
1873 AVCodecContext *c =
nullptr;
1876 uint8_t *buff =
nullptr;
1877 bool gotPicture =
false;
1881 const AVCodec *codec = avcodec_find_decoder(AV_CODEC_ID_MPEG2VIDEO);
1890 av_packet_unref(&pkt);
1891 avcodec_free_context(&c);
1893 std::unique_ptr<
MHIBitmap,
decltype(cleanup_fn)>
cleanup {
this, cleanup_fn };
1895 c = avcodec_alloc_context3(
nullptr);
1897 if (avcodec_open2(c, codec,
nullptr) < 0)
1901 if (av_new_packet(&pkt, length) < 0)
1904 memcpy(pkt.data, data, length);
1909 for (
int limit=0; limit<10 && !gotPicture; limit++)
1911 int len = avcodec_receive_frame(c, picture);
1914 if (len == AVERROR(EAGAIN))
1917 len = avcodec_send_packet(c, &pkt);
1918 if (len == AVERROR(EAGAIN) || len == AVERROR_EOF)
1923 LOG(VB_GENERAL, LOG_ERR,
1924 QString(
"[mhi] video decode error: %1 (%2)")
1936 int nContentWidth = c->width;
1937 int nContentHeight = c->height;
1938 m_image = QImage(nContentWidth, nContentHeight, QImage::Format_ARGB32);
1942 memset(&retbuf, 0,
sizeof(
AVFrame));
1944 int bufflen = nContentWidth * nContentHeight * 3;
1945 auto *outputbuf = (
unsigned char*)av_malloc(bufflen);
1947 av_image_fill_arrays(retbuf.data, retbuf.linesize,
1948 outputbuf, AV_PIX_FMT_RGB24,
1949 nContentWidth, nContentHeight,IMAGE_ALIGN);
1953 nContentWidth, nContentHeight);
1955 uint8_t * buf = outputbuf;
1959 for (
int i = 0; i < nContentHeight; i++)
1961 for (
int j = 0; j < nContentWidth; j++)
1966 m_image.setPixel(j, i, qRgb(red, green, blue));
1969 av_freep(
reinterpret_cast<void*
>(&outputbuf));
1979 if (newWidth ==
m_image.width() && newHeight ==
m_image.height())
1982 if (newWidth <= 0 || newHeight <= 0)
1989 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