basesrc: Handle the new renegotiate event

Makes basesrc handle the new renegotiate event by using a
renegotiate flag.
This commit is contained in:
Thiago Santos 2011-01-17 14:13:46 -03:00 committed by Sebastian Dröge
parent 24cef7aa2f
commit 93904ef3ad

View file

@ -247,6 +247,8 @@ struct _GstBaseSrcPrivate
gboolean qos_enabled; gboolean qos_enabled;
gdouble proportion; gdouble proportion;
GstClockTime earliest_time; GstClockTime earliest_time;
gboolean renegotiate;
}; };
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
@ -322,6 +324,7 @@ static GstFlowReturn gst_base_src_pad_get_range (GstPad * pad, guint64 offset,
static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset, static GstFlowReturn gst_base_src_get_range (GstBaseSrc * src, guint64 offset,
guint length, GstBuffer ** buf); guint length, GstBuffer ** buf);
static gboolean gst_base_src_seekable (GstBaseSrc * src); static gboolean gst_base_src_seekable (GstBaseSrc * src);
static gboolean gst_base_src_negotiate (GstBaseSrc * basesrc);
static void static void
gst_base_src_class_init (GstBaseSrcClass * klass) gst_base_src_class_init (GstBaseSrcClass * klass)
@ -1734,6 +1737,12 @@ gst_base_src_default_event (GstBaseSrc * src, GstEvent * event)
result = TRUE; result = TRUE;
break; break;
} }
case GST_EVENT_RENEGOTIATE:
{
src->priv->renegotiate = TRUE;
result = TRUE;
break;
}
default: default:
result = FALSE; result = FALSE;
break; break;
@ -2365,6 +2374,14 @@ gst_base_src_loop (GstPad * pad)
src = GST_BASE_SRC (GST_OBJECT_PARENT (pad)); src = GST_BASE_SRC (GST_OBJECT_PARENT (pad));
/* check if we need to renegotiate */
if (src->priv->renegotiate) {
if (!gst_base_src_negotiate (src))
GST_DEBUG_OBJECT (src, "Failed to renegotiate");
else
src->priv->renegotiate = TRUE;
}
GST_LIVE_LOCK (src); GST_LIVE_LOCK (src);
if (G_UNLIKELY (src->priv->flushing)) if (G_UNLIKELY (src->priv->flushing))