[comp.sys.mac.programmer] using QuickTime compression

peirce@outpost.UUCP (Michael Peirce) (06/11/91)

I'm trying to try work with the alpha QuickTime that Apple gave out
at the WWDC.

Specifically I'm trying to use JPEG to compress a picture.

I looked at the sample code provided on the CD-ROM called 
SampleCompressPicture.  It looked fairly straightforeward to emulate.

I tried the following code fragment:


	cPict = (PicHandle) NewHandle(sizeof(Picture));
	if ((stat = CompressPicture(rPict,cPict,codecMaxQuality,'jpeg')) != noErr) {
		NumToString(stat,statStr);
		DebugStr(statStr);
	}


This always returns to me -8960, codecErr, general error.

I also tried the FCompressPicture variation with the same results.

I'm including the same include files that the sample program did and
the programs found on the CD-ROM run on my machine and will do JPEG
compression (and it looks great BYW).

The one difference between my code and the sample is that rather than
asking the user for settings, I simply ask for the best that JPEG
can supply.

Has anyone been working with QuickTime yet?

-- michael

P.S.  On a related note, I tried to use the documented Gestalt selector
too, but this always crashed on me.  The code line before was another
call to Gestalt that worked fine.

Maybe this really is alpha software :-)

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE

captkidd@athena.mit.edu (Ivan Cavero Belaunde) (06/12/91)

In article <0B01FFFB.hsyi3b@outpost.UUCP> peirce@outpost.UUCP (Michael Peirce) writes:
>I tried the following code fragment:
>	cPict = (PicHandle) NewHandle(sizeof(Picture));
>	if ((stat = CompressPicture(rPict,cPict,codecMaxQuality,'jpeg')) != noErr) {
>		NumToString(stat,statStr);
>		DebugStr(statStr);
>	}

The codec type for JPEG compression is 'JPEG', not 'jpeg'. If you look in the
QuickTime extension with ResEdit, you'll find a bunch of 'thng' resources
(Component descriptors). You can get the codectypes for the codecs from there.
The AVC uses 'rpza,' the RLE codec uses 'rle ', and the raw codec uses 'raw '
(original huh?).  There's also a 'SIVQ' decoder in there, and what it does
I have no idea, but the VQ in the name leads me to believe it's a
vector-quantization based codec (or actually, dec, since there's no compressor
in there). Hmmm......

>The one difference between my code and the sample is that rather than
>asking the user for settings, I simply ask for the best that JPEG
>can supply.

Yeah, but they use Apple's standard compression dialog (thanks again, guys.
Way cool.), which I believe scans for all available compressor components
and presents them to you in the popup. It thus gets the right type from the
descriptor itself.

>P.S.  On a related note, I tried to use the documented Gestalt selector
>too, but this always crashed on me.  The code line before was another
>call to Gestalt that worked fine.
>Maybe this really is alpha software :-)

Oh yes. Try running EvenBetterBusError with it ;-)

-Ivan Cavero Belaunde
Digital Video Applications (DiVA) Corp.
Internet: captkidd@ATHENA.MIT.EDU
Disclaimer: opinions, assholes, you know...

peirce@outpost.UUCP (Michael Peirce) (06/13/91)

In article <1991Jun11.181453.7921@athena.mit.edu>, captkidd@athena.mit.edu (Ivan Cavero Belaunde) writes:
> In article <0B01FFFB.hsyi3b@outpost.UUCP> peirce@outpost.UUCP (Michael Peirce) writes:
> >I tried the following code fragment:
> >	cPict = (PicHandle) NewHandle(sizeof(Picture));
> >	if ((stat = CompressPicture(rPict,cPict,codecMaxQuality,'jpeg')) != noErr) {
> >		NumToString(stat,statStr);
> >		DebugStr(statStr);
> >	}
> 
> The codec type for JPEG compression is 'JPEG', not 'jpeg'.

This does the trick.  Now to get Apple to correct their documentation. :-)

--  Michael Peirce         --   outpost!peirce@claris.com
--  Peirce Software        --   Suite 301, 719 Hibiscus Place
--  Macintosh Programming  --   San Jose, California 95117
--           & Consulting  --   (408) 244-6554, AppleLink: PEIRCE