Mac OS X Reference Library Apple Developer Connection spyglass button

IMVideoDataSource Protocol Reference

(informal protocol)

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

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. (required)

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
See Also
Declared In
IMAVManager.h

getPixelBufferPixelFormat:

Returns the pixel buffer format. (required)

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
See Also
Declared In
IMAVManager.h

renderIntoOpenGLBuffer:onScreen:forTime:

Provides data for the next video frame using OpenGL buffering. (required)

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
See Also
Declared In
IMAVManager.h

renderIntoPixelBuffer:forTime:

Provides data for the next video frame using pixel buffering. (required)

- (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.

Availability
  • Available in Mac OS X v10.5 and later.
See Also
Declared In
IMAVManager.h


Last updated: 2007-07-08

Did this document help you? Yes It's good, but... Not helpful...