aom: Add direct casts for GstAV1Enc and GstAV1Dec

https://bugzilla.gnome.org/show_bug.cgi?id=791674
This commit is contained in:
Sean DuBois 2018-01-26 06:01:35 +00:00 committed by Sebastian Dröge
parent 8b27637b4a
commit 2b03bc021c
4 changed files with 13 additions and 9 deletions

View file

@ -153,7 +153,7 @@ gst_av1_dec_get_property (GObject * object, guint prop_id, GValue * value,
static gboolean static gboolean
gst_av1_dec_start (GstVideoDecoder * dec) gst_av1_dec_start (GstVideoDecoder * dec)
{ {
GstAV1Dec *av1dec = (GstAV1Dec *) dec; GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
av1dec->decoder_inited = FALSE; av1dec->decoder_inited = FALSE;
av1dec->output_state = NULL; av1dec->output_state = NULL;
@ -165,7 +165,7 @@ gst_av1_dec_start (GstVideoDecoder * dec)
static gboolean static gboolean
gst_av1_dec_stop (GstVideoDecoder * dec) gst_av1_dec_stop (GstVideoDecoder * dec)
{ {
GstAV1Dec *av1dec = (GstAV1Dec *) dec; GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
if (av1dec->output_state) { if (av1dec->output_state) {
gst_video_codec_state_unref (av1dec->output_state); gst_video_codec_state_unref (av1dec->output_state);
@ -188,7 +188,7 @@ gst_av1_dec_stop (GstVideoDecoder * dec)
static gboolean static gboolean
gst_av1_dec_set_format (GstVideoDecoder * dec, GstVideoCodecState * state) gst_av1_dec_set_format (GstVideoDecoder * dec, GstVideoCodecState * state)
{ {
GstAV1Dec *av1dec = (GstAV1Dec *) dec; GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
if (av1dec->decoder_inited) { if (av1dec->decoder_inited) {
aom_codec_destroy (&av1dec->decoder); aom_codec_destroy (&av1dec->decoder);
@ -291,7 +291,7 @@ gst_av1_dec_image_to_buffer (GstAV1Dec * dec, const aom_image_t * img,
static GstFlowReturn static GstFlowReturn
gst_av1_dec_handle_frame (GstVideoDecoder * dec, GstVideoCodecFrame * frame) gst_av1_dec_handle_frame (GstVideoDecoder * dec, GstVideoCodecFrame * frame)
{ {
GstAV1Dec *av1dec = (GstAV1Dec *) dec; GstAV1Dec *av1dec = GST_AV1_DEC_CAST (dec);
GstFlowReturn ret; GstFlowReturn ret;
GstMapInfo minfo; GstMapInfo minfo;
aom_codec_err_t status; aom_codec_err_t status;

View file

@ -41,6 +41,8 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_DEC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_DEC))
#define GST_AV1_DEC_GET_CLASS(obj) \ #define GST_AV1_DEC_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AV1_DEC, GstAV1DecClass)) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_AV1_DEC, GstAV1DecClass))
#define GST_AV1_DEC_CAST(obj) \
((GstAV1Dec *) (obj))
typedef struct _GstAV1Dec GstAV1Dec; typedef struct _GstAV1Dec GstAV1Dec;
typedef struct _GstAV1DecClass GstAV1DecClass; typedef struct _GstAV1DecClass GstAV1DecClass;

View file

@ -147,7 +147,7 @@ gst_av1_enc_finalize (GObject * object)
static void static void
gst_av1_enc_set_latency (GstAV1Enc * encoder) gst_av1_enc_set_latency (GstAV1Enc * encoder)
{ {
GstAV1Enc *av1enc = GST_AV1_ENC (encoder); GstAV1Enc *av1enc = GST_AV1_ENC_CAST (encoder);
GstClockTime latency = GstClockTime latency =
gst_util_uint64_scale (av1enc->aom_cfg.g_lag_in_frames, 1 * GST_SECOND, gst_util_uint64_scale (av1enc->aom_cfg.g_lag_in_frames, 1 * GST_SECOND,
30); 30);
@ -259,7 +259,7 @@ static gboolean
gst_av1_enc_set_format (GstVideoEncoder * encoder, GstVideoCodecState * state) gst_av1_enc_set_format (GstVideoEncoder * encoder, GstVideoCodecState * state)
{ {
GstVideoCodecState *output_state; GstVideoCodecState *output_state;
GstAV1Enc *av1enc = GST_AV1_ENC (encoder); GstAV1Enc *av1enc = GST_AV1_ENC_CAST (encoder);
av1enc->keyframe_dist = 30; av1enc->keyframe_dist = 30;
@ -327,7 +327,7 @@ gst_av1_enc_fill_image (GstAV1Enc * enc, GstVideoFrame * frame,
static GstFlowReturn static GstFlowReturn
gst_av1_enc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame) gst_av1_enc_handle_frame (GstVideoEncoder * encoder, GstVideoCodecFrame * frame)
{ {
GstAV1Enc *av1enc = GST_AV1_ENC (encoder); GstAV1Enc *av1enc = GST_AV1_ENC_CAST (encoder);
aom_image_t raw; aom_image_t raw;
int flags = 0; int flags = 0;
GstFlowReturn ret; GstFlowReturn ret;
@ -373,7 +373,7 @@ static void
gst_av1_enc_set_property (GObject * object, guint prop_id, gst_av1_enc_set_property (GObject * object, guint prop_id,
const GValue * value, GParamSpec * pspec) const GValue * value, GParamSpec * pspec)
{ {
GstAV1Enc *av1enc = GST_AV1_ENC (object); GstAV1Enc *av1enc = GST_AV1_ENC_CAST (object);
GST_OBJECT_LOCK (av1enc); GST_OBJECT_LOCK (av1enc);
@ -390,7 +390,7 @@ static void
gst_av1_enc_get_property (GObject * object, guint prop_id, GValue * value, gst_av1_enc_get_property (GObject * object, guint prop_id, GValue * value,
GParamSpec * pspec) GParamSpec * pspec)
{ {
GstAV1Enc *av1enc = GST_AV1_ENC (object); GstAV1Enc *av1enc = GST_AV1_ENC_CAST (object);
GST_OBJECT_LOCK (av1enc); GST_OBJECT_LOCK (av1enc);

View file

@ -41,6 +41,8 @@ G_BEGIN_DECLS
(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AV1_ENC)) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_AV1_ENC))
#define GST_IS_AV1_ENC_CLASS(klass) \ #define GST_IS_AV1_ENC_CLASS(klass) \
(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_ENC)) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_AV1_ENC))
#define GST_AV1_ENC_CAST(obj) \
((GstAV1Enc *) (obj))
typedef struct _GstAV1Enc GstAV1Enc; typedef struct _GstAV1Enc GstAV1Enc;
typedef struct _GstAV1EncClass GstAV1EncClass; typedef struct _GstAV1EncClass GstAV1EncClass;