- Timestamp:
- Jun 13, 2013 12:02:48 PM (12 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp
r46466 r46523 1340 1340 RTFileClose(pngFile); 1341 1341 } 1342 else if ( !strcmp(a->argv[1], "enablevideocapture") 1343 || !strcmp(a->argv[1], "disablevideocapture")) 1342 else if ( !strcmp(a->argv[1], "vcpenabled")) 1343 { 1344 if (a->argc != 3) 1345 { 1346 errorArgument("Missing argument to '%s'", a->argv[1]); 1347 rc = E_FAIL; 1348 break; 1349 } 1350 if (!strcmp(a->argv[2], "on")) 1351 { 1352 CHECK_ERROR_RET(sessionMachine, COMSETTER(VideoCaptureEnabled)(TRUE), 1); 1353 } 1354 else if (!strcmp(a->argv[2], "off")) 1355 { 1356 CHECK_ERROR_RET(sessionMachine, COMSETTER(VideoCaptureEnabled)(FALSE), 1); 1357 } 1358 else 1359 { 1360 errorArgument("Invalid state '%s'", Utf8Str(a->argv[2]).c_str()); 1361 rc = E_FAIL; 1362 break; 1363 } 1364 } 1365 else if ( !strcmp(a->argv[1], "videocapturescreens")) 1344 1366 { 1345 1367 ULONG cMonitors = 64; 1346 1368 CHECK_ERROR_BREAK(machine, COMGETTER(MonitorCount)(&cMonitors)); 1347 1369 com::SafeArray<BOOL> saScreens(cMonitors); 1348 bool fEnable = !strcmp(a->argv[1], "enablevideocapture");1349 if (a->argc < 3)1350 { 1351 /* default: handle all screens */1370 if ( a->argc == 3 1371 && !strcmp(a->argv[2], "all")) 1372 { 1373 /* enable all screens */ 1352 1374 for (unsigned i = 0; i < cMonitors; i++) 1353 1375 saScreens[i] = true; 1354 1376 } 1377 else if ( a->argc == 3 1378 && !strcmp(a->argv[2], "none")) 1379 { 1380 /* disable all screens */ 1381 for (unsigned i = 0; i < cMonitors; i++) 1382 saScreens[i] = false; 1383 } 1355 1384 else 1356 1385 { 1357 /* handle selected screens */ 1358 CHECK_ERROR_BREAK(machine, COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(saScreens))); 1386 /* enable selected screens */ 1387 for (unsigned i = 0; i < cMonitors; i++) 1388 saScreens[i] = false; 1359 1389 for (int i = 2; SUCCEEDED(rc) && i < a->argc; i++) 1360 1390 { … … 1373 1403 break; 1374 1404 } 1375 saScreens[iScreen] = fEnable;1405 saScreens[iScreen] = true; 1376 1406 } 1377 1407 } -
trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp
r46290 r46523 470 470 " [<xorigin> <yorigin>]]] |\n" 471 471 " screenshotpng <file> [display] |\n" 472 " enablevideocapture <screen>,[<screen>...]\n"473 " disablevideocapture <screen>,[<screen>...]\n"472 " vcpenabled on|off |\n" 473 " vcpscreens all|none|<screen>,[<screen>...] |\n" 474 474 " setcredentials <username>\n" 475 475 " --passwordfile <file> | <password>\n" -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r46478 r46523 4263 4263 <desc> 4264 4264 This setting determines the filename VirtualBox uses to save 4265 the recorded content.</desc> 4265 the recorded content. This setting cannot be changed while video 4266 capturing is enabled. 4267 </desc> 4266 4268 </attribute> 4267 4269 4268 4270 <attribute name="VideoCaptureWidth" type="unsigned long" default="640"> 4269 4271 <desc> 4270 This setting determines the horizontal resolution of the recorded video.</desc> 4272 This setting determines the horizontal resolution of the recorded 4273 video. This setting cannot be changed while video capturing is 4274 enabled. 4275 </desc> 4271 4276 </attribute> 4272 4277 4273 4278 <attribute name="VideoCaptureHeight" type="unsigned long" default="480"> 4274 4279 <desc> 4275 This setting determines the vertical resolution of the recorded video.</desc> 4280 This setting determines the vertical resolution of the recorded 4281 video. This setting cannot be changed while video capturing is 4282 enabled. 4283 </desc> 4276 4284 </attribute> 4277 4285 … … 4280 4288 This setting determines the bitrate in kilobits per second. 4281 4289 Increasing this value makes the video look better for the 4282 cost of an increased file size. 4290 cost of an increased file size. This setting cannot be changed 4291 while video capturing is enabled. 4283 4292 </desc> 4284 4293 </attribute> … … 4289 4298 Frames with a higher frequency will be skipped. Reducing this 4290 4299 value increses the number of skipped frames but reduces the 4291 file size. 4300 file size. This setting cannot be changed while video capturing 4301 is enabled. 4292 4302 </desc> 4293 4303 </attribute> … … 14691 14701 <interface 14692 14702 name="IDisplay" extends="$unknown" 14693 uuid=" 0598a3df-3dc0-43c7-a79c-237fb5bb633d"14703 uuid="23efdcab-1ae5-47ee-951e-e0f9a3935f2a" 14694 14704 wsmap="managed" 14695 14705 > … … 14896 14906 <desc> 14897 14907 Array with resulting screen data. 14898 </desc>14899 </param>14900 </method>14901 14902 <method name="enableVideoCaptureScreens">14903 <desc>14904 Start/stop video capture on selected screens.14905 </desc>14906 <param name="screens" type="boolean" safearray="yes" dir="in">14907 <desc>14908 The screens to start/stop capturing.14909 14908 </desc> 14910 14909 </param> -
trunk/src/VBox/Main/include/DisplayImpl.h
r46465 r46523 30 30 struct VIDEORECCONTEXT; 31 31 32 enum { 32 enum 33 { 33 34 ResizeStatus_Void, 34 35 ResizeStatus_InProgress, … … 68 69 bool fDefaultFormat; 69 70 70 struct { 71 struct 72 { 71 73 /* The rectangle that includes all dirty rectangles. */ 72 74 int32_t xLeft; … … 76 78 } dirtyRect; 77 79 78 struct { 80 struct 81 { 79 82 bool fPending; 80 83 ULONG pixelFormat; … … 90 93 bool fVBVAEnabled; 91 94 uint32_t cVBVASkipUpdate; 92 struct { 95 struct 96 { 93 97 int32_t xLeft; 94 98 int32_t yTop; … … 129 133 130 134 // public methods only for internal purposes 131 int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h, uint16_t flags);135 int handleDisplayResize(unsigned uScreenId, uint32_t bpp, void *pvVRAM, uint32_t cbLine, int w, int h, uint16_t flags); 132 136 void handleDisplayUpdateLegacy(int x, int y, int cx, int cy); 133 137 void handleDisplayUpdate(unsigned uScreenId, int x, int y, int w, int h); … … 146 150 return maFramebuffers[VBOX_VIDEO_PRIMARY_SCREEN].pFramebuffer; 147 151 } 148 void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, 149 int32_t *py2); 150 151 int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect); 152 int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect); 153 154 int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory); 152 void getFramebufferDimensions(int32_t *px1, int32_t *py1, int32_t *px2, int32_t *py2); 153 154 int handleSetVisibleRegion(uint32_t cRect, PRTRECT pRect); 155 int handleQueryVisibleRegion(uint32_t *pcRect, PRTRECT pRect); 156 157 int VideoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory); 155 158 void VideoAccelFlush(void); 156 157 159 bool VideoAccelAllowed(void); 158 159 160 void VideoAccelVRDP(bool fEnable); 161 162 int VideoCaptureStart(); 163 void VideoCaptureStop(); 164 int VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens)); 160 165 161 166 // IEventListener methods … … 170 175 STDMETHOD(TakeScreenShotToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData)); 171 176 STDMETHOD(TakeScreenShotPNGToArray)(ULONG aScreenId, ULONG width, ULONG height, ComSafeArrayOut(BYTE, aScreenData)); 172 STDMETHOD(EnableVideoCaptureScreens)(ComSafeArrayIn(BOOL, aScreens));173 177 STDMETHOD(DrawToScreen)(ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height); 174 178 STDMETHOD(InvalidateAndUpdate)(); … … 213 217 static DECLCALLBACK(void) displayCrHgsmiControlProcess(PPDMIDISPLAYCONNECTOR pInterface, PVBOXVDMACMD_CHROMIUM_CTL pCtl, uint32_t cbCtl); 214 218 215 static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);216 static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext);219 static DECLCALLBACK(void) displayCrHgsmiCommandCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 220 static DECLCALLBACK(void) displayCrHgsmiControlCompletion(int32_t result, uint32_t u32Function, PVBOXHGCMSVCPARM pParam, void *pvContext); 217 221 #endif 218 222 … … 227 231 #endif 228 232 229 230 233 static DECLCALLBACK(void) displaySSMSaveScreenshot(PSSMHANDLE pSSM, void *pvUser); 231 234 static DECLCALLBACK(int) displaySSMLoadScreenshot(PSSMHANDLE pSSM, void *pvUser, uint32_t uVersion, uint32_t uPass); … … 245 248 246 249 /* arguments of the last handleDisplayResize() call */ 247 void *mLastAddress;248 uint32_t mLastBytesPerLine;249 uint32_t mLastBitsPerPixel;250 int mLastWidth;251 int mLastHeight;252 uint16_t mLastFlags;250 void *mLastAddress; 251 uint32_t mLastBytesPerLine; 252 uint32_t mLastBitsPerPixel; 253 int mLastWidth; 254 int mLastHeight; 255 uint16_t mLastFlags; 253 256 254 257 VBVAMEMORY *mpVbvaMemory; … … 264 267 265 268 uint8_t *mpu8VbvaPartial; 266 uint32_t mcbVbvaPartial;269 uint32_t mcbVbvaPartial; 267 270 268 271 #ifdef VBOX_WITH_CRHGSMI … … 279 282 volatile uint32_t mfu32PendingVideoAccelDisable; 280 283 281 int vbvaLock(void);284 int vbvaLock(void); 282 285 void vbvaUnlock(void); 283 286 284 287 RTCRITSECT mSaveSeamlessRectLock; 285 int SaveSeamlessRectLock(void);288 int SaveSeamlessRectLock(void); 286 289 void SaveSeamlessRectUnLock(void); 287 290 288 291 public: 289 static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height);292 static int displayTakeScreenshotEMT(Display *pDisplay, ULONG aScreenId, uint8_t **ppu8Data, size_t *pcbData, uint32_t *pu32Width, uint32_t *pu32Height); 290 293 291 294 private: 292 295 static void InvalidateAndUpdateEMT(Display *pDisplay, unsigned uId, bool fUpdateAll); 293 static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height);294 295 int videoAccelRefreshProcess(void);296 static int drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address, ULONG x, ULONG y, ULONG width, ULONG height); 297 298 int videoAccelRefreshProcess(void); 296 299 297 300 /* Functions run under VBVA lock. */ 298 int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory);301 int videoAccelEnable(bool fEnable, VBVAMEMORY *pVbvaMemory); 299 302 void videoAccelFlush(void); 300 303 … … 310 313 311 314 void gdImageCopyResampled(uint8_t *dst, uint8_t *src, 312 int dstX, int dstY, 313 int srcX, int srcY, 315 int dstX, int dstY, int srcX, int srcY, 314 316 int dstW, int dstH, int srcW, int srcH); 315 317 316 317 void BitmapScale32(uint8_t *dst, 318 int dstW, int dstH, 319 const uint8_t *src, 320 int iDeltaLine, 321 int srcW, int srcH); 318 void BitmapScale32(uint8_t *dst, int dstW, int dstH, 319 const uint8_t *src, int iDeltaLine, int srcW, int srcH); 322 320 323 321 int DisplayMakePNG(uint8_t *pu8Data, uint32_t cx, uint32_t cy, -
trunk/src/VBox/Main/src-client/ConsoleImpl.cpp
r46465 r46523 5108 5108 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 5109 5109 5110 BOOL fEnabled; 5111 HRESULT rc = mMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled); 5110 5112 SafeArray<BOOL> screens; 5111 HRESULT rc = mMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(screens)); 5113 if (SUCCEEDED(rc)) 5114 rc = mMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(screens)); 5112 5115 if (mDisplay) 5113 5116 { 5117 int vrc = VINF_SUCCESS; 5114 5118 if (SUCCEEDED(rc)) 5115 rc = mDisplay->EnableVideoCaptureScreens(ComSafeArrayAsInParam(screens)); 5116 if (SUCCEEDED(rc)) 5117 fireVideoCaptureChangedEvent(mEventSource); 5119 vrc = mDisplay->VideoCaptureEnableScreens(ComSafeArrayAsInParam(screens)); 5120 if (RT_SUCCESS(vrc)) 5121 { 5122 if (fEnabled) 5123 vrc = mDisplay->VideoCaptureStart(); 5124 else 5125 mDisplay->VideoCaptureStop(); 5126 if (RT_SUCCESS(vrc)) 5127 fireVideoCaptureChangedEvent(mEventSource); 5128 else 5129 rc = E_FAIL; 5130 } 5118 5131 } 5119 5132 -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r46471 r46523 123 123 int rc = RTCritSectInit(&mVBVALock); 124 124 AssertRC(rc); 125 125 126 126 rc = RTCritSectInit(&mSaveSeamlessRectLock); 127 127 AssertRC(rc); 128 128 129 129 mfu32PendingVideoAccelDisable = false; 130 130 … … 150 150 memset (&mVBVALock, 0, sizeof (mVBVALock)); 151 151 } 152 152 153 153 if (RTCritSectIsInitialized(&mSaveSeamlessRectLock)) 154 154 { … … 837 837 LogRelFlow(("[%d]: default format %d\n", uScreenId, pFBInfo->fDefaultFormat)); 838 838 839 /* Handle the case if there are some saved visible region that needs to be 840 * applied after the resize of the framebuffer is completed 839 /* Handle the case if there are some saved visible region that needs to be 840 * applied after the resize of the framebuffer is completed 841 841 */ 842 842 SaveSeamlessRectLock(); … … 1125 1125 * for the new region (THis is checked in the above if condition ). With 0 intersection, 1126 1126 * cRectVisibleRegions = 0 is returned to the GUI and if GUI has invalidated its 1127 * earlier region then it draws nothihing and seamless mode doesn't display the 1127 * earlier region then it draws nothihing and seamless mode doesn't display the 1128 1128 * guest desktop. 1129 1129 */ … … 1423 1423 RTCritSectLeave(&mVBVALock); 1424 1424 } 1425 1425 1426 1426 int Display::SaveSeamlessRectLock(void) 1427 1427 { 1428 1428 return RTCritSectEnter(&mSaveSeamlessRectLock); 1429 1429 } 1430 1430 1431 1431 void Display::SaveSeamlessRectUnLock(void) 1432 1432 { 1433 1433 RTCritSectLeave(&mSaveSeamlessRectLock); 1434 1434 } 1435 1435 1436 1436 1437 1437 /** … … 2509 2509 tr("Could not take a screenshot (%Rrc)"), vrc); 2510 2510 2511 LogRelFlowFunc(("rc=% 08X\n", rc));2511 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2512 2512 return rc; 2513 2513 } … … 2587 2587 RTMemFree(pu8Data); 2588 2588 2589 LogRelFlowFunc(("rc=% 08X\n", rc));2589 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2590 2590 return rc; 2591 2591 } … … 2670 2670 RTMemFree(pu8Data); 2671 2671 2672 LogRelFlowFunc(("rc=% 08X\n", rc));2672 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2673 2673 return rc; 2674 2674 } 2675 2675 2676 STDMETHODIMP Display::EnableVideoCaptureScreens(ComSafeArrayIn(BOOL, aScreens))2676 int Display::VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens)) 2677 2677 { 2678 2678 #ifdef VBOX_WITH_VPX … … 2680 2680 for (unsigned i = 0; i < Screens.size(); i++) 2681 2681 maVideoRecEnabled[i] = Screens[i]; 2682 return S_OK;2682 return VINF_SUCCESS; 2683 2683 #else 2684 return E_NOTIMPL; 2684 return VERR_NOT_IMPLEMENTED; 2685 #endif 2686 } 2687 2688 /** 2689 * Start video capturing. Does nothing if capturing is already active. 2690 */ 2691 int Display::VideoCaptureStart() 2692 { 2693 #ifdef VBOX_WITH_VPX 2694 if (VideoRecIsEnabled(mpVideoRecCtx)) 2695 return VINF_SUCCESS; 2696 2697 int rc = VideoRecContextCreate(&mpVideoRecCtx, mcMonitors); 2698 if (RT_FAILURE(rc)) 2699 { 2700 LogFlow(("Failed to create video recording context (%Rrc)!\n", rc)); 2701 return rc; 2702 } 2703 ComPtr<IMachine> pMachine = mParent->machine(); 2704 com::SafeArray<BOOL> screens; 2705 HRESULT hrc = pMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(screens)); 2706 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2707 for (unsigned i = 0; i < RT_ELEMENTS(maVideoRecEnabled); i++) 2708 maVideoRecEnabled[i] = i < screens.size() && screens[i]; 2709 ULONG ulWidth; 2710 hrc = pMachine->COMGETTER(VideoCaptureWidth)(&ulWidth); 2711 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2712 ULONG ulHeight; 2713 hrc = pMachine->COMGETTER(VideoCaptureHeight)(&ulHeight); 2714 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2715 ULONG ulRate; 2716 hrc = pMachine->COMGETTER(VideoCaptureRate)(&ulRate); 2717 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2718 ULONG ulFps; 2719 hrc = pMachine->COMGETTER(VideoCaptureFps)(&ulFps); 2720 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2721 BSTR strFile; 2722 hrc = pMachine->COMGETTER(VideoCaptureFile)(&strFile); 2723 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 2724 for (unsigned uScreen = 0; uScreen < mcMonitors; uScreen++) 2725 { 2726 char *pszAbsPath = RTPathAbsDup(com::Utf8Str(strFile).c_str()); 2727 char *pszExt = RTPathExt(pszAbsPath); 2728 if (pszExt) 2729 pszExt = RTStrDup(pszExt); 2730 RTPathStripExt(pszAbsPath); 2731 if (!pszAbsPath) 2732 rc = VERR_INVALID_PARAMETER; 2733 if (!pszExt) 2734 pszExt = RTStrDup(".webm"); 2735 char *pszName = NULL; 2736 if (RT_SUCCESS(rc)) 2737 { 2738 if (mcMonitors > 1) 2739 rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszExt); 2740 else 2741 rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszExt); 2742 } 2743 if (RT_SUCCESS(rc)) 2744 rc = VideoRecStrmInit(mpVideoRecCtx, uScreen, 2745 pszName, ulWidth, ulHeight, ulRate, ulFps); 2746 if (RT_SUCCESS(rc)) 2747 LogRel(("WebM/VP8 video recording screen #%u with %ux%u @ %u kbps, %u fps to '%s' enabled!\n", 2748 uScreen, ulWidth, ulHeight, ulRate, ulFps, pszName)); 2749 else 2750 LogRel(("Failed to initialize video recording context #%u (%Rrc)!\n", uScreen, rc)); 2751 RTStrFree(pszName); 2752 RTStrFree(pszExt); 2753 RTStrFree(pszAbsPath); 2754 } 2755 return rc; 2756 #else 2757 return VERR_NOT_IMPLEMENTED; 2758 #endif 2759 } 2760 2761 /** 2762 * Stop video capturing. Does nothing if video capturing is not active. 2763 */ 2764 void Display::VideoCaptureStop() 2765 { 2766 #ifdef VBOX_WITH_VPX 2767 VideoRecContextClose(mpVideoRecCtx); 2768 mpVideoRecCtx = NULL; 2685 2769 #endif 2686 2770 } … … 2848 2932 // } 2849 2933 2850 LogRelFlowFunc(("rc=% 08X\n", rc));2934 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2851 2935 return rc; 2852 2936 } … … 2970 3054 tr("Could not invalidate and update the screen (%Rrc)"), rcVBox); 2971 3055 2972 LogRelFlowFunc(("rc=% 08X\n", rc));3056 LogRelFlowFunc(("rc=%Rhrc\n", rc)); 2973 3057 return rc; 2974 3058 } … … 4330 4414 AutoWriteLock displayLock(pThis->pDisplay COMMA_LOCKVAL_SRC_POS); 4331 4415 #ifdef VBOX_WITH_VPX 4332 VideoRecContextClose(pThis->pDisplay->mpVideoRecCtx); 4333 pThis->pDisplay->mpVideoRecCtx = NULL; 4416 pThis->pDisplay->VideoCaptureStop(); 4334 4417 #endif 4335 4418 #ifdef VBOX_WITH_CRHGSMI … … 4443 4526 ComPtr<IMachine> pMachine = pDisplay->mParent->machine(); 4444 4527 BOOL fEnabled = false; 4445 pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled); 4528 HRESULT hrc = pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled); 4529 AssertComRCReturn(hrc, VERR_COM_UNEXPECTED); 4446 4530 if (fEnabled) 4447 { 4448 rc = VideoRecContextCreate(&pDisplay->mpVideoRecCtx, pDisplay->mcMonitors); 4449 if (RT_FAILURE(rc)) 4450 { 4451 LogFlow(("Failed to create video recording context (%Rrc)!\n", rc)); 4452 return E_FAIL; 4453 } 4454 com::SafeArray<BOOL> screens; 4455 HRESULT hrc = pMachine->COMGETTER(VideoCaptureScreens)(ComSafeArrayAsOutParam(screens)); 4456 AssertComRCReturnRC(hrc); 4457 for (unsigned i = 0; i < RT_ELEMENTS(pDisplay->maVideoRecEnabled); i++) 4458 pDisplay->maVideoRecEnabled[i] = i < screens.size() && screens[i]; 4459 ULONG ulWidth; 4460 hrc = pMachine->COMGETTER(VideoCaptureWidth)(&ulWidth); 4461 AssertComRCReturnRC(hrc); 4462 ULONG ulHeight; 4463 hrc = pMachine->COMGETTER(VideoCaptureHeight)(&ulHeight); 4464 AssertComRCReturnRC(hrc); 4465 ULONG ulRate; 4466 hrc = pMachine->COMGETTER(VideoCaptureRate)(&ulRate); 4467 AssertComRCReturnRC(hrc); 4468 ULONG ulFps; 4469 hrc = pMachine->COMGETTER(VideoCaptureFps)(&ulFps); 4470 AssertComRCReturnRC(hrc); 4471 BSTR strFile; 4472 hrc = pMachine->COMGETTER(VideoCaptureFile)(&strFile); 4473 AssertComRCReturnRC(hrc); 4474 for (unsigned uScreen = 0; uScreen < pDisplay->mcMonitors; uScreen++) 4475 { 4476 char *pszAbsPath = RTPathAbsDup(com::Utf8Str(strFile).c_str()); 4477 char *pszExt = RTPathExt(pszAbsPath); 4478 if (pszExt) 4479 pszExt = RTStrDup(pszExt); 4480 RTPathStripExt(pszAbsPath); 4481 if (!pszAbsPath) 4482 rc = VERR_INVALID_PARAMETER; 4483 if (!pszExt) 4484 pszExt = RTStrDup(".webm"); 4485 char *pszName = NULL; 4486 if (RT_SUCCESS(rc)) 4487 { 4488 if (pDisplay->mcMonitors > 1) 4489 rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszExt); 4490 else 4491 rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszExt); 4492 } 4493 if (RT_SUCCESS(rc)) 4494 rc = VideoRecStrmInit(pDisplay->mpVideoRecCtx, uScreen, 4495 pszName, ulWidth, ulHeight, ulRate, ulFps); 4496 if (RT_SUCCESS(rc)) 4497 LogRel(("WebM/VP8 video recording screen #%u with %ux%u @ %u kbps, %u fps to '%s' enabled!\n", 4498 uScreen, ulWidth, ulHeight, ulRate, ulFps, pszName)); 4499 else 4500 LogRel(("Failed to initialize video recording context #%u (%Rrc)!\n", uScreen, rc)); 4501 RTStrFree(pszName); 4502 RTStrFree(pszExt); 4503 RTStrFree(pszAbsPath); 4504 } 4505 } 4531 rc = pDisplay->VideoCaptureStart(); 4506 4532 #endif 4507 4533 4508 return VINF_SUCCESS;4534 return rc; 4509 4535 } 4510 4536 -
trunk/src/VBox/Main/src-server/MachineImpl.cpp
r46465 r46523 1516 1516 mHWData->mCpuExecutionCap = aExecutionCap; 1517 1517 1518 /* Save settings if online - todo why is this required??*/1518 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1519 1519 if (Global::IsOnline(mData->mMachineState)) 1520 1520 saveSettings(NULL); … … 1727 1727 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1728 1728 1729 rc = checkStateDependency(MutableStateDep);1730 if (FAILED(rc)) return rc;1731 1732 1729 setModified(IsModified_MachineData); 1733 1730 mHWData.backup(); 1734 1735 1731 mHWData->mVideoCaptureEnabled = fEnabled; 1732 1733 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1734 if (Global::IsOnline(mData->mMachineState)) 1735 saveSettings(NULL); 1736 1737 alock.release(); 1738 rc = onVideoCaptureChange(); 1736 1739 1737 1740 return rc; … … 1777 1780 if (FAILED(rc)) return rc; 1778 1781 setModified(IsModified_MachineData); 1782 1783 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 1779 1784 if (Global::IsOnline(mData->mMachineState)) 1780 1785 saveSettings(NULL); … … 1802 1807 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1803 1808 1804 HRESULT rc = checkStateDependency(MutableStateDep);1805 if (FAILED(rc)) return rc;1809 if (mHWData->mVideoCaptureEnabled) 1810 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1806 1811 1807 1812 if (strFile.isEmpty()) … … 1832 1837 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1833 1838 1834 HRESULT rc = checkStateDependency(MutableStateDep);1835 if (FAILED(rc)) return rc;1839 if (mHWData->mVideoCaptureEnabled) 1840 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1836 1841 1837 1842 setModified(IsModified_MachineData); … … 1859 1864 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1860 1865 1861 HRESULT rc = checkStateDependency(MutableStateDep);1862 if (FAILED(rc)) return rc;1866 if (mHWData->mVideoCaptureEnabled) 1867 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1863 1868 1864 1869 setModified(IsModified_MachineData); … … 1886 1891 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1887 1892 1888 HRESULT rc = checkStateDependency(MutableStateDep);1889 if (FAILED(rc)) return rc;1893 if (mHWData->mVideoCaptureEnabled) 1894 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1890 1895 1891 1896 setModified(IsModified_MachineData); … … 1913 1918 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1914 1919 1915 HRESULT rc = checkStateDependency(MutableStateDep);1916 if (FAILED(rc)) return rc;1920 if (mHWData->mVideoCaptureEnabled) 1921 return setError(E_INVALIDARG, tr("Cannot change parameters while capturing is enabled")); 1917 1922 1918 1923 setModified(IsModified_MachineData); … … 2944 2949 } 2945 2950 2946 STDMETHODIMP 2947 Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode) 2951 STDMETHODIMP Machine::COMSETTER(ClipboardMode)(ClipboardMode_T aClipboardMode) 2948 2952 { 2949 2953 HRESULT rc = S_OK; … … 2963 2967 mHWData->mClipboardMode = aClipboardMode; 2964 2968 2965 /* Save settings if online - todo why is this required??*/2969 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 2966 2970 if (Global::IsOnline(mData->mMachineState)) 2967 2971 saveSettings(NULL); … … 2984 2988 } 2985 2989 2986 STDMETHODIMP 2987 Machine::COMSETTER(DragAndDropMode)(DragAndDropMode_T aDragAndDropMode) 2990 STDMETHODIMP Machine::COMSETTER(DragAndDropMode)(DragAndDropMode_T aDragAndDropMode) 2988 2991 { 2989 2992 HRESULT rc = S_OK; … … 3003 3006 mHWData->mDragAndDropMode = aDragAndDropMode; 3004 3007 3005 /* Save settings if online - todo why is this required??*/3008 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 3006 3009 if (Global::IsOnline(mData->mMachineState)) 3007 3010 saveSettings(NULL); … … 3010 3013 } 3011 3014 3012 STDMETHODIMP 3013 Machine::COMGETTER(GuestPropertyNotificationPatterns)(BSTR *aPatterns) 3015 STDMETHODIMP Machine::COMGETTER(GuestPropertyNotificationPatterns)(BSTR *aPatterns) 3014 3016 { 3015 3017 CheckComArgOutPointerValid(aPatterns); … … 3032 3034 } 3033 3035 3034 STDMETHODIMP 3035 Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns) 3036 STDMETHODIMP Machine::COMSETTER(GuestPropertyNotificationPatterns)(IN_BSTR aPatterns) 3036 3037 { 3037 3038 AutoCaller autoCaller(this); … … 3049 3050 } 3050 3051 3051 STDMETHODIMP 3052 Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers)) 3052 STDMETHODIMP Machine::COMGETTER(StorageControllers)(ComSafeArrayOut(IStorageController *, aStorageControllers)) 3053 3053 { 3054 3054 CheckComArgOutSafeArrayPointerValid(aStorageControllers); … … 3065 3065 } 3066 3066 3067 STDMETHODIMP 3068 Machine::COMGETTER(TeleporterEnabled)(BOOL *aEnabled) 3067 STDMETHODIMP Machine::COMGETTER(TeleporterEnabled)(BOOL *aEnabled) 3069 3068 { 3070 3069 CheckComArgOutPointerValid(aEnabled); … … 6805 6804 mHWData->mCPUAttached[aCpu] = true; 6806 6805 6807 /* Save settings if online*/6806 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 6808 6807 if (Global::IsOnline(mData->mMachineState)) 6809 6808 saveSettings(NULL); … … 6846 6845 mHWData->mCPUAttached[aCpu] = false; 6847 6846 6848 /* Save settings if online*/6847 /** Save settings if online - @todo why is this required? -- @bugref{6818} */ 6849 6848 if (Global::IsOnline(mData->mMachineState)) 6850 6849 saveSettings(NULL);
Note:
See TracChangeset
for help on using the changeset viewer.