1 | /* $Id: RecordingInternals.h 75354 2018-11-09 11:22:09Z 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/types.h> /* drag in stdint.h before vpx does it. */
|
---|
22 | #include <list>
|
---|
23 |
|
---|
24 | #ifdef VBOX_WITH_LIBVPX
|
---|
25 | # define VPX_CODEC_DISABLE_COMPAT 1
|
---|
26 | # include "vpx/vp8cx.h"
|
---|
27 | # include "vpx/vpx_image.h"
|
---|
28 | # include "vpx/vpx_encoder.h"
|
---|
29 | #endif /* VBOX_WITH_LIBVPX */
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Structure for keeping specific recording video codec data.
|
---|
33 | */
|
---|
34 | typedef struct RECORDINGVIDEOCODEC
|
---|
35 | {
|
---|
36 | #ifdef VBOX_WITH_LIBVPX
|
---|
37 | union
|
---|
38 | {
|
---|
39 | struct
|
---|
40 | {
|
---|
41 | /** VPX codec context. */
|
---|
42 | vpx_codec_ctx_t Ctx;
|
---|
43 | /** VPX codec configuration. */
|
---|
44 | vpx_codec_enc_cfg_t Cfg;
|
---|
45 | /** VPX image context. */
|
---|
46 | vpx_image_t RawImage;
|
---|
47 | /** Pointer to the codec's internal YUV buffer. */
|
---|
48 | uint8_t *pu8YuvBuf;
|
---|
49 | unsigned int uEncoderDeadline;
|
---|
50 | } VPX;
|
---|
51 | };
|
---|
52 | #endif /* VBOX_WITH_LIBVPX */
|
---|
53 | } RECORDINGVIDEOCODEC, *PRECORDINGVIDEOCODEC;
|
---|
54 |
|
---|
55 | /**
|
---|
56 | * Enumeration for supported pixel formats.
|
---|
57 | */
|
---|
58 | enum RECORDINGPIXELFMT
|
---|
59 | {
|
---|
60 | /** Unknown pixel format. */
|
---|
61 | RECORDINGPIXELFMT_UNKNOWN = 0,
|
---|
62 | /** RGB 24. */
|
---|
63 | RECORDINGPIXELFMT_RGB24 = 1,
|
---|
64 | /** RGB 24. */
|
---|
65 | RECORDINGPIXELFMT_RGB32 = 2,
|
---|
66 | /** RGB 565. */
|
---|
67 | RECORDINGPIXELFMT_RGB565 = 3,
|
---|
68 | /** The usual 32-bit hack. */
|
---|
69 | RECORDINGPIXELFMT_32BIT_HACK = 0x7fffffff
|
---|
70 | };
|
---|
71 |
|
---|
72 | /**
|
---|
73 | * Structure for keeping a single recording video frame.
|
---|
74 | */
|
---|
75 | typedef struct RECORDINGVIDEOFRAME
|
---|
76 | {
|
---|
77 | /** X resolution of this frame. */
|
---|
78 | uint32_t uWidth;
|
---|
79 | /** Y resolution of this frame. */
|
---|
80 | uint32_t uHeight;
|
---|
81 | /** Pixel format of this frame. */
|
---|
82 | uint32_t uPixelFormat;
|
---|
83 | /** RGB buffer containing the unmodified frame buffer data from Main's display. */
|
---|
84 | uint8_t *pu8RGBBuf;
|
---|
85 | /** Size (in bytes) of the RGB buffer. */
|
---|
86 | size_t cbRGBBuf;
|
---|
87 | } RECORDINGVIDEOFRAME, *PRECORDINGVIDEOFRAME;
|
---|
88 |
|
---|
89 | #ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
90 | /**
|
---|
91 | * Structure for keeping a single recording audio frame.
|
---|
92 | */
|
---|
93 | typedef struct RECORDINGAUDIOFRAME
|
---|
94 | {
|
---|
95 | /** Pointer to audio data. */
|
---|
96 | uint8_t *pvBuf;
|
---|
97 | /** Size (in bytes) of audio data. */
|
---|
98 | size_t cbBuf;
|
---|
99 | } RECORDINGAUDIOFRAME, *PRECORDINGAUDIOFRAME;
|
---|
100 | #endif
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Enumeration for specifying a video recording block type.
|
---|
104 | */
|
---|
105 | typedef enum RECORDINGBLOCKTYPE
|
---|
106 | {
|
---|
107 | /** Uknown block type, do not use. */
|
---|
108 | RECORDINGBLOCKTYPE_UNKNOWN = 0,
|
---|
109 | /** The block is a video frame. */
|
---|
110 | RECORDINGBLOCKTYPE_VIDEO,
|
---|
111 | #ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
112 | /** The block is an audio frame. */
|
---|
113 | RECORDINGBLOCKTYPE_AUDIO
|
---|
114 | #endif
|
---|
115 | } RECORDINGBLOCKTYPE;
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Generic structure for keeping a single video recording (data) block.
|
---|
119 | */
|
---|
120 | typedef struct RECORDINGBLOCK
|
---|
121 | {
|
---|
122 | /** The block's type. */
|
---|
123 | RECORDINGBLOCKTYPE enmType;
|
---|
124 | /** Number of references held of this block. */
|
---|
125 | uint16_t cRefs;
|
---|
126 | /** The (absolute) time stamp (in ms, PTS) of this block. */
|
---|
127 | uint64_t uTimeStampMs;
|
---|
128 | /** Opaque data block to the actual block data, depending on the block's type. */
|
---|
129 | void *pvData;
|
---|
130 | /** Size (in bytes) of the (opaque) data block. */
|
---|
131 | size_t cbData;
|
---|
132 | } RECORDINGBLOCK, *PRECORDINGBLOCK;
|
---|
133 |
|
---|
134 | /** List for keeping video recording (data) blocks. */
|
---|
135 | typedef std::list<PRECORDINGBLOCK> RECORDINGBLOCKList;
|
---|
136 |
|
---|
137 | void RecordingBlockFree(PRECORDINGBLOCK pBlock);
|
---|
138 | #ifdef VBOX_WITH_AUDIO_RECORDING
|
---|
139 | void RecordingAudioFrameFree(PRECORDINGAUDIOFRAME pFrame);
|
---|
140 | #endif
|
---|
141 | void RecordingVideoFrameFree(PRECORDINGVIDEOFRAME pFrame);
|
---|
142 |
|
---|
143 | #endif /* ____H_RECORDING_INTERNALS */
|
---|