pad-monitor: track current buffer timestamp and duration

This can be used to make sure outgoing buffers match the input
timestamps
This commit is contained in:
Thiago Santos 2013-07-17 00:30:21 -03:00
parent 9a82afbc87
commit c53b10e5c5
2 changed files with 18 additions and 1 deletions

View file

@ -233,6 +233,15 @@ gst_qa_pad_monitor_check_first_buffer (GstQaPadMonitor * pad_monitor,
} }
} }
static void
gst_qa_pad_monitor_update_buffer_data (GstQaPadMonitor * pad_monitor,
GstBuffer * buffer)
{
pad_monitor->current_timestamp = GST_BUFFER_TIMESTAMP (buffer);
pad_monitor->current_duration = GST_BUFFER_DURATION (buffer);
}
static gboolean static gboolean
gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor, gst_qa_pad_monitor_sink_event_check (GstQaPadMonitor * pad_monitor,
GstEvent * event, GstPadEventFunction handler) GstEvent * event, GstPadEventFunction handler)
@ -461,7 +470,10 @@ gst_qa_pad_monitor_chain_func (GstPad * pad, GstBuffer * buffer)
gst_qa_pad_monitor_check_first_buffer (pad_monitor, buffer); gst_qa_pad_monitor_check_first_buffer (pad_monitor, buffer);
gst_qa_pad_monitor_update_buffer_data (pad_monitor, buffer);
ret = pad_monitor->chain_func (pad, buffer); ret = pad_monitor->chain_func (pad, buffer);
return ret; return ret;
} }
@ -524,6 +536,7 @@ gst_qa_pad_monitor_buffer_probe (GstPad * pad, GstBuffer * buffer,
GstQaPadMonitor *monitor = udata; GstQaPadMonitor *monitor = udata;
gst_qa_pad_monitor_check_first_buffer (monitor, buffer); gst_qa_pad_monitor_check_first_buffer (monitor, buffer);
gst_qa_pad_monitor_update_buffer_data (monitor, buffer);
/* TODO should we assume that a pad-monitor should always have an /* TODO should we assume that a pad-monitor should always have an
* element-monitor as a parent? */ * element-monitor as a parent? */

View file

@ -73,12 +73,16 @@ struct _GstQaPadMonitor {
gboolean first_buffer; gboolean first_buffer;
gboolean has_segment; gboolean has_segment;
GstSegment segment;
gboolean pending_flush_stop; gboolean pending_flush_stop;
guint32 pending_flush_stop_seqnum; guint32 pending_flush_stop_seqnum;
guint32 pending_flush_start_seqnum; guint32 pending_flush_start_seqnum;
guint32 pending_newsegment_seqnum; guint32 pending_newsegment_seqnum;
/* tracked data */
GstSegment segment;
GstClockTime current_timestamp;
GstClockTime current_duration;
}; };
/** /**