add debugging and reformat docs

Original commit message from CVS:
add debugging and reformat docs
This commit is contained in:
Thomas Vander Stichele 2007-03-14 14:09:21 +00:00
parent 7292973429
commit 1587ea7bba

View file

@ -540,8 +540,8 @@ audioresample_do_output (GstAudioresample * audioresample, GstBuffer * outbuf)
/* check for possible mem corruption */ /* check for possible mem corruption */
if (outsize > GST_BUFFER_SIZE (outbuf)) { if (outsize > GST_BUFFER_SIZE (outbuf)) {
/* this is an error that when it happens, would need fixing in the /* this is an error that when it happens, would need fixing in the
* resample library; we told * resample library; we told it we wanted only GST_BUFFER_SIZE (outbuf),
* it we wanted only GST_BUFFER_SIZE (outbuf), and it gave us more ! */ * and it gave us more ! */
GST_WARNING_OBJECT (audioresample, GST_WARNING_OBJECT (audioresample,
"audioresample, you memory corrupting bastard. " "audioresample, you memory corrupting bastard. "
"you gave me outsize %d while my buffer was size %d", "you gave me outsize %d while my buffer was size %d",
@ -556,6 +556,14 @@ audioresample_do_output (GstAudioresample * audioresample, GstBuffer * outbuf)
} }
GST_BUFFER_SIZE (outbuf) = outsize; GST_BUFFER_SIZE (outbuf) = outsize;
GST_LOG_OBJECT (audioresample, "transformed to buffer of %ld bytes, ts %"
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
outsize, GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (outbuf)),
GST_TIME_ARGS (GST_BUFFER_DURATION (outbuf)),
GST_BUFFER_OFFSET (outbuf), GST_BUFFER_OFFSET_END (outbuf));
return GST_FLOW_OK; return GST_FLOW_OK;
} }
@ -576,7 +584,12 @@ audioresample_transform (GstBaseTransform * base, GstBuffer * inbuf,
size = GST_BUFFER_SIZE (inbuf); size = GST_BUFFER_SIZE (inbuf);
timestamp = GST_BUFFER_TIMESTAMP (inbuf); timestamp = GST_BUFFER_TIMESTAMP (inbuf);
GST_DEBUG_OBJECT (audioresample, "got buffer of %ld bytes", size); GST_LOG_OBJECT (audioresample, "transforming buffer of %ld bytes, ts %"
GST_TIME_FORMAT ", duration %" GST_TIME_FORMAT ", offset %"
G_GINT64_FORMAT ", offset_end %" G_GINT64_FORMAT,
size, GST_TIME_ARGS (timestamp),
GST_TIME_ARGS (GST_BUFFER_DURATION (inbuf)),
GST_BUFFER_OFFSET (inbuf), GST_BUFFER_OFFSET_END (inbuf));
if (audioresample->ts_offset == -1) { if (audioresample->ts_offset == -1) {
/* if we don't know the initial offset yet, calculate it based on the /* if we don't know the initial offset yet, calculate it based on the
@ -584,14 +597,14 @@ audioresample_transform (GstBaseTransform * base, GstBuffer * inbuf,
if (GST_CLOCK_TIME_IS_VALID (timestamp)) { if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
GstClockTime stime; GstClockTime stime;
/* offset used to calculate the timestamps. We use the sample offset for this /* offset used to calculate the timestamps. We use the sample offset for
* to make it more accurate. We want the first buffer to have the same timestamp * this to make it more accurate. We want the first buffer to have the
* as the incomming timestamp. */ * same timestamp as the incoming timestamp. */
audioresample->next_ts = timestamp; audioresample->next_ts = timestamp;
audioresample->ts_offset = audioresample->ts_offset =
gst_util_uint64_scale_int (timestamp, r->o_rate, GST_SECOND); gst_util_uint64_scale_int (timestamp, r->o_rate, GST_SECOND);
/* offset used to set as the buffer offset, this offset is always relative /* offset used to set as the buffer offset, this offset is always
* to the stream time, note that timestamp is not... */ * relative to the stream time, note that timestamp is not... */
stime = (timestamp - base->segment.start) + base->segment.time; stime = (timestamp - base->segment.start) + base->segment.time;
audioresample->offset = audioresample->offset =
gst_util_uint64_scale_int (stime, r->o_rate, GST_SECOND); gst_util_uint64_scale_int (stime, r->o_rate, GST_SECOND);