venc_class->handle_frame = gst_av1_enc_handle_frame;
venc_class->propose_allocation = gst_av1_enc_propose_allocation;
+ klass->codec_algo = &aom_codec_av1_cx_algo;
GST_DEBUG_CATEGORY_INIT (av1_enc_debug, "av1enc", 0, "AV1 encoding element");
}
static gboolean
gst_av1_enc_init_aom (GstAV1Enc * av1enc)
{
- av1enc->codec_interface = &aom_codec_av1_cx_algo;
+ GstAV1EncClass *av1enc_class = GST_AV1_ENC_GET_CLASS (av1enc);
- if (aom_codec_enc_config_default (av1enc->codec_interface, &av1enc->aom_cfg,
+ if (aom_codec_enc_config_default (av1enc_class->codec_algo, &av1enc->aom_cfg,
0)) {
- gst_av1_codec_error (&av1enc->codec, "Failed to get default codec config.");
+ gst_av1_codec_error (&av1enc->encoder,
+ "Failed to get default codec config.");
return FALSE;
}
GST_DEBUG_OBJECT (av1enc, "Got default encoder config");
GST_DEBUG_OBJECT (av1enc, "Calling encoder init with config:");
gst_av1_enc_debug_encoder_cfg (&av1enc->aom_cfg);
- if (aom_codec_enc_init (&av1enc->codec, av1enc->codec_interface,
+ if (aom_codec_enc_init (&av1enc->encoder, av1enc_class->codec_algo,
&av1enc->aom_cfg, 0)) {
- gst_av1_codec_error (&av1enc->codec, "Failed to initialize encoder");
+ gst_av1_codec_error (&av1enc->encoder, "Failed to initialize encoder");
return FALSE;
}
video_encoder = GST_VIDEO_ENCODER (encoder);
- while ((pkt = aom_codec_get_cx_data (&encoder->codec, &iter)) != NULL) {
+ while ((pkt = aom_codec_get_cx_data (&encoder->encoder, &iter)) != NULL) {
if (pkt->kind == AOM_CODEC_STATS_PKT) {
GST_WARNING_OBJECT (encoder, "Unhandled stats packet");
} else if (pkt->kind == AOM_CODEC_FPMB_STATS_PKT) {
}
av1enc->keyframe_dist++;
- if (aom_codec_encode (&av1enc->codec, &raw, frame->pts, 1, flags)
+ if (aom_codec_encode (&av1enc->encoder, &raw, frame->pts, 1, flags)
!= AOM_CODEC_OK) {
- gst_av1_codec_error (&av1enc->codec, "Failed to encode frame");
+ gst_av1_codec_error (&av1enc->encoder, "Failed to encode frame");
}
ret = gst_av1_enc_process (av1enc);
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AV1_ENC))
#define GST_IS_AV1_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_ENC))
+#define GST_AV1_ENC_GET_CLASS(obj) \
+ (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AV1_ENC, GstAV1EncClass))
#define GST_AV1_ENC_CAST(obj) \
((GstAV1Enc *) (obj))
struct _GstAV1Enc
{
- GstVideoEncoder encoder;
+ GstVideoEncoder base_video_encoder;
guint keyframe_dist;
- GstVideoCodecState *input_state;
-
- aom_codec_iface_t *codec_interface;
aom_codec_enc_cfg_t aom_cfg;
- aom_codec_ctx_t codec;
+ aom_codec_ctx_t encoder;
+
+ GstVideoCodecState *input_state;
};
struct _GstAV1EncClass
{
GstVideoEncoderClass parent_class;
+ /*supported aom algo*/
+ aom_codec_iface_t *codec_algo;
};
GType gst_av1_enc_get_type (void);