[mythtv] Fwd: [mythtv-commits] mythtv branch master updated by jyavenard. v0.28-pre-1024-g9cba5e2
Craig Treleaven
ctreleaven at cogeco.ca
Fri Mar 28 15:15:42 UTC 2014
At 1:18 PM +1100 3/27/14, Jean-Yves Avenard wrote:
>On 27 March 2014 12:25, Craig Treleaven <ctreleaven at cogeco.ca> wrote:
>
>> Is it possible that the image isn't complete or is malformed so way? The
>> logging indicates it is transferred in 1428 byte chunks. Is it possible
>> that the last chunk is being dropped or padded and therefore is malformed?
>
>no... this is multi-part mime. The size of the file being received is
>known in advance. We read until we have received all the data.
>
>Also, you are receiving a proper image.
>From your log:
>Received 960x720 png photo
>
>if it reads the actual dimension and the QImage object was created, it
>means the data is valid
>
>
>You can if you want to check write the image received to disk. and
>check the file yourself.
>
>Use the following patch:
>
>diff --git a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
>b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
>index 0a6c046..7d7c118 100644
>--- a/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
>+++ b/mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp
>@@ -843,6 +843,15 @@ void
>MythAirplayServer::HandleResponse(APHTTPRequest *req,
> .arg(image.width()).arg(image.height()).
> arg(png ? "jpeg" : "png"));
>
>+ if (!image.save("/tmp/airplayimage", png ? "png" : "jpeg"))
>+ {
>+ LOG(VB_GENERAL, LOG_ERR, LOC + "Error writing image
>to disk");
>+ }
>+ QFile file("/tmp/airplayimagebin");
>+ file.open(QIODevice::WriteOnly);
>+ file.write(req->GetBody());
>+ file.close();
>+
> if (m_connections[session].notificationid < 0)
> {
> m_connections[session].notificationid =
>
>This will write two files:
>/tmp/airplayimagebin which is the file exactly as it was received
>and /tmp/airplayimage which is the QImage saved using QImage::save().
>A QImage is a bitmap internally, so that means the file will be
>re-encoded in the required format, and as such different than the
>original
>
>but you can you the finder to check what the file looks like
>
>If you are seeing a red circle where the image is supposed to be
>displayed, there will be an error somewhere, or the theme is wrong....
>check the log.
My working theory now, after a lot of spleunking, is that MacPort's
Qt is being built with a newer library version (likely libpng) which
is causing image format detection to fail.
To test that, I'd like to temporarily bypass detection. I see that
we can optionally tell QImage::fromData which image format to expect.
If I force it to be jpeg and images start displaying, that will
confirm my theory. From the Qt docs [1], that seems possible but I
don't know exactly what to feed it. In
mythtv/libs/libmythtv/AirPlay/mythairplayserver.cpp, line 837 is:
QImage image = QImage::fromData(req->GetBody());
do I replace it with
QImage image = QImage::fromData(req->GetBody(), req->GetBody().size(), "JPEG");
??
Craig
[1] http://qt-project.org/doc/qt-4.8/qimage.html#fromData
More information about the mythtv-dev
mailing list