[Qt-interest] Quicktime C -> QImage

Ulf-Alexander v. Ceumern-Lindenstjerna ceumern at vrmagic.com
Mon Apr 19 14:36:33 CEST 2010


FYI: C style casting is bad, hmmmmkay?

http://www2.research.att.com/~bs/bs_faq2.html#static-cast

cheers, ulf ;)

> -----Original Message-----
> From: qt-interest-bounces at trolltech.com [mailto:qt-interest-
> bounces at trolltech.com] On Behalf Of "Alexander Carôt"
> Sent: Monday, April 19, 2010 12:38 PM
> To: "Alexander Carôt"; stephen at ju-ju.com
> Cc: qt-interest at trolltech.com
> Subject: Re: [Qt-interest] Quicktime C -> QImage
> 
> ... 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
> 
> -- A l e x
> 
> 
> 
> -------- Original-Nachricht --------
> > Datum: Mon, 19 Apr 2010 11:00:01 +0200
> > Von: "Alexander Carôt" <alexander_carot at gmx.net>
> > An: Stephen Chu <stephen at ju-ju.com>
> > CC: qt-interest at trolltech.com
> > Betreff: Re: [Qt-interest] Quicktime C -> QImage
> 
> > Hi Stephen,
> >
> > thanks a lot for the swift response !
> >
> > > That is a CoreGraphics image reference. How do you actually get a
> > > QuickTime image?
> >
> > I believe this is my actual problem (I am newbie to OSX graphic (esp.
> > Quicktime) programming). How do I obtain the pixel array or pointer
> to the
> > pixel image data ? Once I have this I will load it straight into the
> QImage
> > buffer as you described below.
> >
> > Thanks a lot in advance
> >
> > -- A l e x
> >
> >
> >
> > > > and then I thought about using the QImage::setPixel(...) in this
> way:
> > > >
> > > >
> > > > ************
> > > >     unsigned int *pixels = (unsigned int *) image;
> > > >     int i = 0;
> > > >     for (int y = 0; y < 240; y++){
> > > >       for (int x = 0; x < 320; x++){
> > > >         displayImage->setPixel(x,y,pixels[i]);
> > > >         i++;
> > > >       }
> > > >     }
> > > > **************
> > >
> > > If the "image" variable is the same one you get from CGImageCreate,
> it's
> > > just a reference, not a pointer to image buffer. I am surprised it
> > > doesn't crash.
> > >
> > > setPixel is too slow for image construction. You need to create a
> QImage
> > > from the external buffer you get from QT or other source:
> > > http://qt.nokia.com/doc/4.6/qimage.html#QImage-6
> > >
> > > Or you can load the QT image directly into a QImage's owned buffer:
> > > http://qt.nokia.com/doc/4.6/qimage.html#bits
> > >
> > > HTH.
> > > _______________________________________________
> > > Qt-interest mailing list
> > > Qt-interest at trolltech.com
> > > http://lists.trolltech.com/mailman/listinfo/qt-interest
> >
> > --
> > http://www.carot.de
> > http://www.triologue.de
> > Email : Alexander at Carot.de
> > Tel.: +49 (0)177 5719797
> >
> >
> >
> > GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> > Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome01
> > _______________________________________________
> > Qt-interest mailing list
> > Qt-interest at trolltech.com
> > http://lists.trolltech.com/mailman/listinfo/qt-interest
> 
> --
> http://www.carot.de
> http://www.triologue.de
> Email : Alexander at Carot.de
> Tel.: +49 (0)177 5719797
> 
> 
> 
> GRATIS für alle GMX-Mitglieder: Die maxdome Movie-FLAT!
> Jetzt freischalten unter http://portal.gmx.net/de/go/maxdome
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list