VirtualBox

Changeset 75354 in vbox


Ignore:
Timestamp:
Nov 9, 2018 11:22:09 AM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
126487
Message:

Recording: More renaming for Main internals.

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

Legend:

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

    r75352 r75354  
    149149    int i_recordingStop(void);
    150150    AudioVideoRec *i_recordingGetAudioDrv(void) const { return Recording.mAudioRec; }
    151     CaptureContext *i_recordingGetContext(void) const { return Recording.mpRecordCtx; }
     151    RecordingContext *i_recordingGetContext(void) const { return Recording.mpCtx; }
    152152    HRESULT i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs);
    153153#endif
     
    10341034    {
    10351035        Recording()
    1036             : mpRecordCtx(NULL)
     1036            : mpCtx(NULL)
    10371037            , mAudioRec(NULL) { }
    10381038
    10391039        /** The recording context. */
    1040         CaptureContext       *mpRecordCtx;
     1040        RecordingContext       *mpCtx;
    10411041# ifdef VBOX_WITH_AUDIO_RECORDING
    10421042        /** Pointer to capturing audio backend. */
  • trunk/src/VBox/Main/include/DrvAudioRec.h

    r75344 r75354  
    1616 */
    1717
    18 #ifndef ____H_DRVAUDIOVIDEOREC
    19 #define ____H_DRVAUDIOVIDEOREC
     18#ifndef ____H_DRVAUDIORECORDING
     19#define ____H_DRVAUDIORECORDING
    2020
    2121#include <VBox/com/ptr.h>
     
    5959
    6060    /** Pointer to the associated video recording audio driver. */
    61     struct DRVAUDIOVIDEOREC         *mpDrv;
     61    struct DRVAUDIORECORDING         *mpDrv;
    6262    /** Capturing configuration used for configuring the driver. */
    6363    struct settings::RecordSettings mVideoRecCfg;
    6464};
    6565
    66 #endif /* !____H_DRVAUDIOVIDEOREC */
     66#endif /* !____H_DRVAUDIORECORDING */
    6767
  • trunk/src/VBox/Main/include/Recording.h

    r75344 r75354  
    1616 */
    1717
    18 #ifndef ____H_VIDEOREC
    19 #define ____H_VIDEOREC
     18#ifndef ____H_RECORDING
     19#define ____H_RECORDING
    2020
    2121#include <VBox/com/array.h>
     
    3535 * Class for managing a capturing context.
    3636 */
    37 class CaptureContext
     37class RecordingContext
    3838{
    3939public:
    4040
    41     CaptureContext(Console *pConsole);
     41    RecordingContext(Console *pConsole);
    4242
    43     CaptureContext(Console *pConsole, const settings::RecordSettings &a_Settings);
     43    RecordingContext(Console *pConsole, const settings::RecordSettings &a_Settings);
    4444
    45     virtual ~CaptureContext(void);
     45    virtual ~RecordingContext(void);
    4646
    4747public:
    4848
    4949    const settings::RecordSettings &GetConfig(void) const;
    50     CaptureStream *GetStream(unsigned uScreen) const;
     50    RecordingStream *GetStream(unsigned uScreen) const;
    5151    size_t GetStreamCount(void) const;
    5252
     
    7878    int destroyInternal(void);
    7979
    80     CaptureStream *getStreamInternal(unsigned uScreen) const;
     80    RecordingStream *getStreamInternal(unsigned uScreen) const;
    8181
    8282    static DECLCALLBACK(int) threadMain(RTTHREAD hThreadSelf, void *pvUser);
     
    8989     * Enumeration for a recording context state.
    9090     */
    91     enum VIDEORECSTS
     91    enum RECORDINGSTS
    9292    {
    9393        /** Context not initialized. */
    94         VIDEORECSTS_UNINITIALIZED = 0,
     94        RECORDINGSTS_UNINITIALIZED = 0,
    9595        /** Context was created. */
    96         VIDEORECSTS_CREATED       = 1,
     96        RECORDINGSTS_CREATED       = 1,
    9797        /** Context was started. */
    98         VIDEORECSTS_STARTED       = 2,
     98        RECORDINGSTS_STARTED       = 2,
    9999        /** The usual 32-bit hack. */
    100         VIDEORECSTS_32BIT_HACK    = 0x7fffffff
     100        RECORDINGSTS_32BIT_HACK    = 0x7fffffff
    101101    };
    102102
     
    104104    Console                  *pConsole;
    105105    /** Used recording configuration. */
    106     settings::RecordSettings Settings;
     106    settings::RecordSettings  Settings;
    107107    /** The current state. */
    108     VIDEORECSTS               enmState;
     108    RECORDINGSTS              enmState;
    109109    /** Critical section to serialize access. */
    110110    RTCRITSECT                CritSect;
     
    117117    /** Vector of current recording streams.
    118118     *  Per VM screen (display) one recording stream is being used. */
    119     VideoRecStreams           vecStreams;
     119    RecordingStreams          vecStreams;
    120120    /** Timestamp (in ms) of when recording has been started. */
    121121    uint64_t                  tsStartMs;
     
    127127     *  For now this only affects audio, e.g. all recording streams
    128128     *  need to have the same audio data at a specific point in time. */
    129     VideoRecBlockMap          mapBlocksCommon;
     129    RecordingBlockMap         mapBlocksCommon;
    130130};
    131 #endif /* !____H_VIDEOREC */
     131#endif /* !____H_RECORDING */
    132132
  • trunk/src/VBox/Main/include/RecordingInternals.h

    r75346 r75354  
    1616 */
    1717
    18 #ifndef ____H_VIDEOREC_INTERNALS
    19 #define ____H_VIDEOREC_INTERNALS
     18#ifndef ____H_RECORDING_INTERNALS
     19#define ____H_RECORDING_INTERNALS
    2020
    2121#include <iprt/types.h> /* drag in stdint.h before vpx does it. */
     
    3030
    3131/**
    32  * Structure for keeping specific video recording codec data.
     32 * Structure for keeping specific recording video codec data.
    3333 */
    34 typedef struct VIDEORECVIDEOCODEC
     34typedef struct RECORDINGVIDEOCODEC
    3535{
    3636#ifdef VBOX_WITH_LIBVPX
     
    5151    };
    5252#endif /* VBOX_WITH_LIBVPX */
    53 } VIDEORECVIDEOCODEC, *PVIDEORECVIDEOCODEC;
     53} RECORDINGVIDEOCODEC, *PRECORDINGVIDEOCODEC;
    5454
    5555/**
    5656 * Enumeration for supported pixel formats.
    5757 */
    58 enum VIDEORECPIXELFMT
     58enum RECORDINGPIXELFMT
    5959{
    6060    /** Unknown pixel format. */
    61     VIDEORECPIXELFMT_UNKNOWN    = 0,
     61    RECORDINGPIXELFMT_UNKNOWN    = 0,
    6262    /** RGB 24. */
    63     VIDEORECPIXELFMT_RGB24      = 1,
     63    RECORDINGPIXELFMT_RGB24      = 1,
    6464    /** RGB 24. */
    65     VIDEORECPIXELFMT_RGB32      = 2,
     65    RECORDINGPIXELFMT_RGB32      = 2,
    6666    /** RGB 565. */
    67     VIDEORECPIXELFMT_RGB565     = 3,
     67    RECORDINGPIXELFMT_RGB565     = 3,
    6868    /** The usual 32-bit hack. */
    69     VIDEORECPIXELFMT_32BIT_HACK = 0x7fffffff
     69    RECORDINGPIXELFMT_32BIT_HACK = 0x7fffffff
    7070};
    7171
    7272/**
    73  * Structure for keeping a single video recording video frame.
     73 * Structure for keeping a single recording video frame.
    7474 */
    75 typedef struct VIDEORECVIDEOFRAME
     75typedef struct RECORDINGVIDEOFRAME
    7676{
    7777    /** X resolution of this frame. */
     
    8585    /** Size (in bytes) of the RGB buffer. */
    8686    size_t              cbRGBBuf;
    87 } VIDEORECVIDEOFRAME, *PVIDEORECVIDEOFRAME;
     87} RECORDINGVIDEOFRAME, *PRECORDINGVIDEOFRAME;
    8888
    8989#ifdef VBOX_WITH_AUDIO_RECORDING
    9090/**
    91  * Structure for keeping a single video recording audio frame.
     91 * Structure for keeping a single recording audio frame.
    9292 */
    93 typedef struct VIDEORECAUDIOFRAME
     93typedef struct RECORDINGAUDIOFRAME
    9494{
    9595    /** Pointer to audio data. */
     
    9797    /** Size (in bytes) of audio data. */
    9898    size_t              cbBuf;
    99 } VIDEORECAUDIOFRAME, *PVIDEORECAUDIOFRAME;
     99} RECORDINGAUDIOFRAME, *PRECORDINGAUDIOFRAME;
    100100#endif
    101101
     
    103103 * Enumeration for specifying a video recording block type.
    104104 */
    105 typedef enum VIDEORECBLOCKTYPE
     105typedef enum RECORDINGBLOCKTYPE
    106106{
    107107    /** Uknown block type, do not use. */
    108     VIDEORECBLOCKTYPE_UNKNOWN = 0,
     108    RECORDINGBLOCKTYPE_UNKNOWN = 0,
    109109    /** The block is a video frame. */
    110     VIDEORECBLOCKTYPE_VIDEO,
     110    RECORDINGBLOCKTYPE_VIDEO,
    111111#ifdef VBOX_WITH_AUDIO_RECORDING
    112112    /** The block is an audio frame. */
    113     VIDEORECBLOCKTYPE_AUDIO
     113    RECORDINGBLOCKTYPE_AUDIO
    114114#endif
    115 } VIDEORECBLOCKTYPE;
     115} RECORDINGBLOCKTYPE;
    116116
    117117/**
    118118 * Generic structure for keeping a single video recording (data) block.
    119119 */
    120 typedef struct VIDEORECBLOCK
     120typedef struct RECORDINGBLOCK
    121121{
    122122    /** The block's type. */
    123     VIDEORECBLOCKTYPE enmType;
     123    RECORDINGBLOCKTYPE enmType;
    124124    /** Number of references held of this block. */
    125125    uint16_t           cRefs;
     
    130130    /** Size (in bytes) of the (opaque) data block. */
    131131    size_t             cbData;
    132 } VIDEORECBLOCK, *PVIDEORECBLOCK;
     132} RECORDINGBLOCK, *PRECORDINGBLOCK;
    133133
    134134/** List for keeping video recording (data) blocks. */
    135 typedef std::list<PVIDEORECBLOCK> VideoRecBlockList;
     135typedef std::list<PRECORDINGBLOCK> RECORDINGBLOCKList;
    136136
    137 void VideoRecBlockFree(PVIDEORECBLOCK pBlock);
     137void RecordingBlockFree(PRECORDINGBLOCK pBlock);
    138138#ifdef VBOX_WITH_AUDIO_RECORDING
    139 void VideoRecAudioFrameFree(PVIDEORECAUDIOFRAME pFrame);
     139void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame);
    140140#endif
    141 void VideoRecVideoFrameFree(PVIDEORECVIDEOFRAME pFrame);
     141void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame);
    142142
    143 #endif /* ____H_VIDEOREC_INTERNALS */
     143#endif /* ____H_RECORDING_INTERNALS */
  • trunk/src/VBox/Main/include/RecordingStream.h

    r75346 r75354  
    1616 */
    1717
    18 #ifndef ____H_VIDEOREC_STREAM
    19 #define ____H_VIDEOREC_STREAM
     18#ifndef ____H_RECORDING_STREAM
     19#define ____H_RECORDING_STREAM
    2020
    2121#include <map>
     
    3232
    3333class WebMWriter;
    34 class CaptureContext;
     34class RecordingContext;
    3535
    3636/** Structure for queuing all blocks bound to a single timecode.
    3737 *  This can happen if multiple tracks are being involved. */
    38 struct CaptureBlocks
     38struct RecordingBlocks
    3939{
    40     virtual ~CaptureBlocks()
     40    virtual ~RecordingBlocks()
    4141    {
    4242        Clear();
     
    4444
    4545    /**
    46      * Resets a video recording block list by removing (destroying)
     46     * Resets a recording block list by removing (destroying)
    4747     * all current elements.
    4848     */
     
    5151        while (!List.empty())
    5252        {
    53             PVIDEORECBLOCK pBlock = List.front();
    54             VideoRecBlockFree(pBlock);
     53            PRECORDINGBLOCK pBlock = List.front();
     54            RecordingBlockFree(pBlock);
    5555            List.pop_front();
    5656        }
     
    6060
    6161    /** The actual block list for this timecode. */
    62     VideoRecBlockList List;
     62    RECORDINGBLOCKList List;
    6363};
    6464
     
    6666 *  The key specifies a unique timecode, whereas the value
    6767 *  is a list of blocks which all correlate to the same key (timecode). */
    68 typedef std::map<uint64_t, CaptureBlocks *> VideoRecBlockMap;
     68typedef std::map<uint64_t, RecordingBlocks *> RecordingBlockMap;
    6969
    7070/**
    7171 * Structure for holding a set of recording (data) blocks.
    7272 */
    73 struct CaptureBlockSet
     73struct RecordingBlockSet
    7474{
    75     virtual ~CaptureBlockSet()
     75    virtual ~RecordingBlockSet()
    7676    {
    7777        Clear();
     
    8484    void Clear(void)
    8585    {
    86         VideoRecBlockMap::iterator it = Map.begin();
     86        RecordingBlockMap::iterator it = Map.begin();
    8787        while (it != Map.end())
    8888        {
     
    9999    uint64_t         tsLastProcessedMs;
    100100    /** All blocks related to this block set. */
    101     VideoRecBlockMap Map;
     101    RecordingBlockMap Map;
    102102};
    103103
     
    105105 * Class for managing a recording stream.
    106106 */
    107 class CaptureStream
     107class RecordingStream
    108108{
    109109public:
    110110
    111     CaptureStream(CaptureContext *pCtx);
    112 
    113     CaptureStream(CaptureContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
    114 
    115     virtual ~CaptureStream(void);
     111    RecordingStream(RecordingContext *pCtx);
     112
     113    RecordingStream(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
     114
     115    virtual ~RecordingStream(void);
    116116
    117117public:
    118118
    119     int Init(CaptureContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
     119    int Init(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
    120120    int Uninit(void);
    121121
    122     int Process(VideoRecBlockMap &mapBlocksCommon);
     122    int Process(RecordingBlockMap &mapBlocksCommon);
    123123    int SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine,
    124124                       uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, uint64_t uTimeStampMs);
     
    133133    int close(void);
    134134
    135     int initInternal(CaptureContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
     135    int initInternal(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);
    136136    int uninitInternal(void);
    137137
     
    144144    int initVideoVPX(void);
    145145    int uninitVideoVPX(void);
    146     int writeVideoVPX(uint64_t uTimeStampMs, PVIDEORECVIDEOFRAME pFrame);
     146    int writeVideoVPX(uint64_t uTimeStampMs, PRECORDINGVIDEOFRAME pFrame);
    147147#endif
    148148    void lock(void);
     
    167167
    168168    /** Recording context this stream is associated to. */
    169     CaptureContext         *pCtx;
     169    RecordingContext         *pCtx;
    170170    /** The current state. */
    171171    RECORDINGSTREAMSTATE    enmState;
     
    202202        /** Number of failed attempts to encode the current video frame in a row. */
    203203        uint16_t            cFailedEncodingFrames;
    204         VIDEORECVIDEOCODEC Codec;
     204        RECORDINGVIDEOCODEC Codec;
    205205    } Video;
    206206
     
    208208    /** Common set of video recording (data) blocks, needed for
    209209     *  multiplexing to all recording streams. */
    210     CaptureBlockSet                 Blocks;
     210    RecordingBlockSet              Blocks;
    211211};
    212212
    213213/** Vector of video recording streams. */
    214 typedef std::vector <CaptureStream *> VideoRecStreams;
    215 
    216 #endif /* ____H_VIDEOREC_STREAM */
    217 
     214typedef std::vector <RecordingStream *> RecordingStreams;
     215
     216#endif /* ____H_RECORDING_STREAM */
     217
  • trunk/src/VBox/Main/include/RecordingUtils.h

    r75344 r75354  
    1515 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
    1616 */
     17
     18#ifndef ____H_RECORDING_UTILS
     19#define ____H_RECORDING_UTILS
    1720
    1821#include <iprt/asm.h>
     
    195198};
    196199
    197 int videoRecRGBToYUV(uint32_t uPixelFormat,
    198                      uint8_t *paDst, uint32_t uDstWidth, uint32_t uDstHeight,
    199                      uint8_t *paSrc, uint32_t uSrcWidth, uint32_t uSrcHeight);
     200int recordingRGBToYUV(uint32_t uPixelFormat,
     201                      uint8_t *paDst, uint32_t uDstWidth, uint32_t uDstHeight,
     202                      uint8_t *paSrc, uint32_t uSrcWidth, uint32_t uSrcHeight);
     203
     204#endif /* ____H_RECORDING_UTILS */
     205
  • trunk/src/VBox/Main/src-client/ConsoleImpl.cpp

    r75352 r75354  
    56165616    if (pDisplay)
    56175617    {
    5618         const bool fIsEnabled =    Recording.mpRecordCtx
    5619                                 && Recording.mpRecordCtx->IsStarted();
     5618        const bool fIsEnabled =    Recording.mpCtx
     5619                                && Recording.mpCtx->IsStarted();
    56205620
    56215621        if (RT_BOOL(fEnable) != fIsEnabled)
     
    56325632# ifdef VBOX_WITH_AUDIO_RECORDING
    56335633                    /* Attach the video recording audio driver if required. */
    5634                     if (   Recording.mpRecordCtx->IsFeatureEnabled(RecordFeature_Audio)
     5634                    if (   Recording.mpCtx->IsFeatureEnabled(RecordFeature_Audio)
    56355635                        && Recording.mAudioRec)
    56365636                    {
    5637                         vrc = Recording.mAudioRec->applyConfiguration(Recording.mpRecordCtx->GetConfig());
     5637                        vrc = Recording.mAudioRec->applyConfiguration(Recording.mpCtx->GetConfig());
    56385638                        if (RT_SUCCESS(vrc))
    56395639                            vrc = Recording.mAudioRec->doAttachDriverViaEmt(mpUVM, pAutoLock);
     
    56415641# endif
    56425642                    if (   RT_SUCCESS(vrc)
    5643                         && Recording.mpRecordCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */
     5643                        && Recording.mpCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */
    56445644                    {
    56455645                        vrc = i_recordingStart();
     
    68786878HRESULT Console::i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs)
    68796879{
    6880     if (!Recording.mpRecordCtx)
     6880    if (!Recording.mpCtx)
    68816881        return S_OK;
    68826882
    6883     if (   Recording.mpRecordCtx->IsStarted()
    6884         && Recording.mpRecordCtx->IsFeatureEnabled(RecordFeature_Audio))
    6885     {
    6886         return Recording.mpRecordCtx->SendAudioFrame(pvData, cbData, uTimestampMs);
     6883    if (   Recording.mpCtx->IsStarted()
     6884        && Recording.mpCtx->IsFeatureEnabled(RecordFeature_Audio))
     6885    {
     6886        return Recording.mpCtx->SendAudioFrame(pvData, cbData, uTimestampMs);
    68876887    }
    68886888
     
    69076907    Settings.fEnabled = RT_BOOL(fTemp);
    69086908
    6909     SafeIfaceArray<IRecordScreenSettings> paCaptureScreens;
    6910     hrc = pRecordSettings->COMGETTER(Screens)(ComSafeArrayAsOutParam(paCaptureScreens));
     6909    SafeIfaceArray<IRecordScreenSettings> paRecordingScreens;
     6910    hrc = pRecordSettings->COMGETTER(Screens)(ComSafeArrayAsOutParam(paRecordingScreens));
    69116911    AssertComRCReturn(hrc, VERR_INVALID_PARAMETER);
    69126912
    6913     for (unsigned long i = 0; i < (unsigned long)paCaptureScreens.size(); ++i)
     6913    for (unsigned long i = 0; i < (unsigned long)paRecordingScreens.size(); ++i)
    69146914    {
    69156915        settings::RecordScreenSettings RecordScreenSettings;
    6916         ComPtr<IRecordScreenSettings> pRecordScreenSettings = paCaptureScreens[i];
     6916        ComPtr<IRecordScreenSettings> pRecordScreenSettings = paRecordingScreens[i];
    69176917
    69186918        hrc = pRecordScreenSettings->COMGETTER(Enabled)(&fTemp);
     
    69426942    }
    69436943
    6944     Assert(Settings.mapScreens.size() == paCaptureScreens.size());
     6944    Assert(Settings.mapScreens.size() == paRecordingScreens.size());
    69456945
    69466946    return VINF_SUCCESS;
     
    69546954int Console::i_recordingCreate(void)
    69556955{
    6956     AssertReturn(Recording.mpRecordCtx == NULL, VERR_WRONG_ORDER);
     6956    AssertReturn(Recording.mpCtx == NULL, VERR_WRONG_ORDER);
    69576957
    69586958    int rc = VINF_SUCCESS;
     
    69606960    try
    69616961    {
    6962         Recording.mpRecordCtx = new CaptureContext(this);
     6962        Recording.mpCtx = new RecordingContext(this);
    69636963    }
    69646964    catch (std::bad_alloc &)
     
    69756975    if (RT_SUCCESS(rc))
    69766976    {
    6977         AssertPtr(Recording.mpRecordCtx);
    6978         rc = Recording.mpRecordCtx->Create(Settings);
     6977        AssertPtr(Recording.mpCtx);
     6978        rc = Recording.mpCtx->Create(Settings);
    69796979    }
    69806980
     
    69886988void Console::i_recordingDestroy(void)
    69896989{
    6990     if (Recording.mpRecordCtx)
    6991     {
    6992         delete Recording.mpRecordCtx;
    6993         Recording.mpRecordCtx = NULL;
     6990    if (Recording.mpCtx)
     6991    {
     6992        delete Recording.mpCtx;
     6993        Recording.mpCtx = NULL;
    69946994    }
    69956995
     
    70047004int Console::i_recordingStart(void)
    70057005{
    7006     AssertPtrReturn(Recording.mpRecordCtx, VERR_WRONG_ORDER);
    7007 
    7008     if (Recording.mpRecordCtx->IsStarted())
     7006    AssertPtrReturn(Recording.mpCtx, VERR_WRONG_ORDER);
     7007
     7008    if (Recording.mpCtx->IsStarted())
    70097009        return VINF_SUCCESS;
    70107010
    70117011    LogRel(("Recording: Starting ...\n"));
    70127012
    7013     int rc = Recording.mpRecordCtx->Start();
     7013    int rc = Recording.mpCtx->Start();
    70147014    if (RT_SUCCESS(rc))
    70157015    {
    7016         for (unsigned uScreen = 0; uScreen < Recording.mpRecordCtx->GetStreamCount(); uScreen++)
     7016        for (unsigned uScreen = 0; uScreen < Recording.mpCtx->GetStreamCount(); uScreen++)
    70177017            mDisplay->i_recordingScreenChanged(uScreen);
    70187018    }
     
    70307030int Console::i_recordingStop(void)
    70317031{
    7032     if (   !Recording.mpRecordCtx
    7033         || !Recording.mpRecordCtx->IsStarted())
     7032    if (   !Recording.mpCtx
     7033        || !Recording.mpCtx->IsStarted())
    70347034        return VINF_SUCCESS;
    70357035
    70367036    LogRel(("Recording: Stopping ...\n"));
    70377037
    7038     int rc = Recording.mpRecordCtx->Stop();
     7038    int rc = Recording.mpCtx->Stop();
    70397039    if (RT_SUCCESS(rc))
    70407040    {
    7041         const size_t cStreams = Recording.mpRecordCtx->GetStreamCount();
     7041        const size_t cStreams = Recording.mpCtx->GetStreamCount();
    70427042        for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen)
    70437043            mDisplay->i_recordingScreenChanged(uScreen);
  • trunk/src/VBox/Main/src-client/DisplayImpl.cpp

    r75352 r75354  
    24132413int Display::i_recordingInvalidate(void)
    24142414{
    2415     CaptureContext *pCtx = mParent->i_recordingGetContext();
     2415    RecordingContext *pCtx = mParent->i_recordingGetContext();
    24162416    if (!pCtx || !pCtx->IsStarted())
    24172417        return VINF_SUCCESS;
     
    24222422    for (unsigned uScreen = 0; uScreen < mcMonitors; uScreen++)
    24232423    {
    2424         CaptureStream *pRecordingStream = pCtx->GetStream(uScreen);
     2424        RecordingStream *pRecordingStream = pCtx->GetStream(uScreen);
    24252425
    24262426        const bool fStreamEnabled = pRecordingStream->IsReady();
     
    24382438void Display::i_recordingScreenChanged(unsigned uScreenId)
    24392439{
    2440     CaptureContext *pCtx = mParent->i_recordingGetContext();
     2440    RecordingContext *pCtx = mParent->i_recordingGetContext();
    24412441
    24422442    if (   RT_LIKELY(!maRecordingEnabled[uScreenId])
     
    33893389#ifdef VBOX_WITH_RECORDING
    33903390    AssertPtr(pDisplay->mParent);
    3391     CaptureContext *pCtx = pDisplay->mParent->i_recordingGetContext();
     3391    RecordingContext *pCtx = pDisplay->mParent->i_recordingGetContext();
    33923392
    33933393    if (   pCtx
     
    38333833{
    38343834# ifdef VBOX_WITH_RECORDING
    3835     CaptureContext *pCtx = mParent->i_recordingGetContext();
     3835    RecordingContext *pCtx = mParent->i_recordingGetContext();
    38363836    return (      pCtx
    38373837               && pCtx->IsReady(uScreen, uTimestampMs));
     
    38553855    Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED);
    38563856# ifdef VBOX_WITH_RECORDING
    3857     CaptureContext *pCtx = mParent->i_recordingGetContext();
     3857    RecordingContext *pCtx = mParent->i_recordingGetContext();
    38583858
    38593859    if (   pCtx
  • trunk/src/VBox/Main/src-client/DrvAudioRec.cpp

    r75352 r75354  
    272272 * Video recording audio driver instance data.
    273273 */
    274 typedef struct DRVAUDIOVIDEOREC
     274typedef struct DRVAUDIORECORDING
    275275{
    276276    /** Pointer to audio video recording object. */
     
    290290    /** The driver's sink for writing output to. */
    291291    AVRECSINK            Sink;
    292 } DRVAUDIOVIDEOREC, *PDRVAUDIOVIDEOREC;
    293 
    294 /** Makes DRVAUDIOVIDEOREC out of PDMIHOSTAUDIO. */
    295 #define PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface) /* (clang doesn't think it is a POD, thus _DYN.) */ \
    296     ( (PDRVAUDIOVIDEOREC)((uintptr_t)pInterface - RT_UOFFSETOF_DYN(DRVAUDIOVIDEOREC, IHostAudio)) )
     292} DRVAUDIORECORDING, *PDRVAUDIORECORDING;
     293
     294/** Makes DRVAUDIORECORDING out of PDMIHOSTAUDIO. */
     295#define PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface) /* (clang doesn't think it is a POD, thus _DYN.) */ \
     296    ( (PDRVAUDIORECORDING)((uintptr_t)pInterface - RT_UOFFSETOF_DYN(DRVAUDIORECORDING, IHostAudio)) )
    297297
    298298/**
     
    305305 * @param   pCodecParms         Codec parameters to set.
    306306 */
    307 static int avRecSinkInit(PDRVAUDIOVIDEOREC pThis, PAVRECSINK pSink, PAVRECCONTAINERPARMS pConParms, PAVRECCODECPARMS pCodecParms)
     307static int avRecSinkInit(PDRVAUDIORECORDING pThis, PAVRECSINK pSink, PAVRECCONTAINERPARMS pConParms, PAVRECCODECPARMS pCodecParms)
    308308{
    309309    uint32_t uHz       = pCodecParms->PCMProps.uHz;
     
    513513 * @param   pCfgAcq             Acquired configuration by the audio output stream.
    514514 */
    515 static int avRecCreateStreamOut(PDRVAUDIOVIDEOREC pThis, PAVRECSTREAM pStreamAV,
     515static int avRecCreateStreamOut(PDRVAUDIORECORDING pThis, PAVRECSTREAM pStreamAV,
    516516                                PAVRECSINK pSink, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq)
    517517{
     
    585585 * @param   pStreamAV           Audio output stream to destroy.
    586586 */
    587 static int avRecDestroyStreamOut(PDRVAUDIOVIDEOREC pThis, PAVRECSTREAM pStreamAV)
     587static int avRecDestroyStreamOut(PDRVAUDIORECORDING pThis, PAVRECSTREAM pStreamAV)
    588588{
    589589    RT_NOREF(pThis);
     
    621621 * @param   enmStreamCmd        Stream command to issue.
    622622 */
    623 static int avRecControlStreamOut(PDRVAUDIOVIDEOREC pThis,
     623static int avRecControlStreamOut(PDRVAUDIORECORDING pThis,
    624624                                 PAVRECSTREAM pStreamAV, PDMAUDIOSTREAMCMD enmStreamCmd)
    625625{
     
    654654    LogFlowFuncEnter();
    655655
    656     PDRVAUDIOVIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     656    PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    657657
    658658    LogRel(("Recording: Audio driver is using %RU32Hz, %RU16bit, %RU8 %s\n",
     
    699699    /* pcxWritten is optional. */
    700700
    701     PDRVAUDIOVIDEOREC pThis     = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     701    PDRVAUDIORECORDING pThis     = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    702702    RT_NOREF(pThis);
    703703    PAVRECSTREAM      pStreamAV = (PAVRECSTREAM)pStream;
     
    900900    LogFlowFuncEnter();
    901901
    902     PDRVAUDIOVIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     902    PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    903903
    904904    avRecSinkShutdown(&pThis->Sink);
     
    933933    AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    934934
    935     PDRVAUDIOVIDEOREC pThis     = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     935    PDRVAUDIORECORDING pThis     = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    936936    PAVRECSTREAM      pStreamAV = (PAVRECSTREAM)pStream;
    937937
     
    960960    AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    961961
    962     PDRVAUDIOVIDEOREC pThis     = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     962    PDRVAUDIORECORDING pThis     = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    963963    PAVRECSTREAM      pStreamAV = (PAVRECSTREAM)pStream;
    964964
     
    990990    AssertPtrReturn(pStream,    VERR_INVALID_POINTER);
    991991
    992     PDRVAUDIOVIDEOREC pThis     = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);
     992    PDRVAUDIORECORDING pThis     = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface);
    993993    PAVRECSTREAM      pStreamAV = (PAVRECSTREAM)pStream;
    994994
     
    10571057{
    10581058    PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface);
    1059     PDRVAUDIOVIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);
     1059    PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING);
    10601060
    10611061    PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase);
     
    11391139{
    11401140    PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns);
    1141     PDRVAUDIOVIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);
     1141    PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING);
    11421142    RT_NOREF(fFlags);
    11431143
     
    12471247{
    12481248    PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns);
    1249     PDRVAUDIOVIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);
     1249    PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING);
    12501250
    12511251    LogFlowFuncEnter();
     
    13231323    ~0U,
    13241324    /* cbInstance */
    1325     sizeof(DRVAUDIOVIDEOREC),
     1325    sizeof(DRVAUDIORECORDING),
    13261326    /* pfnConstruct */
    13271327    AudioVideoRec::drvConstruct,
  • trunk/src/VBox/Main/src-client/Recording.cpp

    r75346 r75354  
    5454#ifdef DEBUG_andy
    5555/** Enables dumping audio / video data for debugging reasons. */
    56 //# define VBOX_VIDEOREC_DUMP
     56//# define VBOX_RECORDING_DUMP
    5757#endif
    5858
    59 #ifdef VBOX_VIDEOREC_DUMP
     59#ifdef VBOX_RECORDING_DUMP
    6060#pragma pack(push)
    6161#pragma pack(1)
     
    6767    uint16_t u16Reserved2;
    6868    uint32_t u32OffBits;
    69 } VIDEORECBMPHDR, *PVIDEORECBMPHDR;
    70 AssertCompileSize(VIDEORECBMPHDR, 14);
     69} RECORDINGBMPHDR, *PRECORDINGBMPHDR;
     70AssertCompileSize(RECORDINGBMPHDR, 14);
    7171
    7272typedef struct
     
    8383    uint32_t u32ClrUsed;
    8484    uint32_t u32ClrImportant;
    85 } VIDEORECBMPDIBHDR, *PVIDEORECBMPDIBHDR;
    86 AssertCompileSize(VIDEORECBMPDIBHDR, 40);
     85} RECORDINGBMPDIBHDR, *PRECORDINGBMPDIBHDR;
     86AssertCompileSize(RECORDINGBMPDIBHDR, 40);
    8787
    8888#pragma pack(pop)
    89 #endif /* VBOX_VIDEOREC_DUMP */
    90 
    91 
    92 CaptureContext::CaptureContext(Console *a_pConsole)
     89#endif /* VBOX_RECORDING_DUMP */
     90
     91
     92RecordingContext::RecordingContext(Console *a_pConsole)
    9393    : pConsole(a_pConsole)
    94     , enmState(VIDEORECSTS_UNINITIALIZED) { }
    95 
    96 CaptureContext::CaptureContext(Console *a_pConsole, const settings::RecordSettings &a_Settings)
     94    , enmState(RECORDINGSTS_UNINITIALIZED) { }
     95
     96RecordingContext::RecordingContext(Console *a_pConsole, const settings::RecordSettings &a_Settings)
    9797    : pConsole(a_pConsole)
    98     , enmState(VIDEORECSTS_UNINITIALIZED)
    99 {
    100     int rc = CaptureContext::createInternal(a_Settings);
     98    , enmState(RECORDINGSTS_UNINITIALIZED)
     99{
     100    int rc = RecordingContext::createInternal(a_Settings);
    101101    if (RT_FAILURE(rc))
    102102        throw rc;
    103103}
    104104
    105 CaptureContext::~CaptureContext(void)
     105RecordingContext::~RecordingContext(void)
    106106{
    107107    destroyInternal();
     
    109109
    110110/**
    111  * Worker thread for all streams of a video recording context.
     111 * Worker thread for all streams of a recording context.
    112112 *
    113113 * For video frames, this also does the RGB/YUV conversion and encoding.
    114114 */
    115 DECLCALLBACK(int) CaptureContext::threadMain(RTTHREAD hThreadSelf, void *pvUser)
    116 {
    117     CaptureContext *pThis = (CaptureContext *)pvUser;
     115DECLCALLBACK(int) RecordingContext::threadMain(RTTHREAD hThreadSelf, void *pvUser)
     116{
     117    RecordingContext *pThis = (RecordingContext *)pvUser;
    118118
    119119    /* Signal that we're up and rockin'. */
     
    132132         *               for every screen from Main, we here go again (on every wake up) through
    133133         *               all screens.  */
    134         VideoRecStreams::iterator itStream = pThis->vecStreams.begin();
     134        RecordingStreams::iterator itStream = pThis->vecStreams.begin();
    135135        while (itStream != pThis->vecStreams.end())
    136136        {
    137             CaptureStream *pStream = (*itStream);
     137            RecordingStream *pStream = (*itStream);
    138138
    139139            rc = pStream->Process(pThis->mapBlocksCommon);
     
    166166 * @returns IPRT status code.
    167167 */
    168 int CaptureContext::threadNotify(void)
     168int RecordingContext::threadNotify(void)
    169169{
    170170    return RTSemEventSignal(this->WaitEvent);
     
    177177 * @param   a_Settings          Capture settings to use for context creation.
    178178 */
    179 int CaptureContext::createInternal(const settings::RecordSettings &a_Settings)
     179int RecordingContext::createInternal(const settings::RecordSettings &a_Settings)
    180180{
    181181    int rc = RTCritSectInit(&this->CritSect);
     
    186186    while (itScreen != a_Settings.mapScreens.end())
    187187    {
    188         CaptureStream *pStream = NULL;
     188        RecordingStream *pStream = NULL;
    189189        try
    190190        {
    191             pStream = new CaptureStream(this, itScreen->first /* Screen ID */, itScreen->second);
     191            pStream = new RecordingStream(this, itScreen->first /* Screen ID */, itScreen->second);
    192192            this->vecStreams.push_back(pStream);
    193193        }
     
    204204    {
    205205        this->tsStartMs = RTTimeMilliTS();
    206         this->enmState  = VIDEORECSTS_CREATED;
     206        this->enmState  = RECORDINGSTS_CREATED;
    207207        this->fShutdown = false;
    208208
     
    223223}
    224224
    225 int CaptureContext::startInternal(void)
    226 {
    227     if (this->enmState == VIDEORECSTS_STARTED)
     225int RecordingContext::startInternal(void)
     226{
     227    if (this->enmState == RECORDINGSTS_STARTED)
    228228        return VINF_SUCCESS;
    229229
    230     Assert(this->enmState == VIDEORECSTS_CREATED);
    231 
    232     int rc = RTThreadCreate(&this->Thread, CaptureContext::threadMain, (void *)this, 0,
     230    Assert(this->enmState == RECORDINGSTS_CREATED);
     231
     232    int rc = RTThreadCreate(&this->Thread, RecordingContext::threadMain, (void *)this, 0,
    233233                            RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record");
    234234
     
    238238    if (RT_SUCCESS(rc))
    239239    {
    240         this->enmState = VIDEORECSTS_STARTED;
     240        this->enmState = RECORDINGSTS_STARTED;
    241241    }
    242242
     
    244244}
    245245
    246 int CaptureContext::stopInternal(void)
    247 {
    248     if (this->enmState != VIDEORECSTS_STARTED)
     246int RecordingContext::stopInternal(void)
     247{
     248    if (this->enmState != RECORDINGSTS_STARTED)
    249249        return VINF_SUCCESS;
    250250
     
    261261    if (RT_SUCCESS(rc))
    262262    {
    263         this->enmState = VIDEORECSTS_CREATED;
     263        this->enmState = RECORDINGSTS_CREATED;
    264264    }
    265265
     
    271271 * Destroys a video recording context.
    272272 */
    273 int CaptureContext::destroyInternal(void)
     273int RecordingContext::destroyInternal(void)
    274274{
    275275    int rc = stopInternal();
     
    285285    if (RT_SUCCESS(rc))
    286286    {
    287         VideoRecStreams::iterator it = this->vecStreams.begin();
     287        RecordingStreams::iterator it = this->vecStreams.begin();
    288288        while (it != this->vecStreams.end())
    289289        {
    290             CaptureStream *pStream = (*it);
     290            RecordingStream *pStream = (*it);
    291291
    292292            int rc2 = pStream->Uninit();
     
    318318}
    319319
    320 const settings::RecordSettings &CaptureContext::GetConfig(void) const
     320const settings::RecordSettings &RecordingContext::GetConfig(void) const
    321321{
    322322    return this->Settings;
    323323}
    324324
    325 CaptureStream *CaptureContext::getStreamInternal(unsigned uScreen) const
    326 {
    327     CaptureStream *pStream;
     325RecordingStream *RecordingContext::getStreamInternal(unsigned uScreen) const
     326{
     327    RecordingStream *pStream;
    328328
    329329    try
     
    345345 * @param   uScreen             Screen number of recording stream to look up.
    346346 */
    347 CaptureStream *CaptureContext::GetStream(unsigned uScreen) const
     347RecordingStream *RecordingContext::GetStream(unsigned uScreen) const
    348348{
    349349    return getStreamInternal(uScreen);
    350350}
    351351
    352 size_t CaptureContext::GetStreamCount(void) const
     352size_t RecordingContext::GetStreamCount(void) const
    353353{
    354354    return this->vecStreams.size();
    355355}
    356356
    357 int CaptureContext::Create(const settings::RecordSettings &a_Settings)
     357int RecordingContext::Create(const settings::RecordSettings &a_Settings)
    358358{
    359359    return createInternal(a_Settings);
    360360}
    361361
    362 int CaptureContext::Destroy(void)
     362int RecordingContext::Destroy(void)
    363363{
    364364    return destroyInternal();
    365365}
    366366
    367 int CaptureContext::Start(void)
     367int RecordingContext::Start(void)
    368368{
    369369    return startInternal();
    370370}
    371371
    372 int CaptureContext::Stop(void)
     372int RecordingContext::Stop(void)
    373373{
    374374    return stopInternal();
    375375}
    376376
    377 bool CaptureContext::IsFeatureEnabled(RecordFeature_T enmFeature) const
    378 {
    379     VideoRecStreams::const_iterator itStream = this->vecStreams.begin();
     377bool RecordingContext::IsFeatureEnabled(RecordFeature_T enmFeature) const
     378{
     379    RecordingStreams::const_iterator itStream = this->vecStreams.begin();
    380380    while (itStream != this->vecStreams.end())
    381381    {
     
    393393 * @returns @c true if recording context is ready, @c false if not.
    394394 */
    395 bool CaptureContext::IsReady(void) const
    396 {
    397     return (this->enmState >= VIDEORECSTS_CREATED);
     395bool RecordingContext::IsReady(void) const
     396{
     397    return (this->enmState >= RECORDINGSTS_CREATED);
    398398}
    399399
     
    405405 * @param   uTimeStampMs        Current time stamp (in ms). Currently not being used.
    406406 */
    407 bool CaptureContext::IsReady(uint32_t uScreen, uint64_t uTimeStampMs) const
     407bool RecordingContext::IsReady(uint32_t uScreen, uint64_t uTimeStampMs) const
    408408{
    409409    RT_NOREF(uTimeStampMs);
    410410
    411     if (this->enmState != VIDEORECSTS_STARTED)
     411    if (this->enmState != RECORDINGSTS_STARTED)
    412412        return false;
    413413
    414414    bool fIsReady = false;
    415415
    416     const CaptureStream *pStream = GetStream(uScreen);
     416    const RecordingStream *pStream = GetStream(uScreen);
    417417    if (pStream)
    418418        fIsReady = pStream->IsReady();
     
    430430 * @returns true if active, false if not.
    431431 */
    432 bool CaptureContext::IsStarted(void) const
    433 {
    434     return (this->enmState == VIDEORECSTS_STARTED);
     432bool RecordingContext::IsStarted(void) const
     433{
     434    return (this->enmState == RECORDINGSTS_STARTED);
    435435}
    436436
     
    442442 * @param   tsNowMs             Current time stamp (in ms).
    443443 */
    444 bool CaptureContext::IsLimitReached(uint32_t uScreen, uint64_t tsNowMs) const
    445 {
    446     const CaptureStream *pStream = GetStream(uScreen);
     444bool RecordingContext::IsLimitReached(uint32_t uScreen, uint64_t tsNowMs) const
     445{
     446    const RecordingStream *pStream = GetStream(uScreen);
    447447    if (   !pStream
    448448        || pStream->IsLimitReached(tsNowMs))
     
    464464 * @param   uTimeStampMs        Time stamp (in ms) of audio playback.
    465465 */
    466 int CaptureContext::SendAudioFrame(const void *pvData, size_t cbData, uint64_t uTimeStampMs)
     466int RecordingContext::SendAudioFrame(const void *pvData, size_t cbData, uint64_t uTimeStampMs)
    467467{
    468468#ifdef VBOX_WITH_AUDIO_RECORDING
     
    475475     * audio data at the same given point in time.
    476476     */
    477     PVIDEORECBLOCK pBlock = (PVIDEORECBLOCK)RTMemAlloc(sizeof(VIDEORECBLOCK));
     477    PRECORDINGBLOCK pBlock = (PRECORDINGBLOCK)RTMemAlloc(sizeof(RECORDINGBLOCK));
    478478    AssertPtrReturn(pBlock, VERR_NO_MEMORY);
    479     pBlock->enmType = VIDEORECBLOCKTYPE_AUDIO;
    480 
    481     PVIDEORECAUDIOFRAME pFrame = (PVIDEORECAUDIOFRAME)RTMemAlloc(sizeof(VIDEORECAUDIOFRAME));
     479    pBlock->enmType = RECORDINGBLOCKTYPE_AUDIO;
     480
     481    PRECORDINGAUDIOFRAME pFrame = (PRECORDINGAUDIOFRAME)RTMemAlloc(sizeof(RECORDINGAUDIOFRAME));
    482482    AssertPtrReturn(pFrame, VERR_NO_MEMORY);
    483483
     
    489489
    490490    pBlock->pvData       = pFrame;
    491     pBlock->cbData       = sizeof(VIDEORECAUDIOFRAME) + cbData;
     491    pBlock->cbData       = sizeof(RECORDINGAUDIOFRAME) + cbData;
    492492    pBlock->cRefs        = (uint16_t)this->vecStreams.size(); /* All streams need the same audio data. */
    493493    pBlock->uTimeStampMs = uTimeStampMs;
     
    499499    try
    500500    {
    501         VideoRecBlockMap::iterator itBlocks = this->mapBlocksCommon.find(uTimeStampMs);
     501        RecordingBlockMap::iterator itBlocks = this->mapBlocksCommon.find(uTimeStampMs);
    502502        if (itBlocks == this->mapBlocksCommon.end())
    503503        {
    504             CaptureBlocks *pVideoRecBlocks = new CaptureBlocks();
    505             pVideoRecBlocks->List.push_back(pBlock);
    506 
    507             this->mapBlocksCommon.insert(std::make_pair(uTimeStampMs, pVideoRecBlocks));
     504            RecordingBlocks *pRecordingBlocks = new RecordingBlocks();
     505            pRecordingBlocks->List.push_back(pBlock);
     506
     507            this->mapBlocksCommon.insert(std::make_pair(uTimeStampMs, pRecordingBlocks));
    508508        }
    509509        else
     
    547547 * @param   uTimeStampMs       Time stamp (in ms).
    548548 */
    549 int CaptureContext::SendVideoFrame(uint32_t uScreen, uint32_t x, uint32_t y,
     549int RecordingContext::SendVideoFrame(uint32_t uScreen, uint32_t x, uint32_t y,
    550550                                   uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine,
    551551                                   uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData,
     
    559559    AssertRC(rc);
    560560
    561     CaptureStream *pStream = GetStream(uScreen);
     561    RecordingStream *pStream = GetStream(uScreen);
    562562    if (!pStream)
    563563    {
  • trunk/src/VBox/Main/src-client/RecordingInternals.cpp

    r75346 r75354  
    2727 * @param   pFrame              Audio frame to free. The pointer will be invalid after return.
    2828 */
    29 void VideoRecAudioFrameFree(PVIDEORECAUDIOFRAME pFrame)
     29void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame)
    3030{
    3131    if (!pFrame)
     
    4848 * @param   pFrame              Pointer to video frame to free. The pointer will be invalid after return.
    4949 */
    50 void VideoRecVideoFrameFree(PVIDEORECVIDEOFRAME pFrame)
     50void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame)
    5151{
    5252    if (!pFrame)
     
    6767 * @param   pBlock              Video recording (data) block to free. The pointer will be invalid after return.
    6868 */
    69 void VideoRecBlockFree(PVIDEORECBLOCK pBlock)
     69void RECORDINGBLOCKFree(PRECORDINGBLOCK pBlock)
    7070{
    7171    if (!pBlock)
     
    7474    switch (pBlock->enmType)
    7575    {
    76         case VIDEORECBLOCKTYPE_VIDEO:
    77             VideoRecVideoFrameFree((PVIDEORECVIDEOFRAME)pBlock->pvData);
     76        case RECORDINGBLOCKTYPE_VIDEO:
     77            RecordingVideoFrameFree((PRECORDINGVIDEOFRAME)pBlock->pvData);
    7878            break;
    7979
    8080#ifdef VBOX_WITH_AUDIO_RECORDING
    81         case VIDEORECBLOCKTYPE_AUDIO:
    82             VideoRecAudioFrameFree((PVIDEORECAUDIOFRAME)pBlock->pvData);
     81        case RECORDINGBLOCKTYPE_AUDIO:
     82            RecordingAudioFrameFree((PRECORDINGAUDIOFRAME)pBlock->pvData);
    8383            break;
    8484#endif
  • trunk/src/VBox/Main/src-client/RecordingStream.cpp

    r75346 r75354  
    4242
    4343
    44 CaptureStream::CaptureStream(CaptureContext *a_pCtx)
     44RecordingStream::RecordingStream(RecordingContext *a_pCtx)
    4545    : pCtx(a_pCtx)
    4646    , enmState(RECORDINGSTREAMSTATE_UNINITIALIZED)
     
    5151}
    5252
    53 CaptureStream::CaptureStream(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
     53RecordingStream::RecordingStream(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
    5454    : enmState(RECORDINGSTREAMSTATE_UNINITIALIZED)
    5555    , tsStartMs(0)
     
    6363}
    6464
    65 CaptureStream::~CaptureStream(void)
     65RecordingStream::~RecordingStream(void)
    6666{
    6767    int rc2 = uninitInternal();
     
    7474 * @returns IPRT status code.
    7575 */
    76 int CaptureStream::open(const settings::RecordScreenSettings &Settings)
     76int RecordingStream::open(const settings::RecordScreenSettings &Settings)
    7777{
    7878    /* Sanity. */
     
    182182}
    183183
    184 int CaptureStream::parseOptionsString(const com::Utf8Str &strOptions)
     184int RecordingStream::parseOptionsString(const com::Utf8Str &strOptions)
    185185{
    186186    size_t pos = 0;
     
    255255}
    256256
    257 const settings::RecordScreenSettings &CaptureStream::GetConfig(void) const
     257const settings::RecordScreenSettings &RecordingStream::GetConfig(void) const
    258258{
    259259    return this->ScreenSettings;
     
    266266 * @param   tsNowMs             Current time stamp (in ms).
    267267 */
    268 bool CaptureStream::IsLimitReached(uint64_t tsNowMs) const
     268bool RecordingStream::IsLimitReached(uint64_t tsNowMs) const
    269269{
    270270    if (!IsReady())
     
    299299}
    300300
    301 bool CaptureStream::IsReady(void) const
     301bool RecordingStream::IsReady(void) const
    302302{
    303303    return this->fEnabled;
     
    312312 * @param   mapBlocksCommon     Map of common block to process for this stream.
    313313 */
    314 int CaptureStream::Process(VideoRecBlockMap &mapBlocksCommon)
     314int RecordingStream::Process(RecordingBlockMap &mapBlocksCommon)
    315315{
    316316    lock();
     
    324324    int rc = VINF_SUCCESS;
    325325
    326     VideoRecBlockMap::iterator itStreamBlocks = Blocks.Map.begin();
     326    RecordingBlockMap::iterator itStreamBlocks = Blocks.Map.begin();
    327327    while (itStreamBlocks != Blocks.Map.end())
    328328    {
    329         const uint64_t        uTimeStampMs = itStreamBlocks->first;
    330               CaptureBlocks *pBlocks       = itStreamBlocks->second;
     329        const uint64_t         uTimeStampMs = itStreamBlocks->first;
     330              RecordingBlocks *pBlocks      = itStreamBlocks->second;
    331331
    332332        AssertPtr(pBlocks);
     
    334334        while (!pBlocks->List.empty())
    335335        {
    336             PVIDEORECBLOCK pBlock = pBlocks->List.front();
     336            PRECORDINGBLOCK pBlock = pBlocks->List.front();
    337337            AssertPtr(pBlock);
    338338
    339339#ifdef VBOX_WITH_LIBVPX
    340             if (pBlock->enmType == VIDEORECBLOCKTYPE_VIDEO)
    341             {
    342                 PVIDEORECVIDEOFRAME pVideoFrame  = (PVIDEORECVIDEOFRAME)pBlock->pvData;
    343 
    344                 rc = videoRecRGBToYUV(pVideoFrame->uPixelFormat,
    345                                       /* Destination */
    346                                       this->Video.Codec.VPX.pu8YuvBuf, pVideoFrame->uWidth, pVideoFrame->uHeight,
    347                                       /* Source */
    348                                       pVideoFrame->pu8RGBBuf, this->ScreenSettings.Video.ulWidth, this->ScreenSettings.Video.ulHeight);
     340            if (pBlock->enmType == RECORDINGBLOCKTYPE_VIDEO)
     341            {
     342                PRECORDINGVIDEOFRAME pVideoFrame  = (PRECORDINGVIDEOFRAME)pBlock->pvData;
     343
     344                rc = recordingRGBToYUV(pVideoFrame->uPixelFormat,
     345                                       /* Destination */
     346                                       this->Video.Codec.VPX.pu8YuvBuf, pVideoFrame->uWidth, pVideoFrame->uHeight,
     347                                       /* Source */
     348                                       pVideoFrame->pu8RGBBuf, this->ScreenSettings.Video.ulWidth, this->ScreenSettings.Video.ulHeight);
    349349                if (RT_SUCCESS(rc))
    350350                {
     
    355355            }
    356356#endif
    357             VideoRecBlockFree(pBlock);
     357            RecordingBlockFree(pBlock);
    358358            pBlock = NULL;
    359359
     
    369369    /* As each (enabled) screen has to get the same audio data, look for common (audio) data which needs to be
    370370     * written to the screen's assigned recording stream. */
    371     VideoRecBlockMap::iterator itCommonBlocks = mapBlocksCommon.begin();
     371    RecordingBlockMap::iterator itCommonBlocks = mapBlocksCommon.begin();
    372372    while (itCommonBlocks != mapBlocksCommon.end())
    373373    {
    374         VideoRecBlockList::iterator itBlock = itCommonBlocks->second->List.begin();
     374        RECORDINGBLOCKList::iterator itBlock = itCommonBlocks->second->List.begin();
    375375        while (itBlock != itCommonBlocks->second->List.end())
    376376        {
    377             PVIDEORECBLOCK pBlockCommon = (PVIDEORECBLOCK)(*itBlock);
     377            PRECORDINGBLOCK pBlockCommon = (PRECORDINGBLOCK)(*itBlock);
    378378            switch (pBlockCommon->enmType)
    379379            {
    380                 case VIDEORECBLOCKTYPE_AUDIO:
     380                case RECORDINGBLOCKTYPE_AUDIO:
    381381                {
    382                     PVIDEORECAUDIOFRAME pAudioFrame = (PVIDEORECAUDIOFRAME)pBlockCommon->pvData;
     382                    PRECORDINGAUDIOFRAME pAudioFrame = (PRECORDINGAUDIOFRAME)pBlockCommon->pvData;
    383383                    AssertPtr(pAudioFrame);
    384384                    AssertPtr(pAudioFrame->pvBuf);
     
    404404            if (pBlockCommon->cRefs == 0)
    405405            {
    406                 VideoRecBlockFree(pBlockCommon);
     406                RecordingBlockFree(pBlockCommon);
    407407                itCommonBlocks->second->List.erase(itBlock);
    408408                itBlock = itCommonBlocks->second->List.begin();
     
    434434}
    435435
    436 int CaptureStream::SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine,
     436int RecordingStream::SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine,
    437437                                  uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, uint64_t uTimeStampMs)
    438438{
    439439    lock();
    440440
    441     PVIDEORECVIDEOFRAME pFrame = NULL;
     441    PRECORDINGVIDEOFRAME pFrame = NULL;
    442442
    443443    int rc = VINF_SUCCESS;
     
    508508            h = this->ScreenSettings.Video.ulHeight - destY;
    509509
    510         pFrame = (PVIDEORECVIDEOFRAME)RTMemAllocZ(sizeof(VIDEORECVIDEOFRAME));
     510        pFrame = (PRECORDINGVIDEOFRAME)RTMemAllocZ(sizeof(RECORDINGVIDEOFRAME));
    511511        AssertBreakStmt(pFrame, rc = VERR_NO_MEMORY);
    512512
     
    518518            {
    519519                case 32:
    520                     pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB32;
     520                    pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB32;
    521521                    break;
    522522                case 24:
    523                     pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB24;
     523                    pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB24;
    524524                    break;
    525525                case 16:
    526                     pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB565;
     526                    pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB565;
    527527                    break;
    528528                default:
     
    557557        uint32_t offDst = (destY * this->ScreenSettings.Video.ulWidth + destX) * uBytesPerPixel;
    558558
    559 #ifdef VBOX_VIDEOREC_DUMP
    560         VIDEORECBMPHDR bmpHdr;
     559#ifdef VBOX_RECORDING_DUMP
     560        RECORDINGBMPHDR bmpHdr;
    561561        RT_ZERO(bmpHdr);
    562562
    563         VIDEORECBMPDIBHDR bmpDIBHdr;
     563        RECORDINGBMPDIBHDR bmpDIBHdr;
    564564        RT_ZERO(bmpDIBHdr);
    565565
    566566        bmpHdr.u16Magic   = 0x4d42; /* Magic */
    567         bmpHdr.u32Size    = (uint32_t)(sizeof(VIDEORECBMPHDR) + sizeof(VIDEORECBMPDIBHDR) + (w * h * uBytesPerPixel));
    568         bmpHdr.u32OffBits = (uint32_t)(sizeof(VIDEORECBMPHDR) + sizeof(VIDEORECBMPDIBHDR));
    569 
    570         bmpDIBHdr.u32Size          = sizeof(VIDEORECBMPDIBHDR);
     567        bmpHdr.u32Size    = (uint32_t)(sizeof(RECORDINGBMPHDR) + sizeof(RECORDINGBMPDIBHDR) + (w * h * uBytesPerPixel));
     568        bmpHdr.u32OffBits = (uint32_t)(sizeof(RECORDINGBMPHDR) + sizeof(RECORDINGBMPDIBHDR));
     569
     570        bmpDIBHdr.u32Size          = sizeof(RECORDINGBMPDIBHDR);
    571571        bmpDIBHdr.u32Width         = w;
    572572        bmpDIBHdr.u32Height        = h;
     
    599599            memcpy(pFrame->pu8RGBBuf + offDst, puSrcData + offSrc, w * uBytesPerPixel);
    600600
    601 #ifdef VBOX_VIDEOREC_DUMP
     601#ifdef VBOX_RECORDING_DUMP
    602602            if (RT_SUCCESS(rc2))
    603603                RTFileWrite(fh, pFrame->pu8RGBBuf + offDst, w * uBytesPerPixel, NULL);
     
    607607        }
    608608
    609 #ifdef VBOX_VIDEOREC_DUMP
     609#ifdef VBOX_RECORDING_DUMP
    610610        if (RT_SUCCESS(rc2))
    611611            RTFileClose(fh);
     
    616616    if (rc == VINF_SUCCESS) /* Note: Also could be VINF_TRY_AGAIN. */
    617617    {
    618         PVIDEORECBLOCK pBlock = (PVIDEORECBLOCK)RTMemAlloc(sizeof(VIDEORECBLOCK));
     618        PRECORDINGBLOCK pBlock = (PRECORDINGBLOCK)RTMemAlloc(sizeof(RECORDINGBLOCK));
    619619        if (pBlock)
    620620        {
    621621            AssertPtr(pFrame);
    622622
    623             pBlock->enmType = VIDEORECBLOCKTYPE_VIDEO;
     623            pBlock->enmType = RECORDINGBLOCKTYPE_VIDEO;
    624624            pBlock->pvData  = pFrame;
    625             pBlock->cbData  = sizeof(VIDEORECVIDEOFRAME) + pFrame->cbRGBBuf;
     625            pBlock->cbData  = sizeof(RECORDINGVIDEOFRAME) + pFrame->cbRGBBuf;
    626626
    627627            try
    628628            {
    629                 CaptureBlocks *pVideoRecBlocks = new CaptureBlocks();
    630                 pVideoRecBlocks->List.push_back(pBlock);
     629                RecordingBlocks *pRECORDINGBLOCKs = new RecordingBlocks();
     630                pRECORDINGBLOCKs->List.push_back(pBlock);
    631631
    632632                Assert(this->Blocks.Map.find(uTimeStampMs) == this->Blocks.Map.end());
    633                 this->Blocks.Map.insert(std::make_pair(uTimeStampMs, pVideoRecBlocks));
     633                this->Blocks.Map.insert(std::make_pair(uTimeStampMs, pRECORDINGBLOCKs));
    634634            }
    635635            catch (const std::exception &ex)
     
    646646
    647647    if (RT_FAILURE(rc))
    648         VideoRecVideoFrameFree(pFrame);
     648        RecordingVideoFrameFree(pFrame);
    649649
    650650    unlock();
     
    661661 * @param   Settings            Capturing configuration to use for initialization.
    662662 */
    663 int CaptureStream::Init(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
     663int RecordingStream::Init(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
    664664{
    665665    return initInternal(a_pCtx, uScreen, Settings);
     
    674674 * @param   Settings            Capturing configuration to use for initialization.
    675675 */
    676 int CaptureStream::initInternal(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
     676int RecordingStream::initInternal(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)
    677677{
    678678    int rc = parseOptionsString(Settings.strOptions);
     
    806806 * @returns IPRT status code.
    807807 */
    808 int CaptureStream::close(void)
     808int RecordingStream::close(void)
    809809{
    810810    int rc = VINF_SUCCESS;
     
    877877 * @returns IPRT status code.
    878878 */
    879 int CaptureStream::Uninit(void)
     879int RecordingStream::Uninit(void)
    880880{
    881881    return uninitInternal();
    882882}
    883883
    884 int CaptureStream::uninitInternal(void)
     884int RecordingStream::uninitInternal(void)
    885885{
    886886    if (this->enmState != RECORDINGSTREAMSTATE_INITIALIZED)
     
    911911 * @returns IPRT status code.
    912912 */
    913 int CaptureStream::unitVideo(void)
     913int RecordingStream::unitVideo(void)
    914914{
    915915#ifdef VBOX_WITH_LIBVPX
     
    927927 * @returns IPRT status code.
    928928 */
    929 int CaptureStream::uninitVideoVPX(void)
    930 {
    931     PVIDEORECVIDEOCODEC pCodec = &this->Video.Codec;
     929int RecordingStream::uninitVideoVPX(void)
     930{
     931    PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec;
    932932    vpx_img_free(&pCodec->VPX.RawImage);
    933933    pCodec->VPX.pu8YuvBuf = NULL; /* Was pointing to VPX.RawImage. */
     
    945945 * @returns IPRT status code.
    946946 */
    947 int CaptureStream::initVideo(void)
     947int RecordingStream::initVideo(void)
    948948{
    949949    /* Sanity. */
     
    970970 * @returns IPRT status code.
    971971 */
    972 int CaptureStream::initVideoVPX(void)
     972int RecordingStream::initVideoVPX(void)
    973973{
    974974# ifdef VBOX_WITH_LIBVPX_VP9
     
    978978# endif
    979979
    980     PVIDEORECVIDEOCODEC pCodec = &this->Video.Codec;
     980    PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec;
    981981
    982982    vpx_codec_err_t rcv = vpx_codec_enc_config_default(pCodecIface, &pCodec->VPX.Cfg, 0 /* Reserved */);
     
    10221022#endif
    10231023
    1024 int CaptureStream::initAudio(void)
     1024int RecordingStream::initAudio(void)
    10251025{
    10261026#ifdef VBOX_WITH_AUDIO_RECORDING
     
    10451045 * @param   pFrame              Frame to encode and submit.
    10461046 */
    1047 int CaptureStream::writeVideoVPX(uint64_t uTimeStampMs, PVIDEORECVIDEOFRAME pFrame)
     1047int RecordingStream::writeVideoVPX(uint64_t uTimeStampMs, PRECORDINGVIDEOFRAME pFrame)
    10481048{
    10491049    AssertPtrReturn(pFrame, VERR_INVALID_POINTER);
     
    10511051    int rc;
    10521052
    1053     PVIDEORECVIDEOCODEC pCodec = &this->Video.Codec;
     1053    PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec;
    10541054
    10551055    /* Presentation Time Stamp (PTS). */
     
    11031103 * Locks a recording stream.
    11041104 */
    1105 void CaptureStream::lock(void)
     1105void RecordingStream::lock(void)
    11061106{
    11071107    int rc = RTCritSectEnter(&CritSect);
     
    11121112 * Unlocks a locked recording stream.
    11131113 */
    1114 void CaptureStream::unlock(void)
     1114void RecordingStream::unlock(void)
    11151115{
    11161116    int rc = RTCritSectLeave(&CritSect);
  • trunk/src/VBox/Main/src-client/RecordingUtils.cpp

    r75344 r75354  
    147147 * @param   uSrcHeight          Height (Y, in pixels) of source buffer.
    148148 */
    149 int videoRecRGBToYUV(uint32_t uPixelFormat,
     149int recordingRGBToYUV(uint32_t uPixelFormat,
    150150                     uint8_t *paDst, uint32_t uDstWidth, uint32_t uDstHeight,
    151151                     uint8_t *paSrc, uint32_t uSrcWidth, uint32_t uSrcHeight)
     
    153153    switch (uPixelFormat)
    154154    {
    155         case VIDEORECPIXELFMT_RGB32:
     155        case RECORDINGPIXELFMT_RGB32:
    156156            if (!videoRecColorConvWriteYUV420p<ColorConvBGRA32Iter>(paDst, uDstWidth, uDstHeight,
    157157                                                            paSrc, uSrcWidth, uSrcHeight))
    158158                return VERR_INVALID_PARAMETER;
    159159            break;
    160         case VIDEORECPIXELFMT_RGB24:
     160        case RECORDINGPIXELFMT_RGB24:
    161161            if (!videoRecColorConvWriteYUV420p<ColorConvBGR24Iter>(paDst, uDstWidth, uDstHeight,
    162162                                                           paSrc, uSrcWidth, uSrcHeight))
    163163                return VERR_INVALID_PARAMETER;
    164164            break;
    165         case VIDEORECPIXELFMT_RGB565:
     165        case RECORDINGPIXELFMT_RGB565:
    166166            if (!videoRecColorConvWriteYUV420p<ColorConvBGR565Iter>(paDst, uDstWidth, uDstHeight,
    167167                                                            paSrc, uSrcWidth, uSrcHeight))
Note: See TracChangeset for help on using the changeset viewer.

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