Ticket #10019: 0005-freemheg-Support-JPEG-bitmaps.patch

File 0005-freemheg-Support-JPEG-bitmaps.patch, 3.2 KB (added by Lawrence Rust <lvr@…>, 13 years ago)
  • mythtv/libs/libmythfreemheg/Bitmap.cpp

    From 26b5a01d5592f488af3f6d056c546032bd016ebd Mon Sep 17 00:00:00 2001
    From: Lawrence Rust <lvr@softsystem.co.uk>
    Date: Mon, 18 Jul 2011 20:32:19 +0200
    Subject: [PATCH 5/9] freemheg: Support JPEG bitmaps
    
    Signed-off-by: Lawrence Rust <lvr@softsystem.co.uk>
    ---
     mythtv/libs/libmythfreemheg/Bitmap.cpp |    5 ++++-
     mythtv/libs/libmythfreemheg/freemheg.h |    1 +
     mythtv/libs/libmythtv/mhi.cpp          |   16 ++++++++++++++++
     mythtv/libs/libmythtv/mhi.h            |    3 +++
     4 files changed, 24 insertions(+), 1 deletions(-)
    
    diff --git a/mythtv/libs/libmythfreemheg/Bitmap.cpp b/mythtv/libs/libmythfreemheg/Bitmap.cpp
    index 6e6bbc4..522175d 100644
    a b void MHBitmap::CreateContent(const unsigned char *data, int length, MHEngine *en 
    169169    {
    170170        m_pContent->CreateFromMPEG(data, length);
    171171    }
    172 
     172    else if (nCHook == 6) // JPEG ISO/IEC 10918-1, JFIF file
     173    {
     174        m_pContent->CreateFromJPEG(data, length);
     175    }
    173176    else
    174177    {
    175178        // 1,3,5,8 are reserved. 7= H.264 Intra Frame
  • mythtv/libs/libmythfreemheg/freemheg.h

    diff --git a/mythtv/libs/libmythfreemheg/freemheg.h b/mythtv/libs/libmythfreemheg/freemheg.h
    index 0b61f65..327818a 100644
    a b class MHBitmapDisplay 
    191191    // Creation functions
    192192    virtual void CreateFromPNG(const unsigned char *data, int length) = 0;
    193193    virtual void CreateFromMPEG(const unsigned char *data, int length) = 0;
     194    virtual void CreateFromJPEG(const unsigned char *data, int length) = 0;
    194195    // Scale the bitmap.  Only used for image derived from MPEG I-frames.
    195196    virtual void ScaleImage(int newWidth, int newHeight) = 0;
    196197    // Information about the image.
  • mythtv/libs/libmythtv/mhi.cpp

    diff --git a/mythtv/libs/libmythtv/mhi.cpp b/mythtv/libs/libmythtv/mhi.cpp
    index 1631495..d268fb4 100644
    a b void MHIBitmap::CreateFromPNG(const unsigned char *data, int length) 
    14931493    m_opaque = ! m_image.hasAlphaChannel();
    14941494}
    14951495
     1496// Create a bitmap from JPEG.
     1497//virtual
     1498void MHIBitmap::CreateFromJPEG(const unsigned char *data, int length)
     1499{
     1500    m_image = QImage();
     1501
     1502    if (!m_image.loadFromData(data, length, "JPG"))
     1503    {
     1504        m_image = QImage();
     1505        return;
     1506    }
     1507
     1508    // Assume that if it has an alpha buffer then it's partly transparent.
     1509    m_opaque = ! m_image.hasAlphaChannel();
     1510}
     1511
    14961512// Convert an MPEG I-frame into a bitmap.  This is used as the way of
    14971513// sending still pictures.  We convert the image to a QImage even
    14981514// though that actually means converting it from YUV and eventually
  • mythtv/libs/libmythtv/mhi.h

    diff --git a/mythtv/libs/libmythtv/mhi.h b/mythtv/libs/libmythtv/mhi.h
    index 2b10c8b..5174cc7 100644
    a b class MHIBitmap : public MHBitmapDisplay 
    231231    /// Create bitmap from single I frame MPEG
    232232    virtual void CreateFromMPEG(const unsigned char *data, int length);
    233233
     234    /// Create bitmap from JPEG
     235    virtual void CreateFromJPEG(const unsigned char *data, int length);
     236
    234237    /** \fn MHIBitmap::Draw(int,int,QRect,bool)
    235238     *  \brief Draw the completed drawing onto the display.
    236239     *