VirtualBox

Ignore:
Timestamp:
Jul 11, 2024 7:49:37 AM (11 months ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
163915
Message:

Recording: Implemented support for a dedicated progress object, which is exposed to API clients. This can be used for better tracking the recording progress as well as for error reporting. The RecordingSettings API also now has a dedicated start() method to start recording, as well as support for attaching to an already ongoing recording by retrieving the progress object at a later time. Adapted FE/Qt (draft, see @todos), FE/VBoxManage and the Validation Kit testdriver to the new APIs. VBoxManage also can attach to an ongoing recording now. The recording progress object also will have multiple operations to get the recording progress for convenience. bugref:10718

File:
1 edited

Legend:

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

    r105095 r105266  
    3636
    3737#include "RecordingStream.h"
     38#include "ProgressImpl.h"
    3839
    3940class Console;
     
    123124    RecordingContext();
    124125
    125     RecordingContext(Console *ptrConsole, const settings::RecordingSettings &Settings);
    126 
    127126    virtual ~RecordingContext(void);
    128127
     
    136135#endif
    137136
    138     int Create(Console *pConsole, const settings::RecordingSettings &Settings);
     137    int Create(Console *pConsole, const settings::RecordingSettings &Settings, ComPtr<IProgress> &pProgress);
    139138    void Destroy(void);
    140139
    141140    int Start(void);
    142141    int Stop(void);
     142
     143    int SetError(int rc, const com::Utf8Str &strText);
    143144
    144145    int SendAudioFrame(const void *pvData, size_t cbData, uint64_t uTimestampMs);
     
    167168protected:
    168169
    169     int createInternal(Console *ptrConsole, const settings::RecordingSettings &Settings);
     170    int createInternal(Console *ptrConsole, const settings::RecordingSettings &Settings, ComPtr<IProgress> &pProgress);
     171    void reset(void);
    170172    int startInternal(void);
    171173    int stopInternal(void);
     
    183185    int onLimitReached(uint32_t uScreen, int vrc);
    184186
     187    bool progressIsCanceled(void) const;
     188    bool progressIsCompleted(void) const;
     189    int progressCreate(const settings::RecordingSettings &Settings, ComObjPtr<Progress> &pProgress);
     190    int progressNotifyComplete(HRESULT hrc = S_OK, IVirtualBoxErrorInfo *pErrorInfo = NULL);
     191    int progressSet(uint32_t uOp, const Bstr &strDesc);
     192    int progressSet(uint64_t msTimestamp);
     193
    185194    static DECLCALLBACK(int) threadMain(RTTHREAD hThreadSelf, void *pvUser);
    186195
     
    191200    int audioInit(const settings::RecordingScreenSettings &screenSettings);
    192201
    193     static DECLCALLBACK(int) audioCodecWriteDataCallback(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags, void *pvUser);
     202protected:
     203
     204    static DECLCALLBACK(void) s_progressCancelCallback(void *pvUser);
     205
     206    static DECLCALLBACK(void) s_recordingStateChangedCallback(RecordingContext *pCtx, RECORDINGSTS enmSts, uint32_t uScreen, int vrc, void *pvUser);
     207
     208    static DECLCALLBACK(int)  s_audioCodecWriteDataCallback(PRECORDINGCODEC pCodec, const void *pvData, size_t cbData, uint64_t msAbsPTS, uint32_t uFlags, void *pvUser);
    194209
    195210protected:
     
    207222    /** Semaphore to signal the encoding worker thread. */
    208223    RTSEMEVENT                   m_WaitEvent;
     224    /** Current operation of progress. Set to 0 if not started yet, >= 1 if started. */
     225    ULONG                        m_ulCurOp;
     226    /** Number of progress operations. Always >= 1. */
     227    ULONG                        m_cOps;
     228    /** The progress object assigned to this context.
     229     *  Might be NULL if not being used. */
     230    const ComObjPtr<Progress>    m_pProgress;
    209231    /** Shutdown indicator. */
    210232    bool                         m_fShutdown;
     
    236258     *
    237259     *  This avoids doing the (expensive) encoding + multiplexing work in other
    238      *  threads like EMT / audio async I/O..
     260     *  threads like EMT / audio async I/O.
    239261     *
    240262     *  For now this only affects audio, e.g. all recording streams
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