mpegtbase: vmethod to notify when we're done processing input

This can be used to notify subclasses no more data is expected this
round.
tsparse will use it to push whole buffers (without copy) on the main
source pad.
It could also be used later to decide whether to push pending data
in order to reduce latency.
This commit is contained in:
Edward Hervey 2012-06-26 18:51:21 +02:00
parent fe5cf525e1
commit 558beab1b4
2 changed files with 16 additions and 0 deletions

View file

@ -1409,14 +1409,20 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
MpegTSPacketizerPacketReturn pret; MpegTSPacketizerPacketReturn pret;
MpegTSPacketizer2 *packetizer; MpegTSPacketizer2 *packetizer;
MpegTSPacketizerPacket packet; MpegTSPacketizerPacket packet;
MpegTSBaseClass *klass;
base = GST_MPEGTS_BASE (parent); base = GST_MPEGTS_BASE (parent);
klass = GST_MPEGTS_BASE_GET_CLASS (base);
packetizer = base->packetizer; packetizer = base->packetizer;
if (G_UNLIKELY (base->queried_latency == FALSE)) { if (G_UNLIKELY (base->queried_latency == FALSE)) {
query_upstream_latency (base); query_upstream_latency (base);
} }
if (klass->input_done)
gst_buffer_ref (buf);
mpegts_packetizer_push (base->packetizer, buf); mpegts_packetizer_push (base->packetizer, buf);
while (res == GST_FLOW_OK) { while (res == GST_FLOW_OK) {
@ -1465,6 +1471,13 @@ mpegts_base_chain (GstPad * pad, GstObject * parent, GstBuffer * buf)
mpegts_packetizer_clear_packet (base->packetizer, &packet); mpegts_packetizer_clear_packet (base->packetizer, &packet);
} }
if (klass->input_done) {
if (res == GST_FLOW_OK)
res = klass->input_done (base, buf);
else
gst_buffer_unref (buf);
}
return res; return res;
} }

View file

@ -168,6 +168,9 @@ struct _MpegTSBaseClass {
/* flush all streams */ /* flush all streams */
void (*flush) (MpegTSBase * base); void (*flush) (MpegTSBase * base);
/* Notifies subclasses input buffer has been handled */
GstFlowReturn (*input_done) (MpegTSBase *base, GstBuffer *buffer);
/* signals */ /* signals */
void (*pat_info) (GstStructure *pat); void (*pat_info) (GstStructure *pat);
void (*pmt_info) (GstStructure *pmt); void (*pmt_info) (GstStructure *pmt);