Index: /trunk/src/VBox/Main/src-client/VideoRec.cpp
===================================================================
--- /trunk/src/VBox/Main/src-client/VideoRec.cpp	(revision 65175)
+++ /trunk/src/VBox/Main/src-client/VideoRec.cpp	(revision 65176)
@@ -63,4 +63,23 @@
 
 /**
+ * Structure for keeping specific video recording codec data.
+ */
+typedef struct VIDEORECCODEC
+{
+    union
+    {
+        struct
+        {
+            /** VPX codec context. */
+            vpx_codec_ctx_t     CodecCtx;
+            /** VPX codec configuration. */
+            vpx_codec_enc_cfg_t Config;
+            /** VPX image context. */
+            vpx_image_t         RawImage;
+        } VPX;
+    };
+} VIDEORECCODEC, *PVIDEORECCODEC;
+
+/**
  * Strucutre for maintaining a video recording stream.
  */
@@ -69,8 +88,6 @@
     /** Container context. */
     WebMWriter         *pEBML;
-    /** VPX codec context. */
-    vpx_codec_ctx_t     VpxCodec;
-    /** VPX configuration. */
-    vpx_codec_enc_cfg_t VpxConfig;
+    /** Codec data. */
+    VIDEORECCODEC       Codec;
     /** Target X resolution (in pixels). */
     uint32_t            uTargetWidth;
@@ -87,6 +104,4 @@
     /** YUV buffer the encode function fetches the frame from. */
     uint8_t            *pu8YuvBuf;
-    /** VPX image context. */
-    vpx_image_t         VpxRawImage;
     /** Whether video recording is enabled or not. */
     bool                fEnabled;
@@ -565,6 +580,6 @@
             pStream->pEBML->close();
 
-            vpx_img_free(&pStream->VpxRawImage);
-            vpx_codec_err_t rcv = vpx_codec_destroy(&pStream->VpxCodec);
+            vpx_img_free(&pStream->Codec.VPX.RawImage);
+            vpx_codec_err_t rcv = vpx_codec_destroy(&pStream->Codec.VPX.CodecCtx);
             Assert(rcv == VPX_CODEC_OK); RT_NOREF(rcv);
 
@@ -628,5 +643,5 @@
     }
 
-    vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStream->VpxConfig, 0);
+    vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pStream->Codec.VPX.Config, 0);
     if (rcv != VPX_CODEC_OK)
     {
@@ -668,23 +683,23 @@
 
     /* target bitrate in kilobits per second */
-    pStream->VpxConfig.rc_target_bitrate = uRate;
+    pStream->Codec.VPX.Config.rc_target_bitrate = uRate;
     /* frame width */
-    pStream->VpxConfig.g_w = uWidth;
+    pStream->Codec.VPX.Config.g_w = uWidth;
     /* frame height */
-    pStream->VpxConfig.g_h = uHeight;
+    pStream->Codec.VPX.Config.g_h = uHeight;
     /* 1ms per frame */
-    pStream->VpxConfig.g_timebase.num = 1;
-    pStream->VpxConfig.g_timebase.den = 1000;
+    pStream->Codec.VPX.Config.g_timebase.num = 1;
+    pStream->Codec.VPX.Config.g_timebase.den = 1000;
     /* disable multithreading */
-    pStream->VpxConfig.g_threads = 0;
+    pStream->Codec.VPX.Config.g_threads = 0;
 
     pStream->uDelay = 1000 / uFps;
 
     struct vpx_rational arg_framerate = { (int)uFps, 1 };
-    rc = pStream->pEBML->writeHeader(&pStream->VpxConfig, &arg_framerate);
+    rc = pStream->pEBML->writeHeader(&pStream->Codec.VPX.Config, &arg_framerate);
     AssertRCReturn(rc, rc);
 
     /* Initialize codec */
-    rcv = vpx_codec_enc_init(&pStream->VpxCodec, DEFAULTCODEC, &pStream->VpxConfig, 0);
+    rcv = vpx_codec_enc_init(&pStream->Codec.VPX.CodecCtx, DEFAULTCODEC, &pStream->Codec.VPX.Config, 0);
     if (rcv != VPX_CODEC_OK)
     {
@@ -693,10 +708,10 @@
     }
 
-    if (!vpx_img_alloc(&pStream->VpxRawImage, VPX_IMG_FMT_I420, uWidth, uHeight, 1))
+    if (!vpx_img_alloc(&pStream->Codec.VPX.RawImage, VPX_IMG_FMT_I420, uWidth, uHeight, 1))
     {
         LogFlow(("Failed to allocate image %dx%d", uWidth, uHeight));
         return VERR_NO_MEMORY;
     }
-    pStream->pu8YuvBuf = pStream->VpxRawImage.planes[0];
+    pStream->pu8YuvBuf = pStream->Codec.VPX.RawImage.planes[0];
 
     pCtx->fEnabled = true;
@@ -793,6 +808,6 @@
     /* presentation time stamp */
     vpx_codec_pts_t pts = pStream->u64TimeStamp;
-    vpx_codec_err_t rcv = vpx_codec_encode(&pStream->VpxCodec,
-                                           &pStream->VpxRawImage,
+    vpx_codec_err_t rcv = vpx_codec_encode(&pStream->Codec.VPX.CodecCtx,
+                                           &pStream->Codec.VPX.RawImage,
                                            pts /* time stamp */,
                                            pStream->uDelay  /* how long to show this frame */,
@@ -809,5 +824,5 @@
     for (;;)
     {
-        const vpx_codec_cx_pkt_t *pkt = vpx_codec_get_cx_data(&pStream->VpxCodec, &iter);
+        const vpx_codec_cx_pkt_t *pkt = vpx_codec_get_cx_data(&pStream->Codec.VPX.CodecCtx, &iter);
         if (!pkt)
             break;
@@ -815,5 +830,5 @@
         {
             case VPX_CODEC_CX_FRAME_PKT:
-                rc = pStream->pEBML->writeBlock(&pStream->VpxConfig, pkt);
+                rc = pStream->pEBML->writeBlock(&pStream->Codec.VPX.Config, pkt);
                 break;
             default:
