Changeset 51504 in vbox for trunk/src/VBox
- Timestamp:
- Jun 3, 2014 8:43:49 AM (11 years ago)
- svn:sync-xref-src-repo-rev:
- 94118
- Location:
- trunk/src/VBox/Frontends/VBoxHeadless
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Frontends/VBoxHeadless/Makefile.kmk
r48950 r51504 44 44 # 45 45 VBoxHeadless_TEMPLATE := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE) 46 VBoxHeadless_DEFS += \ 47 VBOX_WITH_VIDEO_REC 46 VBoxHeadless_DEFS += $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,) 48 47 VBoxHeadless_SOURCES = VBoxHeadless.cpp 49 48 VBoxHeadless_SOURCES += Framebuffer.cpp -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp
r51436 r51504 43 43 #include <VBox/VBoxVideo.h> 44 44 45 #ifdef VBOX_WITH_VIDEO_REC 46 #include <cstdlib> 47 #include <cerrno> 48 #include "VBoxHeadless.h" 49 #include <iprt/env.h> 50 #include <iprt/param.h> 45 #ifdef VBOX_WITH_VPX 51 46 #include <iprt/process.h> 52 #include <VBox/sup.h>53 47 #endif 54 48 … … 510 504 " --settingspw <pw> Specify the settings password\n" 511 505 " --settingspwfile <file> Specify a file containing the settings password\n" 512 #ifdef VBOX_WITH_V IDEO_REC506 #ifdef VBOX_WITH_VPX 513 507 " -c, -capture, --capture Record the VM screen output to a file\n" 514 508 " -w, --width Frame width when recording\n" … … 521 515 } 522 516 523 #ifdef VBOX_WITH_V IDEO_REC517 #ifdef VBOX_WITH_VPX 524 518 /** 525 519 * Parse the environment for variables which can influence the VIDEOREC settings. … … 570 564 *ppszFileName = pszEnvTemp; 571 565 } 572 #endif /* VBOX_WITH_V IDEO_RECdefined */566 #endif /* VBOX_WITH_VPX defined */ 573 567 574 568 static RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd) … … 656 650 unsigned fPATM = ~0U; 657 651 unsigned fCSAM = ~0U; 658 #ifdef VBOX_WITH_V IDEO_REC652 #ifdef VBOX_WITH_VPX 659 653 bool fVideoRec = 0; 660 654 unsigned long ulFrameWidth = 800; … … 663 657 char szMpegFile[RTPATH_MAX]; 664 658 const char *pszFileNameParam = "VBox-%d.vob"; 665 #endif /* VBOX_WITH_V IDEO_REC*/659 #endif /* VBOX_WITH_VPX */ 666 660 667 661 LogFlow(("VBoxHeadless STARTED.\n")); … … 670 664 "All rights reserved.\n\n"); 671 665 672 #ifdef VBOX_WITH_V IDEO_REC666 #ifdef VBOX_WITH_VPX 673 667 /* Parse the environment */ 674 668 parse_environ(&ulFrameWidth, &ulFrameHeight, &ulBitRate, &pszFileNameParam); … … 722 716 { "--settingspw", OPT_SETTINGSPW, RTGETOPT_REQ_STRING }, 723 717 { "--settingspwfile", OPT_SETTINGSPW_FILE, RTGETOPT_REQ_STRING }, 724 #ifdef VBOX_WITH_V IDEO_REC718 #ifdef VBOX_WITH_VPX 725 719 { "-capture", 'c', 0 }, 726 720 { "--capture", 'c', 0 }, … … 729 723 { "--bitrate", 'r', RTGETOPT_REQ_UINT32 }, 730 724 { "--filename", 'f', RTGETOPT_REQ_STRING }, 731 #endif /* VBOX_WITH_V IDEO_RECdefined */725 #endif /* VBOX_WITH_VPX defined */ 732 726 { "-comment", OPT_COMMENT, RTGETOPT_REQ_STRING }, 733 727 { "--comment", OPT_COMMENT, RTGETOPT_REQ_STRING } … … 797 791 pcszSettingsPwFile = ValueUnion.psz; 798 792 break; 799 #ifdef VBOX_WITH_V IDEO_REC793 #ifdef VBOX_WITH_VPX 800 794 case 'c': 801 795 fVideoRec = true; … … 810 804 pszFileNameParam = ValueUnion.psz; 811 805 break; 812 #endif /* VBOX_WITH_V IDEO_RECdefined */806 #endif /* VBOX_WITH_VPX defined */ 813 807 case 'h': 814 #ifdef VBOX_WITH_V IDEO_REC808 #ifdef VBOX_WITH_VPX 815 809 if ((GetState.pDef->fFlags & RTGETOPT_REQ_MASK) != RTGETOPT_REQ_NOTHING) 816 810 { … … 834 828 } 835 829 836 #ifdef VBOX_WITH_V IDEO_REC830 #ifdef VBOX_WITH_VPX 837 831 if (ulFrameWidth < 512 || ulFrameWidth > 2048 || ulFrameWidth % 2) 838 832 { … … 864 858 } 865 859 RTStrPrintf(&szMpegFile[0], RTPATH_MAX, pszFileNameParam, RTProcSelf()); 866 #endif /* defined VBOX_WITH_V IDEO_REC*/860 #endif /* defined VBOX_WITH_VPX */ 867 861 868 862 if (!pcszNameOrUUID) … … 972 966 CHECK_ERROR_BREAK(console, COMGETTER(Display)(display.asOutParam())); 973 967 974 #ifdef VBOX_WITH_VIDEO_REC 975 IFramebuffer *pFramebuffer = 0; 976 RTLDRMOD hLdrVideoRecFB; 977 PFNREGISTERVIDEORECFB pfnRegisterVideoRecFB; 978 968 #ifdef VBOX_WITH_VPX 979 969 if (fVideoRec) 980 970 { 981 HRESULT rcc = S_OK; 982 int rrc = VINF_SUCCESS; 983 RTERRINFOSTATIC ErrInfo; 984 985 Log2(("VBoxHeadless: loading VBoxVideoRecFB and libvpx shared library\n")); 986 RTErrInfoInitStatic(&ErrInfo); 987 rrc = SUPR3HardenedLdrLoadAppPriv("VBoxVideoRecFB", &hLdrVideoRecFB, RTLDRLOAD_FLAGS_LOCAL, &ErrInfo.Core); 988 989 if (RT_SUCCESS(rrc)) 990 { 991 Log2(("VBoxHeadless: looking up symbol VBoxRegisterVideoRecFB\n")); 992 rrc = RTLdrGetSymbol(hLdrVideoRecFB, "VBoxRegisterVideoRecFB", 993 reinterpret_cast<void **>(&pfnRegisterVideoRecFB)); 994 if (RT_FAILURE(rrc)) 995 LogError("Failed to load the video capture extension, possibly due to a damaged file\n", rrc); 996 } 997 else 998 LogError("Failed to load the video capture extension\n", rrc); /** @todo stupid function, no formatting options. */ 999 if (RT_SUCCESS(rrc)) 1000 { 1001 Log2(("VBoxHeadless: calling pfnRegisterVideoRecFB\n")); 1002 rcc = pfnRegisterVideoRecFB(ulFrameWidth, ulFrameHeight, ulBitRate, 1003 szMpegFile, &pFramebuffer); 1004 if (rcc != S_OK) 1005 LogError("Failed to initialise video capturing - make sure that the file format\n" 1006 "you wish to use is supported on your system\n", rcc); 1007 } 1008 if (RT_SUCCESS(rrc) && rcc == S_OK) 1009 { 1010 Log2(("VBoxHeadless: Registering framebuffer\n")); 1011 pFramebuffer->AddRef(); 1012 display->AttachFramebuffer(VBOX_VIDEO_PRIMARY_SCREEN, pFramebuffer); 1013 } 1014 if (!RT_SUCCESS(rrc) || rcc != S_OK) 1015 rc = E_FAIL; 1016 } 1017 if (rc != S_OK) 1018 { 1019 break; 1020 } 1021 #endif /* defined(VBOX_WITH_VIDEO_REC) */ 971 CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureFile)(Bstr(szMpegFile).raw())); 972 CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureWidth)(ulFrameWidth)); 973 CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureHeight)(ulFrameHeight)); 974 CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureRate)(ulBitRate)); 975 CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureEnabled)(TRUE)); 976 } 977 #endif /* defined(VBOX_WITH_VPX) */ 1022 978 ULONG cMonitors = 1; 1023 979 machine->COMGETTER(MonitorCount)(&cMonitors); … … 1026 982 for (uScreenId = 0; uScreenId < cMonitors; uScreenId++) 1027 983 { 1028 # ifdef VBOX_WITH_VIDEO_REC1029 if (fVideoRec && uScreenId == 0)1030 {1031 /* Already registered. */1032 continue;1033 }1034 # endif1035 984 VRDPFramebuffer *pVRDPFramebuffer = new VRDPFramebuffer(); 1036 985 if (!pVRDPFramebuffer) … … 1316 1265 Log(("VBoxHeadless: event loop has terminated...\n")); 1317 1266 1318 #ifdef VBOX_WITH_VIDEO_REC 1319 if (pFramebuffer) 1320 { 1321 pFramebuffer->Release(); 1322 Log(("Released framebuffer\n")); 1323 pFramebuffer = NULL; 1324 } 1325 #endif /* defined(VBOX_WITH_VIDEO_REC) */ 1267 #ifdef VBOX_WITH_VPX 1268 if (fVideoRec) 1269 { 1270 if (!machine.isNull()) 1271 machine->COMSETTER(VideoCaptureEnabled)(FALSE); 1272 } 1273 #endif /* defined(VBOX_WITH_VPX) */ 1326 1274 1327 1275 /* we don't have to disable VRDE here because we don't save the settings of the VM */ -
trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.h
r44528 r51504 2 2 * 3 3 * VBox frontends: VRDE (headless Remote Desktop server): 4 * Header file with registration call for VideoRec framebuffer5 4 */ 6 5 7 6 /* 8 * Copyright (C) 2006-201 2Oracle Corporation7 * Copyright (C) 2006-2014 Oracle Corporation 9 8 * 10 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 30 29 #include <iprt/critsect.h> 31 30 32 /**33 * Callback function to register an VideoRec framebuffer.34 *35 * @returns COM status code.36 * @param width Framebuffer width.37 * @param height Framebuffer height.38 * @param bitrate Bitrate of mpeg file to be created.39 * @param pixelFormat Framebuffer pixel format40 * @param filename Name of mpeg file to be created41 * @retval retVal The new framebuffer42 */43 typedef DECLCALLBACK(HRESULT) FNREGISTERVIDEORECFB(ULONG width,44 ULONG height, ULONG bitrate,45 com::Bstr filename,46 IFramebuffer **retVal);47 typedef FNREGISTERVIDEORECFB *PFNREGISTERVIDEORECFB;48 49 31 #endif // __H_VBOXHEADLESS
Note:
See TracChangeset
for help on using the changeset viewer.