VirtualBox

Changeset 43929 in vbox


Ignore:
Timestamp:
Nov 21, 2012 2:03:55 PM (12 years ago)
Author:
vboxsync
Message:

ConsoleVRDPServer: VideoIn updates

Location:
trunk/src/VBox/Main
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ConsoleVRDPServer.h

    r43892 r43929  
    2828#include <VBox/RemoteDesktop/VRDESCard.h>
    2929#include <VBox/RemoteDesktop/VRDETSMF.h>
     30#define VRDE_VIDEOIN_WITH_VRDEINTERFACE /* Get the VRDE interface definitions. */
     31#include <VBox/RemoteDesktop/VRDEVideoIn.h>
    3032
    3133#include <VBox/HostServices/VBoxClipboardExt.h>
     
    147149
    148150    int SCardRequest(void *pvUser, uint32_t u32Function, const void *pvData, uint32_t cbData);
     151
     152    int VideoInDeviceAttach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle, void *pvDeviceCtx);
     153    int VideoInDeviceDetach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle);
     154    int VideoInGetDeviceDesc(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle);
     155    int VideoInControl(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle,
     156                       VRDEVIDEOINCTRLHDR *pReq, uint32_t cbReq);
    149157
    150158private:
     
    305313    void tsmfUnlock(void);
    306314    RTCRITSECT mTSMFLock;
     315
     316    /* Video input interface. */
     317    VRDEVIDEOININTERFACE m_interfaceVideoIn;
     318    VRDEVIDEOINCALLBACKS m_interfaceCallbacksVideoIn;
     319    static DECLCALLBACK(void) VRDECallbackVideoInNotify(void *pvCallback,
     320                                                        uint32_t u32Id,
     321                                                        const void *pvData,
     322                                                        uint32_t cbData);
     323    static DECLCALLBACK(void) VRDECallbackVideoInDeviceDesc(void *pvCallback,
     324                                                            int rcRequest,
     325                                                            void *pDeviceCtx,
     326                                                            void *pvUser,
     327                                                            const VRDEVIDEOINDEVICEDESC *pDeviceDesc,
     328                                                            uint32_t cbDevice);
     329    static DECLCALLBACK(void) VRDECallbackVideoInControl(void *pvCallback,
     330                                                         int rcRequest,
     331                                                         void *pDeviceCtx,
     332                                                         void *pvUser,
     333                                                         const VRDEVIDEOINCTRLHDR *pControl,
     334                                                         uint32_t cbControl);
     335    static DECLCALLBACK(void) VRDECallbackVideoInFrame(void *pvCallback,
     336                                                       int rcRequest,
     337                                                       void *pDeviceCtx,
     338                                                       const VRDEVIDEOINPAYLOADHDR *pFrame,
     339                                                       uint32_t cbFrame);
    307340};
    308341
  • trunk/src/VBox/Main/src-client/ConsoleVRDPServer.cpp

    r43892 r43929  
    13811381    RT_ZERO(m_interfaceTSMF);
    13821382    RT_ZERO(m_interfaceCallbacksTSMF);
     1383    RT_ZERO(m_interfaceVideoIn);
     1384    RT_ZERO(m_interfaceCallbacksVideoIn);
    13831385
    13841386    rc = RTCritSectInit(&mTSMFLock);
     
    16641666                    }
    16651667
     1668                    /* VideoIn interface. */
     1669                    m_interfaceVideoIn.header.u64Version = 1;
     1670                    m_interfaceVideoIn.header.u64Size = sizeof(m_interfaceVideoIn);
     1671
     1672                    m_interfaceCallbacksVideoIn.header.u64Version = 1;
     1673                    m_interfaceCallbacksVideoIn.header.u64Size = sizeof(m_interfaceCallbacksVideoIn);
     1674                    m_interfaceCallbacksVideoIn.VRDECallbackVideoInNotify = VRDECallbackVideoInNotify;
     1675                    m_interfaceCallbacksVideoIn.VRDECallbackVideoInDeviceDesc = VRDECallbackVideoInDeviceDesc;
     1676                    m_interfaceCallbacksVideoIn.VRDECallbackVideoInControl = VRDECallbackVideoInControl;
     1677                    m_interfaceCallbacksVideoIn.VRDECallbackVideoInFrame = VRDECallbackVideoInFrame;
     1678
     1679                    vrc = mpEntryPoints->VRDEGetInterface(mhServer,
     1680                                                          VRDE_VIDEOIN_INTERFACE_NAME,
     1681                                                          &m_interfaceVideoIn.header,
     1682                                                          &m_interfaceCallbacksVideoIn.header,
     1683                                                          this);
     1684                    if (RT_SUCCESS(vrc))
     1685                    {
     1686                        LogRel(("VRDE: [%s]\n", VRDE_VIDEOIN_INTERFACE_NAME));
     1687                    }
     1688                    else
     1689                    {
     1690                        RT_ZERO(m_interfaceVideoIn);
     1691                    }
     1692
    16661693                    /* Since these interfaces are optional, it is always a success here. */
    16671694                    vrc = VINF_SUCCESS;
     
    25402567        } break;
    25412568    }
     2569}
     2570
     2571/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInNotify(void *pvCallback,
     2572                                                                       uint32_t u32Id,
     2573                                                                       const void *pvData,
     2574                                                                       uint32_t cbData)
     2575{
     2576#ifdef VBOX_WITH_USB_VIDEO
     2577    ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback);
     2578    UsbWebcamInterface *pWebCam = pThis->mConsole->getUsbWebcamInterface();
     2579    return pWebCam->WebCamNotify(u32Id, pvData, cbData);
     2580#else
     2581    NOREF(pvCallback);
     2582    NOREF(u32Id);
     2583    NOREF(pvData);
     2584    NOREF(cbData);
     2585#endif
     2586}
     2587
     2588/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInDeviceDesc(void *pvCallback,
     2589                                                                                 int rcRequest,
     2590                                                                                 void *pDeviceCtx,
     2591                                                                                 void *pvUser,
     2592                                                                                 const VRDEVIDEOINDEVICEDESC *pDeviceDesc,
     2593                                                                                 uint32_t cbDevice)
     2594{
     2595#ifdef VBOX_WITH_USB_VIDEO
     2596    ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback);
     2597    UsbWebcamInterface *pWebCam = pThis->mConsole->getUsbWebcamInterface();
     2598    return pWebCam->WebCamDeviceDesc(rcRequest, pDeviceCtx, pvUser, pDeviceDesc, cbDevice);
     2599#else
     2600    NOREF(pvCallback);
     2601    NOREF(rcRequest);
     2602    NOREF(pDeviceCtx);
     2603    NOREF(pvUser);
     2604    NOREF(pDeviceDesc);
     2605    NOREF(cbDevice);
     2606#endif
     2607}
     2608
     2609/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInControl(void *pvCallback,
     2610                                                                              int rcRequest,
     2611                                                                              void *pDeviceCtx,
     2612                                                                              void *pvUser,
     2613                                                                              const VRDEVIDEOINCTRLHDR *pControl,
     2614                                                                              uint32_t cbControl)
     2615{
     2616#ifdef VBOX_WITH_USB_VIDEO
     2617    ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback);
     2618    UsbWebcamInterface *pWebCam = pThis->mConsole->getUsbWebcamInterface();
     2619    return pWebCam->WebCamControl(rcRequest, pDeviceCtx, pvUser, pControl, cbControl);
     2620#else
     2621    NOREF(pvCallback);
     2622    NOREF(rcRequest);
     2623    NOREF(pDeviceCtx);
     2624    NOREF(pvUser);
     2625    NOREF(pControl);
     2626    NOREF(cbControl);
     2627#endif
     2628}
     2629
     2630/* static */ DECLCALLBACK(void) ConsoleVRDPServer::VRDECallbackVideoInFrame(void *pvCallback,
     2631                                                                            int rcRequest,
     2632                                                                            void *pDeviceCtx,
     2633                                                                            const VRDEVIDEOINPAYLOADHDR *pFrame,
     2634                                                                            uint32_t cbFrame)
     2635{
     2636#ifdef VBOX_WITH_USB_VIDEO
     2637    ConsoleVRDPServer *pThis = static_cast<ConsoleVRDPServer*>(pvCallback);
     2638    UsbWebcamInterface *pWebCam = pThis->mConsole->getUsbWebcamInterface();
     2639    return pWebCam->WebCamFrame(rcRequest, pDeviceCtx, pvUser, pFrame, cbFrame);
     2640#else
     2641    NOREF(pvCallback);
     2642    NOREF(rcRequest);
     2643    NOREF(pDeviceCtx);
     2644    NOREF(pFrame);
     2645    NOREF(cbFrame);
     2646#endif
     2647}
     2648
     2649int ConsoleVRDPServer::VideoInDeviceAttach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle, void *pvDeviceCtx)
     2650{
     2651    int rc;
     2652
     2653    if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInDeviceAttach)
     2654    {
     2655        rc = m_interfaceVideoIn.VRDEVideoInDeviceAttach(mhServer, pDeviceHandle, pvDeviceCtx);
     2656    }
     2657    else
     2658    {
     2659        rc = VERR_NOT_SUPPORTED;
     2660    }
     2661
     2662    return rc;
     2663}
     2664
     2665int ConsoleVRDPServer::VideoInDeviceDetach(const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle)
     2666{
     2667    int rc;
     2668
     2669    if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInDeviceDetach)
     2670    {
     2671        rc = m_interfaceVideoIn.VRDEVideoInDeviceDetach(mhServer, pDeviceHandle);
     2672    }
     2673    else
     2674    {
     2675        rc = VERR_NOT_SUPPORTED;
     2676    }
     2677
     2678    return rc;
     2679}
     2680
     2681int ConsoleVRDPServer::VideoInGetDeviceDesc(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle)
     2682{
     2683    int rc;
     2684
     2685    if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInGetDeviceDesc)
     2686    {
     2687        rc = m_interfaceVideoIn.VRDEVideoInGetDeviceDesc(mhServer, pvUser, pDeviceHandle);
     2688    }
     2689    else
     2690    {
     2691        rc = VERR_NOT_SUPPORTED;
     2692    }
     2693
     2694    return rc;
     2695}
     2696
     2697int ConsoleVRDPServer::VideoInControl(void *pvUser, const VRDEVIDEOINDEVICEHANDLE *pDeviceHandle,
     2698                                      VRDEVIDEOINCTRLHDR *pReq, uint32_t cbReq)
     2699{
     2700    int rc;
     2701
     2702    if (mhServer && mpEntryPoints && m_interfaceVideoIn.VRDEVideoInControl)
     2703    {
     2704        rc = m_interfaceVideoIn.VRDEVideoInControl(mhServer, pvUser, pDeviceHandle, pReq, cbReq);
     2705    }
     2706    else
     2707    {
     2708        rc = VERR_NOT_SUPPORTED;
     2709    }
     2710
     2711    return rc;
    25422712}
    25432713
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