Skip to content

Commit

Permalink
Merge branch 'master' of github.com:openframeworks/openFrameworks
Browse files Browse the repository at this point in the history
  • Loading branch information
arturoc committed Jul 20, 2011
2 parents e54a36e + 0d71321 commit 727c731
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
6 changes: 6 additions & 0 deletions apps/iPhoneAddonsExamples/xmlSettingsExample/src/testApp.mm
Expand Up @@ -4,6 +4,12 @@
//--------------------------------------------------------------
void testApp::setup(){

// register touch events
ofxRegisterMultitouch(this);

//iPhoneAlerts will be sent to this.
ofxiPhoneAlerts.addListener(this);

ofxiPhoneSetOrientation(OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT);

ofBackground(255,255,255);
Expand Down
11 changes: 7 additions & 4 deletions libs/openFrameworks/video/ofiPhoneVideoPlayer.mm
Expand Up @@ -111,7 +111,8 @@
//----------------------------------------

unsigned char * ofiPhoneVideoPlayer::getPixels() {
if(videoPlayer != NULL)

if(videoPlayer != NULL && isPlaying())
{
CGImageRef currentFrameRef;

Expand Down Expand Up @@ -144,7 +145,7 @@
/*We unlock the image buffer*/
CVPixelBufferUnlockBaseAddress(imageBuffer,0);

if(width==0 && widthIn != 0 && pixels != NULL) {
if(width==0 && widthIn != 0 && pixels == NULL) {
if(internalGLFormat == GL_RGB)
pixels = (GLubyte *) malloc(widthIn * heightIn * 3);
else
Expand All @@ -163,7 +164,7 @@
CGContextRef spriteContext;

spriteContext = CGBitmapContextCreate(pixelsTmp, width, height, CGImageGetBitsPerComponent(currentFrameRef), width * 4, CGImageGetColorSpace(currentFrameRef), kCGImageAlphaPremultipliedLast);

CGContextDrawImage(spriteContext, CGRectMake(0.0, 0.0, (CGFloat)width, (CGFloat)height), currentFrameRef);

CGContextRelease(spriteContext);
Expand Down Expand Up @@ -202,13 +203,15 @@
uint8_t *bufferPixels = (uint8_t *)CVPixelBufferGetBaseAddress(imageBuffer);

if(width != min(size_t(1024),CVPixelBufferGetWidth(imageBuffer))) {

if(videoTexture.bAllocated())
videoTexture.clear();

int widthIn = min(size_t(1024),CVPixelBufferGetWidth(imageBuffer));
int heightIn = min(size_t(1024),CVPixelBufferGetHeight(imageBuffer));

if( width==0 && widthIn != 0 && pixels != NULL) {
if( width==0 && widthIn != 0 && pixels == NULL) {

if(internalGLFormat == GL_RGB)
pixels = (GLubyte *) malloc(widthIn * heightIn * 3);
else
Expand Down

0 comments on commit 727c731

Please sign in to comment.