mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-19 14:56:36 +00:00
basesrc: catch, parse and store QoS event values
Catch, parse and store the QoS values from QoS events for later use.
This commit is contained in:
parent
d576c1105e
commit
ba34494ce3
1 changed files with 33 additions and 0 deletions
|
@ -165,6 +165,8 @@
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <gst/gst_private.h>
|
||||||
|
|
||||||
#include "gstbasesrc.h"
|
#include "gstbasesrc.h"
|
||||||
#include "gsttypefindhelper.h"
|
#include "gsttypefindhelper.h"
|
||||||
#include <gst/gstmarshal.h>
|
#include <gst/gstmarshal.h>
|
||||||
|
@ -237,6 +239,11 @@ struct _GstBaseSrcPrivate
|
||||||
|
|
||||||
/* pending tags to be pushed in the data stream */
|
/* pending tags to be pushed in the data stream */
|
||||||
GList *pending_tags;
|
GList *pending_tags;
|
||||||
|
|
||||||
|
/* QoS *//* with LOCK */
|
||||||
|
gboolean qos_enabled;
|
||||||
|
gdouble proportion;
|
||||||
|
GstClockTime earliest_time;
|
||||||
};
|
};
|
||||||
|
|
||||||
static GstElementClass *parent_class = NULL;
|
static GstElementClass *parent_class = NULL;
|
||||||
|
@ -1659,6 +1666,21 @@ gst_base_src_seekable (GstBaseSrc * src)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_base_src_update_qos (GstBaseSrc * src,
|
||||||
|
gdouble proportion, GstClockTimeDiff diff, GstClockTime timestamp)
|
||||||
|
{
|
||||||
|
GST_CAT_DEBUG_OBJECT (GST_CAT_QOS, src,
|
||||||
|
"qos: proportion: %lf, diff %" G_GINT64_FORMAT ", timestamp %"
|
||||||
|
GST_TIME_FORMAT, proportion, diff, GST_TIME_ARGS (timestamp));
|
||||||
|
|
||||||
|
GST_OBJECT_LOCK (src);
|
||||||
|
src->priv->proportion = proportion;
|
||||||
|
src->priv->earliest_time = timestamp + diff;
|
||||||
|
GST_OBJECT_UNLOCK (src);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
|
gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
|
||||||
{
|
{
|
||||||
|
@ -1680,6 +1702,17 @@ gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
|
||||||
case GST_EVENT_FLUSH_STOP:
|
case GST_EVENT_FLUSH_STOP:
|
||||||
result = gst_base_src_set_flushing (src, FALSE, TRUE, TRUE, NULL);
|
result = gst_base_src_set_flushing (src, FALSE, TRUE, TRUE, NULL);
|
||||||
break;
|
break;
|
||||||
|
case GST_EVENT_QOS:
|
||||||
|
{
|
||||||
|
gdouble proportion;
|
||||||
|
GstClockTimeDiff diff;
|
||||||
|
GstClockTime timestamp;
|
||||||
|
|
||||||
|
gst_event_parse_qos (event, &proportion, &diff, ×tamp);
|
||||||
|
gst_base_src_update_qos (src, proportion, diff, timestamp);
|
||||||
|
result = TRUE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
result = TRUE;
|
result = TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue