return result + 1;
}
+
#if 0
static void
gst_wavparse_parse_adtl (GstWavParse * wavparse, int len)
}
#endif
+
static gboolean
gst_wavparse_parse_file_header (GstElement * element, GstBuffer * buf)
{
gint64 last_stop;
if (event) {
- GstFormat fmt;
-
GST_DEBUG_OBJECT (wav, "doing seek with event");
gst_event_parse_seek (event, &rate, &format, &flags,
if (rate < 0.0)
goto negative_rate;
- fmt = wav->segment.format;
-
- /* we have to have a format as the segment format. Try to convert
- * if not. */
if (format != wav->segment.format) {
+ GST_INFO_OBJECT (wav, "converting seek-event from %s to %s",
+ gst_format_get_name (format),
+ gst_format_get_name (wav->segment.format));
res = TRUE;
if (cur_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (wav->srcpad, format, cur, &fmt, &cur);
+ res =
+ gst_pad_query_convert (wav->srcpad, format, cur,
+ &wav->segment.format, &cur);
if (res && stop_type != GST_SEEK_TYPE_NONE)
- res = gst_pad_query_convert (wav->srcpad, format, stop, &fmt, &stop);
+ res =
+ gst_pad_query_convert (wav->srcpad, format, stop,
+ &wav->segment.format, &stop);
if (!res)
goto no_format;
- format = fmt;
+ format = wav->segment.format;
}
} else {
GST_DEBUG_OBJECT (wav, "doing seek without event");
size = GST_READ_UINT32_LE (GST_BUFFER_DATA (buf) + 4);
}
- GST_DEBUG_OBJECT (wav, "Got TAG: %" GST_FOURCC_FORMAT,
- GST_FOURCC_ARGS (tag));
+ GST_INFO_OBJECT (wav,
+ "Got TAG: %" GST_FOURCC_FORMAT ", offset %" G_GUINT64_FORMAT,
+ GST_FOURCC_ARGS (tag), wav->offset);
/* wav is a st00pid format, we don't know for sure where data starts.
* So we have to go bit by bit until we find the 'data' header
goto push_error;
if (obtained < wav->dataleft) {
+ wav->offset += obtained;
wav->dataleft -= obtained;
} else {
+ wav->offset += wav->dataleft;
wav->dataleft = 0;
}
- wav->offset += obtained;
/* Iterate until need more data, so adapter size won't grow */
if (wav->streaming) {
switch (wav->state) {
case GST_WAVPARSE_START:
- GST_DEBUG_OBJECT (wav, "GST_WAVPARSE_START");
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_START");
if ((ret = gst_wavparse_stream_init (wav)) != GST_FLOW_OK)
goto pause;
/* fall-through */
case GST_WAVPARSE_HEADER:
- GST_DEBUG_OBJECT (wav, "GST_WAVPARSE_HEADER");
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_HEADER");
if ((ret = gst_wavparse_stream_headers (wav)) != GST_FLOW_OK)
goto pause;
wav->state = GST_WAVPARSE_DATA;
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_DATA");
/* fall-through */
case GST_WAVPARSE_DATA:
switch (wav->state) {
case GST_WAVPARSE_START:
- GST_DEBUG_OBJECT (wav, "GST_WAVPARSE_START");
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_START");
if ((ret = gst_wavparse_parse_stream_init (wav)) != GST_FLOW_OK)
goto done;
/* otherwise fall-through */
case GST_WAVPARSE_HEADER:
- GST_DEBUG_OBJECT (wav, "GST_WAVPARSE_HEADER");
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_HEADER");
if ((ret = gst_wavparse_stream_headers (wav)) != GST_FLOW_OK)
goto done;
break;
wav->state = GST_WAVPARSE_DATA;
+ GST_INFO_OBJECT (wav, "GST_WAVPARSE_DATA");
/* fall-through */
case GST_WAVPARSE_DATA:
if ((wavparse->bps == 0) && !wavparse->fact)
goto no_bps_fact;
+ GST_INFO_OBJECT (wavparse, "converting value from %s to %s",
+ gst_format_get_name (src_format), gst_format_get_name (*dest_format));
+
switch (src_format) {
case GST_FORMAT_BYTES:
switch (*dest_format) {
*dest_value -= *dest_value % wavparse->bytes_per_sample;
break;
case GST_FORMAT_TIME:
+ /* src_value + datastart = offset */
+ GST_INFO_OBJECT (wavparse,
+ "src=%" G_GINT64_FORMAT ", offset=%" G_GINT64_FORMAT, src_value,
+ wavparse->offset);
if (wavparse->bps > 0)
*dest_value = gst_util_uint64_scale (src_value, GST_SECOND,
(guint64) wavparse->bps);
gint64 cur;
GstFormat format;
+ /* this is not very precise, as we have pushed severla buffer upstream for prerolling */
curb = wav->offset - wav->datastart;
gst_query_parse_position (query, &format, NULL);
+ GST_INFO_OBJECT (wav, "pos query at %" G_GINT64_FORMAT, curb);
switch (format) {
case GST_FORMAT_TIME:
gst_query_parse_convert (query, &srcformat, &srcvalue,
&dstformat, &dstvalue);
- res &=
- gst_wavparse_pad_convert (pad, srcformat, srcvalue,
+ res = gst_wavparse_pad_convert (pad, srcformat, srcvalue,
&dstformat, &dstvalue);
if (res)
gst_query_set_convert (query, srcformat, srcvalue, dstformat, dstvalue);