Changeset 42340 in vbox
- Timestamp:
- Jul 24, 2012 9:13:12 AM (12 years ago)
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture
- Files:
-
- 2 edited
-
FFmpegFB.cpp (modified) (6 diffs)
-
FFmpegFB.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.cpp
r42061 r42340 171 171 LogFlow(("Destroying FFmpegFB object %p\n", this)); 172 172 #ifdef VBOX_WITH_VPX 173 /* Dummy update to make sure we get all the frame (timing). */173 /* Dummy update to make sure we get all the frame (timing). */ 174 174 NotifyUpdate(0, 0, 0, 0); 175 175 /* Write the last pending frame before exiting */ 176 176 int rc = do_rgb_to_yuv_conversion(); 177 177 if (rc == S_OK) 178 do_encoding_and_write();178 do_encoding_and_write(); 179 179 # if 1 180 180 /* Add another 10 seconds. */ 181 181 for (int i = 10*25; i > 0; i--) 182 do_encoding_and_write();182 do_encoding_and_write(); 183 183 # endif 184 184 Ebml_WriteWebMFileFooter(&ebml, 0); 185 if(ebml.stream)186 fclose(ebml.stream);185 if(ebml.stream) 186 fclose(ebml.stream); 187 187 vpx_codec_destroy(&mVpxCodec); 188 188 RTCritSectDelete(&mCritSect); 189 189 190 /* We have already freed the stream above */190 /* We have already freed the stream above */ 191 191 if (mTempRGBBuffer != 0) 192 192 free(mTempRGBBuffer); … … 265 265 if (mOutOfMemory == true) 266 266 return E_OUTOFMEMORY; 267 int rc;268 int rcOpenFile;269 int rcOpenCodec;267 int rc; 268 int rcOpenFile; 269 int rcOpenCodec; 270 270 271 271 #ifdef VBOX_WITH_VPX 272 mFrameCount = 0;272 mFrameCount = 0; 273 273 memset(&ebml, 0, sizeof(struct EbmlGlobal)); 274 274 ebml.last_pts_ms = -1; … … 837 837 { 838 838 #ifdef VBOX_WITH_VPX 839 vpx_codec_err_t res;839 vpx_codec_err_t res; 840 840 /* Populate encoder configuration */ 841 841 if ((res = vpx_codec_enc_config_default(interface, &mVpxConfig, 0))) 842 {843 LogFlow(("Failed to configure codec \n"));842 { 843 LogFlow(("Failed to configure codec \n")); 844 844 AssertReturn(res == 0, E_UNEXPECTED); 845 }845 } 846 846 847 847 mVpxConfig.rc_target_bitrate = 512; … … 850 850 mVpxConfig.g_timebase.den = 30; 851 851 mVpxConfig.g_timebase.num = 1; 852 mVpxConfig.g_threads = 8;852 mVpxConfig.g_threads = 8; 853 853 854 854 vpx_rational ebmlFPS = mVpxConfig.g_timebase; … … 916 916 char szFileName[RTPATH_MAX]; 917 917 strcpy(szFileName, com::Utf8Str(mFileName).c_str()); 918 ebml.stream = fopen(szFileName, "wb");919 if (!ebml.stream)920 {921 LogFlow(("Failed to open the output File \n"));918 ebml.stream = fopen(szFileName, "wb"); 919 if (!ebml.stream) 920 { 921 LogFlow(("Failed to open the output File \n")); 922 922 return E_FAIL; 923 }924 return S_OK;923 } 924 return S_OK; 925 925 #else 926 926 char szFileName[RTPATH_MAX]; … … 1109 1109 if (mYUVBuffer != NULL) 1110 1110 { 1111 AssertReturn(VpxRawImage.w*VpxRawImage.h*3/2 <= sizeof(mYUVFrameSize), E_UNEXPECTED);1112 memcpy(VpxRawImage.planes[0], (uint8_t *)mYUVBuffer, VpxRawImage.w*VpxRawImage.h*3/2);1113 } 1114 1115 if ((res = vpx_codec_encode(&mVpxCodec, &VpxRawImage , mFrameCount,1111 AssertReturn(VpxRawImage.w*VpxRawImage.h*3/2 <= sizeof(mYUVFrameSize), E_UNEXPECTED); 1112 memcpy(VpxRawImage.planes[0], (uint8_t *)mYUVBuffer, VpxRawImage.w*VpxRawImage.h*3/2); 1113 } 1114 1115 if ((res = vpx_codec_encode(&mVpxCodec, &VpxRawImage , mFrameCount, 1116 1116 mDuration, 0, VPX_DL_REALTIME))) 1117 {1117 { 1118 1118 LogFlow(("Failed to encode: %s\n", vpx_codec_err_to_string(res))); 1119 AssertReturn(res != 0, E_UNEXPECTED);1120 1121 }1119 AssertReturn(res != 0, E_UNEXPECTED); 1120 1121 } 1122 1122 while ((pkt = vpx_codec_get_cx_data(&mVpxCodec, &iter))) 1123 1123 { -
trunk/src/VBox/Frontends/VBoxHeadless/VideoCapture/FFmpegFB.h
r42061 r42340 103 103 private: 104 104 #ifdef VBOX_WITH_VPX 105 EbmlGlobal ebml;106 vpx_codec_ctx_t mVpxCodec;105 EbmlGlobal ebml; 106 vpx_codec_ctx_t mVpxCodec; 107 107 vpx_codec_enc_cfg_t mVpxConfig; 108 FILE * mOutputFile;109 unsigned long mDuration;110 uint32_t mFrameCount;108 FILE * mOutputFile; 109 unsigned long mDuration; 110 uint32_t mFrameCount; 111 111 112 112 #else … … 118 118 AVFrame *mFrame; 119 119 120 HRESULT setup_library();120 HRESULT setup_library(); 121 121 HRESULT setup_output_format(); 122 122 HRESULT list_formats();
Note:
See TracChangeset
for help on using the changeset viewer.

