VirtualBox

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

Last change on this file since 68981 was 68981, checked in by vboxsync, 8 years ago

Main/VideoRec.h: Initialize configuration via constructor.

  • 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.1 KB
Line 
1/* $Id: VideoRec.h 68981 2017-10-04 13:08:07Z 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.215389.xyz. 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 : fEnabled(false)
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 /** Whether recording is enabled or not (as a whole). */
71 bool fEnabled;
72 /** Array of all screens containing whether they're enabled
73 * for recording or not. */
74 com::SafeArray<BOOL> aScreens;
75 /** Destination where to write the stream to. */
76 VIDEORECDEST enmDst;
77 union
78 {
79 /**
80 * Structure for keeping recording parameters if
81 * destination is a file.
82 */
83 struct
84 {
85 BSTR strFile;
86 /** Maximum file size (in MB) to record. */
87 uint32_t uMaxSizeMB;
88 } File;
89 };
90
91#ifdef VBOX_WITH_AUDIO_VIDEOREC
92 /**
93 * Structure for keeping the audio recording parameters.
94 */
95 struct
96 {
97 bool fEnabled;
98 uint16_t uHz;
99 uint8_t cBits;
100 uint8_t cChannels;
101 VIDEORECPROFILE enmProfile;
102 } Audio;
103#endif
104
105 /**
106 * Structure for keeping the video recording parameters.
107 */
108 struct
109 {
110 bool fEnabled;
111 uint32_t uWidth;
112 uint32_t uHeight;
113 uint32_t uRate;
114 uint32_t uFPS;
115
116#ifdef VBOX_WITH_LIBVPX
117 union
118 {
119 struct
120 {
121 /** Encoder deadline. */
122 unsigned int uEncoderDeadline;
123 } VPX;
124 } Codec;
125#endif
126
127 } Video;
128 /** Maximum time (in s) to record.
129 * Specify 0 to disable this check. */
130 uint32_t uMaxTimeS;
131
132 VIDEORECCFG& operator=(const VIDEORECCFG &that)
133 {
134 fEnabled = that.fEnabled;
135
136 aScreens.resize(that.aScreens.size());
137 for (size_t i = 0; i < that.aScreens.size(); ++i)
138 aScreens[i] = that.aScreens[i];
139
140 enmDst = that.enmDst;
141
142 File.strFile = that.File.strFile;
143 File.uMaxSizeMB = that.File.uMaxSizeMB;
144#ifdef VBOX_WITH_AUDIO_VIDEOREC
145 Audio = that.Audio;
146#endif
147 Video = that.Video;
148 uMaxTimeS = that.uMaxTimeS;
149 return *this;
150 }
151
152} VIDEORECCFG, *PVIDEORECCFG;
153
154/** Stores video recording features. */
155typedef uint32_t VIDEORECFEATURES;
156
157/** Video recording is disabled completely. */
158#define VIDEORECFEATURE_NONE 0
159/** Capturing video is enabled. */
160#define VIDEORECFEATURE_VIDEO RT_BIT(0)
161/** Capturing audio is enabled. */
162#define VIDEORECFEATURE_AUDIO RT_BIT(1)
163
164int VideoRecContextCreate(uint32_t cScreens, PVIDEORECCFG pVideoRecCfg, PVIDEORECCONTEXT *ppCtx);
165int VideoRecContextDestroy(PVIDEORECCONTEXT pCtx);
166
167int VideoRecStreamInit(PVIDEORECCONTEXT pCtx, uint32_t uScreen);
168int VideoRecStreamUninit(PVIDEORECCONTEXT pCtx, uint32_t uScreen);
169
170VIDEORECFEATURES VideoRecGetEnabled(PVIDEORECCFG pCfg);
171
172int VideoRecSendAudioFrame(PVIDEORECCONTEXT pCtx, const void *pvData, size_t cbData, uint64_t uTimestampMs);
173int VideoRecSendVideoFrame(PVIDEORECCONTEXT pCtx, uint32_t uScreen,
174 uint32_t x, uint32_t y, uint32_t uPixelFormat, uint32_t uBPP,
175 uint32_t uBytesPerLine, uint32_t uSrcWidth, uint32_t uSrcHeight,
176 uint8_t *puSrcData, uint64_t uTimeStampMs);
177bool VideoRecIsReady(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t uTimeStampMs);
178bool VideoRecIsActive(PVIDEORECCONTEXT pCtx);
179bool VideoRecIsLimitReached(PVIDEORECCONTEXT pCtx, uint32_t uScreen, uint64_t tsNowMs);
180
181#endif /* !____H_VIDEOREC */
182
Note: See TracBrowser for help on using the repository browser.

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