1 | /* $Id: VideoRecInternals.h 74992 2018-10-23 11:09:22Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * Video 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_VIDEOREC_INTERNALS
|
---|
19 | #define ____H_VIDEOREC_INTERNALS
|
---|
20 |
|
---|
21 | #include <list>
|
---|
22 |
|
---|
23 | #ifdef VBOX_WITH_LIBVPX
|
---|
24 | # define VPX_CODEC_DISABLE_COMPAT 1
|
---|
25 | # include "vpx/vp8cx.h"
|
---|
26 | # include "vpx/vpx_image.h"
|
---|
27 | # include "vpx/vpx_encoder.h"
|
---|
28 | #endif /* VBOX_WITH_LIBVPX */
|
---|
29 |
|
---|
30 | /**
|
---|
31 | * Enumeration for video recording destinations.
|
---|
32 | */
|
---|
33 | typedef enum VIDEORECDEST
|
---|
34 | {
|
---|
35 | /** Invalid destination, do not use. */
|
---|
36 | VIDEORECDEST_INVALID = 0,
|
---|
37 | /** Write to a file. */
|
---|
38 | VIDEORECDEST_FILE = 1
|
---|
39 | } VIDEORECDEST;
|
---|
40 |
|
---|
41 | /**
|
---|
42 | * Structure for keeping specific video recording codec data.
|
---|
43 | */
|
---|
44 | typedef struct VIDEORECVIDEOCODEC
|
---|
45 | {
|
---|
46 | union
|
---|
47 | {
|
---|
48 | #ifdef VBOX_WITH_LIBVPX
|
---|
49 | struct
|
---|
50 | {
|
---|
51 | /** VPX codec context. */
|
---|
52 | vpx_codec_ctx_t Ctx;
|
---|
53 | /** VPX codec configuration. */
|
---|
54 | vpx_codec_enc_cfg_t Cfg;
|
---|
55 | /** VPX image context. */
|
---|
56 | vpx_image_t RawImage;
|
---|
57 | /** Pointer to the codec's internal YUV buffer. */
|
---|
58 | uint8_t *pu8YuvBuf;
|
---|
59 | } VPX;
|
---|
60 | #endif /* VBOX_WITH_LIBVPX */
|
---|
61 | };
|
---|
62 | } VIDEORECVIDEOCODEC, *PVIDEORECVIDEOCODEC;
|
---|
63 |
|
---|
64 | /**
|
---|
65 | * Enumeration for supported pixel formats.
|
---|
66 | */
|
---|
67 | enum VIDEORECPIXELFMT
|
---|
68 | {
|
---|
69 | /** Unknown pixel format. */
|
---|
70 | VIDEORECPIXELFMT_UNKNOWN = 0,
|
---|
71 | /** RGB 24. */
|
---|
72 | VIDEORECPIXELFMT_RGB24 = 1,
|
---|
73 | /** RGB 24. */
|
---|
74 | VIDEORECPIXELFMT_RGB32 = 2,
|
---|
75 | /** RGB 565. */
|
---|
76 | VIDEORECPIXELFMT_RGB565 = 3,
|
---|
77 | /** The usual 32-bit hack. */
|
---|
78 | VIDEORECPIXELFMT_32BIT_HACK = 0x7fffffff
|
---|
79 | };
|
---|
80 |
|
---|
81 | /**
|
---|
82 | * Structure for keeping a single video recording video frame.
|
---|
83 | */
|
---|
84 | typedef struct VIDEORECVIDEOFRAME
|
---|
85 | {
|
---|
86 | /** X resolution of this frame. */
|
---|
87 | uint32_t uWidth;
|
---|
88 | /** Y resolution of this frame. */
|
---|
89 | uint32_t uHeight;
|
---|
90 | /** Pixel format of this frame. */
|
---|
91 | uint32_t uPixelFormat;
|
---|
92 | /** RGB buffer containing the unmodified frame buffer data from Main's display. */
|
---|
93 | uint8_t *pu8RGBBuf;
|
---|
94 | /** Size (in bytes) of the RGB buffer. */
|
---|
95 | size_t cbRGBBuf;
|
---|
96 | } VIDEORECVIDEOFRAME, *PVIDEORECVIDEOFRAME;
|
---|
97 |
|
---|
98 | #ifdef VBOX_WITH_AUDIO_VIDEOREC
|
---|
99 | /**
|
---|
100 | * Structure for keeping a single video recording audio frame.
|
---|
101 | */
|
---|
102 | typedef struct VIDEORECAUDIOFRAME
|
---|
103 | {
|
---|
104 | /** Pointer to audio data. */
|
---|
105 | uint8_t *pvBuf;
|
---|
106 | /** Size (in bytes) of audio data. */
|
---|
107 | size_t cbBuf;
|
---|
108 | } VIDEORECAUDIOFRAME, *PVIDEORECAUDIOFRAME;
|
---|
109 | #endif
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Enumeration for specifying a video recording block type.
|
---|
113 | */
|
---|
114 | typedef enum VIDEORECBLOCKTYPE
|
---|
115 | {
|
---|
116 | /** Uknown block type, do not use. */
|
---|
117 | VIDEORECBLOCKTYPE_UNKNOWN = 0,
|
---|
118 | /** The block is a video frame. */
|
---|
119 | VIDEORECBLOCKTYPE_VIDEO,
|
---|
120 | #ifdef VBOX_WITH_AUDIO_VIDEOREC
|
---|
121 | /** The block is an audio frame. */
|
---|
122 | VIDEORECBLOCKTYPE_AUDIO
|
---|
123 | #endif
|
---|
124 | } VIDEORECBLOCKTYPE;
|
---|
125 |
|
---|
126 | /**
|
---|
127 | * Generic structure for keeping a single video recording (data) block.
|
---|
128 | */
|
---|
129 | typedef struct VIDEORECBLOCK
|
---|
130 | {
|
---|
131 | /** The block's type. */
|
---|
132 | VIDEORECBLOCKTYPE enmType;
|
---|
133 | /** Number of references held of this block. */
|
---|
134 | uint16_t cRefs;
|
---|
135 | /** The (absolute) time stamp (in ms, PTS) of this block. */
|
---|
136 | uint64_t uTimeStampMs;
|
---|
137 | /** Opaque data block to the actual block data, depending on the block's type. */
|
---|
138 | void *pvData;
|
---|
139 | /** Size (in bytes) of the (opaque) data block. */
|
---|
140 | size_t cbData;
|
---|
141 | } VIDEORECBLOCK, *PVIDEORECBLOCK;
|
---|
142 |
|
---|
143 | /** List for keeping video recording (data) blocks. */
|
---|
144 | typedef std::list<PVIDEORECBLOCK> VideoRecBlockList;
|
---|
145 |
|
---|
146 | void VideoRecBlockFree(PVIDEORECBLOCK pBlock);
|
---|
147 | #ifdef VBOX_WITH_AUDIO_VIDEOREC
|
---|
148 | void VideoRecAudioFrameFree(PVIDEORECAUDIOFRAME pFrame);
|
---|
149 | #endif
|
---|
150 | void VideoRecVideoFrameFree(PVIDEORECVIDEOFRAME pFrame);
|
---|
151 |
|
---|
152 | #endif /* ____H_VIDEOREC_INTERNALS */
|
---|