Project Description

CocoaVP8 is a dual-licensed commercial/GPL Objective-C library which allows Mac and iOS applications to easily use the VP8 video codec, a high quality, royalty free, open source codec. For more information about VP8, visit www.webmproject.org. To contact the CocoaVP8 team, visit www.frozenmountain.com.

Usage

Use CocoaVP8Encoder and CocoaVP8Decoder to convert YUV buffers to and from VP8 frames. The CocoaVP8Converter class has an optimized conversion method that converts YUV buffers to BGRA buffers, useful when preparing to display an image on the screen.

- (id)init
{
    self = [super init];
    if (self)
    {
        // initialize the encoder/decoder
        _encoder = [[CocoaVP8Encoder alloc] init];
        _decoder = [[CocoaVP8Decoder alloc] init];
    }
}

- (NSMutableData *)encodeBufferYUV:(CocoaVP8BufferYUV *)bufferYUV
{
    // create NSMutableData to hold our encoded VP8 frame
    NSMutableData *frameVP8 = [[[NSMutableData alloc] init] autorelease];

    // perform the encoding, using the YUV buffer as input
    [_encoder encodeBuffer:bufferYUV toFrame:frameVP8]

    // return the encoded VP8 frame
    return frameVP8;

- (CocoaVP8BufferYUV *)decodeFrameVP8:(NSData *)frameVP8
{
    // create CocoaVP8BufferYUV to hold our YUV buffer
    CocoaVP8BufferYUV *bufferYUV = [[[CocoaVP8BufferYUV alloc] init] autorelease];

    // perform the decoding, using the encoded VP8 frame as input
    [_decoder decodeFrame:frameVP8 toBuffer:bufferYUV]

    // return the YUV buffer
    return bufferYUV;
}

- (void)dealloc
{
    [_encoder release];
    [_decoder release];
    [super dealloc];
}

Credits

CocoaVP8 is developed and maintained by Frozen Mountain Software. If you are interested in using CocoaVP8 in a commercial application, please let us know.

Last edited Jan 24, 2013 at 8:49 PM by antonvenema, version 13