Changeset 75354 in vbox
- Timestamp:
- Nov 9, 2018 11:22:09 AM (7 years ago)
- svn:sync-xref-src-repo-rev:
- 126487
- Location:
- trunk/src/VBox/Main
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/ConsoleImpl.h
r75352 r75354 149 149 int i_recordingStop(void); 150 150 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; } 152 152 HRESULT i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uDurationMs); 153 153 #endif … … 1034 1034 { 1035 1035 Recording() 1036 : mp RecordCtx(NULL)1036 : mpCtx(NULL) 1037 1037 , mAudioRec(NULL) { } 1038 1038 1039 1039 /** The recording context. */ 1040 CaptureContext *mpRecordCtx;1040 RecordingContext *mpCtx; 1041 1041 # ifdef VBOX_WITH_AUDIO_RECORDING 1042 1042 /** Pointer to capturing audio backend. */ -
trunk/src/VBox/Main/include/DrvAudioRec.h
r75344 r75354 16 16 */ 17 17 18 #ifndef ____H_DRVAUDIO VIDEOREC19 #define ____H_DRVAUDIO VIDEOREC18 #ifndef ____H_DRVAUDIORECORDING 19 #define ____H_DRVAUDIORECORDING 20 20 21 21 #include <VBox/com/ptr.h> … … 59 59 60 60 /** Pointer to the associated video recording audio driver. */ 61 struct DRVAUDIO VIDEOREC*mpDrv;61 struct DRVAUDIORECORDING *mpDrv; 62 62 /** Capturing configuration used for configuring the driver. */ 63 63 struct settings::RecordSettings mVideoRecCfg; 64 64 }; 65 65 66 #endif /* !____H_DRVAUDIO VIDEOREC*/66 #endif /* !____H_DRVAUDIORECORDING */ 67 67 -
trunk/src/VBox/Main/include/Recording.h
r75344 r75354 16 16 */ 17 17 18 #ifndef ____H_ VIDEOREC19 #define ____H_ VIDEOREC18 #ifndef ____H_RECORDING 19 #define ____H_RECORDING 20 20 21 21 #include <VBox/com/array.h> … … 35 35 * Class for managing a capturing context. 36 36 */ 37 class CaptureContext37 class RecordingContext 38 38 { 39 39 public: 40 40 41 CaptureContext(Console *pConsole);41 RecordingContext(Console *pConsole); 42 42 43 CaptureContext(Console *pConsole, const settings::RecordSettings &a_Settings);43 RecordingContext(Console *pConsole, const settings::RecordSettings &a_Settings); 44 44 45 virtual ~ CaptureContext(void);45 virtual ~RecordingContext(void); 46 46 47 47 public: 48 48 49 49 const settings::RecordSettings &GetConfig(void) const; 50 CaptureStream *GetStream(unsigned uScreen) const;50 RecordingStream *GetStream(unsigned uScreen) const; 51 51 size_t GetStreamCount(void) const; 52 52 … … 78 78 int destroyInternal(void); 79 79 80 CaptureStream *getStreamInternal(unsigned uScreen) const;80 RecordingStream *getStreamInternal(unsigned uScreen) const; 81 81 82 82 static DECLCALLBACK(int) threadMain(RTTHREAD hThreadSelf, void *pvUser); … … 89 89 * Enumeration for a recording context state. 90 90 */ 91 enum VIDEORECSTS91 enum RECORDINGSTS 92 92 { 93 93 /** Context not initialized. */ 94 VIDEORECSTS_UNINITIALIZED = 0,94 RECORDINGSTS_UNINITIALIZED = 0, 95 95 /** Context was created. */ 96 VIDEORECSTS_CREATED = 1,96 RECORDINGSTS_CREATED = 1, 97 97 /** Context was started. */ 98 VIDEORECSTS_STARTED = 2,98 RECORDINGSTS_STARTED = 2, 99 99 /** The usual 32-bit hack. */ 100 VIDEORECSTS_32BIT_HACK = 0x7fffffff100 RECORDINGSTS_32BIT_HACK = 0x7fffffff 101 101 }; 102 102 … … 104 104 Console *pConsole; 105 105 /** Used recording configuration. */ 106 settings::RecordSettings Settings;106 settings::RecordSettings Settings; 107 107 /** The current state. */ 108 VIDEORECSTSenmState;108 RECORDINGSTS enmState; 109 109 /** Critical section to serialize access. */ 110 110 RTCRITSECT CritSect; … … 117 117 /** Vector of current recording streams. 118 118 * Per VM screen (display) one recording stream is being used. */ 119 VideoRecStreamsvecStreams;119 RecordingStreams vecStreams; 120 120 /** Timestamp (in ms) of when recording has been started. */ 121 121 uint64_t tsStartMs; … … 127 127 * For now this only affects audio, e.g. all recording streams 128 128 * need to have the same audio data at a specific point in time. */ 129 VideoRecBlockMapmapBlocksCommon;129 RecordingBlockMap mapBlocksCommon; 130 130 }; 131 #endif /* !____H_ VIDEOREC*/131 #endif /* !____H_RECORDING */ 132 132 -
trunk/src/VBox/Main/include/RecordingInternals.h
r75346 r75354 16 16 */ 17 17 18 #ifndef ____H_ VIDEOREC_INTERNALS19 #define ____H_ VIDEOREC_INTERNALS18 #ifndef ____H_RECORDING_INTERNALS 19 #define ____H_RECORDING_INTERNALS 20 20 21 21 #include <iprt/types.h> /* drag in stdint.h before vpx does it. */ … … 30 30 31 31 /** 32 * Structure for keeping specific video recordingcodec data.32 * Structure for keeping specific recording video codec data. 33 33 */ 34 typedef struct VIDEORECVIDEOCODEC34 typedef struct RECORDINGVIDEOCODEC 35 35 { 36 36 #ifdef VBOX_WITH_LIBVPX … … 51 51 }; 52 52 #endif /* VBOX_WITH_LIBVPX */ 53 } VIDEORECVIDEOCODEC, *PVIDEORECVIDEOCODEC;53 } RECORDINGVIDEOCODEC, *PRECORDINGVIDEOCODEC; 54 54 55 55 /** 56 56 * Enumeration for supported pixel formats. 57 57 */ 58 enum VIDEORECPIXELFMT58 enum RECORDINGPIXELFMT 59 59 { 60 60 /** Unknown pixel format. */ 61 VIDEORECPIXELFMT_UNKNOWN = 0,61 RECORDINGPIXELFMT_UNKNOWN = 0, 62 62 /** RGB 24. */ 63 VIDEORECPIXELFMT_RGB24 = 1,63 RECORDINGPIXELFMT_RGB24 = 1, 64 64 /** RGB 24. */ 65 VIDEORECPIXELFMT_RGB32 = 2,65 RECORDINGPIXELFMT_RGB32 = 2, 66 66 /** RGB 565. */ 67 VIDEORECPIXELFMT_RGB565 = 3,67 RECORDINGPIXELFMT_RGB565 = 3, 68 68 /** The usual 32-bit hack. */ 69 VIDEORECPIXELFMT_32BIT_HACK = 0x7fffffff69 RECORDINGPIXELFMT_32BIT_HACK = 0x7fffffff 70 70 }; 71 71 72 72 /** 73 * Structure for keeping a single videorecording video frame.73 * Structure for keeping a single recording video frame. 74 74 */ 75 typedef struct VIDEORECVIDEOFRAME75 typedef struct RECORDINGVIDEOFRAME 76 76 { 77 77 /** X resolution of this frame. */ … … 85 85 /** Size (in bytes) of the RGB buffer. */ 86 86 size_t cbRGBBuf; 87 } VIDEORECVIDEOFRAME, *PVIDEORECVIDEOFRAME;87 } RECORDINGVIDEOFRAME, *PRECORDINGVIDEOFRAME; 88 88 89 89 #ifdef VBOX_WITH_AUDIO_RECORDING 90 90 /** 91 * Structure for keeping a single videorecording audio frame.91 * Structure for keeping a single recording audio frame. 92 92 */ 93 typedef struct VIDEORECAUDIOFRAME93 typedef struct RECORDINGAUDIOFRAME 94 94 { 95 95 /** Pointer to audio data. */ … … 97 97 /** Size (in bytes) of audio data. */ 98 98 size_t cbBuf; 99 } VIDEORECAUDIOFRAME, *PVIDEORECAUDIOFRAME;99 } RECORDINGAUDIOFRAME, *PRECORDINGAUDIOFRAME; 100 100 #endif 101 101 … … 103 103 * Enumeration for specifying a video recording block type. 104 104 */ 105 typedef enum VIDEORECBLOCKTYPE105 typedef enum RECORDINGBLOCKTYPE 106 106 { 107 107 /** Uknown block type, do not use. */ 108 VIDEORECBLOCKTYPE_UNKNOWN = 0,108 RECORDINGBLOCKTYPE_UNKNOWN = 0, 109 109 /** The block is a video frame. */ 110 VIDEORECBLOCKTYPE_VIDEO,110 RECORDINGBLOCKTYPE_VIDEO, 111 111 #ifdef VBOX_WITH_AUDIO_RECORDING 112 112 /** The block is an audio frame. */ 113 VIDEORECBLOCKTYPE_AUDIO113 RECORDINGBLOCKTYPE_AUDIO 114 114 #endif 115 } VIDEORECBLOCKTYPE;115 } RECORDINGBLOCKTYPE; 116 116 117 117 /** 118 118 * Generic structure for keeping a single video recording (data) block. 119 119 */ 120 typedef struct VIDEORECBLOCK120 typedef struct RECORDINGBLOCK 121 121 { 122 122 /** The block's type. */ 123 VIDEORECBLOCKTYPEenmType;123 RECORDINGBLOCKTYPE enmType; 124 124 /** Number of references held of this block. */ 125 125 uint16_t cRefs; … … 130 130 /** Size (in bytes) of the (opaque) data block. */ 131 131 size_t cbData; 132 } VIDEORECBLOCK, *PVIDEORECBLOCK;132 } RECORDINGBLOCK, *PRECORDINGBLOCK; 133 133 134 134 /** List for keeping video recording (data) blocks. */ 135 typedef std::list<P VIDEORECBLOCK> VideoRecBlockList;135 typedef std::list<PRECORDINGBLOCK> RECORDINGBLOCKList; 136 136 137 void VideoRecBlockFree(PVIDEORECBLOCK pBlock);137 void RecordingBlockFree(PRECORDINGBLOCK pBlock); 138 138 #ifdef VBOX_WITH_AUDIO_RECORDING 139 void VideoRecAudioFrameFree(PVIDEORECAUDIOFRAME pFrame);139 void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame); 140 140 #endif 141 void VideoRecVideoFrameFree(PVIDEORECVIDEOFRAME pFrame);141 void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame); 142 142 143 #endif /* ____H_ VIDEOREC_INTERNALS */143 #endif /* ____H_RECORDING_INTERNALS */ -
trunk/src/VBox/Main/include/RecordingStream.h
r75346 r75354 16 16 */ 17 17 18 #ifndef ____H_ VIDEOREC_STREAM19 #define ____H_ VIDEOREC_STREAM18 #ifndef ____H_RECORDING_STREAM 19 #define ____H_RECORDING_STREAM 20 20 21 21 #include <map> … … 32 32 33 33 class WebMWriter; 34 class CaptureContext;34 class RecordingContext; 35 35 36 36 /** Structure for queuing all blocks bound to a single timecode. 37 37 * This can happen if multiple tracks are being involved. */ 38 struct CaptureBlocks38 struct RecordingBlocks 39 39 { 40 virtual ~ CaptureBlocks()40 virtual ~RecordingBlocks() 41 41 { 42 42 Clear(); … … 44 44 45 45 /** 46 * Resets a videorecording block list by removing (destroying)46 * Resets a recording block list by removing (destroying) 47 47 * all current elements. 48 48 */ … … 51 51 while (!List.empty()) 52 52 { 53 P VIDEORECBLOCK pBlock = List.front();54 VideoRecBlockFree(pBlock);53 PRECORDINGBLOCK pBlock = List.front(); 54 RecordingBlockFree(pBlock); 55 55 List.pop_front(); 56 56 } … … 60 60 61 61 /** The actual block list for this timecode. */ 62 VideoRecBlockList List;62 RECORDINGBLOCKList List; 63 63 }; 64 64 … … 66 66 * The key specifies a unique timecode, whereas the value 67 67 * is a list of blocks which all correlate to the same key (timecode). */ 68 typedef std::map<uint64_t, CaptureBlocks *> VideoRecBlockMap;68 typedef std::map<uint64_t, RecordingBlocks *> RecordingBlockMap; 69 69 70 70 /** 71 71 * Structure for holding a set of recording (data) blocks. 72 72 */ 73 struct CaptureBlockSet73 struct RecordingBlockSet 74 74 { 75 virtual ~ CaptureBlockSet()75 virtual ~RecordingBlockSet() 76 76 { 77 77 Clear(); … … 84 84 void Clear(void) 85 85 { 86 VideoRecBlockMap::iterator it = Map.begin();86 RecordingBlockMap::iterator it = Map.begin(); 87 87 while (it != Map.end()) 88 88 { … … 99 99 uint64_t tsLastProcessedMs; 100 100 /** All blocks related to this block set. */ 101 VideoRecBlockMap Map;101 RecordingBlockMap Map; 102 102 }; 103 103 … … 105 105 * Class for managing a recording stream. 106 106 */ 107 class CaptureStream107 class RecordingStream 108 108 { 109 109 public: 110 110 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); 116 116 117 117 public: 118 118 119 int Init( CaptureContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);119 int Init(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings); 120 120 int Uninit(void); 121 121 122 int Process( VideoRecBlockMap &mapBlocksCommon);122 int Process(RecordingBlockMap &mapBlocksCommon); 123 123 int SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine, 124 124 uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, uint64_t uTimeStampMs); … … 133 133 int close(void); 134 134 135 int initInternal( CaptureContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings);135 int initInternal(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings); 136 136 int uninitInternal(void); 137 137 … … 144 144 int initVideoVPX(void); 145 145 int uninitVideoVPX(void); 146 int writeVideoVPX(uint64_t uTimeStampMs, P VIDEORECVIDEOFRAME pFrame);146 int writeVideoVPX(uint64_t uTimeStampMs, PRECORDINGVIDEOFRAME pFrame); 147 147 #endif 148 148 void lock(void); … … 167 167 168 168 /** Recording context this stream is associated to. */ 169 CaptureContext *pCtx;169 RecordingContext *pCtx; 170 170 /** The current state. */ 171 171 RECORDINGSTREAMSTATE enmState; … … 202 202 /** Number of failed attempts to encode the current video frame in a row. */ 203 203 uint16_t cFailedEncodingFrames; 204 VIDEORECVIDEOCODECCodec;204 RECORDINGVIDEOCODEC Codec; 205 205 } Video; 206 206 … … 208 208 /** Common set of video recording (data) blocks, needed for 209 209 * multiplexing to all recording streams. */ 210 CaptureBlockSetBlocks;210 RecordingBlockSet Blocks; 211 211 }; 212 212 213 213 /** Vector of video recording streams. */ 214 typedef std::vector < CaptureStream *> VideoRecStreams;215 216 #endif /* ____H_ VIDEOREC_STREAM */217 214 typedef std::vector <RecordingStream *> RecordingStreams; 215 216 #endif /* ____H_RECORDING_STREAM */ 217 -
trunk/src/VBox/Main/include/RecordingUtils.h
r75344 r75354 15 15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind. 16 16 */ 17 18 #ifndef ____H_RECORDING_UTILS 19 #define ____H_RECORDING_UTILS 17 20 18 21 #include <iprt/asm.h> … … 195 198 }; 196 199 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); 200 int 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 5616 5616 if (pDisplay) 5617 5617 { 5618 const bool fIsEnabled = Recording.mp RecordCtx5619 && Recording.mp RecordCtx->IsStarted();5618 const bool fIsEnabled = Recording.mpCtx 5619 && Recording.mpCtx->IsStarted(); 5620 5620 5621 5621 if (RT_BOOL(fEnable) != fIsEnabled) … … 5632 5632 # ifdef VBOX_WITH_AUDIO_RECORDING 5633 5633 /* Attach the video recording audio driver if required. */ 5634 if ( Recording.mp RecordCtx->IsFeatureEnabled(RecordFeature_Audio)5634 if ( Recording.mpCtx->IsFeatureEnabled(RecordFeature_Audio) 5635 5635 && Recording.mAudioRec) 5636 5636 { 5637 vrc = Recording.mAudioRec->applyConfiguration(Recording.mp RecordCtx->GetConfig());5637 vrc = Recording.mAudioRec->applyConfiguration(Recording.mpCtx->GetConfig()); 5638 5638 if (RT_SUCCESS(vrc)) 5639 5639 vrc = Recording.mAudioRec->doAttachDriverViaEmt(mpUVM, pAutoLock); … … 5641 5641 # endif 5642 5642 if ( RT_SUCCESS(vrc) 5643 && Recording.mp RecordCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */5643 && Recording.mpCtx->IsReady()) /* Any video recording (audio and/or video) feature enabled? */ 5644 5644 { 5645 5645 vrc = i_recordingStart(); … … 6878 6878 HRESULT Console::i_recordingSendAudio(const void *pvData, size_t cbData, uint64_t uTimestampMs) 6879 6879 { 6880 if (!Recording.mp RecordCtx)6880 if (!Recording.mpCtx) 6881 6881 return S_OK; 6882 6882 6883 if ( Recording.mp RecordCtx->IsStarted()6884 && Recording.mp RecordCtx->IsFeatureEnabled(RecordFeature_Audio))6885 { 6886 return Recording.mp RecordCtx->SendAudioFrame(pvData, cbData, uTimestampMs);6883 if ( Recording.mpCtx->IsStarted() 6884 && Recording.mpCtx->IsFeatureEnabled(RecordFeature_Audio)) 6885 { 6886 return Recording.mpCtx->SendAudioFrame(pvData, cbData, uTimestampMs); 6887 6887 } 6888 6888 … … 6907 6907 Settings.fEnabled = RT_BOOL(fTemp); 6908 6908 6909 SafeIfaceArray<IRecordScreenSettings> pa CaptureScreens;6910 hrc = pRecordSettings->COMGETTER(Screens)(ComSafeArrayAsOutParam(pa CaptureScreens));6909 SafeIfaceArray<IRecordScreenSettings> paRecordingScreens; 6910 hrc = pRecordSettings->COMGETTER(Screens)(ComSafeArrayAsOutParam(paRecordingScreens)); 6911 6911 AssertComRCReturn(hrc, VERR_INVALID_PARAMETER); 6912 6912 6913 for (unsigned long i = 0; i < (unsigned long)pa CaptureScreens.size(); ++i)6913 for (unsigned long i = 0; i < (unsigned long)paRecordingScreens.size(); ++i) 6914 6914 { 6915 6915 settings::RecordScreenSettings RecordScreenSettings; 6916 ComPtr<IRecordScreenSettings> pRecordScreenSettings = pa CaptureScreens[i];6916 ComPtr<IRecordScreenSettings> pRecordScreenSettings = paRecordingScreens[i]; 6917 6917 6918 6918 hrc = pRecordScreenSettings->COMGETTER(Enabled)(&fTemp); … … 6942 6942 } 6943 6943 6944 Assert(Settings.mapScreens.size() == pa CaptureScreens.size());6944 Assert(Settings.mapScreens.size() == paRecordingScreens.size()); 6945 6945 6946 6946 return VINF_SUCCESS; … … 6954 6954 int Console::i_recordingCreate(void) 6955 6955 { 6956 AssertReturn(Recording.mp RecordCtx == NULL, VERR_WRONG_ORDER);6956 AssertReturn(Recording.mpCtx == NULL, VERR_WRONG_ORDER); 6957 6957 6958 6958 int rc = VINF_SUCCESS; … … 6960 6960 try 6961 6961 { 6962 Recording.mp RecordCtx = new CaptureContext(this);6962 Recording.mpCtx = new RecordingContext(this); 6963 6963 } 6964 6964 catch (std::bad_alloc &) … … 6975 6975 if (RT_SUCCESS(rc)) 6976 6976 { 6977 AssertPtr(Recording.mp RecordCtx);6978 rc = Recording.mp RecordCtx->Create(Settings);6977 AssertPtr(Recording.mpCtx); 6978 rc = Recording.mpCtx->Create(Settings); 6979 6979 } 6980 6980 … … 6988 6988 void Console::i_recordingDestroy(void) 6989 6989 { 6990 if (Recording.mp RecordCtx)6991 { 6992 delete Recording.mp RecordCtx;6993 Recording.mp RecordCtx = NULL;6990 if (Recording.mpCtx) 6991 { 6992 delete Recording.mpCtx; 6993 Recording.mpCtx = NULL; 6994 6994 } 6995 6995 … … 7004 7004 int Console::i_recordingStart(void) 7005 7005 { 7006 AssertPtrReturn(Recording.mp RecordCtx, VERR_WRONG_ORDER);7007 7008 if (Recording.mp RecordCtx->IsStarted())7006 AssertPtrReturn(Recording.mpCtx, VERR_WRONG_ORDER); 7007 7008 if (Recording.mpCtx->IsStarted()) 7009 7009 return VINF_SUCCESS; 7010 7010 7011 7011 LogRel(("Recording: Starting ...\n")); 7012 7012 7013 int rc = Recording.mp RecordCtx->Start();7013 int rc = Recording.mpCtx->Start(); 7014 7014 if (RT_SUCCESS(rc)) 7015 7015 { 7016 for (unsigned uScreen = 0; uScreen < Recording.mp RecordCtx->GetStreamCount(); uScreen++)7016 for (unsigned uScreen = 0; uScreen < Recording.mpCtx->GetStreamCount(); uScreen++) 7017 7017 mDisplay->i_recordingScreenChanged(uScreen); 7018 7018 } … … 7030 7030 int Console::i_recordingStop(void) 7031 7031 { 7032 if ( !Recording.mp RecordCtx7033 || !Recording.mp RecordCtx->IsStarted())7032 if ( !Recording.mpCtx 7033 || !Recording.mpCtx->IsStarted()) 7034 7034 return VINF_SUCCESS; 7035 7035 7036 7036 LogRel(("Recording: Stopping ...\n")); 7037 7037 7038 int rc = Recording.mp RecordCtx->Stop();7038 int rc = Recording.mpCtx->Stop(); 7039 7039 if (RT_SUCCESS(rc)) 7040 7040 { 7041 const size_t cStreams = Recording.mp RecordCtx->GetStreamCount();7041 const size_t cStreams = Recording.mpCtx->GetStreamCount(); 7042 7042 for (unsigned uScreen = 0; uScreen < cStreams; ++uScreen) 7043 7043 mDisplay->i_recordingScreenChanged(uScreen); -
trunk/src/VBox/Main/src-client/DisplayImpl.cpp
r75352 r75354 2413 2413 int Display::i_recordingInvalidate(void) 2414 2414 { 2415 CaptureContext *pCtx = mParent->i_recordingGetContext();2415 RecordingContext *pCtx = mParent->i_recordingGetContext(); 2416 2416 if (!pCtx || !pCtx->IsStarted()) 2417 2417 return VINF_SUCCESS; … … 2422 2422 for (unsigned uScreen = 0; uScreen < mcMonitors; uScreen++) 2423 2423 { 2424 CaptureStream *pRecordingStream = pCtx->GetStream(uScreen);2424 RecordingStream *pRecordingStream = pCtx->GetStream(uScreen); 2425 2425 2426 2426 const bool fStreamEnabled = pRecordingStream->IsReady(); … … 2438 2438 void Display::i_recordingScreenChanged(unsigned uScreenId) 2439 2439 { 2440 CaptureContext *pCtx = mParent->i_recordingGetContext();2440 RecordingContext *pCtx = mParent->i_recordingGetContext(); 2441 2441 2442 2442 if ( RT_LIKELY(!maRecordingEnabled[uScreenId]) … … 3389 3389 #ifdef VBOX_WITH_RECORDING 3390 3390 AssertPtr(pDisplay->mParent); 3391 CaptureContext *pCtx = pDisplay->mParent->i_recordingGetContext();3391 RecordingContext *pCtx = pDisplay->mParent->i_recordingGetContext(); 3392 3392 3393 3393 if ( pCtx … … 3833 3833 { 3834 3834 # ifdef VBOX_WITH_RECORDING 3835 CaptureContext *pCtx = mParent->i_recordingGetContext();3835 RecordingContext *pCtx = mParent->i_recordingGetContext(); 3836 3836 return ( pCtx 3837 3837 && pCtx->IsReady(uScreen, uTimestampMs)); … … 3855 3855 Assert(mfCrOglVideoRecState == CRVREC_STATE_SUBMITTED); 3856 3856 # ifdef VBOX_WITH_RECORDING 3857 CaptureContext *pCtx = mParent->i_recordingGetContext();3857 RecordingContext *pCtx = mParent->i_recordingGetContext(); 3858 3858 3859 3859 if ( pCtx -
trunk/src/VBox/Main/src-client/DrvAudioRec.cpp
r75352 r75354 272 272 * Video recording audio driver instance data. 273 273 */ 274 typedef struct DRVAUDIO VIDEOREC274 typedef struct DRVAUDIORECORDING 275 275 { 276 276 /** Pointer to audio video recording object. */ … … 290 290 /** The driver's sink for writing output to. */ 291 291 AVRECSINK Sink; 292 } DRVAUDIO VIDEOREC, *PDRVAUDIOVIDEOREC;293 294 /** Makes DRVAUDIO VIDEORECout of PDMIHOSTAUDIO. */295 #define PDMIHOSTAUDIO_2_DRVAUDIO VIDEOREC(pInterface) /* (clang doesn't think it is a POD, thus _DYN.) */ \296 ( (PDRVAUDIO VIDEOREC)((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)) ) 297 297 298 298 /** … … 305 305 * @param pCodecParms Codec parameters to set. 306 306 */ 307 static int avRecSinkInit(PDRVAUDIO VIDEORECpThis, PAVRECSINK pSink, PAVRECCONTAINERPARMS pConParms, PAVRECCODECPARMS pCodecParms)307 static int avRecSinkInit(PDRVAUDIORECORDING pThis, PAVRECSINK pSink, PAVRECCONTAINERPARMS pConParms, PAVRECCODECPARMS pCodecParms) 308 308 { 309 309 uint32_t uHz = pCodecParms->PCMProps.uHz; … … 513 513 * @param pCfgAcq Acquired configuration by the audio output stream. 514 514 */ 515 static int avRecCreateStreamOut(PDRVAUDIO VIDEORECpThis, PAVRECSTREAM pStreamAV,515 static int avRecCreateStreamOut(PDRVAUDIORECORDING pThis, PAVRECSTREAM pStreamAV, 516 516 PAVRECSINK pSink, PPDMAUDIOSTREAMCFG pCfgReq, PPDMAUDIOSTREAMCFG pCfgAcq) 517 517 { … … 585 585 * @param pStreamAV Audio output stream to destroy. 586 586 */ 587 static int avRecDestroyStreamOut(PDRVAUDIO VIDEORECpThis, PAVRECSTREAM pStreamAV)587 static int avRecDestroyStreamOut(PDRVAUDIORECORDING pThis, PAVRECSTREAM pStreamAV) 588 588 { 589 589 RT_NOREF(pThis); … … 621 621 * @param enmStreamCmd Stream command to issue. 622 622 */ 623 static int avRecControlStreamOut(PDRVAUDIO VIDEORECpThis,623 static int avRecControlStreamOut(PDRVAUDIORECORDING pThis, 624 624 PAVRECSTREAM pStreamAV, PDMAUDIOSTREAMCMD enmStreamCmd) 625 625 { … … 654 654 LogFlowFuncEnter(); 655 655 656 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);656 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 657 657 658 658 LogRel(("Recording: Audio driver is using %RU32Hz, %RU16bit, %RU8 %s\n", … … 699 699 /* pcxWritten is optional. */ 700 700 701 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);701 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 702 702 RT_NOREF(pThis); 703 703 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; … … 900 900 LogFlowFuncEnter(); 901 901 902 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);902 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 903 903 904 904 avRecSinkShutdown(&pThis->Sink); … … 933 933 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 934 934 935 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);935 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 936 936 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; 937 937 … … 960 960 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 961 961 962 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);962 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 963 963 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; 964 964 … … 990 990 AssertPtrReturn(pStream, VERR_INVALID_POINTER); 991 991 992 PDRVAUDIO VIDEOREC pThis = PDMIHOSTAUDIO_2_DRVAUDIOVIDEOREC(pInterface);992 PDRVAUDIORECORDING pThis = PDMIHOSTAUDIO_2_DRVAUDIORECORDING(pInterface); 993 993 PAVRECSTREAM pStreamAV = (PAVRECSTREAM)pStream; 994 994 … … 1057 1057 { 1058 1058 PPDMDRVINS pDrvIns = PDMIBASE_2_PDMDRV(pInterface); 1059 PDRVAUDIO VIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);1059 PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING); 1060 1060 1061 1061 PDMIBASE_RETURN_INTERFACE(pszIID, PDMIBASE, &pDrvIns->IBase); … … 1139 1139 { 1140 1140 PDMDRV_CHECK_VERSIONS_RETURN(pDrvIns); 1141 PDRVAUDIO VIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);1141 PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING); 1142 1142 RT_NOREF(fFlags); 1143 1143 … … 1247 1247 { 1248 1248 PDMDRV_CHECK_VERSIONS_RETURN_VOID(pDrvIns); 1249 PDRVAUDIO VIDEOREC pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIOVIDEOREC);1249 PDRVAUDIORECORDING pThis = PDMINS_2_DATA(pDrvIns, PDRVAUDIORECORDING); 1250 1250 1251 1251 LogFlowFuncEnter(); … … 1323 1323 ~0U, 1324 1324 /* cbInstance */ 1325 sizeof(DRVAUDIO VIDEOREC),1325 sizeof(DRVAUDIORECORDING), 1326 1326 /* pfnConstruct */ 1327 1327 AudioVideoRec::drvConstruct, -
trunk/src/VBox/Main/src-client/Recording.cpp
r75346 r75354 54 54 #ifdef DEBUG_andy 55 55 /** Enables dumping audio / video data for debugging reasons. */ 56 //# define VBOX_ VIDEOREC_DUMP56 //# define VBOX_RECORDING_DUMP 57 57 #endif 58 58 59 #ifdef VBOX_ VIDEOREC_DUMP59 #ifdef VBOX_RECORDING_DUMP 60 60 #pragma pack(push) 61 61 #pragma pack(1) … … 67 67 uint16_t u16Reserved2; 68 68 uint32_t u32OffBits; 69 } VIDEORECBMPHDR, *PVIDEORECBMPHDR;70 AssertCompileSize( VIDEORECBMPHDR, 14);69 } RECORDINGBMPHDR, *PRECORDINGBMPHDR; 70 AssertCompileSize(RECORDINGBMPHDR, 14); 71 71 72 72 typedef struct … … 83 83 uint32_t u32ClrUsed; 84 84 uint32_t u32ClrImportant; 85 } VIDEORECBMPDIBHDR, *PVIDEORECBMPDIBHDR;86 AssertCompileSize( VIDEORECBMPDIBHDR, 40);85 } RECORDINGBMPDIBHDR, *PRECORDINGBMPDIBHDR; 86 AssertCompileSize(RECORDINGBMPDIBHDR, 40); 87 87 88 88 #pragma pack(pop) 89 #endif /* VBOX_ VIDEOREC_DUMP */90 91 92 CaptureContext::CaptureContext(Console *a_pConsole)89 #endif /* VBOX_RECORDING_DUMP */ 90 91 92 RecordingContext::RecordingContext(Console *a_pConsole) 93 93 : pConsole(a_pConsole) 94 , enmState( VIDEORECSTS_UNINITIALIZED) { }95 96 CaptureContext::CaptureContext(Console *a_pConsole, const settings::RecordSettings &a_Settings)94 , enmState(RECORDINGSTS_UNINITIALIZED) { } 95 96 RecordingContext::RecordingContext(Console *a_pConsole, const settings::RecordSettings &a_Settings) 97 97 : 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); 101 101 if (RT_FAILURE(rc)) 102 102 throw rc; 103 103 } 104 104 105 CaptureContext::~CaptureContext(void)105 RecordingContext::~RecordingContext(void) 106 106 { 107 107 destroyInternal(); … … 109 109 110 110 /** 111 * Worker thread for all streams of a videorecording context.111 * Worker thread for all streams of a recording context. 112 112 * 113 113 * For video frames, this also does the RGB/YUV conversion and encoding. 114 114 */ 115 DECLCALLBACK(int) CaptureContext::threadMain(RTTHREAD hThreadSelf, void *pvUser)116 { 117 CaptureContext *pThis = (CaptureContext *)pvUser;115 DECLCALLBACK(int) RecordingContext::threadMain(RTTHREAD hThreadSelf, void *pvUser) 116 { 117 RecordingContext *pThis = (RecordingContext *)pvUser; 118 118 119 119 /* Signal that we're up and rockin'. */ … … 132 132 * for every screen from Main, we here go again (on every wake up) through 133 133 * all screens. */ 134 VideoRecStreams::iterator itStream = pThis->vecStreams.begin();134 RecordingStreams::iterator itStream = pThis->vecStreams.begin(); 135 135 while (itStream != pThis->vecStreams.end()) 136 136 { 137 CaptureStream *pStream = (*itStream);137 RecordingStream *pStream = (*itStream); 138 138 139 139 rc = pStream->Process(pThis->mapBlocksCommon); … … 166 166 * @returns IPRT status code. 167 167 */ 168 int CaptureContext::threadNotify(void)168 int RecordingContext::threadNotify(void) 169 169 { 170 170 return RTSemEventSignal(this->WaitEvent); … … 177 177 * @param a_Settings Capture settings to use for context creation. 178 178 */ 179 int CaptureContext::createInternal(const settings::RecordSettings &a_Settings)179 int RecordingContext::createInternal(const settings::RecordSettings &a_Settings) 180 180 { 181 181 int rc = RTCritSectInit(&this->CritSect); … … 186 186 while (itScreen != a_Settings.mapScreens.end()) 187 187 { 188 CaptureStream *pStream = NULL;188 RecordingStream *pStream = NULL; 189 189 try 190 190 { 191 pStream = new CaptureStream(this, itScreen->first /* Screen ID */, itScreen->second);191 pStream = new RecordingStream(this, itScreen->first /* Screen ID */, itScreen->second); 192 192 this->vecStreams.push_back(pStream); 193 193 } … … 204 204 { 205 205 this->tsStartMs = RTTimeMilliTS(); 206 this->enmState = VIDEORECSTS_CREATED;206 this->enmState = RECORDINGSTS_CREATED; 207 207 this->fShutdown = false; 208 208 … … 223 223 } 224 224 225 int CaptureContext::startInternal(void)226 { 227 if (this->enmState == VIDEORECSTS_STARTED)225 int RecordingContext::startInternal(void) 226 { 227 if (this->enmState == RECORDINGSTS_STARTED) 228 228 return VINF_SUCCESS; 229 229 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, 233 233 RTTHREADTYPE_MAIN_WORKER, RTTHREADFLAGS_WAITABLE, "Record"); 234 234 … … 238 238 if (RT_SUCCESS(rc)) 239 239 { 240 this->enmState = VIDEORECSTS_STARTED;240 this->enmState = RECORDINGSTS_STARTED; 241 241 } 242 242 … … 244 244 } 245 245 246 int CaptureContext::stopInternal(void)247 { 248 if (this->enmState != VIDEORECSTS_STARTED)246 int RecordingContext::stopInternal(void) 247 { 248 if (this->enmState != RECORDINGSTS_STARTED) 249 249 return VINF_SUCCESS; 250 250 … … 261 261 if (RT_SUCCESS(rc)) 262 262 { 263 this->enmState = VIDEORECSTS_CREATED;263 this->enmState = RECORDINGSTS_CREATED; 264 264 } 265 265 … … 271 271 * Destroys a video recording context. 272 272 */ 273 int CaptureContext::destroyInternal(void)273 int RecordingContext::destroyInternal(void) 274 274 { 275 275 int rc = stopInternal(); … … 285 285 if (RT_SUCCESS(rc)) 286 286 { 287 VideoRecStreams::iterator it = this->vecStreams.begin();287 RecordingStreams::iterator it = this->vecStreams.begin(); 288 288 while (it != this->vecStreams.end()) 289 289 { 290 CaptureStream *pStream = (*it);290 RecordingStream *pStream = (*it); 291 291 292 292 int rc2 = pStream->Uninit(); … … 318 318 } 319 319 320 const settings::RecordSettings & CaptureContext::GetConfig(void) const320 const settings::RecordSettings &RecordingContext::GetConfig(void) const 321 321 { 322 322 return this->Settings; 323 323 } 324 324 325 CaptureStream *CaptureContext::getStreamInternal(unsigned uScreen) const326 { 327 CaptureStream *pStream;325 RecordingStream *RecordingContext::getStreamInternal(unsigned uScreen) const 326 { 327 RecordingStream *pStream; 328 328 329 329 try … … 345 345 * @param uScreen Screen number of recording stream to look up. 346 346 */ 347 CaptureStream *CaptureContext::GetStream(unsigned uScreen) const347 RecordingStream *RecordingContext::GetStream(unsigned uScreen) const 348 348 { 349 349 return getStreamInternal(uScreen); 350 350 } 351 351 352 size_t CaptureContext::GetStreamCount(void) const352 size_t RecordingContext::GetStreamCount(void) const 353 353 { 354 354 return this->vecStreams.size(); 355 355 } 356 356 357 int CaptureContext::Create(const settings::RecordSettings &a_Settings)357 int RecordingContext::Create(const settings::RecordSettings &a_Settings) 358 358 { 359 359 return createInternal(a_Settings); 360 360 } 361 361 362 int CaptureContext::Destroy(void)362 int RecordingContext::Destroy(void) 363 363 { 364 364 return destroyInternal(); 365 365 } 366 366 367 int CaptureContext::Start(void)367 int RecordingContext::Start(void) 368 368 { 369 369 return startInternal(); 370 370 } 371 371 372 int CaptureContext::Stop(void)372 int RecordingContext::Stop(void) 373 373 { 374 374 return stopInternal(); 375 375 } 376 376 377 bool CaptureContext::IsFeatureEnabled(RecordFeature_T enmFeature) const378 { 379 VideoRecStreams::const_iterator itStream = this->vecStreams.begin();377 bool RecordingContext::IsFeatureEnabled(RecordFeature_T enmFeature) const 378 { 379 RecordingStreams::const_iterator itStream = this->vecStreams.begin(); 380 380 while (itStream != this->vecStreams.end()) 381 381 { … … 393 393 * @returns @c true if recording context is ready, @c false if not. 394 394 */ 395 bool CaptureContext::IsReady(void) const396 { 397 return (this->enmState >= VIDEORECSTS_CREATED);395 bool RecordingContext::IsReady(void) const 396 { 397 return (this->enmState >= RECORDINGSTS_CREATED); 398 398 } 399 399 … … 405 405 * @param uTimeStampMs Current time stamp (in ms). Currently not being used. 406 406 */ 407 bool CaptureContext::IsReady(uint32_t uScreen, uint64_t uTimeStampMs) const407 bool RecordingContext::IsReady(uint32_t uScreen, uint64_t uTimeStampMs) const 408 408 { 409 409 RT_NOREF(uTimeStampMs); 410 410 411 if (this->enmState != VIDEORECSTS_STARTED)411 if (this->enmState != RECORDINGSTS_STARTED) 412 412 return false; 413 413 414 414 bool fIsReady = false; 415 415 416 const CaptureStream *pStream = GetStream(uScreen);416 const RecordingStream *pStream = GetStream(uScreen); 417 417 if (pStream) 418 418 fIsReady = pStream->IsReady(); … … 430 430 * @returns true if active, false if not. 431 431 */ 432 bool CaptureContext::IsStarted(void) const433 { 434 return (this->enmState == VIDEORECSTS_STARTED);432 bool RecordingContext::IsStarted(void) const 433 { 434 return (this->enmState == RECORDINGSTS_STARTED); 435 435 } 436 436 … … 442 442 * @param tsNowMs Current time stamp (in ms). 443 443 */ 444 bool CaptureContext::IsLimitReached(uint32_t uScreen, uint64_t tsNowMs) const445 { 446 const CaptureStream *pStream = GetStream(uScreen);444 bool RecordingContext::IsLimitReached(uint32_t uScreen, uint64_t tsNowMs) const 445 { 446 const RecordingStream *pStream = GetStream(uScreen); 447 447 if ( !pStream 448 448 || pStream->IsLimitReached(tsNowMs)) … … 464 464 * @param uTimeStampMs Time stamp (in ms) of audio playback. 465 465 */ 466 int CaptureContext::SendAudioFrame(const void *pvData, size_t cbData, uint64_t uTimeStampMs)466 int RecordingContext::SendAudioFrame(const void *pvData, size_t cbData, uint64_t uTimeStampMs) 467 467 { 468 468 #ifdef VBOX_WITH_AUDIO_RECORDING … … 475 475 * audio data at the same given point in time. 476 476 */ 477 P VIDEORECBLOCK pBlock = (PVIDEORECBLOCK)RTMemAlloc(sizeof(VIDEORECBLOCK));477 PRECORDINGBLOCK pBlock = (PRECORDINGBLOCK)RTMemAlloc(sizeof(RECORDINGBLOCK)); 478 478 AssertPtrReturn(pBlock, VERR_NO_MEMORY); 479 pBlock->enmType = VIDEORECBLOCKTYPE_AUDIO;480 481 P VIDEORECAUDIOFRAME pFrame = (PVIDEORECAUDIOFRAME)RTMemAlloc(sizeof(VIDEORECAUDIOFRAME));479 pBlock->enmType = RECORDINGBLOCKTYPE_AUDIO; 480 481 PRECORDINGAUDIOFRAME pFrame = (PRECORDINGAUDIOFRAME)RTMemAlloc(sizeof(RECORDINGAUDIOFRAME)); 482 482 AssertPtrReturn(pFrame, VERR_NO_MEMORY); 483 483 … … 489 489 490 490 pBlock->pvData = pFrame; 491 pBlock->cbData = sizeof( VIDEORECAUDIOFRAME) + cbData;491 pBlock->cbData = sizeof(RECORDINGAUDIOFRAME) + cbData; 492 492 pBlock->cRefs = (uint16_t)this->vecStreams.size(); /* All streams need the same audio data. */ 493 493 pBlock->uTimeStampMs = uTimeStampMs; … … 499 499 try 500 500 { 501 VideoRecBlockMap::iterator itBlocks = this->mapBlocksCommon.find(uTimeStampMs);501 RecordingBlockMap::iterator itBlocks = this->mapBlocksCommon.find(uTimeStampMs); 502 502 if (itBlocks == this->mapBlocksCommon.end()) 503 503 { 504 CaptureBlocks *pVideoRecBlocks = new CaptureBlocks();505 p VideoRecBlocks->List.push_back(pBlock);506 507 this->mapBlocksCommon.insert(std::make_pair(uTimeStampMs, p VideoRecBlocks));504 RecordingBlocks *pRecordingBlocks = new RecordingBlocks(); 505 pRecordingBlocks->List.push_back(pBlock); 506 507 this->mapBlocksCommon.insert(std::make_pair(uTimeStampMs, pRecordingBlocks)); 508 508 } 509 509 else … … 547 547 * @param uTimeStampMs Time stamp (in ms). 548 548 */ 549 int CaptureContext::SendVideoFrame(uint32_t uScreen, uint32_t x, uint32_t y,549 int RecordingContext::SendVideoFrame(uint32_t uScreen, uint32_t x, uint32_t y, 550 550 uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine, 551 551 uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, … … 559 559 AssertRC(rc); 560 560 561 CaptureStream *pStream = GetStream(uScreen);561 RecordingStream *pStream = GetStream(uScreen); 562 562 if (!pStream) 563 563 { -
trunk/src/VBox/Main/src-client/RecordingInternals.cpp
r75346 r75354 27 27 * @param pFrame Audio frame to free. The pointer will be invalid after return. 28 28 */ 29 void VideoRecAudioFrameFree(PVIDEORECAUDIOFRAME pFrame)29 void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame) 30 30 { 31 31 if (!pFrame) … … 48 48 * @param pFrame Pointer to video frame to free. The pointer will be invalid after return. 49 49 */ 50 void VideoRecVideoFrameFree(PVIDEORECVIDEOFRAME pFrame)50 void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame) 51 51 { 52 52 if (!pFrame) … … 67 67 * @param pBlock Video recording (data) block to free. The pointer will be invalid after return. 68 68 */ 69 void VideoRecBlockFree(PVIDEORECBLOCK pBlock)69 void RECORDINGBLOCKFree(PRECORDINGBLOCK pBlock) 70 70 { 71 71 if (!pBlock) … … 74 74 switch (pBlock->enmType) 75 75 { 76 case VIDEORECBLOCKTYPE_VIDEO:77 VideoRecVideoFrameFree((PVIDEORECVIDEOFRAME)pBlock->pvData);76 case RECORDINGBLOCKTYPE_VIDEO: 77 RecordingVideoFrameFree((PRECORDINGVIDEOFRAME)pBlock->pvData); 78 78 break; 79 79 80 80 #ifdef VBOX_WITH_AUDIO_RECORDING 81 case VIDEORECBLOCKTYPE_AUDIO:82 VideoRecAudioFrameFree((PVIDEORECAUDIOFRAME)pBlock->pvData);81 case RECORDINGBLOCKTYPE_AUDIO: 82 RecordingAudioFrameFree((PRECORDINGAUDIOFRAME)pBlock->pvData); 83 83 break; 84 84 #endif -
trunk/src/VBox/Main/src-client/RecordingStream.cpp
r75346 r75354 42 42 43 43 44 CaptureStream::CaptureStream(CaptureContext *a_pCtx)44 RecordingStream::RecordingStream(RecordingContext *a_pCtx) 45 45 : pCtx(a_pCtx) 46 46 , enmState(RECORDINGSTREAMSTATE_UNINITIALIZED) … … 51 51 } 52 52 53 CaptureStream::CaptureStream(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)53 RecordingStream::RecordingStream(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings) 54 54 : enmState(RECORDINGSTREAMSTATE_UNINITIALIZED) 55 55 , tsStartMs(0) … … 63 63 } 64 64 65 CaptureStream::~CaptureStream(void)65 RecordingStream::~RecordingStream(void) 66 66 { 67 67 int rc2 = uninitInternal(); … … 74 74 * @returns IPRT status code. 75 75 */ 76 int CaptureStream::open(const settings::RecordScreenSettings &Settings)76 int RecordingStream::open(const settings::RecordScreenSettings &Settings) 77 77 { 78 78 /* Sanity. */ … … 182 182 } 183 183 184 int CaptureStream::parseOptionsString(const com::Utf8Str &strOptions)184 int RecordingStream::parseOptionsString(const com::Utf8Str &strOptions) 185 185 { 186 186 size_t pos = 0; … … 255 255 } 256 256 257 const settings::RecordScreenSettings & CaptureStream::GetConfig(void) const257 const settings::RecordScreenSettings &RecordingStream::GetConfig(void) const 258 258 { 259 259 return this->ScreenSettings; … … 266 266 * @param tsNowMs Current time stamp (in ms). 267 267 */ 268 bool CaptureStream::IsLimitReached(uint64_t tsNowMs) const268 bool RecordingStream::IsLimitReached(uint64_t tsNowMs) const 269 269 { 270 270 if (!IsReady()) … … 299 299 } 300 300 301 bool CaptureStream::IsReady(void) const301 bool RecordingStream::IsReady(void) const 302 302 { 303 303 return this->fEnabled; … … 312 312 * @param mapBlocksCommon Map of common block to process for this stream. 313 313 */ 314 int CaptureStream::Process(VideoRecBlockMap &mapBlocksCommon)314 int RecordingStream::Process(RecordingBlockMap &mapBlocksCommon) 315 315 { 316 316 lock(); … … 324 324 int rc = VINF_SUCCESS; 325 325 326 VideoRecBlockMap::iterator itStreamBlocks = Blocks.Map.begin();326 RecordingBlockMap::iterator itStreamBlocks = Blocks.Map.begin(); 327 327 while (itStreamBlocks != Blocks.Map.end()) 328 328 { 329 const uint64_t uTimeStampMs = itStreamBlocks->first;330 CaptureBlocks *pBlocks= itStreamBlocks->second;329 const uint64_t uTimeStampMs = itStreamBlocks->first; 330 RecordingBlocks *pBlocks = itStreamBlocks->second; 331 331 332 332 AssertPtr(pBlocks); … … 334 334 while (!pBlocks->List.empty()) 335 335 { 336 P VIDEORECBLOCK pBlock = pBlocks->List.front();336 PRECORDINGBLOCK pBlock = pBlocks->List.front(); 337 337 AssertPtr(pBlock); 338 338 339 339 #ifdef VBOX_WITH_LIBVPX 340 if (pBlock->enmType == VIDEORECBLOCKTYPE_VIDEO)341 { 342 P VIDEORECVIDEOFRAME 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); 349 349 if (RT_SUCCESS(rc)) 350 350 { … … 355 355 } 356 356 #endif 357 VideoRecBlockFree(pBlock);357 RecordingBlockFree(pBlock); 358 358 pBlock = NULL; 359 359 … … 369 369 /* As each (enabled) screen has to get the same audio data, look for common (audio) data which needs to be 370 370 * written to the screen's assigned recording stream. */ 371 VideoRecBlockMap::iterator itCommonBlocks = mapBlocksCommon.begin();371 RecordingBlockMap::iterator itCommonBlocks = mapBlocksCommon.begin(); 372 372 while (itCommonBlocks != mapBlocksCommon.end()) 373 373 { 374 VideoRecBlockList::iterator itBlock = itCommonBlocks->second->List.begin();374 RECORDINGBLOCKList::iterator itBlock = itCommonBlocks->second->List.begin(); 375 375 while (itBlock != itCommonBlocks->second->List.end()) 376 376 { 377 P VIDEORECBLOCK pBlockCommon = (PVIDEORECBLOCK)(*itBlock);377 PRECORDINGBLOCK pBlockCommon = (PRECORDINGBLOCK)(*itBlock); 378 378 switch (pBlockCommon->enmType) 379 379 { 380 case VIDEORECBLOCKTYPE_AUDIO:380 case RECORDINGBLOCKTYPE_AUDIO: 381 381 { 382 P VIDEORECAUDIOFRAME pAudioFrame = (PVIDEORECAUDIOFRAME)pBlockCommon->pvData;382 PRECORDINGAUDIOFRAME pAudioFrame = (PRECORDINGAUDIOFRAME)pBlockCommon->pvData; 383 383 AssertPtr(pAudioFrame); 384 384 AssertPtr(pAudioFrame->pvBuf); … … 404 404 if (pBlockCommon->cRefs == 0) 405 405 { 406 VideoRecBlockFree(pBlockCommon);406 RecordingBlockFree(pBlockCommon); 407 407 itCommonBlocks->second->List.erase(itBlock); 408 408 itBlock = itCommonBlocks->second->List.begin(); … … 434 434 } 435 435 436 int CaptureStream::SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine,436 int RecordingStream::SendVideoFrame(uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP, uint32_t uBytesPerLine, 437 437 uint32_t uSrcWidth, uint32_t uSrcHeight, uint8_t *puSrcData, uint64_t uTimeStampMs) 438 438 { 439 439 lock(); 440 440 441 P VIDEORECVIDEOFRAME pFrame = NULL;441 PRECORDINGVIDEOFRAME pFrame = NULL; 442 442 443 443 int rc = VINF_SUCCESS; … … 508 508 h = this->ScreenSettings.Video.ulHeight - destY; 509 509 510 pFrame = (P VIDEORECVIDEOFRAME)RTMemAllocZ(sizeof(VIDEORECVIDEOFRAME));510 pFrame = (PRECORDINGVIDEOFRAME)RTMemAllocZ(sizeof(RECORDINGVIDEOFRAME)); 511 511 AssertBreakStmt(pFrame, rc = VERR_NO_MEMORY); 512 512 … … 518 518 { 519 519 case 32: 520 pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB32;520 pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB32; 521 521 break; 522 522 case 24: 523 pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB24;523 pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB24; 524 524 break; 525 525 case 16: 526 pFrame->uPixelFormat = VIDEORECPIXELFMT_RGB565;526 pFrame->uPixelFormat = RECORDINGPIXELFMT_RGB565; 527 527 break; 528 528 default: … … 557 557 uint32_t offDst = (destY * this->ScreenSettings.Video.ulWidth + destX) * uBytesPerPixel; 558 558 559 #ifdef VBOX_ VIDEOREC_DUMP560 VIDEORECBMPHDR bmpHdr;559 #ifdef VBOX_RECORDING_DUMP 560 RECORDINGBMPHDR bmpHdr; 561 561 RT_ZERO(bmpHdr); 562 562 563 VIDEORECBMPDIBHDR bmpDIBHdr;563 RECORDINGBMPDIBHDR bmpDIBHdr; 564 564 RT_ZERO(bmpDIBHdr); 565 565 566 566 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); 571 571 bmpDIBHdr.u32Width = w; 572 572 bmpDIBHdr.u32Height = h; … … 599 599 memcpy(pFrame->pu8RGBBuf + offDst, puSrcData + offSrc, w * uBytesPerPixel); 600 600 601 #ifdef VBOX_ VIDEOREC_DUMP601 #ifdef VBOX_RECORDING_DUMP 602 602 if (RT_SUCCESS(rc2)) 603 603 RTFileWrite(fh, pFrame->pu8RGBBuf + offDst, w * uBytesPerPixel, NULL); … … 607 607 } 608 608 609 #ifdef VBOX_ VIDEOREC_DUMP609 #ifdef VBOX_RECORDING_DUMP 610 610 if (RT_SUCCESS(rc2)) 611 611 RTFileClose(fh); … … 616 616 if (rc == VINF_SUCCESS) /* Note: Also could be VINF_TRY_AGAIN. */ 617 617 { 618 P VIDEORECBLOCK pBlock = (PVIDEORECBLOCK)RTMemAlloc(sizeof(VIDEORECBLOCK));618 PRECORDINGBLOCK pBlock = (PRECORDINGBLOCK)RTMemAlloc(sizeof(RECORDINGBLOCK)); 619 619 if (pBlock) 620 620 { 621 621 AssertPtr(pFrame); 622 622 623 pBlock->enmType = VIDEORECBLOCKTYPE_VIDEO;623 pBlock->enmType = RECORDINGBLOCKTYPE_VIDEO; 624 624 pBlock->pvData = pFrame; 625 pBlock->cbData = sizeof( VIDEORECVIDEOFRAME) + pFrame->cbRGBBuf;625 pBlock->cbData = sizeof(RECORDINGVIDEOFRAME) + pFrame->cbRGBBuf; 626 626 627 627 try 628 628 { 629 CaptureBlocks *pVideoRecBlocks = new CaptureBlocks();630 p VideoRecBlocks->List.push_back(pBlock);629 RecordingBlocks *pRECORDINGBLOCKs = new RecordingBlocks(); 630 pRECORDINGBLOCKs->List.push_back(pBlock); 631 631 632 632 Assert(this->Blocks.Map.find(uTimeStampMs) == this->Blocks.Map.end()); 633 this->Blocks.Map.insert(std::make_pair(uTimeStampMs, p VideoRecBlocks));633 this->Blocks.Map.insert(std::make_pair(uTimeStampMs, pRECORDINGBLOCKs)); 634 634 } 635 635 catch (const std::exception &ex) … … 646 646 647 647 if (RT_FAILURE(rc)) 648 VideoRecVideoFrameFree(pFrame);648 RecordingVideoFrameFree(pFrame); 649 649 650 650 unlock(); … … 661 661 * @param Settings Capturing configuration to use for initialization. 662 662 */ 663 int CaptureStream::Init(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)663 int RecordingStream::Init(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings) 664 664 { 665 665 return initInternal(a_pCtx, uScreen, Settings); … … 674 674 * @param Settings Capturing configuration to use for initialization. 675 675 */ 676 int CaptureStream::initInternal(CaptureContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings)676 int RecordingStream::initInternal(RecordingContext *a_pCtx, uint32_t uScreen, const settings::RecordScreenSettings &Settings) 677 677 { 678 678 int rc = parseOptionsString(Settings.strOptions); … … 806 806 * @returns IPRT status code. 807 807 */ 808 int CaptureStream::close(void)808 int RecordingStream::close(void) 809 809 { 810 810 int rc = VINF_SUCCESS; … … 877 877 * @returns IPRT status code. 878 878 */ 879 int CaptureStream::Uninit(void)879 int RecordingStream::Uninit(void) 880 880 { 881 881 return uninitInternal(); 882 882 } 883 883 884 int CaptureStream::uninitInternal(void)884 int RecordingStream::uninitInternal(void) 885 885 { 886 886 if (this->enmState != RECORDINGSTREAMSTATE_INITIALIZED) … … 911 911 * @returns IPRT status code. 912 912 */ 913 int CaptureStream::unitVideo(void)913 int RecordingStream::unitVideo(void) 914 914 { 915 915 #ifdef VBOX_WITH_LIBVPX … … 927 927 * @returns IPRT status code. 928 928 */ 929 int CaptureStream::uninitVideoVPX(void)930 { 931 P VIDEORECVIDEOCODEC pCodec = &this->Video.Codec;929 int RecordingStream::uninitVideoVPX(void) 930 { 931 PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec; 932 932 vpx_img_free(&pCodec->VPX.RawImage); 933 933 pCodec->VPX.pu8YuvBuf = NULL; /* Was pointing to VPX.RawImage. */ … … 945 945 * @returns IPRT status code. 946 946 */ 947 int CaptureStream::initVideo(void)947 int RecordingStream::initVideo(void) 948 948 { 949 949 /* Sanity. */ … … 970 970 * @returns IPRT status code. 971 971 */ 972 int CaptureStream::initVideoVPX(void)972 int RecordingStream::initVideoVPX(void) 973 973 { 974 974 # ifdef VBOX_WITH_LIBVPX_VP9 … … 978 978 # endif 979 979 980 P VIDEORECVIDEOCODEC pCodec = &this->Video.Codec;980 PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec; 981 981 982 982 vpx_codec_err_t rcv = vpx_codec_enc_config_default(pCodecIface, &pCodec->VPX.Cfg, 0 /* Reserved */); … … 1022 1022 #endif 1023 1023 1024 int CaptureStream::initAudio(void)1024 int RecordingStream::initAudio(void) 1025 1025 { 1026 1026 #ifdef VBOX_WITH_AUDIO_RECORDING … … 1045 1045 * @param pFrame Frame to encode and submit. 1046 1046 */ 1047 int CaptureStream::writeVideoVPX(uint64_t uTimeStampMs, PVIDEORECVIDEOFRAME pFrame)1047 int RecordingStream::writeVideoVPX(uint64_t uTimeStampMs, PRECORDINGVIDEOFRAME pFrame) 1048 1048 { 1049 1049 AssertPtrReturn(pFrame, VERR_INVALID_POINTER); … … 1051 1051 int rc; 1052 1052 1053 P VIDEORECVIDEOCODEC pCodec = &this->Video.Codec;1053 PRECORDINGVIDEOCODEC pCodec = &this->Video.Codec; 1054 1054 1055 1055 /* Presentation Time Stamp (PTS). */ … … 1103 1103 * Locks a recording stream. 1104 1104 */ 1105 void CaptureStream::lock(void)1105 void RecordingStream::lock(void) 1106 1106 { 1107 1107 int rc = RTCritSectEnter(&CritSect); … … 1112 1112 * Unlocks a locked recording stream. 1113 1113 */ 1114 void CaptureStream::unlock(void)1114 void RecordingStream::unlock(void) 1115 1115 { 1116 1116 int rc = RTCritSectLeave(&CritSect); -
trunk/src/VBox/Main/src-client/RecordingUtils.cpp
r75344 r75354 147 147 * @param uSrcHeight Height (Y, in pixels) of source buffer. 148 148 */ 149 int videoRecRGBToYUV(uint32_t uPixelFormat,149 int recordingRGBToYUV(uint32_t uPixelFormat, 150 150 uint8_t *paDst, uint32_t uDstWidth, uint32_t uDstHeight, 151 151 uint8_t *paSrc, uint32_t uSrcWidth, uint32_t uSrcHeight) … … 153 153 switch (uPixelFormat) 154 154 { 155 case VIDEORECPIXELFMT_RGB32:155 case RECORDINGPIXELFMT_RGB32: 156 156 if (!videoRecColorConvWriteYUV420p<ColorConvBGRA32Iter>(paDst, uDstWidth, uDstHeight, 157 157 paSrc, uSrcWidth, uSrcHeight)) 158 158 return VERR_INVALID_PARAMETER; 159 159 break; 160 case VIDEORECPIXELFMT_RGB24:160 case RECORDINGPIXELFMT_RGB24: 161 161 if (!videoRecColorConvWriteYUV420p<ColorConvBGR24Iter>(paDst, uDstWidth, uDstHeight, 162 162 paSrc, uSrcWidth, uSrcHeight)) 163 163 return VERR_INVALID_PARAMETER; 164 164 break; 165 case VIDEORECPIXELFMT_RGB565:165 case RECORDINGPIXELFMT_RGB565: 166 166 if (!videoRecColorConvWriteYUV420p<ColorConvBGR565Iter>(paDst, uDstWidth, uDstHeight, 167 167 paSrc, uSrcWidth, uSrcHeight))
Note:
See TracChangeset
for help on using the changeset viewer.