mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 15:08:53 +00:00
amrparse: Sync baseparse changes
This commit is contained in:
parent
8e1c21f309
commit
27d6b25695
2 changed files with 63 additions and 29 deletions
|
@ -735,7 +735,6 @@ gst_base_parse_handle_and_push_buffer (GstBaseParse * parse,
|
||||||
GstBaseParseClass * klass, GstBuffer * buffer)
|
GstBaseParseClass * klass, GstBuffer * buffer)
|
||||||
{
|
{
|
||||||
GstFlowReturn ret;
|
GstFlowReturn ret;
|
||||||
GstClockTime last_stop = GST_CLOCK_TIME_NONE;
|
|
||||||
|
|
||||||
if (parse->priv->discont) {
|
if (parse->priv->discont) {
|
||||||
GST_DEBUG_OBJECT (parse, "marking DISCONT");
|
GST_DEBUG_OBJECT (parse, "marking DISCONT");
|
||||||
|
@ -749,6 +748,46 @@ gst_base_parse_handle_and_push_buffer (GstBaseParse * parse,
|
||||||
* keep track of timestamp and calculate everything possible
|
* keep track of timestamp and calculate everything possible
|
||||||
* if not set already */
|
* if not set already */
|
||||||
|
|
||||||
|
/* First buffers are dropped, this means that the subclass needs more
|
||||||
|
* frames to decide on the format and queues them internally */
|
||||||
|
if (ret == GST_BASE_PARSE_FLOW_DROPPED && !GST_PAD_CAPS (parse->srcpad)) {
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
return GST_FLOW_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* convert internal flow to OK and mark discont for the next buffer. */
|
||||||
|
if (ret == GST_BASE_PARSE_FLOW_DROPPED) {
|
||||||
|
parse->priv->discont = TRUE;
|
||||||
|
ret = GST_FLOW_OK;
|
||||||
|
|
||||||
|
gst_buffer_unref (buffer);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
} else if (ret != GST_FLOW_OK) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
return gst_base_parse_push_buffer (parse, buffer);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_base_parse_push_buffer:
|
||||||
|
* @parse: #GstBaseParse.
|
||||||
|
* @buffer: #GstBuffer.
|
||||||
|
*
|
||||||
|
* Pushes the buffer downstream, sends any pending events and
|
||||||
|
* does some timestamp and segment handling.
|
||||||
|
*
|
||||||
|
* This must be called with srcpad STREAM_LOCK held.
|
||||||
|
*
|
||||||
|
* Returns: #GstFlowReturn
|
||||||
|
*/
|
||||||
|
GstFlowReturn
|
||||||
|
gst_base_parse_push_buffer (GstBaseParse * parse, GstBuffer * buffer)
|
||||||
|
{
|
||||||
|
GstFlowReturn ret = GST_FLOW_OK;
|
||||||
|
GstClockTime last_stop = GST_CLOCK_TIME_NONE;
|
||||||
|
|
||||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
|
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer))
|
||||||
last_stop = GST_BUFFER_TIMESTAMP (buffer);
|
last_stop = GST_BUFFER_TIMESTAMP (buffer);
|
||||||
if (last_stop != GST_CLOCK_TIME_NONE && GST_BUFFER_DURATION_IS_VALID (buffer))
|
if (last_stop != GST_CLOCK_TIME_NONE && GST_BUFFER_DURATION_IS_VALID (buffer))
|
||||||
|
@ -792,7 +831,6 @@ gst_base_parse_handle_and_push_buffer (GstBaseParse * parse,
|
||||||
|
|
||||||
/* TODO: Add to seek table */
|
/* TODO: Add to seek table */
|
||||||
|
|
||||||
if (ret == GST_FLOW_OK) {
|
|
||||||
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
|
if (GST_BUFFER_TIMESTAMP_IS_VALID (buffer) &&
|
||||||
GST_CLOCK_TIME_IS_VALID (parse->segment.stop) &&
|
GST_CLOCK_TIME_IS_VALID (parse->segment.stop) &&
|
||||||
GST_BUFFER_TIMESTAMP (buffer) > parse->segment.stop) {
|
GST_BUFFER_TIMESTAMP (buffer) > parse->segment.stop) {
|
||||||
|
@ -812,19 +850,11 @@ gst_base_parse_handle_and_push_buffer (GstBaseParse * parse,
|
||||||
GST_LOG_OBJECT (parse, "frame (%d bytes) pushed: %d",
|
GST_LOG_OBJECT (parse, "frame (%d bytes) pushed: %d",
|
||||||
GST_BUFFER_SIZE (buffer), ret);
|
GST_BUFFER_SIZE (buffer), ret);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
gst_buffer_unref (buffer);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Update current running segment position */
|
/* Update current running segment position */
|
||||||
if (ret == GST_FLOW_OK && last_stop != GST_CLOCK_TIME_NONE)
|
if (ret == GST_FLOW_OK && last_stop != GST_CLOCK_TIME_NONE)
|
||||||
gst_segment_set_last_stop (&parse->segment, GST_FORMAT_TIME, last_stop);
|
gst_segment_set_last_stop (&parse->segment, GST_FORMAT_TIME, last_stop);
|
||||||
|
|
||||||
/* convert internal flow to OK and mark discont for the next buffer. */
|
|
||||||
if (ret == GST_BASE_PARSE_FLOW_DROPPED) {
|
|
||||||
parse->priv->discont = TRUE;
|
|
||||||
ret = GST_FLOW_OK;
|
|
||||||
}
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1575,13 +1605,14 @@ gst_base_parse_handle_seek (GstBaseParse * parse, GstEvent * event)
|
||||||
* it directly or fail. For TIME, try upstream, but do it ourselves if
|
* it directly or fail. For TIME, try upstream, but do it ourselves if
|
||||||
* it fails upstream */
|
* it fails upstream */
|
||||||
if (format != GST_FORMAT_TIME) {
|
if (format != GST_FORMAT_TIME) {
|
||||||
gst_event_ref (event);
|
|
||||||
return gst_pad_push_event (parse->sinkpad, event);
|
return gst_pad_push_event (parse->sinkpad, event);
|
||||||
} else {
|
} else {
|
||||||
gst_event_ref (event);
|
gst_event_ref (event);
|
||||||
if (gst_pad_push_event (parse->sinkpad, event))
|
if (gst_pad_push_event (parse->sinkpad, event)) {
|
||||||
|
gst_event_unref (event);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* get flush flag */
|
/* get flush flag */
|
||||||
flush = flags & GST_SEEK_FLAG_FLUSH;
|
flush = flags & GST_SEEK_FLAG_FLUSH;
|
||||||
|
|
|
@ -225,6 +225,9 @@ struct _GstBaseParseClass {
|
||||||
GType gst_base_parse_get_type (void);
|
GType gst_base_parse_get_type (void);
|
||||||
|
|
||||||
|
|
||||||
|
GstFlowReturn gst_base_parse_push_buffer (GstBaseParse *parse,
|
||||||
|
GstBuffer *buffer);
|
||||||
|
|
||||||
void gst_base_parse_set_duration (GstBaseParse *parse,
|
void gst_base_parse_set_duration (GstBaseParse *parse,
|
||||||
GstFormat fmt,
|
GstFormat fmt,
|
||||||
gint64 duration);
|
gint64 duration);
|
||||||
|
|
Loading…
Reference in a new issue