VirtualBox

Changeset 71164 in vbox for trunk/src/VBox/Main/src-client


Ignore:
Timestamp:
Mar 1, 2018 3:35:39 PM (7 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
121065
Message:

VideoRec: Got rid of the static codec interface define and prepare for also getting/using other codec interface (like VP9, not used yet).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/src-client/VideoRec.cpp

    r71162 r71164  
    3333#include <iprt/time.h>
    3434
     35#include <VBox/err.h>
    3536#include <VBox/com/VirtualBox.h>
    3637
     
    4041#ifdef VBOX_WITH_LIBVPX
    4142# define VPX_CODEC_DISABLE_COMPAT 1
    42 # include <vpx/vp8cx.h>
    43 # include <vpx/vpx_image.h>
    44 
    45 /** Default VPX codec to use. */
    46 # define DEFAULTCODEC (vpx_codec_vp8_cx())
     43# include "vpx/vp8cx.h"
     44# include "vpx/vpx_image.h"
     45# include "vpx/vpx_encoder.h"
    4746#endif /* VBOX_WITH_LIBVPX */
    4847
     
    148147    uint8_t             abBuf[_64K]; /** @todo Fix! */
    149148    size_t              cbBuf;
    150     /** Time stamp (in ms). */
     149    /** Absolute time stamp (in ms). */
    151150    uint64_t            uTimeStampMs;
    152151} VIDEORECAUDIOFRAME, *PVIDEORECAUDIOFRAME;
     
    10901089    PVIDEORECVIDEOCODEC pVC = &pStream->Video.Codec;
    10911090
    1092 #ifdef VBOX_WITH_LIBVPX
    1093     vpx_codec_err_t rcv = vpx_codec_enc_config_default(DEFAULTCODEC, &pVC->VPX.Cfg, 0);
    1094     if (rcv != VPX_CODEC_OK)
    1095     {
    1096         LogRel(("VideoRec: Failed to get default configuration for VPX codec: %s\n", vpx_codec_err_to_string(rcv)));
    1097         return VERR_INVALID_PARAMETER;
    1098     }
    1099 #endif
    1100 
    11011091    pStream->Video.uDelayMs = 1000 / pCfg->Video.uFPS;
    11021092
     
    11831173
    11841174#ifdef VBOX_WITH_LIBVPX
     1175# ifdef VBOX_WITH_LIBVPX_VP9
     1176    vpx_codec_iface_t *pCodecIface = vpx_codec_vp9_cx();
     1177# else /* Default is using VP8. */
     1178    vpx_codec_iface_t *pCodecIface = vpx_codec_vp8_cx();
     1179# endif
     1180
     1181    vpx_codec_err_t rcv = vpx_codec_enc_config_default(pCodecIface, &pVC->VPX.Cfg, 0 /* Reserved */);
     1182    if (rcv != VPX_CODEC_OK)
     1183    {
     1184        LogRel(("VideoRec: Failed to get default config for VPX encoder: %s\n", vpx_codec_err_to_string(rcv)));
     1185        return VERR_AVREC_CODEC_INIT_FAILED;
     1186    }
     1187
    11851188    /* Target bitrate in kilobits per second. */
    11861189    pVC->VPX.Cfg.rc_target_bitrate = pCfg->Video.uRate;
     
    11961199
    11971200    /* Initialize codec. */
    1198     rcv = vpx_codec_enc_init(&pVC->VPX.Ctx, DEFAULTCODEC, &pVC->VPX.Cfg, 0);
     1201    rcv = vpx_codec_enc_init(&pVC->VPX.Ctx, pCodecIface, &pVC->VPX.Cfg, 0 /* Flags */);
    11991202    if (rcv != VPX_CODEC_OK)
    12001203    {
    1201         LogRel(("VideoRec: Failed to initialize VP8 encoder: %s\n", vpx_codec_err_to_string(rcv)));
    1202         return VERR_INVALID_PARAMETER;
     1204        LogRel(("VideoRec: Failed to initialize VPX encoder: %s\n", vpx_codec_err_to_string(rcv)));
     1205        return VERR_AVREC_CODEC_INIT_FAILED;
    12031206    }
    12041207
Note: See TracChangeset for help on using the changeset viewer.

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