ref: 470fbfbf74b20014460021673ce75794eb3ddaee
parent: b175f65582213b620b9e9ceff31c870e92920848
author: Sam Leitch <sam@luceva.net>
date: Tue Apr 1 18:50:16 EDT 2014
Changes H264bsdRendererGl API to work with multiple decoders.
--- a/ios/src/H264bsdRendererGl.h
+++ b/ios/src/H264bsdRendererGl.h
@@ -12,9 +12,8 @@
@interface H264bsdRendererGl : NSObject
@property (strong, readonly) EAGLContext *context;
-@property (strong, readonly) H264bsdDecoder *decoder;
-- (id)initWithContext:(EAGLContext *)context decoder:(H264bsdDecoder *)decoder;
-- (void)renderNextOutputPicture;
+- (id)initWithContext:(EAGLContext *)context;
+- (void)renderNextOutputPictureWithDecoder:(H264bsdDecoder *)decoder;
@end
--- a/ios/src/H264bsdRendererGl.m
+++ b/ios/src/H264bsdRendererGl.m
@@ -49,7 +49,7 @@
@implementation H264bsdRendererGl
-- (id)initWithContext:(EAGLContext *)context decoder:(H264bsdDecoder *)decoder
+- (id)initWithContext:(EAGLContext *)context
{
self = [super init];
@@ -56,7 +56,6 @@
if(self)
{
_context = context;
- _decoder = decoder;
if(![EAGLContext setCurrentContext:context]) {
NSLog(@"failed to setup context");
@@ -142,7 +141,7 @@
glDeleteBuffers(1, &_texcoordBufferRef);
}
-- (void)renderNextOutputPicture
+- (void)renderNextOutputPictureWithDecoder:(H264bsdDecoder *)decoder
{
if(![EAGLContext setCurrentContext:self.context]) {
NSLog(@"failed to setup context");
@@ -149,11 +148,11 @@
return;
}
- NSData *yuvData = [self.decoder nextOutputPicture];
+ NSData *yuvData = [decoder nextOutputPicture];
if(!yuvData) return;
- NSInteger width = self.decoder.outputWidth;
- NSInteger height = self.decoder.outputHeight;
+ NSInteger width = decoder.outputWidth;
+ NSInteger height = decoder.outputHeight;
NSInteger uvWidth = width/2;
NSInteger uvHeight = height/2;
--- a/ios/test/h264bsd Test/ViewController.m
+++ b/ios/test/h264bsd Test/ViewController.m
@@ -78,7 +78,7 @@
return;
}
- self.renderer = [[H264bsdRendererGl alloc] initWithContext:context decoder:self.decoder];
+ self.renderer = [[H264bsdRendererGl alloc] initWithContext:context];
GLKView *view = (GLKView *)self.view;
view.delegate = self;
@@ -133,7 +133,7 @@
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
{
- [self.renderer renderNextOutputPicture];
+ [self.renderer renderNextOutputPictureWithDecoder:self.decoder];
}
@end