[MOVED FROM BAD 064/134] vp8enc: use baseclass event virtual handler

This commit is contained in:
Mark Nauwelaerts 2011-03-23 08:50:31 +01:00 committed by Sebastian Dröge
parent 280354df3f
commit 402879a52e
2 changed files with 7 additions and 18 deletions

View file

@ -153,10 +153,10 @@ static gboolean gst_vp8_enc_handle_frame (GstBaseVideoEncoder *
base_video_encoder, GstVideoFrame * frame); base_video_encoder, GstVideoFrame * frame);
static GstFlowReturn gst_vp8_enc_shape_output (GstBaseVideoEncoder * encoder, static GstFlowReturn gst_vp8_enc_shape_output (GstBaseVideoEncoder * encoder,
GstVideoFrame * frame); GstVideoFrame * frame);
static gboolean gst_vp8_enc_sink_event (GstBaseVideoEncoder *
base_video_encoder, GstEvent * event);
static GstCaps *gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder); static GstCaps *gst_vp8_enc_get_caps (GstBaseVideoEncoder * base_video_encoder);
static gboolean gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event);
static GstStaticPadTemplate gst_vp8_enc_sink_template = static GstStaticPadTemplate gst_vp8_enc_sink_template =
GST_STATIC_PAD_TEMPLATE ("sink", GST_STATIC_PAD_TEMPLATE ("sink",
GST_PAD_SINK, GST_PAD_SINK,
@ -225,6 +225,7 @@ gst_vp8_enc_class_init (GstVP8EncClass * klass)
base_video_encoder_class->set_format = gst_vp8_enc_set_format; base_video_encoder_class->set_format = gst_vp8_enc_set_format;
base_video_encoder_class->finish = gst_vp8_enc_finish; base_video_encoder_class->finish = gst_vp8_enc_finish;
base_video_encoder_class->shape_output = gst_vp8_enc_shape_output; base_video_encoder_class->shape_output = gst_vp8_enc_shape_output;
base_video_encoder_class->event = gst_vp8_enc_sink_event;
base_video_encoder_class->get_caps = gst_vp8_enc_get_caps; base_video_encoder_class->get_caps = gst_vp8_enc_get_caps;
g_object_class_install_property (gobject_class, PROP_BITRATE, g_object_class_install_property (gobject_class, PROP_BITRATE,
@ -312,12 +313,6 @@ gst_vp8_enc_init (GstVP8Enc * gst_vp8_enc, GstVP8EncClass * klass)
gst_vp8_enc->multipass_mode = DEFAULT_MULTIPASS_MODE; gst_vp8_enc->multipass_mode = DEFAULT_MULTIPASS_MODE;
gst_vp8_enc->multipass_cache_file = DEFAULT_MULTIPASS_CACHE_FILE; gst_vp8_enc->multipass_cache_file = DEFAULT_MULTIPASS_CACHE_FILE;
gst_vp8_enc->auto_alt_ref_frames = DEFAULT_AUTO_ALT_REF_FRAMES; gst_vp8_enc->auto_alt_ref_frames = DEFAULT_AUTO_ALT_REF_FRAMES;
/* FIXME: Add sink/src event vmethods */
gst_vp8_enc->base_sink_event_func =
GST_PAD_EVENTFUNC (GST_BASE_VIDEO_CODEC_SINK_PAD (gst_vp8_enc));
gst_pad_set_event_function (GST_BASE_VIDEO_CODEC_SINK_PAD (gst_vp8_enc),
gst_vp8_enc_sink_event);
} }
static void static void
@ -985,10 +980,9 @@ done:
} }
static gboolean static gboolean
gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event) gst_vp8_enc_sink_event (GstBaseVideoEncoder * benc, GstEvent * event)
{ {
GstVP8Enc *enc = GST_VP8_ENC (gst_pad_get_parent (pad)); GstVP8Enc *enc = GST_VP8_ENC (benc);
gboolean ret;
if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) { if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) {
GstTagList *list; GstTagList *list;
@ -999,10 +993,8 @@ gst_vp8_enc_sink_event (GstPad * pad, GstEvent * event)
gst_tag_setter_merge_tags (setter, list, mode); gst_tag_setter_merge_tags (setter, list, mode);
} }
ret = enc->base_sink_event_func (pad, event); /* just peeked, baseclass handles the rest */
gst_object_unref (enc); return FALSE;
return ret;
} }
#endif /* HAVE_VP8_ENCODER */ #endif /* HAVE_VP8_ENCODER */

View file

@ -78,9 +78,6 @@ struct _GstVP8Enc
int n_frames; int n_frames;
int keyframe_distance; int keyframe_distance;
/* FIXME: Get a event vfunc in BaseVideoEncoder */
GstPadEventFunction base_sink_event_func;
}; };
struct _GstVP8EncClass struct _GstVP8EncClass