[Qt-interest] Quicktime C -> QImage

Stephen Chu stephen at ju-ju.com
Mon Apr 19 15:54:16 CEST 2010


In article <20100419103738.280160 at gmx.net>,
 "Alexander Carôt" <alexander_carot at gmx.net> wrote:

> ... I just figured the following:
> 
> CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider(image));
> rawData = (unsigned char*) CFDataGetBytePtr(data);
> 
> gives me the raw pixels from a CGImageRef. I already succeeded in displaying 
> my first captured Quicktime-Video-Frames on a QImage. Still some color issues 
> and so forth. I will verfiy and possibly get back later.
> 
> Thanks for your initial comments, which helped a lot.
> Best
> 

Glad to hear you made it working. I am not familiar with QuickTime. My 
work deals with our own image data directly. However, I don't think you 
need to use CGImage as an intermediate store. CoreGraphics came much 
later than QuickTime, so QuickTime must have some way to load the 
captured data into your own buffer.

Also pay attention to byte-ordering. QImage::Format_RGB32 and 
Format_ARGB32 assume that the 32-bit pixel is in host endian. That is, 
on a big-endian machine like PowerPC, the bytes in the buffer are in 
ARGBARG... sequence while on a little-endian one like x86, they are 
GBRAGBRA...

>From my (painful) experience dealing with Apple, they mostly assume 
ARGBARGB sequence regardless of host endian. Unfortunately, Qt does not 
provide an option to use reverse byte order image buffer: 
<http://bugreports.qt.nokia.com/browse/QTBUG-5200>

HTH

-- 
Stephen Chu



More information about the Qt-interest-old mailing list