Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

freemheg: Support JPEG bitmaps

Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
Signed-off-by: Stuart Morgan <smorgan@mythtv.org>
  • Loading branch information...
commit abc52edc1fbd4bc5eb7a19c633f9de4ef2da1dce 1 parent 0a864fd
Lawrence Rust authored stuartm committed
View
5 mythtv/libs/libmythfreemheg/Bitmap.cpp
@@ -169,7 +169,10 @@ void MHBitmap::CreateContent(const unsigned char *data, int length, MHEngine *en
{
m_pContent->CreateFromMPEG(data, length);
}
-
+ else if (nCHook == 6) // JPEG ISO/IEC 10918-1, JFIF file
+ {
+ m_pContent->CreateFromJPEG(data, length);
+ }
else
{
// 1,3,5,8 are reserved. 7= H.264 Intra Frame
View
1  mythtv/libs/libmythfreemheg/freemheg.h
@@ -191,6 +191,7 @@ class MHBitmapDisplay
// Creation functions
virtual void CreateFromPNG(const unsigned char *data, int length) = 0;
virtual void CreateFromMPEG(const unsigned char *data, int length) = 0;
+ virtual void CreateFromJPEG(const unsigned char *data, int length) = 0;
// Scale the bitmap. Only used for image derived from MPEG I-frames.
virtual void ScaleImage(int newWidth, int newHeight) = 0;
// Information about the image.
View
16 mythtv/libs/libmythtv/mhi.cpp
@@ -1495,6 +1495,22 @@ void MHIBitmap::CreateFromPNG(const unsigned char *data, int length)
m_opaque = ! m_image.hasAlphaChannel();
}
+// Create a bitmap from JPEG.
+//virtual
+void MHIBitmap::CreateFromJPEG(const unsigned char *data, int length)
+{
+ m_image = QImage();
+
+ if (!m_image.loadFromData(data, length, "JPG"))
+ {
+ m_image = QImage();
+ return;
+ }
+
+ // Assume that if it has an alpha buffer then it's partly transparent.
+ m_opaque = ! m_image.hasAlphaChannel();
+}
+
// Convert an MPEG I-frame into a bitmap. This is used as the way of
// sending still pictures. We convert the image to a QImage even
// though that actually means converting it from YUV and eventually
View
3  mythtv/libs/libmythtv/mhi.h
@@ -231,6 +231,9 @@ class MHIBitmap : public MHBitmapDisplay
/// Create bitmap from single I frame MPEG
virtual void CreateFromMPEG(const unsigned char *data, int length);
+ /// Create bitmap from JPEG
+ virtual void CreateFromJPEG(const unsigned char *data, int length);
+
/** \fn MHIBitmap::Draw(int,int,QRect,bool)
* \brief Draw the completed drawing onto the display.
*
Please sign in to comment.
Something went wrong with that request. Please try again.