Changeset 42341 in vbox
- Timestamp:
- Jul 24, 2012 9:35:00 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.cpp
r42340 r42341 44 44 */ 45 45 extern "C" DECLEXPORT(HRESULT) VBoxRegisterFFmpegFB(ULONG width, 46 ULONG height, ULONG bitrate,47 com::Bstr filename,48 IFramebuffer **retVal)46 ULONG height, ULONG bitrate, 47 com::Bstr filename, 48 IFramebuffer **retVal) 49 49 { 50 50 Log2(("VBoxRegisterFFmpegFB: called\n")); … … 110 110 /* For temporary RGB frame we allocate enough memory to deal with 111 111 RGB16 to RGB32 */ 112 mTempRGBBuffer = reinterpret_cast<uint8_t *>( malloc(cPixels * 4));113 if ( mTempRGBBuffer == 0)112 mTempRGBBuffer = reinterpret_cast<uint8_t *>(RTMemAlloc(cPixels * 4)); 113 if (!mTempRGBBuffer) 114 114 goto nomem_temp_rgb_buffer; 115 mYUVBuffer = reinterpret_cast<uint8_t *>( malloc(mYUVFrameSize));116 if ( mYUVBuffer == 0)115 mYUVBuffer = reinterpret_cast<uint8_t *>(RTMemAlloc(mYUVFrameSize)); 116 if (!mYUVBuffer) 117 117 goto nomem_yuv_buffer; 118 118 return; … … 121 121 nomem_yuv_buffer: 122 122 Log(("Failed to allocate memory for mYUVBuffer\n")); 123 free(mYUVBuffer);123 RTMemFree(mYUVBuffer); 124 124 nomem_temp_rgb_buffer: 125 125 Log(("Failed to allocate memory for mTempRGBBuffer\n")); 126 free(mTempRGBBuffer);126 RTMemFree(mTempRGBBuffer); 127 127 mOutOfMemory = true; 128 128 #else … … 133 133 RGB16 to RGB32 */ 134 134 mTempRGBBuffer = reinterpret_cast<uint8_t *>(av_malloc(cPixels * 4)); 135 if ( mTempRGBBuffer == 0)135 if (!mTempRGBBuffer) 136 136 goto nomem_temp_rgb_buffer; 137 137 mYUVBuffer = reinterpret_cast<uint8_t *>(av_malloc(mYUVFrameSize)); 138 if ( mYUVBuffer == 0)138 if (!mYUVBuffer) 139 139 goto nomem_yuv_buffer; 140 140 mFrame = avcodec_alloc_frame(); 141 if ( mFrame == 0)141 if (!mFrame) 142 142 goto nomem_mframe; 143 143 mOutBuf = reinterpret_cast<uint8_t *>(av_malloc(mYUVFrameSize * 2)); 144 if ( mOutBuf == 0)144 if (!mOutBuf) 145 145 goto nomem_moutbuf; 146 146 … … 189 189 190 190 /* We have already freed the stream above */ 191 if (mTempRGBBuffer != 0)192 free(mTempRGBBuffer);193 if (mYUVBuffer != 0)194 free(mYUVBuffer);195 if (mRGBBuffer != 0)191 if (mTempRGBBuffer) 192 RTMemFree(mTempRGBBuffer); 193 if (mYUVBuffer) 194 RTMemFree(mYUVBuffer); 195 if (mRGBBuffer) 196 196 RTMemFree(mRGBBuffer); 197 197 #else … … 232 232 /* We have already freed the stream above */ 233 233 mpStream = 0; 234 if (mTempRGBBuffer != 0)234 if (mTempRGBBuffer) 235 235 av_free(mTempRGBBuffer); 236 if (mYUVBuffer != 0)236 if (mYUVBuffer) 237 237 av_free(mYUVBuffer); 238 if (mFrame != 0)238 if (mFrame) 239 239 av_free(mFrame); 240 if (mOutBuf != 0)240 if (mOutBuf) 241 241 av_free(mOutBuf); 242 if (mRGBBuffer != 0)242 if (mRGBBuffer) 243 243 RTMemFree(mRGBBuffer); 244 244 #endif … … 1109 1109 if (mYUVBuffer != NULL) 1110 1110 { 1111 1111 // BOGUS! AssertReturn(VpxRawImage.w*VpxRawImage.h*3/2 <= sizeof(mYUVFrameSize), E_UNEXPECTED); 1112 1112 memcpy(VpxRawImage.planes[0], (uint8_t *)mYUVBuffer, VpxRawImage.w*VpxRawImage.h*3/2); 1113 1113 }
Note:
See TracChangeset
for help on using the changeset viewer.