VirtualBox

source: vbox/trunk/src/VBox/Main/include/RecordingInternals.h@ 75488

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

Recording/Main: Implemented better support for recording limits (also now configurable per screen).

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 5.1 KB
Line 
1/* $Id: RecordingInternals.h 75488 2018-11-15 16:12:07Z vboxsync $ */
2/** @file
3 * Recording internals 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_RECORDING_INTERNALS
19#define ____H_RECORDING_INTERNALS
20
21#include <iprt/assert.h>
22#include <iprt/types.h> /* drag in stdint.h before vpx does it. */
23#include <list>
24
25#ifdef VBOX_WITH_LIBVPX
26# define VPX_CODEC_DISABLE_COMPAT 1
27# include "vpx/vp8cx.h"
28# include "vpx/vpx_image.h"
29# include "vpx/vpx_encoder.h"
30#endif /* VBOX_WITH_LIBVPX */
31
32/**
33 * Structure for keeping specific recording video codec data.
34 */
35typedef struct RECORDINGVIDEOCODEC
36{
37#ifdef VBOX_WITH_LIBVPX
38 union
39 {
40 struct
41 {
42 /** VPX codec context. */
43 vpx_codec_ctx_t Ctx;
44 /** VPX codec configuration. */
45 vpx_codec_enc_cfg_t Cfg;
46 /** VPX image context. */
47 vpx_image_t RawImage;
48 /** Pointer to the codec's internal YUV buffer. */
49 uint8_t *pu8YuvBuf;
50 /** The encoder's deadline (in ms).
51 * The more time the encoder is allowed to spend encoding, the better the encoded
52 * result, in exchange for higher CPU usage and time spent encoding. */
53 unsigned int uEncoderDeadline;
54 } VPX;
55 };
56#endif /* VBOX_WITH_LIBVPX */
57} RECORDINGVIDEOCODEC, *PRECORDINGVIDEOCODEC;
58
59/**
60 * Enumeration for supported pixel formats.
61 */
62enum RECORDINGPIXELFMT
63{
64 /** Unknown pixel format. */
65 RECORDINGPIXELFMT_UNKNOWN = 0,
66 /** RGB 24. */
67 RECORDINGPIXELFMT_RGB24 = 1,
68 /** RGB 24. */
69 RECORDINGPIXELFMT_RGB32 = 2,
70 /** RGB 565. */
71 RECORDINGPIXELFMT_RGB565 = 3,
72 /** The usual 32-bit hack. */
73 RECORDINGPIXELFMT_32BIT_HACK = 0x7fffffff
74};
75
76/**
77 * Structure for keeping a single recording video frame.
78 */
79typedef struct RECORDINGVIDEOFRAME
80{
81 /** X resolution of this frame. */
82 uint32_t uWidth;
83 /** Y resolution of this frame. */
84 uint32_t uHeight;
85 /** Pixel format of this frame. */
86 uint32_t uPixelFormat;
87 /** RGB buffer containing the unmodified frame buffer data from Main's display. */
88 uint8_t *pu8RGBBuf;
89 /** Size (in bytes) of the RGB buffer. */
90 size_t cbRGBBuf;
91} RECORDINGVIDEOFRAME, *PRECORDINGVIDEOFRAME;
92
93#ifdef VBOX_WITH_AUDIO_RECORDING
94/**
95 * Structure for keeping a single recording audio frame.
96 */
97typedef struct RECORDINGAUDIOFRAME
98{
99 /** Pointer to audio data. */
100 uint8_t *pvBuf;
101 /** Size (in bytes) of audio data. */
102 size_t cbBuf;
103} RECORDINGAUDIOFRAME, *PRECORDINGAUDIOFRAME;
104#endif
105
106/**
107 * Enumeration for specifying a video recording block type.
108 */
109typedef enum RECORDINGBLOCKTYPE
110{
111 /** Uknown block type, do not use. */
112 RECORDINGBLOCKTYPE_UNKNOWN = 0,
113 /** The block is a video frame. */
114 RECORDINGBLOCKTYPE_VIDEO,
115#ifdef VBOX_WITH_AUDIO_RECORDING
116 /** The block is an audio frame. */
117 RECORDINGBLOCKTYPE_AUDIO
118#endif
119} RECORDINGBLOCKTYPE;
120
121#ifdef VBOX_WITH_AUDIO_RECORDING
122void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame);
123#endif
124void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame);
125
126/**
127 * Generic structure for keeping a single video recording (data) block.
128 */
129struct RecordingBlock
130{
131 RecordingBlock()
132 : enmType(RECORDINGBLOCKTYPE_UNKNOWN)
133 , cRefs(0)
134 , pvData(NULL)
135 , cbData(0) { }
136
137 virtual ~RecordingBlock()
138 {
139 Reset();
140 }
141
142 void Reset(void)
143 {
144 switch (enmType)
145 {
146 case RECORDINGBLOCKTYPE_UNKNOWN:
147 break;
148
149 case RECORDINGBLOCKTYPE_VIDEO:
150 RecordingVideoFrameFree((PRECORDINGVIDEOFRAME)pvData);
151 break;
152
153#ifdef VBOX_WITH_AUDIO_RECORDING
154 case RECORDINGBLOCKTYPE_AUDIO:
155 RecordingAudioFrameFree((PRECORDINGAUDIOFRAME)pvData);
156 break;
157#endif
158 default:
159 AssertFailed();
160 break;
161 }
162
163 enmType = RECORDINGBLOCKTYPE_UNKNOWN;
164 cRefs = 0;
165 pvData = NULL;
166 cbData = 0;
167 }
168
169 /** The block's type. */
170 RECORDINGBLOCKTYPE enmType;
171 /** Number of references held of this block. */
172 uint16_t cRefs;
173 /** The (absolute) time stamp (in ms, PTS) of this block. */
174 uint64_t uTimeStampMs;
175 /** Opaque data block to the actual block data, depending on the block's type. */
176 void *pvData;
177 /** Size (in bytes) of the (opaque) data block. */
178 size_t cbData;
179};
180
181/** List for keeping video recording (data) blocks. */
182typedef std::list<RecordingBlock *> RecordingBlockList;
183
184#endif /* ____H_RECORDING_INTERNALS */
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