public static VpxCodecEncoderConfiguration CreateDefault(VpxCodec codec) { vpx_codec_enc_cfg cfg; VpxCodecError error; error = VpxMarshal.vpx_codec_enc_config_default(codec.Handle, out cfg, 0); if (error != VpxCodecError.OK) { throw new VpxInteropException(error); } var ptr = Vpx.AllocateHGlobalPointerOfStruct(cfg); return(new VpxCodecEncoderConfiguration(ptr, true)); }
public VpxEncoder(VpxCodec codec, VpxCodecEncoderConfiguration config, VpxCodecFlags flags) { if (codec == null) { throw new ArgumentNullException(nameof(codec)); } config = config ?? VpxCodecEncoderConfiguration.CreateDefault(codec); vpx_codec_ctx enc; var error = VpxMarshal.vpx_codec_enc_init_ver(out enc, codec.Handle, config.Handle, flags, VpxMarshal.EncoderAbiVersion); if (error != VpxCodecError.OK) { throw new VpxInteropException(error); } ctx = Vpx.AllocateHGlobalPointerOfStruct(enc); }