Apple Developer Connection
Member Login Log In | Not a Member? Contact ADC

Next Page > Hide TOC

IMVideoDataSource Protocol Reference

Framework
/System/Library/Frameworks/InstantMessage.framework
Declared in
InstantMessage/IMAVManager.h
Companion guide

Overview

IMVideoDataSource is an informal protocol that an IMAVManager data source must conform to in order to provide video data to iChat AV.

To provide video when the CVPixelBuffer representation is preferred, the data source must implement both the getPixelBufferPixelFormat: and renderIntoPixelBuffer:forTime: methods. Otherwise, to provide video when the CVOpenGLBuffers representation is preferred, the data source must implement both the getOpenGLBufferContext:pixelFormat: and renderIntoOpenGLBuffer:onScreen:forTime: methods.

Tasks

Providing Pixel Buffered Video

Providing OpenGL Buffered Video

Instance Methods

getOpenGLBufferContext:pixelFormat:

Returns the pixel OpenGL buffer context and pixel format.

- (void)getOpenGLBufferContext:(CGLContextObj *)contextOut pixelFormat:(CGLPixelFormatObj *)pixelFormatOut

Parameters
contextOut

The OpenGL context to be used for the CVOpenGLBufferRef instances passed to the renderIntoOpenGLBuffer:onScreen:forTime: method.

pixelFormatOut

The OpenGL pixel format to be used for the CVOpenGLBufferRef instances passed to the renderIntoOpenGLBuffer:onScreen:forTime: method.

Discussion

This method is invoked once after setVideoDataSource: is sent to an IMAVManager object.

See Also

getPixelBufferPixelFormat:

Returns the pixel buffer format.

- (void)getPixelBufferPixelFormat:(OSType *)pixelFormatOut

Parameters
pixelFormatOut

The pixel format to be used for the CVPixelBufferRef instances passed to the renderIntoPixelBuffer:forTime: method.

Discussion

This method is invoked once after setVideoDataSource: is sent to an IMAVManager object.

See Also

renderIntoOpenGLBuffer:onScreen:forTime:

Provides data for the next video frame using OpenGL buffering.

- (BOOL)renderIntoOpenGLBuffer:(CVOpenGLBufferRef)buffer onScreen:(int *)screenInOut forTime:(CVTimeStamp *)timeStamp

Parameters
buffer

The OpenGL buffer to fill. The receiver should call the CVOpenGLBufferAttach function and then fill the buffer with video data.

screenInOut

The recommended virtual screen number to pass to the CVOpenGLBufferAttach function for maximum efficiency. The receiver may use a different screen number, but it must write that value back into screenInOut before returning.

timeStamp

The frame time for which the buffer should be rendered.

You should render a video frame that corresponds to the supplied host time, timeStamp->hostTime, and before returning from this method, change the host time to the earliest time for which the rendered video is valid. For example, if the content is a movie, then set the host time to correspond to the rendered frame—typically, slightly earlier than the original host time. If the content is a photo slideshow, then set the host time to the time the image first appeared which can be several seconds before the original host time. Adjusting the time this way helps synchronize the audio with the video track.

Return Value

Returns YES if the buffer is successfully filled with new frame data. Returns NO if nothing changed or an error was encountered.

Discussion

This method is invoked each time a frame is sent to iChat AV. This method is not invoked on the main thread.

See Also

renderIntoPixelBuffer:forTime:

Provides data for the next video frame using pixel buffering.

- (BOOL)renderIntoPixelBuffer:(CVPixelBufferRef)buffer forTime:(CVTimeStamp *)timeStamp

Parameters
buffer

The pixel buffer to fill with video data. The dimensions can vary. Use the CVPixelBufferGetWidth and CVPixelBufferGetHeight functions to get the dimensions each time this method is invoked.

timeStamp

The frame time for which the buffer should be rendered.

You should render a video frame that corresponds to the supplied host time, timeStamp->hostTime, and before returning from this method, change the host time to the earliest time for which the rendered video is valid. For example, if the content is a movie, then set the host time to correspond to the rendered frame—typically, slightly earlier than the original host time. If the content is a photo slideshow, then set the host time to the time the image first appeared which can be several seconds before the original host time. Adjusting the time this way helps synchronize the audio with the video track.

Return Value

Returns YES if the buffer is successfully filled with new frame data. Returns NO if nothing changed or an error was encountered.

Discussion

This method is invoked each time a frame is sent to iChat AV. This method is not invoked on the main thread.

See Also


Next Page > Hide TOC


Last updated: 2007-07-08




Did this document help you?
Yes: Tell us what works for you.

It’s good, but: Report typos, inaccuracies, and so forth.

It wasn’t helpful: Tell us what would have helped.
Get information on Apple products.
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Copyright © 2007 Apple Inc.
All rights reserved. | Terms of use | Privacy Notice