Changeset 96229 in vbox for trunk/src/VBox/Main/include
- Timestamp:
- Aug 16, 2022 3:41:39 PM (2 years ago)
- Location:
- trunk/src/VBox/Main/include
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/include/Recording.h
r95645 r96229 38 38 RecordingContext(); 39 39 40 RecordingContext(Console *ptrConsole, const settings::RecordingSettings & settings);40 RecordingContext(Console *ptrConsole, const settings::RecordingSettings &Settings); 41 41 42 42 virtual ~RecordingContext(void); … … 47 47 RecordingStream *GetStream(unsigned uScreen) const; 48 48 size_t GetStreamCount(void) const; 49 #ifdef VBOX_WITH_AUDIO_RECORDING 50 PRECORDINGCODEC GetCodecAudio(void) { return &this->CodecAudio; } 51 #endif 49 52 50 int Create(Console *pConsole, const settings::RecordingSettings & settings);53 int Create(Console *pConsole, const settings::RecordingSettings &Settings); 51 54 void Destroy(void); 52 55 … … 72 75 protected: 73 76 74 int createInternal(Console *ptrConsole, const settings::RecordingSettings & settings);77 int createInternal(Console *ptrConsole, const settings::RecordingSettings &Settings); 75 78 int startInternal(void); 76 79 int stopInternal(void); … … 80 83 RecordingStream *getStreamInternal(unsigned uScreen) const; 81 84 85 int writeCommonData(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags); 86 82 87 int lock(void); 83 88 int unlock(void); … … 86 91 87 92 int threadNotify(void); 93 94 protected: 95 96 int audioInit(const settings::RecordingScreenSettings &screenSettings); 97 98 static DECLCALLBACK(int) audioCodecWriteDataCallback(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags, void *pvUser); 88 99 89 100 protected: … … 107 118 Console *pConsole; 108 119 /** Used recording configuration. */ 109 settings::RecordingSettings Settings;120 settings::RecordingSettings m_Settings; 110 121 /** The current state. */ 111 122 RECORDINGSTS enmState; … … 116 127 /** Shutdown indicator. */ 117 128 bool fShutdown; 118 /** Worker thread. */129 /** Encoding worker thread. */ 119 130 RTTHREAD Thread; 120 131 /** Vector of current recording streams. … … 125 136 /** Timestamp (in ms) of when recording has been started. */ 126 137 uint64_t tsStartMs; 138 #ifdef VBOX_WITH_AUDIO_RECORDING 139 /** Audio codec to use. 140 * 141 * We multiplex audio data from this recording context to all streams, 142 * to avoid encoding the same audio data for each stream. We ASSUME that 143 * all audio data of a VM will be the same for each stream at a given 144 * point in time. */ 145 RECORDINGCODEC CodecAudio; 146 #endif /* VBOX_WITH_AUDIO_RECORDING */ 127 147 /** Block map of common blocks which need to get multiplexed 128 148 * to all recording streams. This common block maps should help -
trunk/src/VBox/Main/include/RecordingInternals.h
r96178 r96229 122 122 * @param pCodec Codec instance to use. 123 123 * @param pFrame Pointer to frame data to encode. 124 * @param pvDst Where to store the encoded data on success.125 * @param cbDst Size (in bytes) of \a pvDst.126 124 * @param pcEncoded Where to return the number of encoded blocks in \a pvDst on success. Optional. 127 125 * @param pcbEncoded Where to return the number of encoded bytes in \a pvDst on success. Optional. 128 126 */ 129 DECLCALLBACKMEMBER(int, pfnEncode, (PRECORDINGCODEC pCodec, const PRECORDINGFRAME pFrame, void *pvDst, size_t cbDst,size_t *pcEncoded, size_t *pcbEncoded));127 DECLCALLBACKMEMBER(int, pfnEncode, (PRECORDINGCODEC pCodec, const PRECORDINGFRAME pFrame, size_t *pcEncoded, size_t *pcbEncoded)); 130 128 131 129 /** … … 138 136 } RECORDINGCODECOPS, *PRECORDINGCODECOPS; 139 137 138 /** No encoding flags set. */ 139 #define RECORDINGCODEC_ENC_F_NONE UINT32_C(0) 140 /** Data block is a key block. */ 141 #define RECORDINGCODEC_ENC_F_BLOCK_IS_KEY RT_BIT_32(0) 142 /** Data block is invisible. */ 143 #define RECORDINGCODEC_ENC_F_BLOCK_IS_INVISIBLE RT_BIT_32(1) 144 /** Encoding flags valid mask. */ 145 #define RECORDINGCODEC_ENC_F_VALID_MASK 0x1 146 140 147 /** 141 148 * Structure for keeping a codec callback table. … … 143 150 typedef struct RECORDINGCODECCALLBACKS 144 151 { 145 DECLCALLBACKMEMBER(int, pfnWriteData, (PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, void *pvUser)); 152 /** 153 * Callback for notifying that encoded data has been written. 154 * 155 * @returns VBox status code. 156 * @param pCodec Pointer to codec instance which has written the data. 157 * @param pvData Pointer to written data (encoded). 158 * @param cbData Size (in bytes) of \a pvData. 159 * @param msAbsPTS Absolute PTS (in ms) of the written data. 160 * @param uFlags Encoding flags of type RECORDINGCODEC_ENC_F_XXX. 161 * @param pvUser User-supplied pointer. 162 */ 163 DECLCALLBACKMEMBER(int, pfnWriteData, (PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags, void *pvUser)); 146 164 /** User-supplied data pointer. */ 147 void 165 void *pvUser; 148 166 } RECORDINGCODECCALLBACKS, *PRECORDINGCODECCALLBACKS; 149 167 … … 186 204 * Set to 0 to use a variable bit rate (VBR) (if available, otherwise fall back to CBR). */ 187 205 uint32_t uBitrate; 188 /** Time (in ms) an (encoded) frame takes.206 /** Time (in ms) the encoder expects us to send data to encode. 189 207 * 190 208 * For Opus, valid frame sizes are: … … 196 214 * 40 1920 197 215 * 60 2880 216 * 217 * For Vorbis, valid frame sizes are powers of two from 64 to 8192 bytes. 198 218 */ 199 219 uint32_t msFrame; 200 /** The frame size in bytes (based on msFrame). */220 /** The frame size in bytes (based on \a msFrame). */ 201 221 uint32_t cbFrame; 202 /** The frame size in samples per frame (based on msFrame). */222 /** The frame size in samples per frame (based on \a msFrame). */ 203 223 uint32_t csFrame; 204 224 } RECORDINGCODECPARMS, *PRECORDINGCODECPARMS; … … 258 278 259 279 /** 280 * Structure for keeping a codec's internal state. 281 */ 282 typedef struct RECORDINGCODECSTATE 283 { 284 /** Timestamp (in ms, absolute) of the last frame was encoded. */ 285 uint64_t tsLastWrittenMs; 286 /** Number of encoding errors. */ 287 uint64_t cEncErrors; 288 } RECORDINGCODECSTATE; 289 /** Pointer to an internal encoder state. */ 290 typedef RECORDINGCODECSTATE *PRECORDINGCODECSTATE; 291 292 /** 260 293 * Structure for keeping codec-specific data. 261 294 */ … … 268 301 /** Generic codec parameters. */ 269 302 RECORDINGCODECPARMS Parms; 303 /** Generic codec parameters. */ 304 RECORDINGCODECSTATE State; 270 305 271 306 #ifdef VBOX_WITH_LIBVPX … … 288 323 #endif /* VBOX_WITH_AUDIO_RECORDING */ 289 324 290 /** Timestamp (in ms) of the last frame was encoded. */291 uint64_t uLastTimeStampMs;292 /** Number of encoding errors. */293 uint 64_t cEncErrors;325 /** Internal scratch buffer for en-/decoding steps. */ 326 void *pvScratch; 327 /** Size (in bytes) of \a pvScratch. */ 328 uint32_t cbScratch; 294 329 295 330 #ifdef VBOX_WITH_STATISTICS /** @todo Register these values with STAM. */ … … 300 335 /** Total time (in ms) of already encoded audio data. */ 301 336 uint64_t msEncTotal; 302 } S tats;337 } STAM; 303 338 #endif 304 339 } RECORDINGCODEC, *PRECORDINGCODEC; … … 395 430 : enmType(RECORDINGBLOCKTYPE_UNKNOWN) 396 431 , cRefs(0) 432 , uFlags(RECORDINGCODEC_ENC_F_NONE) 397 433 , pvData(NULL) 398 434 , cbData(0) { } … … 434 470 /** Number of references held of this block. */ 435 471 uint16_t cRefs; 472 /** Block flags of type RECORDINGCODEC_ENC_F_XXX. */ 473 uint64_t uFlags; 436 474 /** The (absolute) timestamp (in ms, PTS) of this block. */ 437 475 uint64_t msTimestamp; … … 449 487 int recordingCodecInit(const PRECORDINGCODEC pCodec, const PRECORDINGCODECCALLBACKS pCallbacks, const settings::RecordingScreenSettings &Settings); 450 488 int recordingCodecDestroy(PRECORDINGCODEC pCodec); 451 int recordingCodecEncode(PRECORDINGCODEC pCodec, const PRECORDINGFRAME pFrame, void *pvDst, size_t cbDst,size_t *pcEncoded, size_t *pcbEncoded);489 int recordingCodecEncode(PRECORDINGCODEC pCodec, const PRECORDINGFRAME pFrame, size_t *pcEncoded, size_t *pcbEncoded); 452 490 int recordingCodecFinalize(PRECORDINGCODEC pCodec); 453 491 #endif /* !MAIN_INCLUDED_RecordingInternals_h */ -
trunk/src/VBox/Main/include/RecordingStream.h
r96179 r96229 126 126 uint16_t GetID(void) const { return this->uScreenID; }; 127 127 #ifdef VBOX_WITH_AUDIO_RECORDING 128 PRECORDINGCODEC GetAudioCodec(void) { return &this->CodecAudio; };128 PRECORDINGCODEC GetAudioCodec(void) { return this->pCodecAudio; }; 129 129 #endif 130 130 PRECORDINGCODEC GetVideoCodec(void) { return &this->CodecVideo; }; … … 132 132 bool IsReady(void) const; 133 133 134 public: 135 136 static DECLCALLBACK(int) codecWriteDataCallback(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags, void *pvUser); 137 134 138 protected: 135 139 136 static DECLCALLBACK(int) codecWriteDataCallback(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, void *pvUser); 137 138 protected: 139 140 int open(const settings::RecordingScreenSettings &Settings); 140 int open(const settings::RecordingScreenSettings &screenSettings); 141 141 int close(void); 142 142 143 int initInternal(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordingScreenSettings & Settings);143 int initInternal(RecordingContext *pCtx, uint32_t uScreen, const settings::RecordingScreenSettings &screenSettings); 144 144 int uninitInternal(void); 145 145 146 int initVideo(const settings::RecordingScreenSettings & Settings);146 int initVideo(const settings::RecordingScreenSettings &screenSettings); 147 147 int unitVideo(void); 148 149 int initAudio(const settings::RecordingScreenSettings &Settings);150 148 151 149 bool isLimitReachedInternal(uint64_t msTimestamp) const; 152 150 int iterateInternal(uint64_t msTimestamp); 151 152 int codecWriteToWebM(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags); 153 153 154 154 void lock(void); … … 171 171 172 172 /** Recording context this stream is associated to. */ 173 RecordingContext * pCtx;173 RecordingContext *m_pCtx; 174 174 /** The current state. */ 175 175 RECORDINGSTREAMSTATE enmState; … … 192 192 /** Critical section to serialize access. */ 193 193 RTCRITSECT CritSect; 194 /** Timestamp (in ms) of when recording has been start . */194 /** Timestamp (in ms) of when recording has been started. */ 195 195 uint64_t tsStartMs; 196 197 /** Audio codec instance data to use. */ 198 RECORDINGCODEC CodecAudio; 196 #ifdef VBOX_WITH_AUDIO_RECORDING 197 /** Pointer to audio codec instance data to use. 198 * 199 * We multiplex audio data from the recording context to all streams, 200 * to avoid encoding the same audio data for each stream. We ASSUME that 201 * all audio data of a VM will be the same for each stream at a given 202 * point in time. 203 * 204 * Might be NULL if not being used. */ 205 PRECORDINGCODEC pCodecAudio; 206 #endif /* VBOX_WITH_AUDIO_RECORDING */ 199 207 /** Video codec instance data to use. */ 200 RECORDINGCODEC 208 RECORDINGCODEC CodecVideo; 201 209 /** Screen settings to use. */ 202 settings::RecordingScreenSettings ScreenSettings; 210 settings::RecordingScreenSettings 211 ScreenSettings; 203 212 /** Common set of recording (data) blocks, needed for 204 213 * multiplexing to all recording streams. */ 205 RecordingBlockSet 214 RecordingBlockSet Blocks; 206 215 }; 207 216 -
trunk/src/VBox/Main/include/WebMWriter.h
r96210 r96229 563 563 int AddVideoTrack(PRECORDINGCODEC pCodec, uint16_t uWidth, uint16_t uHeight, uint32_t uFPS, uint8_t *puTrack); 564 564 565 int WriteBlock(uint8_t uTrack, const void *pvData, size_t cbData );565 int WriteBlock(uint8_t uTrack, const void *pvData, size_t cbData, WebMTimecodeAbs tcAbsPTSMs, WebMBlockFlags uFlags); 566 566 567 567 const com::Utf8Str& GetFileName(void); … … 594 594 int writeSimpleBlockQueued(WebMTrack *a_pTrack, WebMSimpleBlock *a_pBlock); 595 595 596 #ifdef VBOX_WITH_LIBVPX597 int writeSimpleBlockVP8(WebMTrack *a_pTrack, const vpx_codec_enc_cfg_t *a_pCfg, const vpx_codec_cx_pkt_t *a_pPkt);598 #endif599 600 int writeSimpleBlockAudio(WebMTrack *pTrack, const void *pvData, size_t cbData, WebMTimecodeAbs tcAbsPTSMs);601 602 596 int processQueue(WebMQueue *pQueue, bool fForce); 603 597
Note:
See TracChangeset
for help on using the changeset viewer.