gst/level/gstlevel.*: Use basetransform segment so that it is correctly managed on flushes and start/stop.

Original commit message from CVS:
* gst/level/gstlevel.c: (gst_level_class_init), (gst_level_start),
(gst_level_transform_ip):
* gst/level/gstlevel.h:
Use basetransform segment so that it is correctly managed on flushes and
start/stop.
Report message timestamp as stream time, which is what an application
can understand.
This commit is contained in:
Wim Taymans 2007-09-13 17:31:16 +00:00
parent bdbd709e00
commit 80dc806b65
3 changed files with 11 additions and 35 deletions

View file

@ -1,3 +1,13 @@
2007-09-13 Wim Taymans <wim.taymans@gmail.com>
* gst/level/gstlevel.c: (gst_level_class_init), (gst_level_start),
(gst_level_transform_ip):
* gst/level/gstlevel.h:
Use basetransform segment so that it is correctly managed on flushes and
start/stop.
Report message timestamp as stream time, which is what an application
can understand.
2007-09-13 Sebastian Dröge <slomo@circular-chaos.org> 2007-09-13 Sebastian Dröge <slomo@circular-chaos.org>
* ext/taglib/gstapev2mux.cc: * ext/taglib/gstapev2mux.cc:

View file

@ -147,7 +147,6 @@ static void gst_level_dispose (GObject * obj);
static gboolean gst_level_set_caps (GstBaseTransform * trans, GstCaps * in, static gboolean gst_level_set_caps (GstBaseTransform * trans, GstCaps * in,
GstCaps * out); GstCaps * out);
static gboolean gst_level_start (GstBaseTransform * trans); static gboolean gst_level_start (GstBaseTransform * trans);
static gboolean gst_level_event (GstBaseTransform * trans, GstEvent * event);
static GstFlowReturn gst_level_transform_ip (GstBaseTransform * trans, static GstFlowReturn gst_level_transform_ip (GstBaseTransform * trans,
GstBuffer * in); GstBuffer * in);
@ -198,7 +197,6 @@ gst_level_class_init (GstLevelClass * klass)
trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_level_set_caps); trans_class->set_caps = GST_DEBUG_FUNCPTR (gst_level_set_caps);
trans_class->start = GST_DEBUG_FUNCPTR (gst_level_start); trans_class->start = GST_DEBUG_FUNCPTR (gst_level_start);
trans_class->event = GST_DEBUG_FUNCPTR (gst_level_event);
trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_level_transform_ip); trans_class->transform_ip = GST_DEBUG_FUNCPTR (gst_level_transform_ip);
trans_class->passthrough_on_same_caps = TRUE; trans_class->passthrough_on_same_caps = TRUE;
} }
@ -449,36 +447,6 @@ gst_level_start (GstBaseTransform * trans)
GstLevel *filter = GST_LEVEL (trans); GstLevel *filter = GST_LEVEL (trans);
filter->num_frames = 0; filter->num_frames = 0;
gst_segment_init (&filter->segment, GST_FORMAT_UNDEFINED);
return TRUE;
}
static gboolean
gst_level_event (GstBaseTransform * trans, GstEvent * event)
{
GstLevel *filter = GST_LEVEL (trans);
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_NEWSEGMENT:{
GstFormat format;
gdouble rate, arate;
gint64 start, stop, time;
gboolean update;
/* the newsegment values are used to clip the input samples
* and to convert the incomming timestamps to running time */
gst_event_parse_new_segment_full (event, &update, &rate, &arate, &format,
&start, &stop, &time);
/* now configure the values */
gst_segment_set_newsegment_full (&filter->segment, update,
rate, arate, format, start, stop, time);
break;
}
default:
break;
}
return TRUE; return TRUE;
} }
@ -621,7 +589,7 @@ gst_level_transform_ip (GstBaseTransform * trans, GstBuffer * in)
if (filter->message) { if (filter->message) {
GstMessage *m; GstMessage *m;
GstClockTime endtime = GstClockTime endtime =
gst_segment_to_running_time (&filter->segment, GST_FORMAT_TIME, gst_segment_to_stream_time (&trans->segment, GST_FORMAT_TIME,
GST_BUFFER_TIMESTAMP (in)) GST_BUFFER_TIMESTAMP (in))
+ GST_FRAMES_TO_CLOCK_TIME (num_frames, filter->rate); + GST_FRAMES_TO_CLOCK_TIME (num_frames, filter->rate);

View file

@ -78,8 +78,6 @@ struct _GstLevel {
gdouble *RMS_dB; /* RMS in dB to emit */ gdouble *RMS_dB; /* RMS in dB to emit */
GstClockTime *decay_peak_age; /* age of last peak */ GstClockTime *decay_peak_age; /* age of last peak */
GstSegment segment;
void (*process)(gpointer, guint, guint, gdouble*, gdouble*); void (*process)(gpointer, guint, guint, gdouble*, gdouble*);
}; };