VirtualBox

Changeset 65263 in vbox


Ignore:
Timestamp:
Jan 12, 2017 3:25:30 PM (8 years ago)
Author:
vboxsync
Message:

VideoRec: Made the feature less dependent from the codec(s) being used by renaming VBOX_WITH_VPX to VBOX_WITH_VIDEOREC. The feature itself then relies on codecs we do / don't provide on compile time, e.g. VBOX_WITH_LIBVPX.

Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/Config.kmk

    r65229 r65263  
    651651# Enable this to build vbox-img even if VBOX_WITH_TESTCASES is disabled
    652652VBOX_WITH_VBOX_IMG =
    653 # Enables the VPX module for VM video capturing
    654653if1of ($(KBUILD_TARGET).$(KBUILD_TARGET_ARCH), darwin.x86 darwin.amd64 linux.x86 linux.amd64 solaris.amd64 win.x86 win.amd64)
    655  VBOX_WITH_VPX = 1
     654 # Enables the video capturing support.
     655 VBOX_WITH_VIDEOREC = 1
    656656 # Enables audio support for VM video capturing. Not enabled by default yet.
    657657 VBOX_WITH_AUDIO_VIDEOREC =
     
    679679# Enable cURL (required for the network part of the GUI)
    680680VBOX_WITH_LIBCURL = 1
     681# Enable VPX (VP8 / VP9 codec), used for video capturing.
     682VBOX_WITH_LIBVPX = 1
    681683# Enable Host=>Guest Drag'n'Drop
    682684if1of ($(KBUILD_TARGET), darwin linux solaris win)
     
    11481150 endif
    11491151 if1of ($(KBUILD_TARGET), win)
    1150   VBOX_WITH_VPX=
     1152  VBOX_WITH_LIBVPX=
    11511153 endif
    11521154 VBOX_GUI_WITH_HIDPI=
     
    37073709endif
    37083710
    3709 SDK_VBOX_VPX       = .
    3710 SDK_VBOX_VPX_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvpx
    3711 SDK_VBOX_VPX_INCS ?= $(SDK_VBOX_VPX_DEFAULT_INCS)
    3712 SDK_VBOX_VPX_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvpx$(VBOX_SUFF_LIB)
     3711ifdef VBOX_WITH_LIBVPX
     3712 SDK_VBOX_VPX       = .
     3713 SDK_VBOX_VPX_DEFAULT_INCS := $(PATH_ROOT)/src/libs/libvpx
     3714 SDK_VBOX_VPX_INCS ?= $(SDK_VBOX_VPX_DEFAULT_INCS)
     3715 SDK_VBOX_VPX_LIBS ?= $(PATH_STAGE_LIB)/VBox-libvpx$(VBOX_SUFF_LIB)
     3716endif
    37133717
    37143718ifdef VBOX_WITH_LIBOPUS
    3715 SDK_VBOX_OPUS       = .
    3716 SDK_VBOX_OPUS_INCS ?= $(PATH_ROOT)/src/libs/libopus-1.1.3/include
    3717 SDK_VBOX_OPUS_LIBS ?= $(PATH_STAGE_LIB)/VBox-libopus$(VBOX_SUFF_LIB)
     3719 SDK_VBOX_OPUS       = .
     3720 SDK_VBOX_OPUS_INCS ?= $(PATH_ROOT)/src/libs/libopus-1.1.3/include
     3721 SDK_VBOX_OPUS_LIBS ?= $(PATH_STAGE_LIB)/VBox-libopus$(VBOX_SUFF_LIB)
    37183722endif
    37193723
  • trunk/src/VBox/Frontends/VBoxHeadless/Makefile.kmk

    r62493 r65263  
    55
    66#
    7 # Copyright (C) 2006-2016 Oracle Corporation
     7# Copyright (C) 2006-2017 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    4545#
    4646VBoxHeadless_TEMPLATE  := $(if $(VBOX_WITH_HARDENING),VBOXMAINCLIENTDLL,VBOXMAINCLIENTEXE)
    47 VBoxHeadless_DEFS      += $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,)
     47VBoxHeadless_DEFS      += $(if $(VBOX_WITH_VIDEOREC),VBOX_WITH_VIDEOREC,)
    4848VBoxHeadless_SOURCES    = VBoxHeadless.cpp
    4949ifdef VBOX_WITH_GUEST_PROPS
  • trunk/src/VBox/Frontends/VBoxHeadless/VBoxHeadless.cpp

    r64184 r65263  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    4444#include <VBox/VBoxVideo.h>
    4545
    46 #ifdef VBOX_WITH_VPX
     46#ifdef VBOX_WITH_VIDEOREC
    4747# include <cstdlib>
    4848# include <cerrno>
     
    464464             "                                       settings password\n"
    465465             "   -start-paused, --start-paused     Start the VM in paused state\n"
    466 #ifdef VBOX_WITH_VPX
     466#ifdef VBOX_WITH_VIDEOREC
    467467             "   -c, -capture, --capture           Record the VM screen output to a file\n"
    468468             "   -w, --width                       Frame width when recording\n"
     
    475475}
    476476
    477 #ifdef VBOX_WITH_VPX
     477#ifdef VBOX_WITH_VIDEOREC
    478478/**
    479479 * Parse the environment for variables which can influence the VIDEOREC settings.
     
    524524        *ppszFileName = pszEnvTemp;
    525525}
    526 #endif /* VBOX_WITH_VPX defined */
     526#endif /* VBOX_WITH_VIDEOREC defined */
    527527
    528528static RTEXITCODE readPasswordFile(const char *pszFilename, com::Utf8Str *pPasswd)
     
    626626    unsigned fCSAM  = ~0U;
    627627    unsigned fPaused = 0;
    628 #ifdef VBOX_WITH_VPX
     628#ifdef VBOX_WITH_VIDEOREC
    629629    bool fVideoRec = 0;
    630630    unsigned long ulFrameWidth = 800;
     
    633633    char szMpegFile[RTPATH_MAX];
    634634    const char *pszFileNameParam = "VBox-%d.vob";
    635 #endif /* VBOX_WITH_VPX */
     635#endif /* VBOX_WITH_VIDEOREC */
    636636#ifdef RT_OS_WINDOWS
    637637    ATL::CComModule _Module; /* Required internally by ATL (constructor records instance in global variable). */
     
    643643             "All rights reserved.\n\n");
    644644
    645 #ifdef VBOX_WITH_VPX
     645#ifdef VBOX_WITH_VIDEOREC
    646646    /* Parse the environment */
    647647    parse_environ(&ulFrameWidth, &ulFrameHeight, &ulBitRate, &pszFileNameParam);
     
    696696        { "--settingspw", OPT_SETTINGSPW, RTGETOPT_REQ_STRING },
    697697        { "--settingspwfile", OPT_SETTINGSPW_FILE, RTGETOPT_REQ_STRING },
    698 #ifdef VBOX_WITH_VPX
     698#ifdef VBOX_WITH_VIDEOREC
    699699        { "-capture", 'c', 0 },
    700700        { "--capture", 'c', 0 },
     
    703703        { "--bitrate", 'r', RTGETOPT_REQ_UINT32 },
    704704        { "--filename", 'f', RTGETOPT_REQ_STRING },
    705 #endif /* VBOX_WITH_VPX defined */
     705#endif /* VBOX_WITH_VIDEOREC defined */
    706706        { "-comment", OPT_COMMENT, RTGETOPT_REQ_STRING },
    707707        { "--comment", OPT_COMMENT, RTGETOPT_REQ_STRING },
     
    780780                fPaused = true;
    781781                break;
    782 #ifdef VBOX_WITH_VPX
     782#ifdef VBOX_WITH_VIDEOREC
    783783            case 'c':
    784784                fVideoRec = true;
     
    793793                pszFileNameParam = ValueUnion.psz;
    794794                break;
    795 #endif /* VBOX_WITH_VPX defined */
     795#endif /* VBOX_WITH_VIDEOREC defined */
    796796            case 'h':
    797 #ifdef VBOX_WITH_VPX
     797#ifdef VBOX_WITH_VIDEOREC
    798798                if ((GetState.pDef->fFlags & RTGETOPT_REQ_MASK) != RTGETOPT_REQ_NOTHING)
    799799                {
     
    817817    }
    818818
    819 #ifdef VBOX_WITH_VPX
     819#ifdef VBOX_WITH_VIDEOREC
    820820    if (ulFrameWidth < 512 || ulFrameWidth > 2048 || ulFrameWidth % 2)
    821821    {
     
    847847    }
    848848    RTStrPrintf(&szMpegFile[0], RTPATH_MAX, pszFileNameParam, RTProcSelf());
    849 #endif /* defined VBOX_WITH_VPX */
     849#endif /* defined VBOX_WITH_VIDEOREC */
    850850
    851851    if (!pcszNameOrUUID)
     
    958958        CHECK_ERROR_BREAK(console, COMGETTER(Display)(display.asOutParam()));
    959959
    960 #ifdef VBOX_WITH_VPX
     960#ifdef VBOX_WITH_VIDEOREC
    961961        if (fVideoRec)
    962962        {
     
    967967            CHECK_ERROR_BREAK(machine, COMSETTER(VideoCaptureEnabled)(TRUE));
    968968        }
    969 #endif /* defined(VBOX_WITH_VPX) */
     969#endif /* defined(VBOX_WITH_VIDEOREC) */
    970970
    971971        /* get the machine debugger (isn't necessarily available) */
     
    12161216        Log(("VBoxHeadless: event loop has terminated...\n"));
    12171217
    1218 #ifdef VBOX_WITH_VPX
     1218#ifdef VBOX_WITH_VIDEOREC
    12191219        if (fVideoRec)
    12201220        {
     
    12221222                machine->COMSETTER(VideoCaptureEnabled)(FALSE);
    12231223        }
    1224 #endif /* defined(VBOX_WITH_VPX) */
     1224#endif /* defined(VBOX_WITH_VIDEOREC) */
    12251225
    12261226        /* we don't have to disable VRDE here because we don't save the settings of the VM */
  • trunk/src/VBox/Frontends/VBoxManage/Makefile.kmk

    r62585 r65263  
    55
    66#
    7 # Copyright (C) 2006-2016 Oracle Corporation
     7# Copyright (C) 2006-2017 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    3838        $(if $(VBOX_WITH_USB_CARDREADER),VBOX_WITH_USB_CARDREADER) \
    3939        $(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH) \
    40         $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX) \
     40        $(if $(VBOX_WITH_VIDEOREC),VBOX_WITH_VIDEOREC) \
    4141        $(if $(VBOX_WITH_NAT_SERVICE),VBOX_WITH_NAT_SERVICE) \
    4242        $(if $(VBOX_WITH_VMSVGA),VBOX_WITH_VMSVGA)
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageControlVM.cpp

    r64907 r65263  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    17061706            RTFileClose(pngFile);
    17071707        }
    1708 #ifdef VBOX_WITH_VPX
     1708#ifdef VBOX_WITH_VIDEOREC
    17091709        /*
    17101710         * Note: Commands starting with "vcp" are the deprecated versions and are
     
    19401940            CHECK_ERROR_BREAK(sessionMachine, COMSETTER(VideoCaptureOptions)(Bstr(a->argv[3]).raw()));
    19411941        }
    1942 #endif /* VBOX_WITH_VPX */
     1942#endif /* VBOX_WITH_VIDEOREC */
    19431943        else if (!strcmp(a->argv[1], "webcam"))
    19441944        {
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageHelp.cpp

    r64997 r65263  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    885885                     "                                             acpishutdown]\n"
    886886#endif
    887 #ifdef VBOX_WITH_VPX
     887#ifdef VBOX_WITH_VIDEOREC
    888888                     "                            [--videocap on|off]\n"
    889889                     "                            [--videocapscreens all|<screen ID> [<screen ID> ...]]\n"
  • trunk/src/VBox/Frontends/VBoxManage/VBoxManageModifyVM.cpp

    r65181 r65263  
    203203    MODIFYVM_USBCARDREADER,
    204204#endif
    205 #ifdef VBOX_WITH_VPX
     205#ifdef VBOX_WITH_VIDEOREC
    206206    MODIFYVM_VIDEOCAP,
    207207    MODIFYVM_VIDEOCAP_SCREENS,
     
    372372    { "--faulttolerancesyncinterval", MODIFYVM_FAULT_TOLERANCE_SYNC_INTERVAL, RTGETOPT_REQ_UINT32 },
    373373    { "--chipset",                  MODIFYVM_CHIPSET,                   RTGETOPT_REQ_STRING },
    374 #ifdef VBOX_WITH_VPX
     374#ifdef VBOX_WITH_VIDEOREC
    375375    { "--videocap",                 MODIFYVM_VIDEOCAP,                  RTGETOPT_REQ_BOOL_ONOFF },
    376376    { "--vcpenabled",               MODIFYVM_VIDEOCAP,                  RTGETOPT_REQ_BOOL_ONOFF }, /* deprecated */
     
    451451}
    452452
     453#ifdef VBOX_WITH_VIDEOREC
    453454static int parseScreens(const char *pcszScreens, com::SafeArray<BOOL> *pScreens)
    454455{
     
    474475    return 0;
    475476}
     477#endif
    476478
    477479static int parseNum(uint32_t uIndex, unsigned cMaxIndex, const char *pszName)
     
    28492851                break;
    28502852            }
    2851 #ifdef VBOX_WITH_VPX
     2853#ifdef VBOX_WITH_VIDEOREC
    28522854            case MODIFYVM_VIDEOCAP:
    28532855            {
  • trunk/src/VBox/Main/Makefile.kmk

    r65184 r65263  
    289289        $(if $(VBOX_WITH_AUDIO_VALIDATIONKIT),VBOX_WITH_AUDIO_VALIDATIONKIT,) \
    290290        $(if $(VBOX_WITH_AUDIO_VIDEOREC),VBOX_WITH_AUDIO_VIDEOREC,) \
    291         $(if $(VBOX_WITH_VRDE_AUDIO),VBOX_WITH_VRDE_AUDIO,) \
     291    $(if $(VBOX_WITH_VIDEOREC),VBOX_WITH_VIDEOREC,) \
     292    $(if $(VBOX_WITH_VRDE_AUDIO),VBOX_WITH_VRDE_AUDIO,) \
    292293        $(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
    293294        $(if $(VBOX_WITH_VIRTIO),VBOX_WITH_VIRTIO,) \
     
    671672        $(if $(VBOX_WITH_AUDIO_VALIDATIONKIT),VBOX_WITH_AUDIO_VALIDATIONKIT,) \
    672673        $(if $(VBOX_WITH_AUDIO_VIDEOREC),VBOX_WITH_AUDIO_VIDEOREC,) \
     674    $(if $(VBOX_WITH_VIDEOREC),VBOX_WITH_VIDEOREC,) \
    673675        $(if $(VBOX_WITH_VRDE_AUDIO),VBOX_WITH_VRDE_AUDIO,) \
    674676        $(if $(VBOX_WITH_E1000),VBOX_WITH_E1000,) \
     
    686688        $(if $(VBOX_WITH_EXTPACK),VBOX_WITH_EXTPACK,) \
    687689        $(if $(VBOX_WITH_PCI_PASSTHROUGH),VBOX_WITH_PCI_PASSTHROUGH,) \
    688         $(if $(VBOX_WITH_VRDEAUTH_IN_VBOXSVC),VBOX_WITH_VRDEAUTH_IN_VBOXSVC,) \
    689         $(if $(VBOX_WITH_VPX),VBOX_WITH_VPX,)
     690        $(if $(VBOX_WITH_VRDEAUTH_IN_VBOXSVC),VBOX_WITH_VRDEAUTH_IN_VBOXSVC,)
    690691ifdef VBOX_WITH_CRHGSMI
    691692 VBoxC_DEFS += VBOX_WITH_CRHGSMI
     
    703704
    704705VBoxC_SDKS = VBOX_LIBPNG VBOX_ZLIB
    705 ifdef VBOX_WITH_VPX
    706   VBoxC_SDKS += VBOX_VPX
    707 endif
     706
     707ifdef VBOX_WITH_VIDEOREC
     708  ifdef VBOX_WITH_LIBVPX
     709   VBoxC_SDKS += VBOX_VPX
     710   VBoxC_DEFS += VBOX_WITH_LIBVPX
     711  else
     712   $(error "VBox: No alternative for VPX when using video capturing support yet")
     713  endif
     714endif
     715
    708716ifdef VBOX_WITH_AUDIO_VIDEOREC
    709717  ifdef VBOX_WITH_LIBOPUS
    710718   VBoxC_SDKS += VBOX_OPUS
     719   VBoxC_DEFS += VBOX_WITH_LIBOPUS
    711720  else
    712721   $(error "VBox: No alternative for Opus when using audio support for video capturing yet")
    713722  endif
    714723endif
     724
    715725ifdef VBOX_WITH_OPENSSL_FIPS
    716726  VBoxC_SDKS += VBOX_OPENSSL2
     
    802812        src-client/DisplayImplLegacy.cpp \
    803813        src-client/DisplaySourceBitmapImpl.cpp \
     814        src-client/EbmlWriter.cpp \
    804815        src-client/EmulatedUSBImpl.cpp \
    805816        src-client/GuestImpl.cpp \
     
    812823        src-client/USBDeviceImpl.cpp \
    813824        src-client/VBoxDriversRegister.cpp \
     825        src-client/VideoRec.cpp \
    814826        src-client/VirtualBoxClientImpl.cpp \
    815827        src-client/VMMDevInterface.cpp \
     
    857869 VBoxC_SOURCES += \
    858870        src-client/RemoteUSBBackend.cpp
    859 endif
    860 ifdef VBOX_WITH_VPX
    861  VBoxC_SOURCES += \
    862         src-client/EbmlWriter.cpp \
    863         src-client/VideoRec.cpp
    864871endif
    865872ifndef VBOX_WITH_VRDEAUTH_IN_VBOXSVC
  • trunk/src/VBox/Main/include/DisplayImpl.h

    r63606 r65263  
    9696#endif /* VBOX_WITH_CROGL */
    9797
    98 #ifdef VBOX_WITH_VPX
     98#ifdef VBOX_WITH_VIDEOREC
    9999    struct
    100100    {
    101101        ComPtr<IDisplaySourceBitmap> pSourceBitmap;
    102102    } videoCapture;
    103 #endif
     103#endif /* VBOX_WITH_VIDEOREC */
    104104} DISPLAYFBINFO;
    105105
     
    205205    void i_VideoCaptureStop();
    206206    int  i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens));
    207 #ifdef VBOX_WITH_VPX
     207#ifdef VBOX_WITH_VIDEOREC
    208208    void videoCaptureScreenChanged(unsigned uScreenId);
    209209#endif
     
    462462    /* Serializes access to mVideoAccelLegacy and mfVideoAccelVRDP, etc between VRDP and Display. */
    463463    RTCRITSECT mVideoAccelLock;
    464 #ifdef VBOX_WITH_VPX
     464#ifdef VBOX_WITH_VIDEOREC
    465465    /* Serializes access to video capture source bitmaps. */
    466466    RTCRITSECT mVideoCaptureLock;
     
    503503#endif
    504504
    505 #ifdef VBOX_WITH_VPX
     505#ifdef VBOX_WITH_VIDEOREC
    506506    VIDEORECCONTEXT *mpVideoRecCtx;
    507507    bool maVideoRecEnabled[SchemaDefs::MaxGuestMonitors];
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r65173 r65263  
    55
    66/*
    7  * Copyright (C) 2006-2016 Oracle Corporation
     7 * Copyright (C) 2006-2017 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    5151#include <VBox/com/array.h>
    5252
    53 #ifdef VBOX_WITH_VPX
     53#ifdef VBOX_WITH_VIDEOREC
    5454# include <iprt/path.h>
    5555# include "VideoRec.h"
     
    131131    mfHostCursorCapabilities = 0;
    132132#endif
    133 #ifdef VBOX_WITH_VPX
     133#ifdef VBOX_WITH_VIDEOREC
    134134    rc = RTCritSectInit(&mVideoCaptureLock);
    135135    AssertRC(rc);
     
    163163    uninit();
    164164
    165 #ifdef VBOX_WITH_VPX
     165#ifdef VBOX_WITH_VIDEOREC
    166166    if (RTCritSectIsInitialized(&mVideoCaptureLock))
    167167    {
     
    714714        maFramebuffers[uScreenId].updateImage.cbLine = 0;
    715715        maFramebuffers[uScreenId].pFramebuffer.setNull();
    716 #ifdef VBOX_WITH_VPX
     716#ifdef VBOX_WITH_VIDEOREC
    717717        maFramebuffers[uScreenId].videoCapture.pSourceBitmap.setNull();
    718718#endif
     
    988988        i_handleSetVisibleRegion(mcRectVisibleRegion, mpRectVisibleRegion);
    989989
    990 #ifdef VBOX_WITH_VPX
     990#ifdef VBOX_WITH_VIDEOREC
    991991    videoCaptureScreenChanged(uScreenId);
    992992#endif
     
    22662266int Display::i_VideoCaptureEnableScreens(ComSafeArrayIn(BOOL, aScreens))
    22672267{
    2268 #ifdef VBOX_WITH_VPX
     2268#ifdef VBOX_WITH_VIDEOREC
    22692269    com::SafeArray<BOOL> Screens(ComSafeArrayInArg(aScreens));
    22702270    for (unsigned i = 0; i < Screens.size(); i++)
     
    22802280    return VINF_SUCCESS;
    22812281#else
    2282     return VERR_NOT_IMPLEMENTED;
     2282    ComSafeArrayNoRef(aScreens);
     2283    return VERR_NOT_SUPPORTED;
    22832284#endif
    22842285}
     
    22892290int Display::i_VideoCaptureStart()
    22902291{
    2291 #ifdef VBOX_WITH_VPX
     2292#ifdef VBOX_WITH_VIDEOREC
    22922293    if (VideoRecIsEnabled(mpVideoRecCtx))
    22932294        return VINF_SUCCESS;
     
    23482349        if (RT_SUCCESS(rc))
    23492350        {
     2351#ifndef DEUBG_andy
    23502352            if (mcMonitors > 1)
    23512353                rc = RTStrAPrintf(&pszName, "%s-%u%s", pszAbsPath, uScreen+1, pszSuff);
    23522354            else
    23532355                rc = RTStrAPrintf(&pszName, "%s%s", pszAbsPath, pszSuff);
     2356#else
     2357            if (mcMonitors > 1)
     2358                rc = RTStrAPrintf(&pszName, "/tmp/avcap-%u.webm", uScreen+1);
     2359            else
     2360                rc = RTStrAPrintf(&pszName, "/tmp/avcap.webm");
     2361#endif
    23542362        }
    23552363        if (RT_SUCCESS(rc))
     
    23962404    }
    23972405    return rc;
    2398 #else
    2399     return VERR_NOT_IMPLEMENTED;
     2406#else /* VBOX_WITH_VIDEOREC */
     2407    return VERR_NOT_SUPPORTED;
    24002408#endif
    24012409}
     
    24062414void Display::i_VideoCaptureStop()
    24072415{
    2408 #ifdef VBOX_WITH_VPX
     2416#ifdef VBOX_WITH_VIDEOREC
    24092417    if (VideoRecIsEnabled(mpVideoRecCtx))
    24102418        LogRel(("Display::VideoCaptureStop: WebM/VP8 video recording stopped\n"));
     
    24182426}
    24192427
    2420 #ifdef VBOX_WITH_VPX
     2428#ifdef VBOX_WITH_VIDEOREC
    24212429void Display::videoCaptureScreenChanged(unsigned uScreenId)
    24222430{
     
    24362444    }
    24372445}
    2438 #endif
     2446#endif /* VBOX_WITH_VIDEOREC */
    24392447
    24402448int Display::i_drawToScreenEMT(Display *pDisplay, ULONG aScreenId, BYTE *address,
     
    31333141    }
    31343142
    3135 #ifdef VBOX_WITH_VPX
     3143#ifdef VBOX_WITH_VIDEOREC
    31363144    if (VideoRecIsEnabled(pDisplay->mpVideoRecCtx))
    31373145    {
     
    32293237        } while (0);
    32303238    }
    3231 #endif /* VBOX_WITH_VPX */
     3239#endif /* VBOX_WITH_VIDEOREC */
    32323240
    32333241#ifdef DEBUG_sunlover_2
     
    35783586     *        However, using one of the prefixes indicating the timestamp unit
    35793587     *        would be very valuable!  */
    3580 # if VBOX_WITH_VPX
     3588# if VBOX_WITH_VIDEOREC
    35813589    return VideoRecIsReady(mpVideoRecCtx, uScreen, u64Timestamp);
    35823590# else
     
    35983606{
    35993607    Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED);
    3600 # if VBOX_WITH_VPX
     3608# if VBOX_WITH_VIDEOREC
    36013609    int rc = VideoRecCopyToIntBuf(mpVideoRecCtx, uScreen, x, y,
    36023610                                  uPixelFormat,
     
    36063614    NOREF(rc);
    36073615    Assert(rc == VINF_SUCCESS /* || rc == VERR_TRY_AGAIN || rc == VINF_TRY_AGAIN*/);
    3608 # endif
     3616# else
     3617    RT_NOREF(uScreen, x, y, uPixelFormat, \
     3618             uBitsPerPixel, uBytesPerLine, uGuestWidth, uGuestHeight, pu8BufferAddress, u64Timestamp);
     3619# endif /* VBOX_WITH_VIDEOREC */
    36093620}
    36103621
     
    42784289    {
    42794290        AutoWriteLock displayLock(pThis->pDisplay COMMA_LOCKVAL_SRC_POS);
    4280 #ifdef VBOX_WITH_VPX
     4291#ifdef VBOX_WITH_VIDEOREC
    42814292        pThis->pDisplay->i_VideoCaptureStop();
    42824293#endif
     
    43894400#endif
    43904401
    4391 #ifdef VBOX_WITH_VPX
     4402#ifdef VBOX_WITH_VIDEOREC
    43924403    ComPtr<IMachine> pMachine = pDisplay->mParent->i_machine();
    43934404    BOOL fEnabled = false;
    43944405    HRESULT hrc = pMachine->COMGETTER(VideoCaptureEnabled)(&fEnabled);
    43954406    AssertComRCReturn(hrc, VERR_COM_UNEXPECTED);
    4396 
    4397 #ifdef DEBUG_andy
    4398     fEnabled = true;
    4399 #endif
    44004407
    44014408    if (fEnabled)
  • trunk/src/VBox/Main/src-client/DrvAudioVideoRec.cpp

    r65256 r65263  
    3939#include <VBox/err.h>
    4040
    41 #include <opus.h>
    42 
     41#ifdef VBOX_WITH_LIBOPUS
     42# include <opus.h>
     43#endif
    4344
    4445/*********************************************************************************************************************************
     
    7071    union
    7172    {
     73#ifdef VBOX_WITH_LIBOPUS
    7274        struct
    7375        {
     
    7577            OpusEncoder *pEnc;
    7678        } Opus;
     79#endif /* VBOX_WITH_LIBOPUS */
    7780    };
    7881} AVRECCODEC, *PAVRECCODEC;
     
    135138    PAVRECSTREAMOUT pStreamOut = (PAVRECSTREAMOUT)pStream;
    136139
    137     int rc = DrvAudioHlpStreamCfgToProps(pCfgReq, &pStreamOut->Props);
     140    int rc;
     141
     142#ifdef VBOX_WITH_LIBOPUS
     143    rc = DrvAudioHlpStreamCfgToProps(pCfgReq, &pStreamOut->Props);
    138144    if (RT_SUCCESS(rc))
    139145    {
     
    177183        }
    178184    }
    179 
    180     LogFlowFuncLeaveRC(VINF_SUCCESS);
    181     return VINF_SUCCESS;
     185#else
     186    rc = VERR_NOT_SUPPORTED;
     187#endif /* VBOX_WITH_LIBOPUS */
     188
     189    LogFlowFuncLeaveRC(rc);
     190    return rc;
    182191}
    183192
     
    310319                 pStreamOut->Props.cBits, pStreamOut->Props.fSigned, cSamplesToSend));
    311320
     321    uint32_t csRead = 0;
     322
     323    int rc;
     324
    312325    /*
    313326     * Call the encoder with the data.
    314327     */
     328#ifdef VBOX_WITH_LIBOPUS
    315329
    316330    /** @todo For now we ASSUME 25 FPS. */
     
    318332    size_t   cbFrameSize = AUDIOMIXBUF_S2B(&pStream->MixBuf, csFrameSize);
    319333
    320     uint32_t csRead = 0;
    321     int rc = AudioMixBufReadCirc(&pStream->MixBuf, (uint8_t *)&pStreamOut->pvFrameBuf[pStreamOut->offFrameBufWrite],
    322                                  pStreamOut->cbFrameBufSize - pStreamOut->offFrameBufWrite, &csRead);
     334    rc = AudioMixBufReadCirc(&pStream->MixBuf, (uint8_t *)&pStreamOut->pvFrameBuf[pStreamOut->offFrameBufWrite],
     335                             pStreamOut->cbFrameBufSize - pStreamOut->offFrameBufWrite, &csRead);
    323336    if (RT_SUCCESS(rc))
    324337    {
     
    356369        }
    357370    }
     371#else
     372    rc = VERR_NOT_SUPPORTED;
     373#endif /* VBOX_WITH_LIBOPUS */
    358374
    359375    if (csRead)
     
    385401    }
    386402
     403#ifdef VBOX_WITH_LIBOPUS
    387404    if (pStreamOut->Codec.Opus.pEnc)
    388405    {
     
    390407        pStreamOut->Codec.Opus.pEnc = NULL;
    391408    }
     409#endif
    392410
    393411    return VINF_SUCCESS;
  • trunk/src/VBox/Main/src-client/EbmlWriter.cpp

    r65261 r65263  
    309309    };
    310310
    311 #ifdef VBOX_WITH_AUDIO_VIDEOREC
     311#ifdef VBOX_WITH_LIBOPUS
    312312# pragma pack(push)
    313313# pragma pack(1)
     
    325325    };
    326326# pragma pack(pop)
    327 #endif /* VBOX_WITH_AUDIO_VIDEOREC */
     327#endif /* VBOX_WITH_LIBOPUS */
    328328
    329329    /** Audio codec to use. */
     
    387387    int AddAudioTrack(float fSamplingHz, float fOutputHz, uint8_t cChannels, uint8_t cBitDepth)
    388388    {
    389 #ifdef VBOX_WITH_AUDIO_VIDEOREC
     389#ifdef VBOX_WITH_LIBOPUS
    390390        m_Ebml.subStart(TrackEntry);
    391391        m_Ebml.serializeUnsignedInteger(TrackNumber, (uint8_t)m_lstTracks.size());
     
    557557    }
    558558
    559 #ifdef VBOX_WITH_AUDIO_VIDEOREC
     559#ifdef VBOX_WITH_LIBOPUS
    560560    /* Audio blocks that have same absolute timecode as video blocks SHOULD be written before the video blocks. */
    561561    int writeBlockOpus(const void *pvData, size_t cbData)
     
    563563static uint16_t s_uTimecode = 0;
    564564
    565         return writeSimpleBlockInternal(1 /** @todo FIX! */, s_uTimecode++, pvData, cbData, 0 /* Flags */);
     565        return writeSimpleBlockInternal(0 /** @todo FIX! */, s_uTimecode++, pvData, cbData, 0 /* Flags */);
    566566    }
    567567#endif
     
    581581        switch (blockType)
    582582        {
    583 #ifdef VBOX_WITH_AUDIO_VIDEOREC
     583
    584584            case WebMWriter::BlockType_Audio:
    585585            {
     586#ifdef VBOX_WITH_LIBOPUS
    586587                if (m_enmAudioCodec == WebMWriter::AudioCodec_Opus)
    587588                {
     
    591592                }
    592593                else
     594#endif /* VBOX_WITH_LIBOPUS */
    593595                    rc = VERR_NOT_SUPPORTED;
    594596                break;
    595597            }
    596 #endif
     598
    597599            case WebMWriter::BlockType_Video:
    598600            {
  • trunk/src/VBox/Main/src-client/VideoRec.cpp

    r65260 r65263  
    11/* $Id$ */
    22/** @file
    3  * Encodes the screen content in VPX format.
     3 * Video capturing utility routines.
    44 */
    55
     
    3434#include "VideoRec.h"
    3535
    36 #define VPX_CODEC_DISABLE_COMPAT 1
    37 #include <vpx/vp8cx.h>
    38 #include <vpx/vpx_image.h>
     36#ifdef VBOX_WITH_LIBVPX
     37# define VPX_CODEC_DISABLE_COMPAT 1
     38# include <vpx/vp8cx.h>
     39# include <vpx/vpx_image.h>
    3940
    4041/** Default VPX codec to use. */
    41 #define DEFAULTCODEC (vpx_codec_vp8_cx())
     42# define DEFAULTCODEC (vpx_codec_vp8_cx())
     43#endif /* VBOX_WITH_LIBVPX */
    4244
    4345static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStrm);
     
    4951 * Enumeration for a video recording state.
    5052 */
    51 enum
     53enum VIDEORECSTS
    5254{
    5355    /** Not initialized. */
    54     VIDREC_UNINITIALIZED = 0,
     56    VIDEORECSTS_UNINITIALIZED = 0,
    5557    /** Initialized, idle. */
    56     VIDREC_IDLE = 1,
     58    VIDEORECSTS_IDLE          = 1,
    5759    /** Currently in VideoRecCopyToIntBuf(), delay termination. */
    58     VIDREC_COPYING = 2,
     60    VIDEORECSTS_COPYING      = 2,
    5961    /** Signal that we are terminating. */
    60     VIDREC_TERMINATING = 3
     62    VIDEORECSTS_TERMINATING  = 3
    6163};
    6264
     65/**
     66 * Enumeration for supported pixel formats.
     67 */
     68enum VIDEORECPIXELFMT
     69{
     70    /** Unknown pixel format. */
     71    VIDEORECPIXELFMT_UNKNOWN = 0,
     72    /** RGB 24. */
     73    VIDEORECPIXELFMT_RGB24   = 1,
     74    /** RGB 24. */
     75    VIDEORECPIXELFMT_RGB32   = 2,
     76    /** RGB 565. */
     77    VIDEORECPIXELFMT_RGB565  = 3
     78};
     79
    6380/* Must be always accessible and therefore cannot be part of VIDEORECCONTEXT */
    64 static uint32_t g_enmState = VIDREC_UNINITIALIZED;
     81static uint32_t g_enmState = VIDEORECSTS_UNINITIALIZED;
    6582
    6683/**
     
    7188    union
    7289    {
     90#ifdef VBOX_WITH_LIBVPX
    7391        struct
    7492        {
     
    8098            vpx_image_t         RawImage;
    8199        } VPX;
     100#endif /* VBOX_WITH_LIBVPX */
    82101    };
    83102} VIDEORECCODEC, *PVIDEORECCODEC;
     
    424443        AssertRCBreak(rc);
    425444
    426         if (ASMAtomicReadU32(&g_enmState) == VIDREC_TERMINATING)
     445        if (ASMAtomicReadU32(&g_enmState) == VIDEORECSTS_TERMINATING)
    427446            break;
    428447
     
    469488    AssertPtrReturn(ppCtx, VERR_INVALID_POINTER);
    470489
    471     Assert(ASMAtomicReadU32(&g_enmState) == VIDREC_UNINITIALIZED);
     490    Assert(ASMAtomicReadU32(&g_enmState) == VIDEORECSTS_UNINITIALIZED);
    472491
    473492    int rc = VINF_SUCCESS;
     
    511530        AssertRCReturn(rc, rc);
    512531
    513         ASMAtomicWriteU32(&g_enmState, VIDREC_IDLE);
     532        ASMAtomicWriteU32(&g_enmState, VIDEORECSTS_IDLE);
    514533
    515534        if (ppCtx)
     
    549568        return;
    550569
    551     uint32_t enmState = VIDREC_IDLE;
     570    uint32_t enmState = VIDEORECSTS_IDLE;
    552571
    553572    for (;;) /** @todo r=andy Remove busy waiting! */
    554573    {
    555         if (ASMAtomicCmpXchgExU32(&g_enmState, VIDREC_TERMINATING, enmState, &enmState))
    556             break;
    557         if (enmState == VIDREC_UNINITIALIZED)
     574        if (ASMAtomicCmpXchgExU32(&g_enmState, VIDEORECSTS_TERMINATING, enmState, &enmState))
     575            break;
     576        if (enmState == VIDEORECSTS_UNINITIALIZED)
    558577            return;
    559578    }
    560579
    561     if (enmState == VIDREC_COPYING)
     580    if (enmState == VIDEORECSTS_COPYING)
    562581    {
    563582        int rc = RTSemEventWait(pCtx->TermEvent, RT_INDEFINITE_WAIT);
     
    606625    RTMemFree(pCtx);
    607626
    608     ASMAtomicWriteU32(&g_enmState, VIDREC_UNINITIALIZED);
     627    ASMAtomicWriteU32(&g_enmState, VIDEORECSTS_UNINITIALIZED);
    609628}
    610629
     
    640659    pStream->pu8RgbBuf = (uint8_t *)RTMemAllocZ(uWidth * uHeight * 4);
    641660    AssertReturn(pStream->pu8RgbBuf, VERR_NO_MEMORY);
    642     pStream->uEncoderDeadline = VPX_DL_REALTIME;
    643661
    644662    /* Play safe: the file must not exist, overwriting is potentially
     
    646664     * other important file, causing unintentional data loss. */
    647665
     666#ifdef VBOX_WITH_LIBVPX
     667    pStream->uEncoderDeadline = VPX_DL_REALTIME;
     668
    648669    vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStream->Codec.VPX.Config, 0);
    649670    if (rcv != VPX_CODEC_OK)
     
    652673        return VERR_INVALID_PARAMETER;
    653674    }
     675#endif
    654676
    655677    com::Utf8Str options(pszOptions);
     
    669691            if (value.compare("realtime", Utf8Str::CaseInsensitive) == 0)
    670692            {
     693#ifdef VBOX_WITH_LIBVPX
    671694                pStream->uEncoderDeadline = VPX_DL_REALTIME;
     695#endif
    672696            }
    673697            else if (value.compare("good", Utf8Str::CaseInsensitive) == 0)
     
    677701            else if (value.compare("best", Utf8Str::CaseInsensitive) == 0)
    678702            {
     703#ifdef VBOX_WITH_LIBVPX
    679704                pStream->uEncoderDeadline = VPX_DL_BEST_QUALITY;
     705#endif
    680706            }
    681707            else
     
    724750    }
    725751
     752    pStream->uDelay = 1000 / uFps;
     753
     754    if (fHasVideoTrack)
     755    {
     756        rc = pStream->pEBML->AddVideoTrack(uWidth, uHeight, uFps);
     757        if (RT_FAILURE(rc))
     758        {
     759            LogRel(("VideoRec: Failed to add video track to output file '%s' (%Rrc)\n", pszFile, rc));
     760            return rc;
     761        }
     762    }
     763
     764#ifdef VBOX_WITH_LIBVPX
    726765    /* target bitrate in kilobits per second */
    727766    pStream->Codec.VPX.Config.rc_target_bitrate = uRate;
     
    736775    pStream->Codec.VPX.Config.g_threads = 0;
    737776
    738     pStream->uDelay = 1000 / uFps;
    739 
    740     if (fHasVideoTrack)
    741     {
    742         rc = pStream->pEBML->AddVideoTrack(pStream->Codec.VPX.Config.g_w, /* Width */
    743                                            pStream->Codec.VPX.Config.g_h, /* Height */
    744                                            uFps);
    745         if (RT_FAILURE(rc))
    746         {
    747             LogRel(("VideoRec: Failed to add video track to output file '%s' (%Rrc)\n", pszFile, rc));
    748             return rc;
    749         }
    750     }
    751 
    752     /* Initialize codec */
     777    /* Initialize codec. */
    753778    rcv = vpx_codec_enc_init(&pStream->Codec.VPX.CodecCtx, DEFAULTCODEC, &pStream->Codec.VPX.Config, 0);
    754779    if (rcv != VPX_CODEC_OK)
     
    765790
    766791    pStream->pu8YuvBuf = pStream->Codec.VPX.RawImage.planes[0];
     792#endif
    767793
    768794    pCtx->fEnabled = true;
     
    782808    RT_NOREF(pCtx);
    783809    uint32_t enmState = ASMAtomicReadU32(&g_enmState);
    784     return (   enmState == VIDREC_IDLE
    785             || enmState == VIDREC_COPYING);
     810    return (   enmState == VIDEORECSTS_IDLE
     811            || enmState == VIDEORECSTS_COPYING);
    786812}
    787813
     
    798824{
    799825    uint32_t enmState = ASMAtomicReadU32(&g_enmState);
    800     if (enmState != VIDREC_IDLE)
     826    if (enmState != VIDEORECSTS_IDLE)
    801827        return false;
    802828
     
    858884static int videoRecEncodeAndWrite(PVIDEORECSTREAM pStream)
    859885{
     886    int rc;
     887
     888#ifdef VBOX_WITH_LIBVPX
    860889    /* presentation time stamp */
    861890    vpx_codec_pts_t pts = pStream->u64TimeStamp;
     
    873902
    874903    vpx_codec_iter_t iter = NULL;
    875     int rc = VERR_NO_DATA;
     904    rc = VERR_NO_DATA;
    876905    for (;;)
    877906    {
     
    896925
    897926    pStream->cFrame++;
     927#else
     928    RT_NOREF(pStream);
     929    rc = VERR_NOT_SUPPORTED;
     930#endif /* VBOX_WITH_LIBVPX */
    898931    return rc;
    899932}
     
    909942    switch (pStrm->u32PixelFormat)
    910943    {
    911         case VPX_IMG_FMT_RGB32:
     944        case VIDEORECPIXELFMT_RGB32:
    912945            LogFlow(("32 bit\n"));
    913946            if (!colorConvWriteYUV420p<ColorConvBGRA32Iter>(pStrm->uTargetWidth,
     
    915948                                                            pStrm->pu8YuvBuf,
    916949                                                            pStrm->pu8RgbBuf))
    917                 return VERR_GENERAL_FAILURE;
    918             break;
    919         case VPX_IMG_FMT_RGB24:
     950                return VERR_INVALID_PARAMETER;
     951            break;
     952        case VIDEORECPIXELFMT_RGB24:
    920953            LogFlow(("24 bit\n"));
    921954            if (!colorConvWriteYUV420p<ColorConvBGR24Iter>(pStrm->uTargetWidth,
     
    923956                                                           pStrm->pu8YuvBuf,
    924957                                                           pStrm->pu8RgbBuf))
    925                 return VERR_GENERAL_FAILURE;
    926             break;
    927         case VPX_IMG_FMT_RGB565:
     958                return VERR_INVALID_PARAMETER;
     959            break;
     960        case VIDEORECPIXELFMT_RGB565:
    928961            LogFlow(("565 bit\n"));
    929962            if (!colorConvWriteYUV420p<ColorConvBGR565Iter>(pStrm->uTargetWidth,
     
    931964                                                            pStrm->pu8YuvBuf,
    932965                                                            pStrm->pu8RgbBuf))
    933                 return VERR_GENERAL_FAILURE;
     966                return VERR_INVALID_PARAMETER;
    934967            break;
    935968        default:
    936             return VERR_GENERAL_FAILURE;
     969            return VERR_NOT_SUPPORTED;
    937970    }
    938971    return VINF_SUCCESS;
     
    964997{
    965998    /* Do not execute during termination and guard against termination */
    966     if (!ASMAtomicCmpXchgU32(&g_enmState, VIDREC_COPYING, VIDREC_IDLE))
     999    if (!ASMAtomicCmpXchgU32(&g_enmState, VIDEORECSTS_COPYING, VIDEORECSTS_IDLE))
    9671000        return VINF_TRY_AGAIN;
    9681001
     
    10501083            {
    10511084                case 32:
    1052                     pStream->u32PixelFormat = VPX_IMG_FMT_RGB32;
     1085                    pStream->u32PixelFormat = VIDEORECPIXELFMT_RGB32;
    10531086                    bpp = 4;
    10541087                    break;
    10551088                case 24:
    1056                     pStream->u32PixelFormat = VPX_IMG_FMT_RGB24;
     1089                    pStream->u32PixelFormat = VIDEORECPIXELFMT_RGB24;
    10571090                    bpp = 3;
    10581091                    break;
    10591092                case 16:
    1060                     pStream->u32PixelFormat = VPX_IMG_FMT_RGB565;
     1093                    pStream->u32PixelFormat = VIDEORECPIXELFMT_RGB565;
    10611094                    bpp = 2;
    10621095                    break;
     
    10981131    } while (0);
    10991132
    1100     if (!ASMAtomicCmpXchgU32(&g_enmState, VIDREC_IDLE, VIDREC_COPYING))
     1133    if (!ASMAtomicCmpXchgU32(&g_enmState, VIDEORECSTS_IDLE, VIDEORECSTS_COPYING))
    11011134    {
    11021135        rc = RTSemEventSignal(pCtx->TermEvent);
  • trunk/src/libs/Makefile.kmk

    r65184 r65263  
    55
    66#
    7 # Copyright (C) 2006-2016 Oracle Corporation
     7# Copyright (C) 2006-2017 Oracle Corporation
    88#
    99# This file is part of VirtualBox Open Source Edition (OSE), as
     
    7878 endif
    7979
    80  # VP8 for video capture
    81  if defined(VBOX_WITH_VPX) && !defined(VBOX_ONLY_DOCS) && !defined(VBOX_WITH_SDK) \
     80 # VPX for video capture.
     81 if defined(VBOX_WITH_LIBVPX) && !defined(VBOX_ONLY_DOCS) && !defined(VBOX_WITH_SDK) \
    8282   && ("$(SDK_VBOX_VPX_INCS)" == "$(SDK_VBOX_VPX_DEFAULT_INCS)")
    8383  if1of ($(KBUILD_TARGET), darwin linux solaris win)
     
    8686 endif
    8787
    88  # Opus for audio encoding video capture
     88 # Opus for audio encoding video capture.
    8989 if defined(VBOX_WITH_LIBOPUS) && !defined(VBOX_ONLY_DOCS) && !defined(VBOX_WITH_SDK) \
    9090   && ("$(SDK_VBOX_OPUS_INCS)" == "$(SDK_VBOX_OPUS_DEFAULT_INCS)")
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette