AwsError H264Encoder::Initialize()

in h264_encoder_core/src/h264_encoder.cpp [334:365]


AwsError H264Encoder::Initialize(const int src_width, const int src_height,
                                 const AVPixelFormat src_encoding,
                                 const ParameterReaderInterface & dst_params)
{
  int dst_width, dst_height;
  bool dims_set = (dst_params.ReadParam(ParameterPath(kOutputWidthKey), dst_width) == Aws::AWS_ERR_OK &&
                   dst_params.ReadParam(ParameterPath(kOutputHeightKey), dst_height) == Aws::AWS_ERR_OK);
  if (!dims_set) {
    dst_width = src_width;
    dst_height = src_height;
  }

  int fps_num, fps_den;
  bool fps_set = (dst_params.ReadParam(ParameterPath(kFpsNumeratorKey), fps_num) == Aws::AWS_ERR_OK &&
                  dst_params.ReadParam(ParameterPath(kFpsDenominatorKey), fps_den) == Aws::AWS_ERR_OK);
  if (!fps_set) {
    AWS_LOG_WARN(__func__, "fps not set");
    fps_num = kDefaultFpsNumerator;
    fps_den = kDefaultFpsDenominator;
  }

  std::string codec;
  dst_params.ReadParam(ParameterPath(kCodecKey), codec);

  int bitrate = kDefaultBitrate;
  dst_params.ReadParam(ParameterPath(kBitrateKey), bitrate);

  impl_ = std::unique_ptr<H264EncoderImpl>(new H264EncoderImpl());

  return impl_->Initialize(src_width, src_height, src_encoding, codec, dst_width, dst_height,
                           fps_num, fps_den, bitrate);
}