VirtualBox

source: vbox/trunk/src/VBox/Main/src-client/VideoRec.h@ 72014

Last change on this file since 72014 was 72014, checked in by vboxsync, 7 years ago

VideoRec/Main: Simplified recoding state checking by only using the IMachine::VideoCaptureEnabled getter. A bit of renaming.

  • 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: 5.5 KB
Line 
1/* $Id: VideoRec.h 72014 2018-04-25 13:28:31Z vboxsync $ */
2/** @file
3 * Encodes the screen content in VPX format.
4 */
5
6/*
7 * Copyright (C) 2012-2017 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
23struct VIDEORECCONTEXT;
24typedef struct VIDEORECCONTEXT *PVIDEORECCONTEXT;
25
26struct VIDEORECSTREAM;
27typedef struct VIDEORECSTREAM *PVIDEORECSTREAM;
28
29/**
30 * Enumeration for video recording destinations.
31 */
32typedef enum VIDEORECDEST
33{
34 /** Invalid destination, do not use. */
35 VIDEORECDEST_INVALID = 0,
36 /** Write to a file. */
37 VIDEORECDEST_FILE = 1
38} VIDEORECDEST;
39
40/**
41 * Enumeration for definining a video / audio
42 * profile setting.
43 */
44typedef enum VIDEORECPROFILE
45{
46 VIDEORECPROFILE_NONE = 0,
47 VIDEORECPROFILE_LOW,
48 VIDEORECPROFILE_MEDIUM,
49 VIDEORECPROFILE_HIGH,
50 VIDEORECPROFILE_BEST,
51 VIDEORECPROFILE_REALTIME
52} VIDEORECPROFILE;
53
54/**
55 * Structure for keeping a video recording configuration.
56 */
57typedef struct VIDEORECCFG
58{
59 VIDEORECCFG(void)
60 : enmDst(VIDEORECDEST_INVALID)
61 , uMaxTimeS(0)
62 {
63#ifdef VBOX_WITH_AUDIO_VIDEOREC
64 RT_ZERO(Audio);
65#endif
66 RT_ZERO(Video);
67 }
68
69 /** Whether recording is enabled or not (as a whole). */
70 //bool fEnabled;
71 /** Array of all screens containing whether they're enabled
72 * for recording or not. */
73 com::SafeArray<BOOL> aScreens;
74 /** Destination where to write the stream to. */
75 VIDEORECDEST enmDst;
76
77 /**
78 * Structure for keeping recording parameters if
79 * destination is a file.
80 */
81 struct
82 {
83 /** File name (as absolute path). */
84 com::Bstr strName;
85 /** Maximum file size (in MB) to record. */
86 uint32_t uMaxSizeMB;
87 } File;
88
89#ifdef VBOX_WITH_AUDIO_VIDEOREC
90 /**
91 * Structure for keeping the audio recording parameters.
92 */
93 struct
94 {
95 /** Whether audio recording is enabled or not. */
96 bool fEnabled;
97 /** The device LUN the audio driver is attached / configured to. */
98 unsigned uLUN;
99 /** Hertz (Hz) rate. */
100 uint16_t uHz;
101 /** Bits per sample. */
102 uint8_t cBits;
103 /** Number of audio channels. */
104 uint8_t cChannels;
105 /** Audio profile which is being used. */
106 VIDEORECPROFILE enmProfile;
107 } Audio;
108#endif
109
110 /**
111 * Structure for keeping the video recording parameters.
112 */
113 struct
114 {
115 /** Whether video recording is enabled or not. */
116 bool fEnabled;
117 /** Target width (in pixels). */
118 uint32_t uWidth;
119 /** Target height (in pixels). */
120 uint32_t uHeight;
121 /** Target encoding rate. */
122 uint32_t uRate;
123 /** Target FPS. */
124 uint32_t uFPS;
125
126#ifdef VBOX_WITH_LIBVPX
127 union
128 {
129 struct
130 {
131 /** Encoder deadline. */
132 unsigned int uEncoderDeadline;
133 } VPX;
134 } Codec;
135#endif
136
137 } Video;
138 /** Maximum time (in s) to record.
139 * Specify 0 to disable this check. */
140 uint32_t uMaxTimeS;
141
142 VIDEORECCFG& operator=(const VIDEORECCFG &that)
143 {
144 aScreens.resize(that.aScreens.size());
145 for (size_t i = 0; i < that.aScreens.size(); ++i)
146 aScreens[i] = that.aScreens[i];
147
148 enmDst = that.enmDst;
149
150 File.strName = that.File.strName;
151 File.uMaxSizeMB = that.File.uMaxSizeMB;
152#ifdef VBOX_WITH_AUDIO_VIDEOREC
153 Audio = that.Audio;
154#endif
155 Video = that.Video;
156 uMaxTimeS = that.uMaxTimeS;
157 return *this;
158 }
159
160} VIDEORECCFG, *PVIDEORECCFG;
161
162/** Stores video recording features. */
163typedef uint32_t VIDEORECFEATURES;
164
165/** Video recording is disabled completely. */
166#define VIDEORECFEATURE_NONE 0
167/** Capturing video is enabled. */
168#define VIDEORECFEATURE_VIDEO RT_BIT(0)
169/** Capturing audio is enabled. */
170#define VIDEORECFEATURE_AUDIO RT_BIT(1)
171
172int VideoRecContextCreate(uint32_t cScreens, PVIDEORECCFG pVideoRecCfg, PVIDEORECCONTEXT *ppCtx);
173int VideoRecContextDestroy(PVIDEORECCONTEXT pCtx);
174
175int VideoRecStreamInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen);
176int VideoRecStreamUninit(PVIDEORECCONTEXT pCtx, uint32_t uScreen);
177
178VIDEORECFEATURES VideoRecGetFeatures(PVIDEORECCFG pCfg);
179
180int VideoRecSendAudioFrame(PVIDEORECCONTEXT pCtx, const void *pvData, size_t cbData, uint64_t uTimestampMs);
181int VideoRecSendVideoFrame(PVIDEORECCONTEXT pCtx, uint32_t uScreen,
182 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP,
183 uint32_t uBytesPerLine, uint32_t uSrcWidth, uint32_t uSrcHeight,
184 uint8_t *puSrcData, uint64_t uTimeStampMs);
185bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t uTimeStampMs);
186bool VideoRecIsStarted(PVIDEORECCONTEXT pCtx);
187bool VideoRecIsLimitReached(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t tsNowMs);
188
189#endif /* !____H_VIDEOREC */
190
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