From c4630dfcee5ca649d3759438c9285df2647fab39 Mon Sep 17 00:00:00 2001 From: Steve Baker Date: Mon, 17 Sep 2001 19:15:53 +0000 Subject: [PATCH] init the values when the state hits playing so that we don't do dum things like log(0) Original commit message from CVS: init the values when the state hits playing so that we don't do dum things like log(0) --- gst/gstdparammanager.c | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/gst/gstdparammanager.c b/gst/gstdparammanager.c index 8f25a9b8e4..41e1dfeaa4 100644 --- a/gst/gstdparammanager.c +++ b/gst/gstdparammanager.c @@ -540,23 +540,27 @@ gst_dpman_state_change (GstElement *element, gint state, GstDParamManager *dpman GSList *dwraps; GstDParam *dparam; GstDParamWrapper *dpwrap; - - if (state == GST_STATE_PLAYING) return; - GST_DEBUG(GST_CAT_PARAMS, "initialising params\n"); - + g_return_if_fail (dpman != NULL); g_return_if_fail (GST_IS_DPMAN (dpman)); - - // force all params to be updated - dwraps = GST_DPMAN_DPARAMS_LIST(dpman); - while (dwraps){ - dpwrap = (GstDParamWrapper*)dwraps->data; - dparam = dpwrap->dparam; - - if (dparam){ - GST_DPARAM_READY_FOR_UPDATE(dparam) = TRUE; + + if (state == GST_STATE_PLAYING){ + GST_DEBUG(GST_CAT_PARAMS, "initialising params\n"); + + // force all params to be updated + dwraps = GST_DPMAN_DPARAMS_LIST(dpman); + while (dwraps){ + dpwrap = (GstDParamWrapper*)dwraps->data; + dparam = dpwrap->dparam; + + if (dparam){ + GST_DPARAM_READY_FOR_UPDATE(dparam) = TRUE; + if (dparam->spec){ + g_value_copy(dparam->spec->default_val, GST_DPARAM_VALUE(dparam)); + } + } + dwraps = g_slist_next(dwraps); } - dwraps = g_slist_next(dwraps); } }