From Stephan Huber, "thanks for your input, unfortunately I could not get it working with packing, but setting the row-length works now. Seems I had it wrong the first time.
Attached are both files. This should fix the video-bug mentioned on the dlf-wiki. "
This commit is contained in:
@@ -43,7 +43,7 @@ public:
|
||||
|
||||
~NSAutoreleasePoolHelper()
|
||||
{
|
||||
[_pool release];
|
||||
[_pool drain];
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -118,7 +118,7 @@ void OSXQTKitVideo::initializeQTKit()
|
||||
{
|
||||
EnterMovies();
|
||||
QTMovie* movie = [QTMovie movie];
|
||||
[movie release];
|
||||
movie = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -129,6 +129,8 @@ OSXQTKitVideo::OSXQTKitVideo()
|
||||
, _rate(0.0)
|
||||
, _coreVideoAdapter(NULL)
|
||||
{
|
||||
NSAutoreleasePoolHelper autorelease_pool_helper;
|
||||
|
||||
initializeQTKit();
|
||||
|
||||
_status = INVALID;
|
||||
@@ -381,21 +383,21 @@ void OSXQTKitVideo::decodeFrame(bool force)
|
||||
CFRelease(_data->lastFrame);
|
||||
CVPixelBufferRelease(_data->lastFrame);
|
||||
}
|
||||
|
||||
size_t buffer_width = CVPixelBufferGetWidth(currentFrame);
|
||||
size_t bpr = CVPixelBufferGetBytesPerRow(currentFrame);
|
||||
size_t buffer_width = CVPixelBufferGetWidth(currentFrame);
|
||||
size_t buffer_height = CVPixelBufferGetHeight(currentFrame);
|
||||
|
||||
CVPixelBufferLockBaseAddress( currentFrame, kCVPixelBufferLock_ReadOnly );
|
||||
|
||||
void* raw_pixel_data = CVPixelBufferGetBaseAddress(currentFrame);
|
||||
|
||||
|
||||
|
||||
setImage(buffer_width,buffer_height,1,
|
||||
GL_RGBA8,
|
||||
GL_BGRA,
|
||||
GL_UNSIGNED_INT_8_8_8_8_REV,
|
||||
GL_UNSIGNED_BYTE,
|
||||
(unsigned char *)raw_pixel_data,
|
||||
osg::Image::NO_DELETE,1);
|
||||
osg::Image::NO_DELETE,1, bpr/4);
|
||||
|
||||
CVPixelBufferUnlockBaseAddress( currentFrame, 0 );
|
||||
|
||||
|
||||
@@ -491,10 +491,11 @@ void OSXAVFoundationVideo::update(osg::NodeVisitor *)
|
||||
|
||||
size_t width = CVPixelBufferGetWidth(newframe);
|
||||
size_t height = CVPixelBufferGetHeight(newframe);
|
||||
size_t bpr = CVPixelBufferGetBytesPerRow(newframe);
|
||||
|
||||
// Get the base address of the pixel buffer
|
||||
void *baseAddress = CVPixelBufferGetBaseAddress(newframe);
|
||||
setImage(width, height, 1, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, (unsigned char*)baseAddress, NO_DELETE);
|
||||
setImage(width, height, 1, GL_RGBA, GL_BGRA, GL_UNSIGNED_BYTE, (unsigned char*)baseAddress, NO_DELETE, 1, bpr/4);
|
||||
// std::cout << this << " new frame: " << width << "x" << height << " " << baseAddress << std::endl;
|
||||
CVPixelBufferUnlockBaseAddress(newframe, kCVPixelBufferLock_ReadOnly);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user