mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-30 12:49:40 +00:00
aom: Consistent naming between av1dec and av1enc
https://bugzilla.gnome.org/show_bug.cgi?id=791674
This commit is contained in:
parent
3a8d50a355
commit
327586bd26
2 changed files with 18 additions and 13 deletions
|
@ -121,6 +121,7 @@ gst_av1_enc_class_init (GstAV1EncClass * klass)
|
|||
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");
|
||||
}
|
||||
|
||||
|
@ -223,11 +224,12 @@ gst_av1_enc_debug_encoder_cfg (struct aom_codec_enc_cfg *cfg)
|
|||
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");
|
||||
|
@ -245,9 +247,9 @@ gst_av1_enc_init_aom (GstAV1Enc * av1enc)
|
|||
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;
|
||||
}
|
||||
|
||||
|
@ -285,7 +287,7 @@ gst_av1_enc_process (GstAV1Enc * encoder)
|
|||
|
||||
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) {
|
||||
|
@ -350,9 +352,9 @@ gst_av1_enc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
|
|||
}
|
||||
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);
|
||||
|
|
|
@ -41,6 +41,8 @@ G_BEGIN_DECLS
|
|||
(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))
|
||||
|
||||
|
@ -49,20 +51,21 @@ typedef struct _GstAV1EncClass GstAV1EncClass;
|
|||
|
||||
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);
|
||||
|
|
Loading…
Reference in a new issue