mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-23 16:50:47 +00:00
audioencoder: Rename ::event() to ::sink_event() and add ::src_event()
This commit is contained in:
parent
d8cb235fe4
commit
f791ec1f10
2 changed files with 56 additions and 8 deletions
|
@ -305,8 +305,12 @@ static GstCaps *gst_audio_encoder_getcaps_default (GstAudioEncoder * enc,
|
||||||
|
|
||||||
static gboolean gst_audio_encoder_sink_event_default (GstAudioEncoder * enc,
|
static gboolean gst_audio_encoder_sink_event_default (GstAudioEncoder * enc,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
|
static gboolean gst_audio_encoder_src_event_default (GstAudioEncoder * enc,
|
||||||
|
GstEvent * event);
|
||||||
static gboolean gst_audio_encoder_sink_event (GstPad * pad, GstObject * parent,
|
static gboolean gst_audio_encoder_sink_event (GstPad * pad, GstObject * parent,
|
||||||
GstEvent * event);
|
GstEvent * event);
|
||||||
|
static gboolean gst_audio_encoder_src_event (GstPad * pad, GstObject * parent,
|
||||||
|
GstEvent * event);
|
||||||
static gboolean gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc,
|
static gboolean gst_audio_encoder_sink_setcaps (GstAudioEncoder * enc,
|
||||||
GstCaps * caps);
|
GstCaps * caps);
|
||||||
static GstFlowReturn gst_audio_encoder_chain (GstPad * pad, GstObject * parent,
|
static GstFlowReturn gst_audio_encoder_chain (GstPad * pad, GstObject * parent,
|
||||||
|
@ -361,7 +365,8 @@ gst_audio_encoder_class_init (GstAudioEncoderClass * klass)
|
||||||
GST_DEBUG_FUNCPTR (gst_audio_encoder_change_state);
|
GST_DEBUG_FUNCPTR (gst_audio_encoder_change_state);
|
||||||
|
|
||||||
klass->getcaps = gst_audio_encoder_getcaps_default;
|
klass->getcaps = gst_audio_encoder_getcaps_default;
|
||||||
klass->event = gst_audio_encoder_sink_event_default;
|
klass->sink_event = gst_audio_encoder_sink_event_default;
|
||||||
|
klass->src_event = gst_audio_encoder_src_event_default;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -395,6 +400,8 @@ gst_audio_encoder_init (GstAudioEncoder * enc, GstAudioEncoderClass * bclass)
|
||||||
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src");
|
gst_element_class_get_pad_template (GST_ELEMENT_CLASS (bclass), "src");
|
||||||
g_return_if_fail (pad_template != NULL);
|
g_return_if_fail (pad_template != NULL);
|
||||||
enc->srcpad = gst_pad_new_from_template (pad_template, "src");
|
enc->srcpad = gst_pad_new_from_template (pad_template, "src");
|
||||||
|
gst_pad_set_event_function (enc->srcpad,
|
||||||
|
GST_DEBUG_FUNCPTR (gst_audio_encoder_src_event));
|
||||||
gst_pad_set_query_function (enc->srcpad,
|
gst_pad_set_query_function (enc->srcpad,
|
||||||
GST_DEBUG_FUNCPTR (gst_audio_encoder_src_query));
|
GST_DEBUG_FUNCPTR (gst_audio_encoder_src_query));
|
||||||
gst_pad_use_fixed_caps (enc->srcpad);
|
gst_pad_use_fixed_caps (enc->srcpad);
|
||||||
|
@ -1438,8 +1445,8 @@ gst_audio_encoder_sink_event (GstPad * pad, GstObject * parent,
|
||||||
GST_DEBUG_OBJECT (enc, "received event %d, %s", GST_EVENT_TYPE (event),
|
GST_DEBUG_OBJECT (enc, "received event %d, %s", GST_EVENT_TYPE (event),
|
||||||
GST_EVENT_TYPE_NAME (event));
|
GST_EVENT_TYPE_NAME (event));
|
||||||
|
|
||||||
if (klass->event)
|
if (klass->sink_event)
|
||||||
ret = klass->event (enc, event);
|
ret = klass->sink_event (enc, event);
|
||||||
else {
|
else {
|
||||||
gst_event_unref (event);
|
gst_event_unref (event);
|
||||||
ret = FALSE;
|
ret = FALSE;
|
||||||
|
@ -1505,6 +1512,42 @@ error:
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_audio_encoder_src_event_default (GstAudioEncoder * enc, GstEvent * event)
|
||||||
|
{
|
||||||
|
gboolean res;
|
||||||
|
|
||||||
|
switch (GST_EVENT_TYPE (event)) {
|
||||||
|
default:
|
||||||
|
res = gst_pad_event_default (enc->srcpad, GST_OBJECT_CAST (enc), event);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
gst_audio_encoder_src_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
||||||
|
{
|
||||||
|
GstAudioEncoder *enc;
|
||||||
|
GstAudioEncoderClass *klass;
|
||||||
|
gboolean ret;
|
||||||
|
|
||||||
|
enc = GST_AUDIO_ENCODER (parent);
|
||||||
|
klass = GST_AUDIO_ENCODER_GET_CLASS (enc);
|
||||||
|
|
||||||
|
GST_DEBUG_OBJECT (enc, "received event %d, %s", GST_EVENT_TYPE (event),
|
||||||
|
GST_EVENT_TYPE_NAME (event));
|
||||||
|
|
||||||
|
if (klass->src_event)
|
||||||
|
ret = klass->src_event (enc, event);
|
||||||
|
else {
|
||||||
|
gst_event_unref (event);
|
||||||
|
ret = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* gst_audio_encoded_audio_convert:
|
* gst_audio_encoded_audio_convert:
|
||||||
* @fmt: audio format of the encoded audio
|
* @fmt: audio format of the encoded audio
|
||||||
|
|
|
@ -139,10 +139,12 @@ struct _GstAudioEncoder {
|
||||||
* @flush: Optional.
|
* @flush: Optional.
|
||||||
* Instructs subclass to clear any codec caches and discard
|
* Instructs subclass to clear any codec caches and discard
|
||||||
* any pending samples and not yet returned encoded data.
|
* any pending samples and not yet returned encoded data.
|
||||||
* @event: Optional.
|
* @sink_event: Optional.
|
||||||
* Event handler on the sink pad. This function should return
|
* Event handler on the sink pad. Subclasses should chain up to
|
||||||
* TRUE if the event was handled and should be discarded
|
* the parent implementation to invoke the default handler.
|
||||||
* (i.e. not unref'ed).
|
* @src_event: Optional.
|
||||||
|
* Event handler on the src pad. Subclasses should chain up to
|
||||||
|
* the parent implementation to invoke the default handler.
|
||||||
* @pre_push: Optional.
|
* @pre_push: Optional.
|
||||||
* Called just prior to pushing (encoded data) buffer downstream.
|
* Called just prior to pushing (encoded data) buffer downstream.
|
||||||
* Subclass has full discretionary access to buffer,
|
* Subclass has full discretionary access to buffer,
|
||||||
|
@ -185,7 +187,10 @@ struct _GstAudioEncoderClass {
|
||||||
GstFlowReturn (*pre_push) (GstAudioEncoder *enc,
|
GstFlowReturn (*pre_push) (GstAudioEncoder *enc,
|
||||||
GstBuffer **buffer);
|
GstBuffer **buffer);
|
||||||
|
|
||||||
gboolean (*event) (GstAudioEncoder *enc,
|
gboolean (*sink_event) (GstAudioEncoder *enc,
|
||||||
|
GstEvent *event);
|
||||||
|
|
||||||
|
gboolean (*src_event) (GstAudioEncoder *enc,
|
||||||
GstEvent *event);
|
GstEvent *event);
|
||||||
|
|
||||||
GstCaps * (*getcaps) (GstAudioEncoder *enc, GstCaps *filter);
|
GstCaps * (*getcaps) (GstAudioEncoder *enc, GstCaps *filter);
|
||||||
|
|
Loading…
Reference in a new issue