Ticket #5606: mheg-qt4.patch
File mheg-qt4.patch, 18.1 KB (added by , 17 years ago) |
---|
-
configure
1173 1173 enable ivtv 1174 1174 enable lamemp3 1175 1175 enable lirc 1176 disable mheg1176 enable mheg 1177 1177 enable opengl 1178 1178 enable qtwebkit 1179 1179 enable v4l -
libs/libmythtv/libmythtv.pro
3 3 4 4 QT += network xml sql 5 5 using_dbox2:QT *= qt3support 6 using_mheg:QT *= qt3support7 6 8 7 TEMPLATE = lib 9 8 TARGET = mythtv-$$LIBVERSION -
libs/libmythtv/dsmcccache.h
19 19 { 20 20 public: 21 21 DSMCCCacheKey() {} 22 DSMCCCacheKey(const char * data, int size): 23 QByteArray(data, size) {} 22 24 QString toString(void) const; 23 25 // Operator used in < for DSMCCCacheReference 24 26 friend bool operator < (const DSMCCCacheKey &key1, -
libs/libmythtv/dsmccobjcarousel.cpp
67 67 68 68 if (m_blocks[ddb->block_number] == NULL) 69 69 { // We haven't seen this block before. 70 QByteArray *block = new QByteArray; 71 block->duplicate((char*) data, ddb->len); 70 QByteArray *block = new QByteArray((char*) data, ddb->len); 72 71 // Add this to our set of blocks. 73 72 m_blocks[ddb->block_number] = block; 74 73 m_receivedData += ddb->len; -
libs/libmythtv/dsmcccache.cpp
200 200 void DSMCCCache::AddFileInfo(DSMCCCacheDir *pDir, const BiopBinding *pBB) 201 201 { 202 202 QString name; 203 name .setAscii(pBB->m_name.m_comps[0].m_id203 name = QString::fromAscii(pBB->m_name.m_comps[0].m_id 204 204 /*, pBB->m_name.m_comps[0].m_id_len*/); 205 205 206 206 const DSMCCCacheReference *entry = … … 218 218 { 219 219 // Is it already there? 220 220 QString name; 221 name .setAscii(pBB->m_name.m_comps[0].m_id221 name = QString::fromAscii(pBB->m_name.m_comps[0].m_id 222 222 /*, pBB->m_name.m_comps[0].m_id_len*/); 223 223 const DSMCCCacheReference *entry = 224 224 pBB->m_ior.m_profile_body->GetReference(); -
libs/libmythtv/mhi.h
18 18 #include <QString> 19 19 #include <QWaitCondition> 20 20 #include <QImage> 21 #include <q3pointarray.h>22 21 23 22 // MythTV headers 24 23 #include "../libmythfreemheg/freemheg.h" … … 288 287 virtual void DrawOval(int x, int y, int width, int height); 289 288 virtual void DrawArcSector(int x, int y, int width, int height, 290 289 int start, int arc, bool isSector); 291 virtual void DrawPoly(bool isFilled, const Q3PointArray &points);290 virtual void DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray); 292 291 293 292 protected: 294 293 void DrawRect(int x, int y, int width, int height, MHRgba colour); -
libs/libmythtv/dsmccbiop.cpp
173 173 (buf[off + 2] << 8) | (buf[off + 3])); 174 174 off += 4; 175 175 uint nObjLen = buf[off++]; 176 m_objkey .duplicate((const char*)buf + off, nObjLen);176 m_objkey = DSMCCCacheKey((const char*)buf + off, nObjLen); 177 177 off += nObjLen; 178 178 m_objkind_len = ((buf[off + 0] << 24) | (buf[off + 1] << 16) | 179 179 (buf[off + 2] << 8) | (buf[off + 3])); … … 277 277 DSMCCCacheReference ref(cachep->CarouselId(), cachep->ModuleId(), 278 278 cachep->StreamId(), m_objkey); 279 279 280 QByteArray filedata; 281 filedata.duplicate((const char *)data+(*curp), content_len); 280 QByteArray filedata = QByteArray((const char *)data+(*curp), content_len); 282 281 filecache->CacheFileData(ref, filedata); 283 282 284 283 (*curp) += content_len; … … 416 415 version_major = data[off++]; 417 416 version_minor = data[off++]; 418 417 uint objKeyLen = data[off++]; /* <= 4 */ 419 m_Reference.m_Key .duplicate((char*)data + off, objKeyLen);418 m_Reference.m_Key = DSMCCCacheKey((char*)data + off, objKeyLen); 420 419 off += objKeyLen; 421 420 return off; 422 421 } -
libs/libmythtv/mhi.cpp
3 3 #include <QRegion> 4 4 #include <qbitarray.h> 5 5 6 #include <Q 3MemArray>6 #include <QVector> 7 7 8 8 #include "mhi.h" 9 9 #include "osd.h" … … 847 847 GetHeight() / MHIContext::StdDisplayHeight, 848 848 Qt::IgnoreAspectRatio, 849 849 Qt::SmoothTransformation); 850 AddToDisplay(q_scaled.convert Depth(32),850 AddToDisplay(q_scaled.convertToFormat(QImage::Format_ARGB32), 851 851 x * GetWidth() / MHIContext::StdDisplayWidth, 852 852 y * GetHeight() / MHIContext::StdDisplayHeight); 853 853 } 854 854 else if (!displayRect.isEmpty()) 855 855 { // We must clip the image. 856 QImage clipped = qImage.convert Depth(32)856 QImage clipped = qImage.convertToFormat(QImage::Format_ARGB32) 857 857 .copy(displayRect.x() - x, displayRect.y() - y, 858 858 displayRect.width(), displayRect.height()); 859 859 QImage q_scaled = … … 876 876 // the screen that is not covered with other visibles. 877 877 void MHIContext::DrawBackground(const QRegion ®) 878 878 { 879 if (reg.is Null() || reg.isEmpty())879 if (reg.isEmpty()) 880 880 return; 881 881 882 882 QRect bounds = reg.boundingRect(); … … 1312 1312 // Ovals (ellipses) 1313 1313 void MHIDLA::DrawOval(int x, int y, int width, int height) 1314 1314 { 1315 // Simple but inefficient way of drawing a ellipse. 1316 Q3PointArray ellipse; 1317 ellipse.makeEllipse(x, y, width, height); 1318 DrawPoly(true, ellipse); 1315 // Not implemented. Not actually used in practice. 1319 1316 } 1320 1317 1321 1318 // Arcs and sectors 1322 1319 void MHIDLA::DrawArcSector(int x, int y, int width, int height, 1323 1320 int start, int arc, bool isSector) 1324 1321 { 1325 Q3PointArray points; 1326 // MHEG and Qt both measure arcs as angles anticlockwise from 1327 // the 3 o'clock position but MHEG uses 64ths of a degree 1328 // whereas Qt uses 16ths. 1329 points.makeArc(x, y, width, height, start/4, arc/4); 1330 if (isSector) 1331 { 1332 // Have to add the centre as a point and fill the figure. 1333 if (arc != 360*64) 1334 points.putPoints(points.size(), 1, x+width/2, y+height/2); 1335 DrawPoly(true, points); 1336 } 1337 else 1338 DrawPoly(false, points); 1322 // Not implemented. Not actually used in practice. 1339 1323 } 1340 1324 1341 1325 // Polygons. This is used directly and also to draw other figures. … … 1344 1328 // a result of rounding when drawing ellipses. 1345 1329 typedef struct { int yBottom, yTop, xBottom; float slope; } lineSeg; 1346 1330 1347 void MHIDLA::DrawPoly(bool isFilled, const Q3PointArray &points)1331 void MHIDLA::DrawPoly(bool isFilled, int nPoints, const int *xArray, const int *yArray) 1348 1332 { 1349 int nPoints = points.size();1350 1333 if (nPoints < 2) 1351 1334 return; 1352 1335 1353 1336 if (isFilled) 1354 1337 { 1355 Q 3MemArray<lineSeg> lineArray(nPoints);1338 QVector <lineSeg> lineArray(nPoints); 1356 1339 int nLines = 0; 1357 1340 // Initialise the line segment array. Include all lines 1358 1341 // apart from horizontal. Close the polygon by starting 1359 1342 // with the last point in the array. 1360 int lastX = points[nPoints-1].x(); // Last point1361 int lastY = points[nPoints-1].y();1343 int lastX = xArray[nPoints-1]; // Last point 1344 int lastY = yArray[nPoints-1]; 1362 1345 int yMin = lastY, yMax = lastY; 1363 1346 for (int k = 0; k < nPoints; k++) 1364 1347 { 1365 int thisX = points[k].x();1366 int thisY = points[k].y();1348 int thisX = xArray[k]; 1349 int thisY = yArray[k]; 1367 1350 if (lastY != thisY) 1368 1351 { 1369 1352 if (lastY > thisY) … … 1418 1401 } 1419 1402 1420 1403 // Draw the boundary 1421 QPoint last = points[nPoints-1]; // Last point 1404 int lastXpoint = xArray[nPoints-1]; // Last point 1405 int lastYpoint = yArray[nPoints-1]; 1422 1406 for (int i = 0; i < nPoints; i++) 1423 1407 { 1424 DrawLine(points[i].x(), points[i].y(), last.x(), last.y()); 1425 last = points[i]; 1408 DrawLine(xArray[i], yArray[i], lastXpoint, lastYpoint); 1409 lastXpoint = xArray[i]; 1410 lastYpoint = yArray[i]; 1426 1411 } 1427 1412 } 1428 1413 else // PolyLine - draw lines between the points but don't close it. 1429 1414 { 1430 1415 for (int i = 1; i < nPoints; i++) 1431 1416 { 1432 DrawLine( points[i].x(), points[i].y(), points[i-1].x(), points[i-1].y());1417 DrawLine(xArray[i], yArray[i], xArray[i-1], yArray[i-1]); 1433 1418 } 1434 1419 } 1435 1420 } … … 1443 1428 return; 1444 1429 // Construct an image the size of the bounding box and tile the 1445 1430 // bitmap over this. 1446 QImage tiledImage = QImage(rect.width(), rect.height(), 1447 m_image.depth()); 1431 QImage tiledImage = QImage(rect.width(), rect.height(), QImage::Format_ARGB32); 1448 1432 1449 for (int i = 0; i < rect.width(); i += m_image.width())1433 for (int i = 0; i < rect.width(); i++) 1450 1434 { 1451 for (int j = 0; j < rect.height(); j += m_image.height())1435 for (int j = 0; j < rect.height(); j++) 1452 1436 { 1453 bitBlt( &tiledImage, i, j, &m_image, 0, 0, -1, -1, (Qt::ImageConversionFlags)0);1437 tiledImage.setPixel(i, j, m_image.pixel(i % m_image.width(), j % m_image.height())); 1454 1438 } 1455 1439 } 1456 1440 m_parent->DrawImage(rect.x(), rect.y(), rect, tiledImage); … … 1464 1448 // Create a bitmap from PNG. 1465 1449 void MHIBitmap::CreateFromPNG(const unsigned char *data, int length) 1466 1450 { 1467 m_image .reset();1451 m_image = QImage(); 1468 1452 1469 1453 if (!m_image.loadFromData(data, length, "PNG")) 1470 1454 { 1471 m_image .reset();1455 m_image = QImage(); 1472 1456 return; 1473 1457 } 1474 1458 1475 1459 // Assume that if it has an alpha buffer then it's partly transparent. 1476 m_opaque = ! m_image.hasAlpha Buffer();1460 m_opaque = ! m_image.hasAlphaChannel(); 1477 1461 } 1478 1462 1479 1463 // Convert an MPEG I-frame into a bitmap. This is used as the way of … … 1487 1471 AVFrame *picture = NULL; 1488 1472 uint8_t *buff = NULL, *buffPtr; 1489 1473 int gotPicture = 0, len; 1490 m_image .reset();1474 m_image = QImage(); 1491 1475 1492 1476 // Find the mpeg2 video decoder. 1493 1477 AVCodec *codec = avcodec_find_decoder(CODEC_ID_MPEG2VIDEO); … … 1579 1563 1580 1564 if (newWidth <= 0 || newHeight <= 0) 1581 1565 { // This would be a bit silly but handle it anyway. 1582 m_image .reset();1566 m_image = QImage(); 1583 1567 return; 1584 1568 } 1585 1569 -
libs/libmythfreemheg/Engine.cpp
218 218 219 219 // Save the path we use for this app. 220 220 pProgram->m_Path = csPath; // Record the path 221 int nPos = pProgram->m_Path. findRev('/');221 int nPos = pProgram->m_Path.lastIndexOf('/'); 222 222 if (nPos < 0) pProgram->m_Path = ""; 223 223 else pProgram->m_Path = pProgram->m_Path.left(nPos); 224 224 // Have now got the application. … … 352 352 if (str.Size() != 0) csPath = QString::fromUtf8((const char *)str.Bytes(), str.Size()); 353 353 if (csPath.left(4) == "DSM:") csPath = csPath.mid(4); // Remove DSM: 354 354 // If it has any other prefix this isn't a request for a carousel object. 355 int firstColon = csPath. find(':'), firstSlash = csPath.find('/');355 int firstColon = csPath.indexOf(':'), firstSlash = csPath.indexOf('/'); 356 356 if (firstColon > 0 && firstSlash > 0 && firstColon < firstSlash) 357 357 return QString(); 358 358 … … 364 364 } 365 365 // Remove any occurrences of x/../ 366 366 int nPos; 367 while ((nPos = csPath. find("/../")) >= 0) {367 while ((nPos = csPath.indexOf("/../")) >= 0) { 368 368 int nEnd = nPos+4; 369 369 while (nPos >= 1 && csPath[nPos-1] != '/') nPos--; 370 370 csPath = csPath.left(nPos) + csPath.mid(nEnd); -
libs/libmythfreemheg/DynamicLineArt.h
26 26 #include "Visible.h" 27 27 #include "BaseActions.h" 28 28 29 #include <Q3PointArray>30 31 32 29 class MHDynamicLineArt; 33 30 class MHDLADisplay; 34 31 … … 66 63 virtual void DrawLine(int x1, int y1, int x2, int y2, MHEngine *); 67 64 virtual void DrawOval(int x1, int y1, int width, int height, MHEngine *); 68 65 virtual void DrawRectangle(int x1, int y1, int x2, int y2, MHEngine *); 69 virtual void DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *);66 virtual void DrawPoly(bool fIsPolygon, int nPoints, const int *xArray, const int *yArray, MHEngine *); 70 67 71 68 protected: 72 69 MHDLADisplay *m_picture; // The sequence of drawing actions. -
libs/libmythfreemheg/Root.h
30 30 class MHIngredient; 31 31 class MHEngine; 32 32 33 #include <q3pointarray.h>34 35 33 enum EventType { EventIsAvailable = 1, EventContentAvailable, EventIsDeleted, EventIsRunning, EventIsStopped, 36 34 EventUserInput, EventAnchorFired, EventTimerFired, EventAsyncStopped, EventInteractionCompleted, 37 35 EventTokenMovedFrom, EventTokenMovedTo, EventStreamEvent, EventStreamPlaying, EventStreamStopped, … … 165 163 virtual void GetLineStyle(MHRoot */*pResult*/) { InvalidAction("GetLineStyle"); } 166 164 virtual void GetLineColour(MHRoot */*pResult*/) { InvalidAction("GetLineColour"); } 167 165 virtual void GetFillColour(MHRoot */*pResult*/) { InvalidAction("GetFillColour"); } 168 virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/, int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); } 166 virtual void DrawArcSector(bool /*fIsSector*/, int /*x*/, int /*y*/, int /*width*/, int /*height*/, int /*start*/, 167 int /*arc*/, MHEngine *) { InvalidAction("DrawArc/Sector"); } 169 168 virtual void DrawLine(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawLine"); } 170 169 virtual void DrawOval(int /*x1*/, int /*y1*/, int /*width*/, int /*height*/, MHEngine *) { InvalidAction("DrawOval"); } 171 170 virtual void DrawRectangle(int /*x1*/, int /*y1*/, int /*x2*/, int /*y2*/, MHEngine *) { InvalidAction("DrawRectangle"); } 172 virtual void DrawPoly(bool /*fIsPolygon*/, const Q3PointArray &/*points*/, MHEngine *) { InvalidAction("DrawPoly(gon/line)"); } 171 virtual void DrawPoly(bool /*fIsPolygon*/, int /*nPoints*/, const int */*xArray*/, const int */*yArray*/, MHEngine *) 172 { InvalidAction("DrawPoly(gon/line)"); } 173 173 174 174 // Actions on Video streams. 175 175 virtual void ScaleVideo(int /*xScale*/, int /*yScale*/, MHEngine *) { InvalidAction("ScaleVideo"); } -
libs/libmythfreemheg/libmythfreemheg.pro
24 24 25 25 LIBS += $$EXTRA_LIBS 26 26 27 #The following line was inserted by qt3to428 QT += network xml sql qt3support29 30 27 include ( ../libs-targetfix.pro ) 28 -
libs/libmythfreemheg/DynamicLineArt.cpp
29 29 #include "ASN1Codes.h" 30 30 #include "Engine.h" 31 31 #include "freemheg.h" 32 #include <Q3PointArray>33 32 34 33 MHDynamicLineArt::MHDynamicLineArt() 35 34 { … … 156 155 engine->Redraw(GetVisibleArea()); 157 156 } 158 157 159 void MHDynamicLineArt::DrawPoly(bool fIsPolygon, const Q3PointArray &points, MHEngine *engine)158 void MHDynamicLineArt::DrawPoly(bool fIsPolygon, int nPoints, const int xArray[], const int yArray[], MHEngine *engine) 160 159 { 161 m_picture->DrawPoly(fIsPolygon, points);160 m_picture->DrawPoly(fIsPolygon, nPoints, xArray, yArray); 162 161 engine->Redraw(GetVisibleArea()); 163 162 } 164 163 … … 178 177 179 178 void MHDrawPoly::Perform(MHEngine *engine) 180 179 { 181 Q3PointArray points(m_Points.Size()); 182 for (int i = 0; i < m_Points.Size(); i++) { 180 int nPoints = m_Points.Size(); 181 int *xArray = new int[nPoints]; 182 int *yArray = new int[nPoints]; 183 for (int i = 0; i < nPoints; i++) { 183 184 MHPointArg *pPoint = m_Points[i]; 184 points.setPoint(i, pPoint->x.GetValue(engine), pPoint->y.GetValue(engine)); 185 xArray[i] = pPoint->x.GetValue(engine); 186 yArray[i] = pPoint->y.GetValue(engine); 185 187 } 186 Target(engine)->DrawPoly(m_fIsPolygon, points, engine); 188 Target(engine)->DrawPoly(m_fIsPolygon, nPoints, xArray, yArray, engine); 189 delete[](xArray); 190 delete[](yArray); 187 191 } 188 192 189 193 void MHDrawPoly::PrintArgs(FILE *fd, int /*nTabs*/) const -
libs/libmythfreemheg/freemheg.h
23 23 #define FREEMHEG_H 24 24 25 25 #include <qregion.h> 26 #include <Q3PointArray>27 26 #include <stdio.h> 28 27 #include <stdlib.h> 29 28 … … 159 158 virtual void DrawBorderedRectangle(int x, int y, int width, int height) = 0; 160 159 virtual void DrawOval(int x, int y, int width, int height) = 0; 161 160 virtual void DrawArcSector(int x, int y, int width, int height, int start, int arc, bool isSector) = 0; 162 virtual void DrawPoly(bool isFilled, const Q3PointArray &points) = 0;161 virtual void DrawPoly(bool isFilled, int nPoints, const int xArray[], const int yArray[]) = 0; 163 162 }; 164 163 165 164 class MHTextDisplay {