Definition at line 771 of file VideoAccessObject.h. References ILOG_ERROR, mFrame, mPacket, mRgbBuffer, mRgbBufferSize, mRgbFrame, mSrcAddress, and mVideoCodecCtx. Referenced by VideoAccessObject(). 00772 { 00773 mPacket = new AVPacket; 00774 mPacket->data = 0; 00775 00776 // Allocate frame for reading 00777 mFrame = avcodec_alloc_frame(); 00778 00779 // Allocate frame for RGB conversion 00780 mRgbFrame = avcodec_alloc_frame(); 00781 00782 if ((mFrame == NULL) || (mRgbFrame == NULL)) 00783 { 00784 ILOG_ERROR("Could not allocate frame memory for: " << mSrcAddress); 00785 return false; 00786 } 00787 00788 // allocate buffer to hold frame data converted to RGB; 00789 // (note the comments in avcodec.h for avpicture_get_size) 00790 mRgbBufferSize = avpicture_fill( (AVPicture*) mRgbFrame, 00791 NULL, PIX_FMT_RGB24, mVideoCodecCtx->width, mVideoCodecCtx->height); 00792 mRgbBuffer = new UInt8[mRgbBufferSize]; 00793 //ClearRgbBuffer(); 00794 00795 // Assign appropriate parts of buffer to image planes in mRgbFrame 00796 int result = avpicture_fill( (AVPicture*) mRgbFrame, 00797 mRgbBuffer, PIX_FMT_RGB24, mVideoCodecCtx->width, mVideoCodecCtx->height); 00798 00799 return true; 00800 }
|