Neowert
2004.07.27, 04:14 AM
So I am trying to tinker with ichat to put a watermark on every frame from the isight. I think I got pretty far for not knowing quicktime that well. So far I have a callback that is called each a frame comes from the isight. My callback is a bit messy, but you should get the idea. Since it is ichat, I cannot just draw to the ichat window, or the reciever would not see my watermark. I cannot seem to change anything. Here is the callback:
ComponentResult MySGGrabBottleProc (SGChannel c, short bufferNum, long refCon ){
//apeprintf("Called Bottle Proc\n");
ComponentResult err;
GWorldPtr filterBuf;
Rect filterRect;
Boolean done;
err = SGGrabFrame(c, bufferNum);
err = SGGrabFrameComplete(c, bufferNum, &done);
if(done){
PixMapHandle bufferPM;
Rect bufferRect;
err = SGGetBufferInfo (c, bufferNum, &bufferPM, &bufferRect, &filterBuf, nil);
bufferRect.bottom = 5;
bufferRect.right = 5;
SGSetCompressBuffer(c, 0, &bufferRect);
if (!err) {
//draw watermark
//SetPortPix(GetGWorldPixMap(filterBuf));
/* draw some text into the buffer */
//TextMode (srcXor);
//MoveTo (bufferRect.right - 20, bufferRect.bottom - 14);
//DrawString ("\pQT");
//TextMode(srcOr);
}
}
return err;
}
Just some info about ichat: It uses SGNewChannel to open a channel. SGDataProc is also called each frame. SGGrabBottleCompleProc (or something named like that) is not called. Neither are the series of DecompressSequence begin functions. Actually, DecompressSequenceBegin is called once.
ComponentResult MySGGrabBottleProc (SGChannel c, short bufferNum, long refCon ){
//apeprintf("Called Bottle Proc\n");
ComponentResult err;
GWorldPtr filterBuf;
Rect filterRect;
Boolean done;
err = SGGrabFrame(c, bufferNum);
err = SGGrabFrameComplete(c, bufferNum, &done);
if(done){
PixMapHandle bufferPM;
Rect bufferRect;
err = SGGetBufferInfo (c, bufferNum, &bufferPM, &bufferRect, &filterBuf, nil);
bufferRect.bottom = 5;
bufferRect.right = 5;
SGSetCompressBuffer(c, 0, &bufferRect);
if (!err) {
//draw watermark
//SetPortPix(GetGWorldPixMap(filterBuf));
/* draw some text into the buffer */
//TextMode (srcXor);
//MoveTo (bufferRect.right - 20, bufferRect.bottom - 14);
//DrawString ("\pQT");
//TextMode(srcOr);
}
}
return err;
}
Just some info about ichat: It uses SGNewChannel to open a channel. SGDataProc is also called each frame. SGGrabBottleCompleProc (or something named like that) is not called. Neither are the series of DecompressSequence begin functions. Actually, DecompressSequenceBegin is called once.