VirtualBox

source: vbox/trunk/src/VBox/Main/include/VideoRec.h@ 75067

Last change on this file since 75067 was 75067, checked in by vboxsync, 6 years ago

Build fix.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
  • Property svn:mergeinfo set to (toggle deleted branches)
    /branches/VBox-3.0/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h58652,​70973
    /branches/VBox-3.2/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h66309,​66318
    /branches/VBox-4.0/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h70873
    /branches/VBox-4.1/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h74233
    /branches/VBox-4.2/src/VBox/Main/src-client/VideoRec.h91503-91504,​91506-91508,​91510,​91514-91515,​91521
    /branches/VBox-4.3/src/VBox/Main/src-client/VideoRec.h91223
    /branches/VBox-4.3/trunk/src/VBox/Main/src-client/VideoRec.h91223
    /branches/dsen/gui/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h79076-79078,​79089,​79109-79110,​79112-79113,​79127-79130,​79134,​79141,​79151,​79155,​79157-79159,​79193,​79197
    /branches/dsen/gui2/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h79224,​79228,​79233,​79235,​79258,​79262-79263,​79273,​79341,​79345,​79354,​79357,​79387-79388,​79559-79569,​79572-79573,​79578,​79581-79582,​79590-79591,​79598-79599,​79602-79603,​79605-79606,​79632,​79635,​79637,​79644
    /branches/dsen/gui3/src/VBox/Frontends/VBoxHeadless/VideoCapture/EncodeAndWrite.h79645-79692
File size: 6.4 KB
Line 
1/* $Id: VideoRec.h 75067 2018-10-25 13:10:22Z vboxsync $ */
2/** @file
3 * Video recording code header.
4 */
5
6/*
7 * Copyright (C) 2012-2018 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#ifndef ____H_VIDEOREC
19#define ____H_VIDEOREC
20
21#include <VBox/com/array.h>
22#include <VBox/com/string.h>
23#include <VBox/com/VirtualBox.h>
24#include <VBox/err.h>
25
26using namespace com;
27
28#include "VideoRecInternals.h"
29#include "VideoRecStream.h"
30
31/**
32 * Enumeration for definining a video / audio
33 * profile setting.
34 */
35typedef enum VIDEORECPROFILE
36{
37 VIDEORECPROFILE_NONE = 0,
38 VIDEORECPROFILE_LOW,
39 VIDEORECPROFILE_MEDIUM,
40 VIDEORECPROFILE_HIGH,
41 VIDEORECPROFILE_BEST,
42 VIDEORECPROFILE_REALTIME
43} VIDEORECPROFILE;
44
45/** Stores video recording features. */
46typedef uint32_t VIDEORECFEATURES;
47
48/** Video recording is disabled completely. */
49#define VIDEORECFEATURE_NONE 0
50/** Capturing video is enabled. */
51#define VIDEORECFEATURE_VIDEO RT_BIT(0)
52/** Capturing audio is enabled. */
53#define VIDEORECFEATURE_AUDIO RT_BIT(1)
54
55/**
56 * Structure for keeping a video recording configuration.
57 */
58typedef struct VIDEORECCFG
59{
60 VIDEORECCFG(void)
61 : enmDst(VIDEORECDEST_INVALID)
62 , uMaxTimeS(0)
63 {
64#ifdef VBOX_WITH_AUDIO_VIDEOREC
65 RT_ZERO(Audio);
66#endif
67 RT_ZERO(Video);
68 }
69
70 /** Array of all screens containing whether they're enabled
71 * for recording or not. */
72 com::SafeArray<BOOL> aScreens;
73 /** Destination where to write the stream to. */
74 VIDEORECDEST enmDst;
75
76 /**
77 * Structure for keeping recording parameters if
78 * destination is a file.
79 */
80 struct
81 {
82 /** File name (as absolute path). */
83 com::Bstr strName;
84 /** Maximum file size (in MB) to record. */
85 uint32_t uMaxSizeMB;
86 } File;
87
88#ifdef VBOX_WITH_AUDIO_VIDEOREC
89 /**
90 * Structure for keeping the audio recording parameters.
91 */
92 struct
93 {
94 /** Whether audio recording is enabled or not. */
95 bool fEnabled;
96 /** The device LUN the audio driver is attached / configured to. */
97 unsigned uLUN;
98 /** Hertz (Hz) rate. */
99 uint16_t uHz;
100 /** Bits per sample. */
101 uint8_t cBits;
102 /** Number of audio channels. */
103 uint8_t cChannels;
104 /** Audio profile which is being used. */
105 VIDEORECPROFILE enmProfile;
106 } Audio;
107#endif
108
109 /**
110 * Structure for keeping the video recording parameters.
111 */
112 struct
113 {
114 /** Whether video recording is enabled or not. */
115 bool fEnabled;
116 /** Target width (in pixels). */
117 uint32_t uWidth;
118 /** Target height (in pixels). */
119 uint32_t uHeight;
120 /** Target encoding rate. */
121 uint32_t uRate;
122 /** Target FPS. */
123 uint32_t uFPS;
124
125#ifdef VBOX_WITH_LIBVPX
126 union
127 {
128 struct
129 {
130 /** Encoder deadline. */
131 unsigned int uEncoderDeadline;
132 } VPX;
133 } Codec;
134#endif
135
136 } Video;
137 /** Maximum time (in s) to record.
138 * Specify 0 to disable this check. */
139 uint32_t uMaxTimeS;
140
141 VIDEORECCFG& operator=(const VIDEORECCFG &that)
142 {
143 aScreens.resize(that.aScreens.size());
144 for (size_t i = 0; i < that.aScreens.size(); ++i)
145 aScreens[i] = that.aScreens[i];
146
147 enmDst = that.enmDst;
148
149 File.strName = that.File.strName;
150 File.uMaxSizeMB = that.File.uMaxSizeMB;
151#ifdef VBOX_WITH_AUDIO_VIDEOREC
152 Audio = that.Audio;
153#endif
154 Video = that.Video;
155 uMaxTimeS = that.uMaxTimeS;
156 return *this;
157 }
158
159} VIDEORECCFG, *PVIDEORECCFG;
160
161/**
162 * Structure for keeping a video recording context.
163 */
164typedef struct VIDEORECCONTEXT
165{
166 /** Used recording configuration. */
167 VIDEORECCFG Cfg;
168 /** The current state. */
169 uint32_t enmState;
170 /** Critical section to serialize access. */
171 RTCRITSECT CritSect;
172 /** Semaphore to signal the encoding worker thread. */
173 RTSEMEVENT WaitEvent;
174 /** Whether this conext is in started state or not. */
175 bool fStarted;
176 /** Shutdown indicator. */
177 bool fShutdown;
178 /** Worker thread. */
179 RTTHREAD Thread;
180 /** Vector of current recording streams.
181 * Per VM screen (display) one recording stream is being used. */
182 VideoRecStreams vecStreams;
183 /** Timestamp (in ms) of when recording has been started. */
184 uint64_t tsStartMs;
185 /** Block map of common blocks which need to get multiplexed
186 * to all recording streams. This common block maps should help
187 * reducing the time spent in EMT and avoid doing the (expensive)
188 * multiplexing work in there.
189 *
190 * For now this only affects audio, e.g. all recording streams
191 * need to have the same audio data at a specific point in time. */
192 VideoRecBlockMap mapBlocksCommon;
193} VIDEORECCONTEXT, *PVIDEORECCONTEXT;
194
195int VideoRecContextCreate(uint32_t cScreens, PVIDEORECCFG pVideoRecCfg, PVIDEORECCONTEXT *ppCtx);
196int VideoRecContextDestroy(PVIDEORECCONTEXT pCtx);
197
198VIDEORECFEATURES VideoRecGetFeatures(PVIDEORECCFG pCfg);
199PVIDEORECSTREAM VideoRecGetStream(PVIDEORECCONTEXT pCtx, uint32_t uScreen);
200
201int VideoRecSendAudioFrame(PVIDEORECCONTEXT pCtx, const void *pvData, size_t cbData, uint64_t uTimestampMs);
202int VideoRecSendVideoFrame(PVIDEORECCONTEXT pCtx, uint32_t uScreen,
203 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP,
204 uint32_t uBytesPerLine, uint32_t uSrcWidth, uint32_t uSrcHeight,
205 uint8_t *puSrcData, uint64_t uTimeStampMs);
206bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t uTimeStampMs);
207bool VideoRecIsStarted(PVIDEORECCONTEXT pCtx);
208bool VideoRecIsLimitReached(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t tsNowMs);
209
210#endif /* !____H_VIDEOREC */
211
Note: See TracBrowser for help on using the repository browser.

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