Commit 5d5dc55a authored by Seungha Yang's avatar Seungha Yang 🐑

audioencoder: Add finish vfunc for subclass to be able to drain pending data

Depending on subclass implementation, there might be pending/queued encoded
data. Similar to GstVideoEncoder::finish(), GstAudioEncoder needs to
provide such a way for subclass to drain pending data on EOS.
parent eed54928
Pipeline #149417 waiting for manual action with stages
in 28 seconds
......@@ -1592,9 +1592,18 @@ gst_audio_encoder_sink_event_default (GstAudioEncoder * enc, GstEvent * event)
break;
case GST_EVENT_EOS:
{
GstFlowReturn flow_ret;
GST_AUDIO_ENCODER_STREAM_LOCK (enc);
gst_audio_encoder_drain (enc);
if (klass->finish) {
flow_ret = klass->finish (enc);
} else {
flow_ret = GST_FLOW_OK;
}
/* check for pending events and tags */
gst_audio_encoder_push_pending_events (enc);
gst_audio_encoder_check_and_push_pending_tags (enc);
......@@ -1606,6 +1615,7 @@ gst_audio_encoder_sink_event_default (GstAudioEncoder * enc, GstEvent * event)
* _finish_frame() call. */
res = gst_audio_encoder_push_event (enc, event);
break;
}
case GST_EVENT_CAPS:
{
......
......@@ -189,6 +189,9 @@ struct _GstAudioEncoder {
* return TRUE if the query could be performed. Subclasses
* should chain up to the parent implementation to invoke the
* default handler. Since: 1.6
* @finish: Optional.
* Called to request subclass to dispatch any pending remaining
* data (e.g. at EOS). Since: 1.18
*
* Subclasses can override any of the available virtual methods or not, as
* needed. At minimum @set_format and @handle_frame needs to be overridden.
......@@ -242,9 +245,10 @@ struct _GstAudioEncoderClass {
gboolean (*src_query) (GstAudioEncoder *encoder,
GstQuery *query);
GstFlowReturn (*finish) (GstAudioEncoder *encoder);
/*< private >*/
gpointer _gst_reserved[GST_PADDING_LARGE-3];
gpointer _gst_reserved[GST_PADDING_LARGE-4];
};
GST_AUDIO_API
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment